diff options
author | Homu <homu@barosl.com> | 2016-10-20 22:23:37 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2016-10-20 22:23:37 +0900 |
commit | 3ae014f0dedc5979956b411d022c4874be76619d (patch) | |
tree | e77c92d636e1204b44e1e62938338d4a9151afac | |
parent | 7327dc59476c79547170d3ef8162f24b3aea385f (diff) | |
parent | 05d6f5060c9c5e20f9b3e59edb0e7abb468fab78 (diff) | |
download | bundler-3ae014f0dedc5979956b411d022c4874be76619d.tar.gz |
Auto merge of #5104 - hmistry:lock-install-error, r=segiddins
Fixed bundler incorrectly printing "the gem may have been yanked" in local installs
Closes #5022.
-rw-r--r-- | lib/bundler/definition.rb | 2 | ||||
-rw-r--r-- | spec/install/yanked_spec.rb | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 8a6bf0d17c..7ec7a2077d 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -173,7 +173,7 @@ module Bundler rescue GemNotFound => e # Handle yanked gem gem_name, gem_version = extract_gem_info(e) locked_gem = @locked_specs[gem_name].last - raise if locked_gem.nil? || locked_gem.version.to_s != gem_version + raise if locked_gem.nil? || locked_gem.version.to_s != gem_version || !@remote raise GemNotFound, "Your bundle is locked to #{locked_gem}, but that version could not " \ "be found in any of the sources listed in your Gemfile. If you haven't changed sources, " \ "that means the author of #{locked_gem} has removed it. You'll need to update your bundle " \ diff --git a/spec/install/yanked_spec.rb b/spec/install/yanked_spec.rb index ab96d4fcee..4c0c4e407a 100644 --- a/spec/install/yanked_spec.rb +++ b/spec/install/yanked_spec.rb @@ -41,3 +41,32 @@ context "when installing a bundle that includes yanked gems" do expect(out).to include("Could not find gem 'foo (= 10.0.0)' in any of the gem sources") end end + +context "when using gem before installing" do + it "does not suggest the author has yanked the gem" do + gemfile <<-G + source "file://#{gem_repo1}" + gem "rack", "0.9.1" + G + + lockfile <<-L + GEM + remote: file://#{gem_repo1} + specs: + rack (0.9.1) + + PLATFORMS + ruby + + DEPENDENCIES + rack (= 0.9.1) + L + + bundle :list + + expect(out).to include("Could not find rack-0.9.1 in any of the sources") + expect(out).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.") + expect(out).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.") + expect(out).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.") + end +end |