diff options
-rw-r--r-- | lib/rubygems/resolver/activation_request.rb | 41 | ||||
-rw-r--r-- | lib/rubygems/resolver/api_specification.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/resolver/conflict.rb | 1 | ||||
-rw-r--r-- | lib/rubygems/resolver/dependency_request.rb | 36 | ||||
-rw-r--r-- | lib/rubygems/resolver/git_specification.rb | 19 | ||||
-rw-r--r-- | lib/rubygems/resolver/installed_specification.rb | 16 | ||||
-rw-r--r-- | lib/rubygems/resolver/installer_set.rb | 3 | ||||
-rw-r--r-- | lib/rubygems/resolver/local_specification.rb | 16 | ||||
-rw-r--r-- | lib/rubygems/resolver/requirement_list.rb | 24 | ||||
-rw-r--r-- | lib/rubygems/resolver/specification.rb | 29 | ||||
-rw-r--r-- | lib/rubygems/resolver/vendor_set.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/resolver/vendor_specification.rb | 8 |
12 files changed, 178 insertions, 21 deletions
@@ -1,21 +1,33 @@ ## -# Specifies a Specification object that should be activated. -# Also contains a dependency that was used to introduce this -# activation. class Gem::Resolver::ActivationRequest attr_reader :request attr_reader :spec - def initialize spec, req, others_possible = true @spec = spec - @request = req @others_possible = others_possible end - def == other case other when Gem::Specification @spec == other @@ -26,6 +38,9 @@ class Gem::Resolver::ActivationRequest end end def download path if @spec.respond_to? :source source = @spec.source @@ -38,10 +53,16 @@ class Gem::Resolver::ActivationRequest source.download full_spec, path end def full_name @spec.full_name end def full_spec Gem::Specification === @spec ? @spec : @spec.spec end @@ -66,7 +87,7 @@ class Gem::Resolver::ActivationRequest end ## - # Indicates if the requested gem has already been installed. def installed? case @spec @@ -81,6 +102,9 @@ class Gem::Resolver::ActivationRequest end end def name @spec.name end @@ -130,6 +154,9 @@ class Gem::Resolver::ActivationRequest end end def version @spec.version end @@ -34,6 +34,10 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification @dependencies == other.dependencies end def pretty_print q # :nodoc: q.group 2, '[APISpecification', ']' do q.breakable @@ -95,7 +95,6 @@ class Gem::Resolver::Conflict path = [] while current do - spec_name = current.spec.full_name requirement = current.request.dependency.requirement path << "#{current.spec.full_name} (#{requirement})" @@ -4,16 +4,26 @@ class Gem::Resolver::DependencyRequest attr_reader :dependency attr_reader :requester - def initialize(dep, act) - @dependency = dep - @requester = act end - def ==(other) case other when Gem::Dependency @dependency == other @@ -24,26 +34,39 @@ class Gem::Resolver::DependencyRequest end end def matches_spec?(spec) @dependency.matches_spec? spec end def name @dependency.name end # Indicate that the request is for a gem explicitly requested by the user def explicit? @requester.nil? end - # Indicate that the requset is for a gem requested as a dependency of another gem def implicit? !explicit? end # Return a String indicating who caused this request to be added (only # valid for implicit requests) def request_context @requester ? @requester.request : "(unknown)" end @@ -59,6 +82,9 @@ class Gem::Resolver::DependencyRequest end end def requirement @dependency.requirement end @@ -12,5 +12,24 @@ class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification @source == other.source end end @@ -11,16 +11,22 @@ class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification end ## # Returns +true+ if this gem is installable for the current platform. def installable_platform? # BACKCOMPAT If the file is coming out of a specified file, then we # ignore the platform. This code can be removed in RG 3.0. - if @source.kind_of? Gem::Source::SpecificFile - return true - else - Gem::Platform.match @spec.platform - end end ## @@ -20,6 +20,9 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set attr_accessor :ignore_installed # :nodoc: def initialize domain @domain = domain @@ -0,0 +1,16 @@ @@ -1,19 +1,28 @@ ## -# Used internally to hold the requirements being considered -# while attempting to find a proper activation set. class Gem::Resolver::RequirementList include Enumerable def initialize @list = [] end - def initialize_copy(other) @list = @list.dup end def add(req) @list.push req req @@ -30,14 +39,23 @@ class Gem::Resolver::RequirementList end end def empty? @list.empty? end def remove @list.shift end def next5 @list[0,5] end @@ -56,5 +56,34 @@ class Gem::Resolver::Specification "#{@name}-#{@version}" end end @@ -32,6 +32,8 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set raise Gem::GemNotFoundException, "unable to find #{gemspec} for gem #{name}" unless spec key = "#{spec.name}-#{spec.version}-#{spec.platform}" @specs[key] = spec @@ -12,5 +12,13 @@ class Gem::Resolver::VendorSpecification < Gem::Resolver::SpecSpecification @source == other.source end end |