lib/rubygems/test_case.rb
##
# Sets up Gem::SpecFetcher to return information from the gems in +specs+.
# Best used with +@all_gems+ from #util_setup_fake_fetcher.
Sets up Gem::SpecFetcher to return information from the gems in +specs+.
Sets up Gem :: SpecFetcher to return information from the gems in + specs + .
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 
    nil 
  end
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 nil end
Sets up Gem::SpecFetcher to return information from the gems in +specs+.
Sets up Gem :: SpecFetcher to return information from the gems in + specs + .
# HACK for test_download_to_cache # force errors
specs