Permalink
Browse files

Fantastic and also useful update instructions for outdated Bundler co…

…nflicts
  • Loading branch information...
1 parent 5b8960d commit 4c3b33917e2cfb1568b1650d1bc45b585f6061ec @indirect indirect committed Oct 17, 2010
Showing with 9 additions and 2 deletions.
  1. +1 −2 lib/bundler.rb
  2. +8 −0 lib/bundler/resolver.rb
View
3 lib/bundler.rb
@@ -49,7 +49,7 @@ class InvalidOption < DslError ; end
WINDOWS = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
NULL = WINDOWS ? "NUL" : "/dev/null"
-
+ # Internal errors, should be rescued
class VersionConflict < BundlerError
attr_reader :conflicts
@@ -61,7 +61,6 @@ def initialize(conflicts, msg = nil)
status_code(6)
end
- # Internal errors, should be rescued
class InvalidSpecSet < StandardError; end
class << self
View
8 lib/bundler/resolver.rb
@@ -417,13 +417,20 @@ def error_message
# If the origin is "bundler", the conflict is us
if origin.name == "bundler"
o << " Current Bundler version:\n"
+ newer_bundler_required = requirement.requirement > Gem::Requirement.new(origin.version)
# If the origin is a LockfileParser, it does not respond_to :required_by
elsif !origin.respond_to?(:required_by) || !(required_by = origin.required_by.first)
o << " In snapshot (Gemfile.lock):\n"
end
o << gem_message(origin)
+ # If the bundle wants a newer bundler than the running bundler, explain
+ if origin.name == "bundler" && newer_bundler_required
+ o << "Your version of Bundler is older than the one requested by the Gemfile.\n"
+ o << "Perhaps you need to update Bundler by running `gem install bundler`."
+ end
+
# origin is nil if the required gem and version cannot be found in any of
# the specified sources
else
@@ -453,6 +460,7 @@ def error_message
end
end
+ o
end
end
end

0 comments on commit 4c3b339

Please sign in to comment.