def search(dependency)
      @cache[dependency.hash] ||= begin
        find_by_name(dependency.name).select do |spec|
          dependency =~ spec
        end.sort_by {|s| s.version }
      end
    end
def search(dependency)
      @cache[dependency.hash] ||= begin
        find_by_name(dependency.name).select do |spec|
          dependency =~ spec
        end.sort_by {|s| s.version }
      end
    end
Takes an array of gem sources and fetches the full index of
 gems from each one. It then combines the indexes together keeping
 track of the original source so that any resolved gem can be
 fetched from the correct source.

 ==== Parameters
 *sources<String>:: URI pointing to the gem repository
 Searches for a gem that matches the dependency

 ==== Parameters
 dependency<Gem::Dependency>:: The gem dependency to search for

 ==== Returns
 [Gem::Specification]:: A collection of gem specifications
   matching the search