mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Better error when installing a git lockfile and git not present
28f4842196
This commit is contained in:
parent
a954f273a8
commit
f634d1ee00
2 changed files with 43 additions and 3 deletions
|
@ -56,7 +56,6 @@ module Bundler
|
||||||
@ref = ref
|
@ref = ref
|
||||||
@revision = revision
|
@revision = revision
|
||||||
@git = git
|
@git = git
|
||||||
raise GitNotInstalledError.new if allow? && !Bundler.git_present?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def revision
|
def revision
|
||||||
|
@ -208,7 +207,11 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
def allow?
|
def allow?
|
||||||
@git ? @git.allow_git_ops? : true
|
allowed = @git ? @git.allow_git_ops? : true
|
||||||
|
|
||||||
|
raise GitNotInstalledError.new if allowed && !Bundler.git_present?
|
||||||
|
|
||||||
|
allowed
|
||||||
end
|
end
|
||||||
|
|
||||||
def with_path(&blk)
|
def with_path(&blk)
|
||||||
|
|
|
@ -1436,7 +1436,44 @@ In Gemfile:
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "without git installed" do
|
describe "without git installed" do
|
||||||
it "prints a better error message" do
|
it "prints a better error message when installing" do
|
||||||
|
build_git "foo"
|
||||||
|
|
||||||
|
gemfile <<-G
|
||||||
|
source "#{file_uri_for(gem_repo1)}"
|
||||||
|
|
||||||
|
gem "rake", git: "https://github.com/ruby/rake"
|
||||||
|
G
|
||||||
|
|
||||||
|
lockfile <<-L
|
||||||
|
GIT
|
||||||
|
remote: https://github.com/ruby/rake
|
||||||
|
revision: 5c60da8644a9e4f655e819252e3b6ca77f42b7af
|
||||||
|
specs:
|
||||||
|
rake (13.0.6)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
#{lockfile_platforms}
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
rake!
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
|
||||||
|
with_path_as("") do
|
||||||
|
bundle "install", :raise_on_error => false
|
||||||
|
end
|
||||||
|
expect(err).
|
||||||
|
to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "prints a better error message when updating" do
|
||||||
build_git "foo"
|
build_git "foo"
|
||||||
|
|
||||||
install_gemfile <<-G
|
install_gemfile <<-G
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue