Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2060 from jdelStrother/picky_update

Error-out on "bundle update unknown-gem"
  • Loading branch information...
commit 4d163e80aa751b7f6268926af0121303d505f315 2 parents d97ada4 + 8c712e7
@indirect indirect authored
Showing with 15 additions and 0 deletions.
  1. +8 −0 lib/bundler/cli.rb
  2. +7 −0 spec/update/gems_spec.rb
View
8 lib/bundler/cli.rb
@@ -277,6 +277,8 @@ def update(*gems)
# We're doing a full update
Bundler.definition(true)
else
+ # cycle through the requested gems, just to make sure they exist
+ gems.each{ |n| gem_dependency_with_name(n) }
Bundler.definition(:gems => gems, :sources => sources)
end
@@ -686,5 +688,11 @@ def locate_gem(name)
spec.full_gem_path
end
+ def gem_dependency_with_name(name)
+ dep = Bundler.load.dependencies.find{|d| d.name == name }
+ raise GemNotFound, "Could not find gem '#{name}'." unless dep
+ dep
+ end
+
end
end
View
7 spec/update/gems_spec.rb
@@ -56,6 +56,13 @@
end
end
+ describe "with a unknown dependency" do
+ it "should inform the user" do
+ bundle "update halting-problem-solver", :expect_err=>true
+ out.should include "Could not find gem 'halting-problem-solver'"
+ end
+ end
+
describe "with --local option" do
it "doesn't hit repo2" do
FileUtils.rm_rf(gem_repo2)
Please sign in to comment.
Something went wrong with that request. Please try again.