find_gems_with_sources (Gem::DependencyInstaller)

    # File lib/rubygems/dependency_installer.rb, line 82
      def find_gems_with_sources(dep)
        gems_and_sources = []

        if @domain == :both or @domain == :local then
          Dir[File.join(Dir.pwd, "#{dep.name}-[0-9]*.gem")].each do |gem_file|
            spec = Gem::Format.from_file_by_path(gem_file).spec
            gems_and_sources << [spec, gem_file] if spec.name == dep.name
          end
        end

        if @domain == :both or @domain == :remote then
          begin
            requirements = dep.version_requirements.requirements.map do |req, ver|
              req
            end

            all = !@prerelease && (requirements.length > 1 ||
                    (requirements.first != ">=" and requirements.first != ">"))

            found = Gem::SpecFetcher.fetcher.fetch dep, all, true, @prerelease
            gems_and_sources.push(*found)

          rescue Gem::RemoteFetcher::FetchError => e
            if Gem.configuration.really_verbose then
              say "Error fetching remote data:\t\t#{e.message}"
              say "Falling back to local-only install"
            end
            @domain = :local
          end
        end

        gems_and_sources.sort_by do |gem, source|
          [gem, source =~ /^http:\/\// ? 0 : 1] # local gems win
        end
      end