summaryrefslogtreecommitdiff
path: root/lib/rubygems/spec_fetcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/spec_fetcher.rb')
-rw-r--r--lib/rubygems/spec_fetcher.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index 967ab4492a..53ff8d1f45 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -74,6 +74,12 @@ class Gem::SpecFetcher
list, errors = available_specs(type)
list.each do |source, specs|
+ if dependency.name.is_a?(String) && specs.respond_to?(:bsearch)
+ start_index = (0 ... specs.length).bsearch{ |i| specs[i].name >= dependency.name }
+ end_index = (0 ... specs.length).bsearch{ |i| specs[i].name > dependency.name }
+ specs = specs[start_index ... end_index] if start_index && end_index
+ end
+
found[source] = specs.select do |tup|
if dependency.match?(tup)
if matching_platform and !Gem::Platform.match(tup.platform)
@@ -214,15 +220,15 @@ class Gem::SpecFetcher
def tuples_for(source, type, gracefully_ignore=false)
cache = @caches[type]
- if gracefully_ignore
+ tuples =
begin
cache[source.uri] ||= source.load_specs(type)
rescue Gem::RemoteFetcher::FetchError
+ raise unless gracefully_ignore
[]
end
- else
- cache[source.uri] ||= source.load_specs(type)
- end
+
+ tuples.sort_by { |tup| tup.name }
end
end