class Bundler::Source::Rubygems

def download_gem_from_uri(spec, uri)

def download_gem_from_uri(spec, uri)
  spec.fetch_platform
  download_path = Bundler.requires_sudo? ? Bundler.tmp : Gem.dir
  gem_path = "#{Gem.dir}/cache/#{spec.full_name}.gem"
  FileUtils.mkdir_p("#{download_path}/cache")
  Gem::RemoteFetcher.fetcher.download(spec, uri, download_path)
  if Bundler.requires_sudo?
    sudo "mkdir -p #{Gem.dir}/cache"
    sudo "mv #{Bundler.tmp}/cache/#{spec.full_name}.gem #{gem_path}"
  end
  gem_path
end