Skip to content

Commit

Permalink
Move formatting logic from Gem::Platform.local to Gem::Platform::Stri…
Browse files Browse the repository at this point in the history
…ngParser
  • Loading branch information
gustavothecoder committed Dec 9, 2023
1 parent 281de0f commit 3c9fbf4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bundler/lib/bundler/installer/standalone.rb
Expand Up @@ -140,7 +140,7 @@ def platform_parser
def local_platform
force_mswin_version = true
Gem::Platform::StringParser
.run(RbConfig::CONFIG["arch"])
.run(RbConfig::CONFIG["arch"], force_mswin_version)
.compact
.join "-"
end
Expand Down
5 changes: 2 additions & 3 deletions lib/rubygems/platform.rb
Expand Up @@ -14,9 +14,8 @@ class Gem::Platform

def self.local
@local ||= begin
arch = RbConfig::CONFIG["arch"]
arch = "#{arch}_60" if /mswin(?:32|64)$/.match?(arch)
new(arch)
force_mswin_version = true
new(StringParser.run(RbConfig::CONFIG["arch"], force_mswin_version))
end
end

Expand Down
3 changes: 2 additions & 1 deletion lib/rubygems/platform/string_parser.rb
@@ -1,7 +1,8 @@
# frozen_string_literal: true

module Gem::Platform::StringParser
def self.run(arch)
def self.run(arch, force_mswin_version = false)
arch = "#{arch}_60" if /mswin(?:32|64)$/.match?(arch) && force_mswin_version
arch = arch.split "-"

if arch.length > 2 && arch.last !~ /\d+(\.\d+)?$/ # reassemble x86-linux-{libc}
Expand Down

0 comments on commit 3c9fbf4

Please sign in to comment.