summaryrefslogtreecommitdiff
path: root/lib/bundler/spec_set.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-10-26 20:50:06 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-11-08 09:04:28 +0900
commit9f67118d7bc790ee5c3449e28f76e428958bc5cb (patch)
tree79524a868fdd041b00099521b6c9d8f7e1ae513e /lib/bundler/spec_set.rb
parenta131ea39b7b9c34304dfbf8112581c49ce9ff827 (diff)
[rubygems/rubygems] Simplify selecting specs with `force_ruby_platform` set
https://github.com/rubygems/rubygems/commit/5f90a43635 Co-authored-by: Martin Emde <martin.emde@gmail.com>
Diffstat (limited to 'lib/bundler/spec_set.rb')
-rw-r--r--lib/bundler/spec_set.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 912ff8bf2e..cb8f0fd1b2 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -200,9 +200,11 @@ module Bundler
def specs_for_dependency(dep, platform)
specs_for_name = lookup[dep.name]
- target_platform = dep.force_ruby_platform ? Gem::Platform::RUBY : (platform || Bundler.local_platform)
- matching_specs = GemHelpers.select_best_platform_match(specs_for_name, target_platform)
- matching_specs.each {|s| s.force_ruby_platform = true } if dep.force_ruby_platform
+ matching_specs = if dep.force_ruby_platform
+ GemHelpers.force_ruby_platform(specs_for_name)
+ else
+ GemHelpers.select_best_platform_match(specs_for_name, platform || Bundler.local_platform)
+ end
matching_specs.map!(&:materialize_for_installation).compact! if platform.nil?
matching_specs
end