From 58b0a67432f5fd69d169ed4919ec0db6e6680279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Mon, 6 Mar 2023 17:58:13 +0100 Subject: [PATCH] [rubygems/rubygems] Extract a new small platform helper https://github.com/rubygems/rubygems/commit/8f7340df8e --- lib/bundler/current_ruby.rb | 2 +- lib/bundler/definition.rb | 2 +- lib/bundler/gem_helpers.rb | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb index 1d2d8ff2fb282c..93e0c401c056b6 100644 --- a/lib/bundler/current_ruby.rb +++ b/lib/bundler/current_ruby.rb @@ -43,7 +43,7 @@ class CurrentRuby ].freeze def ruby? - return true if Bundler::GemHelpers.generic_local_platform == Gem::Platform::RUBY + return true if Bundler::GemHelpers.generic_local_platform_is_ruby? !windows? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby") end diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 761185ff21d804..72fbae198464c8 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -592,7 +592,7 @@ def pin_locally_available_names(source_requirements) end def current_ruby_platform_locked? - return false unless generic_local_platform == Gem::Platform::RUBY + return false unless generic_local_platform_is_ruby? return false if Bundler.settings[:force_ruby_platform] && !@platforms.include?(Gem::Platform::RUBY) current_platform_locked? diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb index e85a93c64a36a3..de007523ec7797 100644 --- a/lib/bundler/gem_helpers.rb +++ b/lib/bundler/gem_helpers.rb @@ -34,6 +34,11 @@ def local_platform end module_function :local_platform + def generic_local_platform_is_ruby? + generic_local_platform == Gem::Platform::RUBY + end + module_function :generic_local_platform_is_ruby? + def platform_specificity_match(spec_platform, user_platform) spec_platform = Gem::Platform.new(spec_platform)