diff options
Diffstat (limited to 'lib/rubygems/resolver/activation_request.rb')
-rw-r--r-- | lib/rubygems/resolver/activation_request.rb | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/rubygems/resolver/activation_request.rb b/lib/rubygems/resolver/activation_request.rb index 2dd540cda0..135d75d6bc 100644 --- a/lib/rubygems/resolver/activation_request.rb +++ b/lib/rubygems/resolver/activation_request.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Specifies a Specification object that should be activated. Also contains a # dependency that was used to introduce this activation. @@ -50,15 +50,27 @@ class Gem::Resolver::ActivationRequest # Downloads a gem at +path+ and returns the file path. def download path - if @spec.respond_to? :source + Gem.ensure_gem_subdirectories path + + if @spec.respond_to? :sources + exception = nil + path = @spec.sources.find{ |source| + begin + source.download full_spec, path + rescue exception + end + } + return path if path + raise exception if exception + + elsif @spec.respond_to? :source source = @spec.source + source.download full_spec, path + else source = Gem.sources.first + source.download full_spec, path end - - Gem.ensure_gem_subdirectories path - - source.download full_spec, path end ## |