diff options
Diffstat (limited to 'lib/rubygems/dependency_installer.rb')
-rw-r--r-- | lib/rubygems/dependency_installer.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb index 49afc76c79..e189e800a0 100644 --- a/lib/rubygems/dependency_installer.rb +++ b/lib/rubygems/dependency_installer.rb @@ -124,12 +124,25 @@ class Gem::DependencyInstaller case scheme when 'http' then unless File.exist? local_gem_path then - say "Downloading gem #{gem_file_name}" if - Gem.configuration.really_verbose + begin + say "Downloading gem #{gem_file_name}" if + Gem.configuration.really_verbose + + remote_gem_path = source_uri + "gems/#{gem_file_name}" + + gem = Gem::RemoteFetcher.fetcher.fetch_path remote_gem_path + rescue Gem::RemoteFetcher::FetchError + raise if spec.original_platform == spec.platform - remote_gem_path = source_uri + "gems/#{gem_file_name}" + alternate_name = "#{spec.name}-#{spec.version}-#{spec.original_platform}.gem" - gem = Gem::RemoteFetcher.fetcher.fetch_path remote_gem_path + say "Failed, downloading gem #{alternate_name}" if + Gem.configuration.really_verbose + + remote_gem_path = source_uri + "gems/#{alternate_name}" + + gem = Gem::RemoteFetcher.fetcher.fetch_path remote_gem_path + end File.open local_gem_path, 'wb' do |fp| fp.write gem |