diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-21 23:27:30 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-21 23:27:30 +0000 |
commit | 5307d803f5cce7b14a6afd1d51f6d53ec85ca87d (patch) | |
tree | aac2997a9ff000fbf2f1f9f27077bb7b2403f2c9 /lib/rubygems/resolver/conflict.rb | |
parent | b1529a30e08040b717adef8ac1fa8be1c060e7e1 (diff) |
* lib/rubygems: Update to RubyGems master 50a8210. Important changes
in this commit:
RubyGems now automatically checks for gem.deps.rb or Gemfile when
running ruby executables. This behavior is similar to `bundle exec
rake`. This change may be reverted before Ruby 2.1.0 if too many bugs
are found.
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/resolver/conflict.rb')
-rw-r--r-- | lib/rubygems/resolver/conflict.rb | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/lib/rubygems/resolver/conflict.rb b/lib/rubygems/resolver/conflict.rb index b081972658..20c6eced31 100644 --- a/lib/rubygems/resolver/conflict.rb +++ b/lib/rubygems/resolver/conflict.rb @@ -4,25 +4,38 @@ class Gem::Resolver::Conflict + ## + # The specification that was activated prior to the conflict + attr_reader :activated + ## + # The dependency that is in conflict with the activated gem. + attr_reader :dependency attr_reader :failed_dep # :nodoc: + ## + # Creates a new resolver conflict when +dependency+ is in conflict with an + # already +activated+ specification. + def initialize(dependency, activated, failed_dep=dependency) @dependency = dependency @activated = activated @failed_dep = failed_dep end - def == other + def == other # :nodoc: self.class === other and @dependency == other.dependency and @activated == other.activated and @failed_dep == other.failed_dep end + ## + # A string explanation of the conflict. + def explain "<Conflict wanted: #{@failed_dep}, had: #{activated.spec.full_name}>" end @@ -41,11 +54,15 @@ class Gem::Resolver::Conflict activated = @activated.spec.full_name requirement = @failed_dep.dependency.requirement - " Activated %s instead of (%s) via:\n %s\n" % [ - activated, requirement, request_path.join(', ') + " Activated %s via:\n %s\n instead of (%s) via:\n %s\n" % [ + activated, request_path(@activated).join(', '), + requirement, request_path(requester).join(', '), ] end + ## + # Returns true if the conflicting dependency's name matches +spec+. + def for_spec?(spec) @dependency.name == spec.name end @@ -72,16 +89,17 @@ class Gem::Resolver::Conflict end ## - # Path of specifications that requested this dependency + # Path of activations from the +current+ list. - def request_path - current = requester - path = [] + def request_path current + path = [] while current do - path << current.spec.full_name + spec_name = current.spec.full_name + requirement = current.request.dependency.requirement + path << "#{current.spec.full_name} (#{requirement})" - current = current.request.requester + current = current.parent end path = ['user request (gem command or Gemfile)'] if path.empty? @@ -98,5 +116,8 @@ class Gem::Resolver::Conflict end -Gem::Resolver::DependencyConflict = Gem::Resolver::Conflict +## +# TODO: Remove in RubyGems 3 + +Gem::Resolver::DependencyConflict = Gem::Resolver::Conflict # :nodoc: |