# File lib/bundler/source/rubygems.rb, line 476
def download_gem(spec, download_path)
local_path = File.join(download_path, "cache/#{spec.full_name}.gem")
if (cache_path = download_cache_path(spec)) && cache_path.file?
SharedHelpers.filesystem_access(local_path) do
FileUtils.cp(cache_path, local_path)
end
else
uri = spec.remote.uri
Bundler.ui.confirm("Fetching #{version_message(spec)}")
rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, download_path)
if rubygems_local_path != local_path
FileUtils.mv(rubygems_local_path, local_path)
end
cache_globally(spec, local_path)
end
end