aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/index.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/index.rb')
-rw-r--r--lib/bundler/index.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb
index 493ac8fa..5af70668 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