class Gem::RequestSet::Lockfile
解析 gem.deps.rb.lock 文件并构建一个包含其中找到的依赖项的 LockSet。 如果缺少锁定文件,则不构造 LockSet。
属性
platforms[R]
此 Lockfile
的平台
公共类方法
build(request_set, gem_deps_file, dependencies = nil) 单击以切换源代码
为给定的 request_set
和 gem_deps_file
位置创建一个新的 Lockfile
。
# File rubygems/request_set/lockfile.rb, line 44 def self.build(request_set, gem_deps_file, dependencies = nil) request_set.resolve dependencies ||= requests_to_deps request_set.sorted_requests new request_set, gem_deps_file, dependencies end
new(request_set, gem_deps_file, dependencies) 单击以切换源代码
# File rubygems/request_set/lockfile.rb, line 74 def initialize(request_set, gem_deps_file, dependencies) @set = request_set @dependencies = dependencies @gem_deps_file = File.expand_path(gem_deps_file) @gem_deps_dir = File.dirname(@gem_deps_file) @platforms = [] end
公共实例方法
add_GIT(out, git_requests) 单击以切换源代码
# File rubygems/request_set/lockfile.rb, line 122 def add_GIT(out, git_requests) return if git_requests.empty? by_repository_revision = git_requests.group_by do |request| source = request.spec.source [source.repository, source.rev_parse] end by_repository_revision.each do |(repository, revision), requests| out << "GIT" out << " remote: #{repository}" out << " revision: #{revision}" out << " specs:" requests.sort_by(&:name).each do |request| out << " #{request.name} (#{request.version})" dependencies = request.spec.dependencies.sort_by(&:name) dependencies.each do |dep| out << " #{dep.name}#{dep.requirement.for_lockfile}" end end out << nil end end
spec_groups() 单击以切换源代码
# File rubygems/request_set/lockfile.rb, line 192 def spec_groups requests.group_by {|request| request.spec.class } end
to_s() 单击以切换源代码
锁定文件的内容。
# File rubygems/request_set/lockfile.rb, line 199 def to_s out = [] groups = spec_groups add_PATH out, groups.delete(Gem::Resolver::VendorSpecification) { [] } add_GIT out, groups.delete(Gem::Resolver::GitSpecification) { [] } add_GEM out, groups add_PLATFORMS out add_DEPENDENCIES out out.join "\n" end
write() 单击以切换源代码
将锁定文件写入 gem 依赖文件旁边
# File rubygems/request_set/lockfile.rb, line 220 def write content = to_s File.open "#{@gem_deps_file}.lock", "w" do |io| io.write content end end
私有实例方法
requests() 单击以切换源代码
# File rubygems/request_set/lockfile.rb, line 230 def requests @set.sorted_requests end