util_setup_spec_fetcher(*specs)
public
Show source
def util_setup_spec_fetcher(*specs)
all_specs = Gem::Specification.to_a + specs
Gem::Specification._resort! all_specs
spec_fetcher = Gem::SpecFetcher.fetcher
prerelease, all = all_specs.partition { |spec| spec.version.prerelease? }
latest = Gem::Specification._latest_specs all_specs
spec_fetcher.specs[@uri] = []
all.each do |spec|
spec_fetcher.specs[@uri] << spec.name_tuple
end
spec_fetcher.latest_specs[@uri] = []
latest.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 = latest.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
all_specs.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