diff options
author | Andre Arko <andre@arko.net> | 2014-08-15 21:44:56 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2014-08-15 22:24:08 -0700 |
commit | 52d18078cd8cc4a4a179f03b7090e6c44c410c59 (patch) | |
tree | 7fe0aaa0b376eae6bf4b48fd790b024bfd646c45 | |
parent | 73f176ffd8000bc9730087a7b296a44b1ef71019 (diff) | |
download | bundler-52d18078cd8cc4a4a179f03b7090e6c44c410c59.tar.gz |
move cross-source unmet API deps into definition
-rw-r--r-- | lib/bundler/definition.rb | 9 | ||||
-rw-r--r-- | lib/bundler/source.rb | 5 | ||||
-rw-r--r-- | lib/bundler/source/rubygems.rb | 29 |
3 files changed, 22 insertions, 21 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index ab41393123..1c29fc279c 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -204,10 +204,17 @@ module Bundler def index @index ||= Index.build do |idx| + unmet = [] + sources.all_sources.each do |s| - @dependency_names += s.specs.unmet_dependency_names + unmet.push(*s.specs.unmet_dependency_names).uniq! idx.add_source s.specs end + + sources.all_sources.each do |s| + s.add_specs_named(unmet) + unmet.push(*s.specs.unmet_dependency_names).uniq! + end end end diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index ce0cbb5dc2..948ffe3e62 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -14,6 +14,11 @@ module Bundler mirrors[normalized_key] || uri end + attr_accessor :dependency_names + def add_specs_named(names) + # implemented in Rubygems + end + def version_message(spec) locked_spec = Bundler.locked_gems.specs.find { |s| s.name == spec.name } if Bundler.locked_gems locked_spec_version = locked_spec.version if locked_spec diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index f613877ea6..c92e902b79 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -8,7 +8,6 @@ module Bundler API_REQUEST_LIMIT = 100 # threshold for switching back to the modern index instead of fetching every spec attr_reader :remotes, :caches - attr_accessor :dependency_names def initialize(options = {}) @options = options @@ -171,6 +170,14 @@ module Bundler end end + def add_specs_named(names) + return unless @allow_remote + fetchers.each do |f| + new_specs = f.specs(names, self) + specs.use new_specs unless new_specs.empty? + end + end + protected def source_uris_for_spec(spec) @@ -298,25 +305,7 @@ module Bundler idx.use f.specs(dependency_names, self) Bundler.ui.info "" if !Bundler.ui.debug? # new line now that the dots are over end - - 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 !allow_api + else api_fetchers.each do |f| Bundler.ui.info "Fetching source index from #{f.uri}" idx.use f.specs(nil, self) |