summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/fetch_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands/fetch_command.rb')
-rw-r--r--lib/rubygems/commands/fetch_command.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb
index ec021359b6..f5a8abc349 100644
--- a/lib/rubygems/commands/fetch_command.rb
+++ b/lib/rubygems/commands/fetch_command.rb
@@ -43,12 +43,13 @@ class Gem::Commands::FetchCommand < Gem::Command
dep.prerelease = options[:prerelease]
specs_and_sources, errors = Gem::SpecFetcher.fetcher.spec_for_dependency dep
+
if platform then
filtered = specs_and_sources.select { |s,| s.platform == platform }
specs_and_sources = filtered unless filtered.empty?
end
- spec, source = specs_and_sources.sort_by { |s,| s.version }.first
+ spec, source = specs_and_sources.max_by { |s,| s.version }
if spec.nil? then
show_lookup_failure gem_name, version, errors, options[:domain]