def download_to_cache dependency
    found = Gem::SpecFetcher.fetcher.fetch dependency, true, true,
                                           dependency.prerelease?

    return if found.empty?

    spec, source_uri = found.sort_by { |(s,_)| s.version }.last

    download spec, source_uri
  end
#
Given a name and requirement, downloads this gem into cache and returns the
filename. Returns nil if the gem cannot be located.
--
Should probably be integrated with #download below, but that will be a
larger, more emcompassing effort. -erikh