Class: Gem::Resolver::Specification
- Defined in:
- lib/rubygems/resolver/specification.rb
Overview
A Resolver::Specification contains a subset of the information contained in a Gem::Specification. Only the information necessary for dependency resolution in the resolver is included.
Direct Known Subclasses
APISpecification, IndexSpecification, LockSpecification, SpecSpecification
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
The dependencies of the gem for this specification.
-
#name ⇒ Object
readonly
The name of the gem for this specification.
-
#platform ⇒ Object
readonly
The platform this gem works on.
-
#required_ruby_version ⇒ Object
readonly
The required_ruby_version constraint for this specification.
-
#required_rubygems_version ⇒ Object
readonly
The required_ruby_version constraint for this specification.
-
#set ⇒ Object
readonly
The set this specification came from.
-
#source ⇒ Object
readonly
The source for this specification.
-
#spec ⇒ Object
readonly
The Gem::Specification for this Resolver::Specification.
-
#version ⇒ Object
readonly
The version of the gem for this specification.
Instance Method Summary collapse
- #download(options) ⇒ Object
-
#fetch_development_dependencies ⇒ Object
Fetches development dependencies if the source does not provide them by default (see APISpecification).
-
#full_name ⇒ Object
The name and version of the specification.
-
#initialize ⇒ Specification
constructor
Sets default instance variables for the specification.
-
#install(options = {}) {|installer| ... } ⇒ Object
Installs this specification using the Gem::Installer
options
. -
#installable_platform? ⇒ Boolean
Returns true if this specification is installable on this platform.
-
#local? ⇒ Boolean
:nodoc:.
Constructor Details
#initialize ⇒ Specification
Sets default instance variables for the specification.
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rubygems/resolver/specification.rb', line 59 def initialize @dependencies = nil @name = nil @platform = nil @set = nil @source = nil @version = nil @required_ruby_version = Gem::Requirement.default @required_rubygems_version = Gem::Requirement.default end |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
The dependencies of the gem for this specification
11 12 13 |
# File 'lib/rubygems/resolver/specification.rb', line 11 def dependencies @dependencies end |
#name ⇒ Object (readonly)
The name of the gem for this specification
16 17 18 |
# File 'lib/rubygems/resolver/specification.rb', line 16 def name @name end |
#platform ⇒ Object (readonly)
The platform this gem works on.
21 22 23 |
# File 'lib/rubygems/resolver/specification.rb', line 21 def platform @platform end |
#required_ruby_version ⇒ Object (readonly)
The required_ruby_version constraint for this specification.
49 50 51 |
# File 'lib/rubygems/resolver/specification.rb', line 49 def required_ruby_version @required_ruby_version end |
#required_rubygems_version ⇒ Object (readonly)
The required_ruby_version constraint for this specification.
54 55 56 |
# File 'lib/rubygems/resolver/specification.rb', line 54 def required_rubygems_version @required_rubygems_version end |
#set ⇒ Object (readonly)
The set this specification came from.
26 27 28 |
# File 'lib/rubygems/resolver/specification.rb', line 26 def set @set end |
#source ⇒ Object (readonly)
The source for this specification
31 32 33 |
# File 'lib/rubygems/resolver/specification.rb', line 31 def source @source end |
#spec ⇒ Object (readonly)
The Gem::Specification for this Resolver::Specification.
Implementers, note that #install updates @spec, so be sure to cache the Gem::Specification in @spec when overriding.
39 40 41 |
# File 'lib/rubygems/resolver/specification.rb', line 39 def spec @spec end |
#version ⇒ Object (readonly)
The version of the gem for this specification.
44 45 46 |
# File 'lib/rubygems/resolver/specification.rb', line 44 def version @version end |
Instance Method Details
#download(options) ⇒ Object
107 108 109 110 111 112 113 |
# File 'lib/rubygems/resolver/specification.rb', line 107 def download() dir = [:install_dir] || Gem.dir Gem.ensure_gem_subdirectories dir source.download spec, dir end |
#fetch_development_dependencies ⇒ Object
Fetches development dependencies if the source does not provide them by default (see APISpecification).
74 75 |
# File 'lib/rubygems/resolver/specification.rb', line 74 def fetch_development_dependencies # :nodoc: end |
#full_name ⇒ Object
The name and version of the specification.
Unlike Gem::Specification#full_name, the platform is not included.
82 83 84 |
# File 'lib/rubygems/resolver/specification.rb', line 82 def full_name "#{@name}-#{@version}" end |
#install(options = {}) {|installer| ... } ⇒ Object
Installs this specification using the Gem::Installer options
. The install method yields a Gem::Installer instance, which indicates the gem will be installed, or nil
, which indicates the gem is already installed.
After installation #spec is updated to point to the just-installed specification.
95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/rubygems/resolver/specification.rb', line 95 def install( = {}) require 'rubygems/installer' gem = download installer = Gem::Installer.at gem, yield installer if block_given? @spec = installer.install end |
#installable_platform? ⇒ Boolean
Returns true if this specification is installable on this platform.
118 119 120 |
# File 'lib/rubygems/resolver/specification.rb', line 118 def installable_platform? Gem::Platform.match_spec? spec end |
#local? ⇒ Boolean
:nodoc:
122 123 124 |
# File 'lib/rubygems/resolver/specification.rb', line 122 def local? # :nodoc: false end |