diff options
author | Terence Lee <hone02@gmail.com> | 2012-11-29 20:32:07 -0500 |
---|---|---|
committer | Terence Lee <hone02@gmail.com> | 2012-11-29 20:36:26 -0500 |
commit | 8b43db5aecae1218988f6f90b970a644f35ca861 (patch) | |
tree | 9d68115e1ca16cb6182d13bc291bf122e51e3665 | |
parent | c092b52c2caf9c5a4d63ca57d4bb7e3ad2fdcc74 (diff) | |
download | bundler-8b43db5aecae1218988f6f90b970a644f35ca861.tar.gz |
Mimick interface to match RG 1.8.24 with RG2.0
Rubygems 2.0 doesn't actually raise an exception here and stashes them
in an error array that gets returned. Only raise when we don't get any
tuples back. The reason for doing this, is :complete will return if any
specs get returned. We want to return these back in case the server
doesn't have prerelease specs, it will have an error but continue. This
will support gem servers like geminabox which don't generate prerelease
specs by default.
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index ac841d7db3..22ff1d4133 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -404,7 +404,13 @@ module Bundler end def fetch_all_remote_specs - tuples, _ = Gem::SpecFetcher.new.available_specs(:complete) + tuples, errors = Gem::SpecFetcher.new.available_specs(:complete) + # only raise if we don't get any specs back. + # this means we still work if prerelease_specs.4.8.gz + # don't exist but specs.4.8.gz do + if tuples.empty? && error = errors.detect {|e| e.is_a?(Gem::SourceFetchProblem) } + raise Gem::RemoteFetcher::FetchError.new(error.error, error.source) + end hash = {} tuples.each do |source,tuples| @@ -412,8 +418,6 @@ module Bundler end hash - rescue Gem::RemoteFetcher::FetchError - raise HTTPError, "Could not reach #{strip_user_pass_from_uri(@remote_uri)}" end def spec_from_gem(path) |