Specifies a Specification object that should be activated. Also contains a dependency that was used to introduce this activation.
The parent request for this activation request.
The specification to be activated.
# File tmp/rubies/ruby-2.5.9/lib/rubygems/resolver/activation_request.rb, line 25
def initialize spec, request, others_possible = true
@spec = spec
@request = request
@others_possible = others_possible
end
Creates a new ActivationRequest
that will activate spec
. The parent request
is used to provide diagnostics in case of conflicts.
others_possible
indicates that other specifications may also match this activation request.
# File tmp/rubies/ruby-2.5.9/lib/rubygems/resolver/activation_request.rb, line 45
def development?
@request.development?
end
Is this activation request for a development dependency?
# File tmp/rubies/ruby-2.5.9/lib/rubygems/resolver/activation_request.rb, line 52
def download path
Gem.ensure_gem_subdirectories path
if @spec.respond_to? :sources
exception = nil
path = @spec.sources.find{ |source|
begin
source.download full_spec, path
rescue exception
end
}
return path if path
raise exception if exception
elsif @spec.respond_to? :source
source = @spec.source
source.download full_spec, path
else
source = Gem.sources.first
source.download full_spec, path
end
end
Downloads a gem at path
and returns the file path.
# File tmp/rubies/ruby-2.5.9/lib/rubygems/resolver/activation_request.rb, line 79
def full_name
@spec.full_name
end
The full name of the specification to be activated.
# File tmp/rubies/ruby-2.5.9/lib/rubygems/resolver/activation_request.rb, line 88
def full_spec
Gem::Specification === @spec ? @spec : @spec.spec
end
The Gem::Specification
for this activation request.
# File tmp/rubies/ruby-2.5.9/lib/rubygems/resolver/activation_request.rb, line 114
def installed?
case @spec
when Gem::Resolver::VendorSpecification then
true
else
this_spec = full_spec
Gem::Specification.any? do |s|
s == this_spec
end
end
end
True if the requested gem has already been installed.
# File tmp/rubies/ruby-2.5.9/lib/rubygems/resolver/activation_request.rb, line 130
def name
@spec.name
end
The name of this activation request’s specification
# File tmp/rubies/ruby-2.5.9/lib/rubygems/resolver/activation_request.rb, line 138
def others_possible?
case @others_possible
when true, false then
@others_possible
else
not @others_possible.empty?
end
end
Indicate if this activation is one of a set of possible requests for the same Dependency request.
# File tmp/rubies/ruby-2.5.9/lib/rubygems/resolver/activation_request.rb, line 151
def parent
@request.requester
end
Return the ActivationRequest
that contained the dependency that we were activated for.
# File tmp/rubies/ruby-2.5.9/lib/rubygems/resolver/activation_request.rb, line 182
def version
@spec.version
end
The version of this activation request’s specification