123456789_123456789_123456789_123456789_123456789_

Class: Gem::Resolver::Specification

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: lib/rubygems/resolver/specification.rb

Overview

A Specification contains a subset of the information contained in a ::Gem::Specification. Only the information necessary for dependency resolution in the resolver is included.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.newSpecification

Sets default instance variables for the specification.

[ GitHub ]

  
# 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 (readonly)

The dependencies of the gem for this specification

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 11

attr_reader :dependencies

#installable_platform?Boolean (readonly)

Returns true if this specification is installable on this platform.

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 118

def installable_platform?
  Gem::Platform.match_spec? spec
end

#local?Boolean (readonly)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 122

def local? # :nodoc:
  false
end

#name (readonly)

The name of the gem for this specification

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 16

attr_reader :name

#platform (readonly)

The platform this gem works on.

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 21

attr_reader :platform

#required_ruby_version (readonly)

The required_ruby_version constraint for this specification.

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 49

attr_reader :required_ruby_version

#required_rubygems_version (readonly)

The required_ruby_version constraint for this specification.

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 54

attr_reader :required_rubygems_version

#set (readonly)

The set this specification came from.

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 26

attr_reader :set

#source (readonly)

The source for this specification

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 31

attr_reader :source

#spec (readonly)

The ::Gem::Specification for this Specification.

Implementers, note that #install updates @spec, so be sure to cache the ::Gem::Specification in @spec when overriding.

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 39

attr_reader :spec

#version (readonly)

The version of the gem for this specification.

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 44

attr_reader :version

Instance Method Details

#download(options)

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 107

def download(options)
  dir = options[:install_dir] || Gem.dir

  Gem.ensure_gem_subdirectories dir

  source.download spec, dir
end

#fetch_development_dependencies

This method is for internal use only.

Fetches development dependencies if the source does not provide them by default (see APISpecification).

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 74

def fetch_development_dependencies # :nodoc:
end

#full_name

The name and version of the specification.

Unlike Specification#full_name, the platform is not included.

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 82

def full_name
  "#{@name}-#{@version}"
end

#install(options = {}) {|installer| ... }

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.

Yields:

[ GitHub ]

  
# File 'lib/rubygems/resolver/specification.rb', line 95

def install(options = {})
  require_relative "../installer"

  gem = download options

  installer = Gem::Installer.at gem, options

  yield installer if block_given?

  @spec = installer.install
end