Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/rubygems/spec_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ def search_for_dependency(dependency, matching_platform=true)

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)
Expand Down Expand Up @@ -216,12 +222,12 @@ def tuples_for(source, type, gracefully_ignore=false)

if gracefully_ignore
begin
cache[source.uri] ||= source.load_specs(type)
cache[source.uri] ||= source.load_specs(type).sort_by{ |tup| tup.name }.freeze
rescue Gem::RemoteFetcher::FetchError
[]
[].freeze
end
else
cache[source.uri] ||= source.load_specs(type)
cache[source.uri] ||= source.load_specs(type).sort_by{ |tup| tup.name }.freeze
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ def self.latest_specs prerelease = false
result.map(&:last).map(&:values).flatten.reject { |spec|
minimum = native[spec.name]
minimum && spec.version < minimum
}
}.sort_by{ |tup| tup.name }.freeze
end

##
Expand Down