Skip to content

Commit

Permalink
[rubygems/rubygems] Extract a new small platform helper
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored and hsbt committed Nov 13, 2023
1 parent bd6aaa7 commit 58b0a67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/bundler/current_ruby.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/definition.rb
Expand Up @@ -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?
Expand Down
5 changes: 5 additions & 0 deletions lib/bundler/gem_helpers.rb
Expand Up @@ -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)

Expand Down

0 comments on commit 58b0a67

Please sign in to comment.