Class: Gem::Resolver::LockSpecification
- Inherits:
-
Specification
- Object
- Specification
- Gem::Resolver::LockSpecification
- Defined in:
- lib/rubygems/resolver/lock_specification.rb
Overview
The LockSpecification comes from a lockfile (Gem::RequestSet::Lockfile).
A LockSpecification’s dependency information is pre-filled from the lockfile.
Instance Attribute Summary
Attributes inherited from Specification
#dependencies, #name, #platform, #set, #source, #version
Instance Method Summary collapse
-
#add_dependency(dependency) ⇒ Object
Adds
dependency
from the lockfile to this specification. -
#initialize(set, name, version, source, platform) ⇒ LockSpecification
constructor
A new instance of LockSpecification.
-
#install(options) ⇒ Object
This is a null install as a locked specification is considered installed.
-
#spec ⇒ Object
A specification constructed from the lockfile is returned.
Methods inherited from Specification
#full_name, #installable_platform?
Constructor Details
#initialize(set, name, version, source, platform) ⇒ LockSpecification
Returns a new instance of LockSpecification.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rubygems/resolver/lock_specification.rb', line 9 def initialize set, name, version, source, platform super() @name = name @platform = platform @set = set @source = source @version = version @dependencies = [] @spec = nil end |
Instance Method Details
#add_dependency(dependency) ⇒ Object
Adds dependency
from the lockfile to this specification
40 41 42 |
# File 'lib/rubygems/resolver/lock_specification.rb', line 40 def add_dependency dependency # :nodoc: @dependencies << dependency end |
#install(options) ⇒ Object
This is a null install as a locked specification is considered installed. options
are ignored.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rubygems/resolver/lock_specification.rb', line 26 def install destination = [:install_dir] || Gem.dir if File.exist? File.join(destination, 'specifications', spec.spec_name) then yield nil return end super end |
#spec ⇒ Object
A specification constructed from the lockfile is returned
47 48 49 50 51 52 53 54 55 |
# File 'lib/rubygems/resolver/lock_specification.rb', line 47 def spec @spec ||= Gem::Specification.new do |s| s.name = @name s.version = @version s.platform = @platform s.dependencies.concat @dependencies end end |