# File lib/rubygems/spec_fetcher.rb, line 68
  def fetch(dependency, all = false, matching_platform = true, prerelease = false)
    specs_and_sources = find_matching dependency, all, matching_platform, prerelease

    specs_and_sources.map do |spec_tuple, source_uri|
      [fetch_spec(spec_tuple, URI.parse(source_uri)), source_uri]
    end

  rescue Gem::RemoteFetcher::FetchError => e
    raise unless warn_legacy e do
      require 'rubygems/source_info_cache'

      return Gem::SourceInfoCache.search_with_source(dependency,
                                                     matching_platform, all)
    end
  end