diff options
author | Andre Arko <andre@arko.net> | 2013-10-03 00:31:30 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2013-10-03 16:32:31 -0700 |
commit | 833b69c467f23e12148433e1c2add53dcbaa4668 (patch) | |
tree | ddbe25fd38417d0db8b2bcf7d886d5cd9c982597 | |
parent | 6cd5efa17ace67e8cfb2aa326bf2b1733c195a64 (diff) | |
download | bundler-retry_network.tar.gz |
fix the bug that downloads every specretry_network
basically, the bug happened anytime an API fetcher encountered an error
and fell back on the not-API. then the rubygems source would continue
to think that it should query every spec for dependencies, which would
trigger every spec to be downloaded. we now check for sources that have
changed from use_api to !use_api so we know to abort.
-rw-r--r-- | lib/bundler/source/rubygems.rb | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 9f2bc02399..f929c9d674 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -230,25 +230,33 @@ module Bundler # because ensuring we have all the gems we need involves downloading # the gemspecs of those gems, if the non-api sites contain more than # about 100 gems, we just treat all sites as non-api for speed. - if idx.size < API_REQUEST_LIMIT && dependency_names.size < API_REQUEST_LIMIT + allow_api = idx.size < API_REQUEST_LIMIT && dependency_names.size < API_REQUEST_LIMIT + + if allow_api api_fetchers.each do |f| Bundler.ui.info "Fetching gem metadata from #{f.uri}", Bundler.ui.debug? idx.use f.specs(dependency_names, self) Bundler.ui.info "" if !Bundler.ui.debug? # new line now that the dots are over end - # it's possible that gems from one source depend on gems from some - # other source, so now we download gemspecs and iterate over those - # dependencies, looking for gems we don't have info on yet. - unmet = idx.unmet_dependency_names + if api_fetchers.all?{|f| f.use_api } + # it's possible that gems from one source depend on gems from some + # other source, so now we download gemspecs and iterate over those + # dependencies, looking for gems we don't have info on yet. + unmet = idx.unmet_dependency_names + + # if there are any cross-site gems we missed, get them now + api_fetchers.each do |f| + Bundler.ui.info "Fetching additional metadata from #{f.uri}", Bundler.ui.debug? + idx.use f.specs(unmet, self) + Bundler.ui.info "" if !Bundler.ui.debug? # new line now that the dots are over + end if unmet.any? + else + allow_api = false + end + end - # if there are any cross-site gems we missed, get them now - api_fetchers.each do |f| - Bundler.ui.info "Fetching additional metadata from #{f.uri}", Bundler.ui.debug? - idx.use f.specs(unmet, self) - Bundler.ui.info "" if !Bundler.ui.debug? # new line now that the dots are over - end if unmet.any? - else + if !allow_api api_fetchers.each do |f| Bundler.ui.info "Fetching source index from #{f.uri}" idx.use f.specs(nil, self) |