util_setup_spec_fetcher(*specs)
public
Show source
def util_setup_spec_fetcher(*specs)
specs -= Gem::Specification._all
Gem::Specification.add_specs(*specs)
spec_fetcher = Gem::SpecFetcher.fetcher
prerelease, all = Gem::Specification.partition { |spec|
spec.version.prerelease?
}
spec_fetcher.specs[@uri] = []
all.each do |spec|
spec_fetcher.specs[@uri] << spec.name_tuple
end
spec_fetcher.latest_specs[@uri] = []
Gem::Specification.latest_specs.each do |spec|
spec_fetcher.latest_specs[@uri] << spec.name_tuple
end
spec_fetcher.prerelease_specs[@uri] = []
prerelease.each do |spec|
spec_fetcher.prerelease_specs[@uri] << spec.name_tuple
end
unless Gem::RemoteFetcher === @fetcher then
v = Gem.marshal_version
specs = all.map { |spec| spec.name_tuple }
s_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic specs
latest_specs = Gem::Specification.latest_specs.map do |spec|
spec.name_tuple
end
l_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic latest_specs
prerelease_specs = prerelease.map { |spec| spec.name_tuple }
p_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic prerelease_specs
@fetcher.data["#{@gem_repo}specs.#{v}.gz"] = s_zip
@fetcher.data["#{@gem_repo}latest_specs.#{v}.gz"] = l_zip
@fetcher.data["#{@gem_repo}prerelease_specs.#{v}.gz"] = p_zip
v = Gem.marshal_version
Gem::Specification.each do |spec|
path = "#{@gem_repo}quick/Marshal.#{v}/#{spec.original_name}.gemspec.rz"
data = Marshal.dump spec
data_deflate = Zlib::Deflate.deflate data
@fetcher.data[path] = data_deflate
end
end
nil
end