类 Gem::Resolver::LockSpecification

LockSpecification 来自于锁定文件 (Gem::RequestSet::Lockfile)。

LockSpecification 的依赖信息是从锁定文件中预先填充的。

属性

sources[R]

公共类方法

new(set, name, version, sources, platform) 点击切换源代码
# File rubygems/resolver/lock_specification.rb, line 12
def initialize(set, name, version, sources, platform)
  super()

  @name     = name
  @platform = platform
  @set      = set
  @source   = sources.first
  @sources  = sources
  @version  = version

  @dependencies = []
  @spec         = nil
end

公共实例方法

install(options = {}) { |nil| ... } 点击切换源代码

这是一个空安装,因为锁定的规范被认为是已安装的。options 将被忽略。

# File rubygems/resolver/lock_specification.rb, line 30
def install(options = {})
  destination = options[:install_dir] || Gem.dir

  if File.exist? File.join(destination, "specifications", spec.spec_name)
    yield nil
    return
  end

  super
end
spec() 点击切换源代码

返回一个从锁定文件构造的规范

# File rubygems/resolver/lock_specification.rb, line 73
def spec
  @spec ||= Gem::Specification.find do |spec|
    spec.name == @name && spec.version == @version
  end

  @spec ||= Gem::Specification.new do |s|
    s.name     = @name
    s.version  = @version
    s.platform = @platform

    s.dependencies.concat @dependencies
  end
end