summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/resolver.rb12
-rw-r--r--spec/update/gems_spec.rb26
2 files changed, 34 insertions, 4 deletions
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 81ecb7ae50..fe9fbe9ab8 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -198,8 +198,9 @@ module Bundler
# Force the current
if current.name == 'bundler' && !existing
existing = search(DepProxy.new(Gem::Dependency.new('bundler', VERSION), Gem::Platform::RUBY)).first
- activated['bundler'] = existing
raise GemNotFound, %Q{Bundler could not find gem "bundler" (#{VERSION})} unless existing
+ existing.required_by << existing
+ activated['bundler'] = existing
end
if current.requirement.satisfied_by?(existing.version)
@@ -230,9 +231,9 @@ module Bundler
parent ||= existing.required_by.last if existing.respond_to?(:required_by)
# We track the spot where the current gem was activated because we need
# to keep a list of every spot a failure happened.
- debug { " -> Jumping to: #{parent.name}" }
if parent
- throw parent.name, existing.respond_to?(:required_by) && existing.required_by.last.name
+ debug { " -> Jumping to: #{parent.name}" }
+ throw parent.name, existing.respond_to?(:required_by) && existing.required_by.last && existing.required_by.last.name
else
# The original set of dependencies conflict with the base set of specs
# passed to the resolver. This is by definition an impossible resolve.
@@ -413,8 +414,11 @@ module Bundler
o << gem_message(requirement)
+ # If the origin is "bundler", the conflict is us
+ if origin.name == "bundler"
+ o << " Current Bundler version:\n"
# If the origin is a LockfileParser, it does not respond_to :required_by
- unless origin.respond_to?(:required_by) && required_by = origin.required_by.first
+ elsif !(origin.respond_to?(:required_by) && origin.required_by.first)
o << " In snapshot (Gemfile.lock):\n"
end
diff --git a/spec/update/gems_spec.rb b/spec/update/gems_spec.rb
index 969b6ec945..9e31ef6b63 100644
--- a/spec/update/gems_spec.rb
+++ b/spec/update/gems_spec.rb
@@ -84,3 +84,29 @@ describe "bundle update without a Gemfile.lock" do
should_be_installed "rack 1.0.0"
end
end
+
+describe "bundle update when a gem depends on a newer version of bundler" do
+ before(:each) do
+ build_repo2 do
+ build_gem "rails", "3.0.1" do |s|
+ s.add_dependency "bundler", Bundler::VERSION.succ
+ end
+ end
+
+ gemfile <<-G
+ source "file://#{gem_repo2}"
+ gem "rails", "3.0.1"
+ G
+ end
+
+ it "should not explode" do
+ bundle "update"
+ err.should be_empty
+ end
+
+ it "should explain that bundler conflicted" do
+ bundle "update"
+ out.should_not =~ /In snapshot/
+ out.should =~ /Current Bundler version/
+ end
+end \ No newline at end of file