diff options
author | Tim Moore <tmoore@incrementalism.net> | 2014-07-06 18:35:31 +1000 |
---|---|---|
committer | Tim Moore <tmoore@incrementalism.net> | 2014-07-30 14:16:35 +1000 |
commit | ab78e7449ba1c1024de22ff798c6a32fb581abca (patch) | |
tree | 30e77a8e8f10b423874e6c713f1446d803bf8037 /lib/bundler/index.rb | |
parent | 9af2172e6dc6b29dc24f92a27b7a385faa952ba3 (diff) | |
download | bundler-ab78e7449ba1c1024de22ff798c6a32fb581abca.tar.gz |
Detect ambiguous gems.
Diffstat (limited to 'lib/bundler/index.rb')
-rw-r--r-- | lib/bundler/index.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb index 493ac8fa52..5af7066845 100644 --- a/lib/bundler/index.rb +++ b/lib/bundler/index.rb @@ -10,13 +10,14 @@ module Bundler i end - attr_reader :specs, :sources - protected :specs + attr_reader :specs, :all_specs, :sources + protected :specs, :all_specs def initialize @sources = [] @cache = {} @specs = Hash.new { |h,k| h[k] = [] } + @all_specs = Hash.new { |h,k| h[k] = [] } end def initialize_copy(o) @@ -24,10 +25,14 @@ module Bundler @sources = @sources.dup @cache = {} @specs = Hash.new { |h,k| h[k] = [] } + @all_specs = Hash.new { |h,k| h[k] = [] } o.specs.each do |name, array| @specs[name] = array.dup end + o.all_specs.each do |name, array| + @all_specs[name] = array.dup + end end def inspect @@ -39,6 +44,14 @@ module Bundler true end + def search_all(name) + all_matches = @all_specs[name] + local_search(name) + @sources.each do |source| + all_matches.concat(source.search_all(name)) + end + all_matches + end + # Search this index's specs, and any source indexes that this index knows # about, returning all of the results. def search(query, base = nil) @@ -105,6 +118,7 @@ module Bundler return unless other other.each do |s| if (dupes = search_by_spec(s)) && dupes.any? + @all_specs[s.name] = [s] + dupes next unless override_dupes @specs[s.name] -= dupes end |