# File lib/rubygems/remote_installer.rb, line 88
    def specs_n_sources_matching(gem_name, version_requirement)
      specs_n_sources = []

      source_index_hash.each do |source_uri, source_index|
        specs = source_index.search(/^#{Regexp.escape gem_name}$/i,
                                    version_requirement)
        # TODO move to SourceIndex#search?
        ruby_version = Gem::Version.new RUBY_VERSION
        specs = specs.select do |spec|
          spec.required_ruby_version.nil? or
            spec.required_ruby_version.satisfied_by? ruby_version
        end
        specs.each { |spec| specs_n_sources << [spec, source_uri] }
      end

      if specs_n_sources.empty? then
        raise GemNotFoundException, "Could not find #{gem_name} (#{version_requirement}) in any repository"
      end

      specs_n_sources = specs_n_sources.sort_by { |gs,| gs.version }.reverse

      specs_n_sources
    end