class Bundler::RubygemsIntegration::Future

Rubygems 2.0

def all_specs

def all_specs
  Gem::Specification.to_a
end

def build(spec)

def build(spec)
  Gem::Package.build(spec)
end

def fetch_all_remote_specs

def fetch_all_remote_specs
  tuples, errors = Gem::SpecFetcher.new.available_specs(:complete)
  # only raise if we don't get any specs back.
  # this means we still work if prerelease_specs.4.8.gz
  # don't exist but specs.4.8.gz do
  if tuples.empty? && error = errors.detect {|e| e.is_a?(Gem::SourceFetchProblem) }
    raise Gem::RemoteFetcher::FetchError.new(error.error, error.source)
  end
  hash = {}
  tuples.each do |source,tuples|
    hash[source.uri] = tuples.map { |tuple| tuple.to_a }
  end
  hash
end

def find_name(name)

def find_name(name)
  Gem::Specification.find_all_by_name name
end

def spec_from_gem(path)

def spec_from_gem(path)
  Gem::Package.new(path).spec
rescue Gem::Package::FormatError
  raise Bundler::GemspecError, "Could not read gem at #{path}. It may be corrupted."
end

def stub_rubygems(specs)

def stub_rubygems(specs)
  Gem::Specification.all = specs
  Gem.post_reset {
    Gem::Specification.all = specs
  }
end