class Bundler::Source::Rubygems

def fetch(spec)

def fetch(spec)
  Bundler.ui.debug "  * Downloading"
  Gem::RemoteFetcher.fetcher.download(spec, uri, Gem.dir)
end

def fetch_all_specs(&blk)

def fetch_all_specs(&blk)
  Gem::SpecFetcher.new.list(true, false).each(&blk)
  Gem::SpecFetcher.new.list(false, true).each(&blk)
end

def fetch_specs

def fetch_specs
  index = Index.new
  Bundler.ui.info "Fetching source index from #{uri}"
  old, Gem.sources = Gem.sources, ["#{uri}"]
  fetch_all_specs do |n,v|
    v.each do |name, version, platform|
      next unless Gem::Platform.match(platform)
      spec = RemoteSpecification.new(name, version, platform, @uri)
      spec.source = self
      index << spec
    end
  end
  index.freeze
ensure
  Gem.sources = old
end

def gem_path(spec)

def gem_path(spec)
  "#{Gem.dir}/cache/#{spec.full_name}.gem"
end

def initialize(options = {})

def initialize(options = {})
  @options = options
  @uri = options["uri"].to_s
  @uri = "#{uri}/" unless @uri =~ %r'/$'
  @uri = URI.parse(@uri) unless @uri.is_a?(URI)
  raise ArgumentError, "The source must be an absolute URI" unless @uri.absolute?
end

def install(spec)

def install(spec)
  Bundler.ui.debug "  * Installing"
  installer = Gem::Installer.new gem_path(spec),
    :install_dir         => Gem.dir,
    :ignore_dependencies => true,
    :wrappers            => true,
    :env_shebang         => true,
    :bin_dir             => "#{Gem.dir}/bin"
  installer.install
end

def specs

def specs
  @specs ||= fetch_specs
end

def to_s

def to_s
  "rubygems repository at #{uri}"
end