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 50

def initialize
  @dependencies = nil
  @name         = nil
  @platform     = nil
  @set          = nil
  @source       = nil
  @version      = nil
end

Instance Attribute Details

#dependencies (readonly)

The dependencies of the gem for this specification

[ GitHub ]

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

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 107

def installable_platform?
  Gem::Platform.match spec.platform
end

#local?Boolean (readonly)

This method is for internal use only.
[ GitHub ]

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

def local? # :nodoc:
  false
end

#name (readonly)

The name of the gem for this specification

[ GitHub ]

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

attr_reader :name

#platform (readonly)

The platform this gem works on.

[ GitHub ]

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

attr_reader :platform

#set (readonly)

The set this specification came from.

[ GitHub ]

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

attr_reader :set

#source (readonly)

The source for this specification

[ GitHub ]

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

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 40

attr_reader :spec

#version (readonly)

The version of the gem for this specification.

[ GitHub ]

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

attr_reader :version

Instance Method Details

#download(options)

[ GitHub ]

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

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 63

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 71

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 84

def install(options = {})
  require 'rubygems/installer'

  gem = download options

  installer = Gem::Installer.at gem, options

  yield installer if block_given?

  @spec = installer.install
end