method
util_setup_spec_fetcher
v1_9_3_392 -
Show latest stable
- Class:
Gem::TestCase
util_setup_spec_fetcher(*specs)public
Sets up Gem::SpecFetcher to return information from the gems in specs. Best used with +@all_gems+ from #util_setup_fake_fetcher.
# File lib/rubygems/test_case.rb, line 665
def util_setup_spec_fetcher(*specs)
specs -= Gem::Specification._all
Gem::Specification.add_specs(*specs)
spec_fetcher = Gem::SpecFetcher.fetcher
prerelease, _ = Gem::Specification.partition { |spec|
spec.version.prerelease?
}
spec_fetcher.specs[@uri] = []
Gem::Specification.each do |spec|
spec_tuple = [spec.name, spec.version, spec.original_platform]
spec_fetcher.specs[@uri] << spec_tuple
end
spec_fetcher.latest_specs[@uri] = []
Gem::Specification.latest_specs.each do |spec|
spec_tuple = [spec.name, spec.version, spec.original_platform]
spec_fetcher.latest_specs[@uri] << spec_tuple
end
spec_fetcher.prerelease_specs[@uri] = []
prerelease.each do |spec|
spec_tuple = [spec.name, spec.version, spec.original_platform]
spec_fetcher.prerelease_specs[@uri] << spec_tuple
end
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 unless Gem::RemoteFetcher === @fetcher # HACK for test_download_to_cache
nil # force errors
end Related methods
- Instance methods
- all_spec_names
- assert_path_exists
- build_rake_in
- create_tmpdir
- dep
- install_gem
- install_gem_user
- install_specs
- make_command
- mu_pp
- new_spec
- nmake_found?
- process_based_port
- quick_gem
- quick_spec
- read_binary
- read_cache
- refute_path_exists
- req
- setup
- spec
- teardown
- uninstall_gem
- util_build_gem
- util_clear_gems
- util_gem
- util_gzip
- util_make_gems
- util_set_arch
- util_setup_fake_fetcher
- util_setup_spec_fetcher
- util_spec
- util_zip
- v
- vc_windows?
- win_platform?
- write_file
- Class methods
- make_command
- process_based_port
- rubybin
- vc_windows?
- win_platform?