diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-10 17:51:40 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-10 17:51:40 +0000 |
commit | 4f6779bac7b4e294bc473782d60cbd071f0d0f8d (patch) | |
tree | d37b54da20f8c0adf2d98e810aacc8259b0602ff /lib/rubygems/dependency_resolver/activation_request.rb | |
parent | 31d355aaa9436e2b24efd5e6501cabd876267c46 (diff) | |
download | ruby-4f6779bac7b4e294bc473782d60cbd071f0d0f8d.tar.gz |
* lib/rubygems: Update to RubyGems master 4bdc4f2. Important changes
in this commit:
RubyGems now chooses the test server port reliably. Patch by akr.
Partial implementation of bundler's Gemfile format.
Refactorings to improve the new resolver.
Fixes bugs in the resolver.
* test/rubygems: Tests for the above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/dependency_resolver/activation_request.rb')
-rw-r--r-- | lib/rubygems/dependency_resolver/activation_request.rb | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/lib/rubygems/dependency_resolver/activation_request.rb b/lib/rubygems/dependency_resolver/activation_request.rb index 25af6378ac..c5d1e24d85 100644 --- a/lib/rubygems/dependency_resolver/activation_request.rb +++ b/lib/rubygems/dependency_resolver/activation_request.rb @@ -47,11 +47,21 @@ class Gem::DependencyResolver::ActivationRequest end def inspect # :nodoc: - others_possible = nil - others_possible = ' (others possible)' if @others_possible + others = + case @others_possible + when true then # TODO remove at RubyGems 3 + ' (others possible)' + when false then # TODO remove at RubyGems 3 + nil + else + unless @others_possible.empty? then + others = @others_possible.map { |s| s.full_name } + " (others possible: #{others.join ', '})" + end + end '#<%s for %p from %s%s>' % [ - self.class, @spec, @request, others_possible + self.class, @spec, @request, others ] end @@ -59,10 +69,15 @@ class Gem::DependencyResolver::ActivationRequest # Indicates if the requested gem has already been installed. def installed? - this_spec = full_spec + case @spec + when Gem::DependencyResolver::VendorSpecification then + true + else + this_spec = full_spec - Gem::Specification.any? do |s| - s == this_spec + Gem::Specification.any? do |s| + s == this_spec + end end end @@ -75,7 +90,12 @@ class Gem::DependencyResolver::ActivationRequest # requests for the same Dependency request. def others_possible? - @others_possible + case @others_possible + when true, false then + @others_possible + else + not @others_possible.empty? + end end ## @@ -95,9 +115,18 @@ class Gem::DependencyResolver::ActivationRequest q.text ' for ' q.pp @request - - q.breakable - q.text ' (other possible)' if @others_possible + case @others_possible + when false then + when true then + q.breakable + q.text 'others possible' + else + unless @others_possible.empty? then + q.breakable + q.text 'others ' + q.pp @others_possible.map { |s| s.full_name } + end + end end end |