summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSamuel Giddins <[email protected]>2025-06-05 11:26:17 -0700
committerHiroshi SHIBATA <[email protected]>2025-06-11 08:48:56 +0900
commit7e3d271f765b6e2b2372b6af2f974d448cbfd1e0 (patch)
tree3166510c7bdaf8419e057b1eb572260555b15d6a /lib
parentb5beb1982502c46aeaac2f29888763df3272b568 (diff)
[rubygems/rubygems] Install the best matching gem for the current platform in gem install
Instead of picking essentially a random matching platform Signed-off-by: Samuel Giddins <[email protected]> https://github.com/rubygems/rubygems/commit/3727096297
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/resolver.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rubygems/resolver.rb b/lib/rubygems/resolver.rb
index 35d83abd2d..9bf5f80930 100644
--- a/lib/rubygems/resolver.rb
+++ b/lib/rubygems/resolver.rb
@@ -241,7 +241,7 @@ class Gem::Resolver
sources.each do |source|
groups[source].
- sort_by {|spec| [spec.version, spec.platform =~ Gem::Platform.local ? 1 : 0] }. # rubocop:disable Performance/RegexpMatch
+ sort_by {|spec| [spec.version, -Gem::Platform.platform_specificity_match(spec.platform, Gem::Platform.local)] }.
map {|spec| ActivationRequest.new spec, dependency }.
each {|activation_request| activation_requests << activation_request }
end