class Bundler::Source::Rubygems
def fetch_gem(spec)
def fetch_gem(spec) return false unless spec.remote uri = spec.remote.uri spec.fetch_platform download_path = Bundler.requires_sudo? ? Bundler.tmp(spec.full_name) : Bundler.rubygems.gem_dir gem_path = "#{Bundler.rubygems.gem_dir}/cache/#{spec.full_name}.gem" SharedHelpers.filesystem_access("#{download_path}/cache") do |p| FileUtils.mkdir_p(p) end Bundler.rubygems.download_gem(spec, uri, download_path) if Bundler.requires_sudo? SharedHelpers.filesystem_access("#{Bundler.rubygems.gem_dir}/cache") do |p| Bundler.mkdir_p(p) end Bundler.sudo "mv #{download_path}/cache/#{spec.full_name}.gem #{gem_path}" end gem_path ensure Bundler.rm_rf(download_path) if Bundler.requires_sudo? end