summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorshields <shields@tablecheck.com>2022-08-28 22:40:02 +0900
committergit <svn-admin@ruby-lang.org>2022-08-29 00:33:15 +0900
commit8799c912052f8bb957a65edd103e0064cac94598 (patch)
tree6bd697fbc6a44e96d12adfc161196572bd029ab5 /lib
parent1486ffe03913076889290e38d86a7bdaca4e6fbd (diff)
[rubygems/rubygems] Add platform :windows as a shortcut for all Windows platforms
https://github.com/rubygems/rubygems/commit/f3c49ad3f7
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/current_ruby.rb19
-rw-r--r--lib/bundler/dependency.rb1
-rw-r--r--lib/bundler/rubygems_ext.rb1
3 files changed, 16 insertions, 5 deletions
diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb
index 36f26b7ab4..f9987c4da8 100644
--- a/lib/bundler/current_ruby.rb
+++ b/lib/bundler/current_ruby.rb
@@ -36,17 +36,18 @@ module Bundler
rbx
ruby
truffleruby
+ windows
x64_mingw
].freeze
def ruby?
return true if Bundler::GemHelpers.generic_local_platform == Gem::Platform::RUBY
- !mswin? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby")
+ !windows? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby")
end
def mri?
- !mswin? && RUBY_ENGINE == "ruby"
+ !windows? && RUBY_ENGINE == "ruby"
end
def rbx?
@@ -65,16 +66,24 @@ module Bundler
RUBY_ENGINE == "truffleruby"
end
- def mswin?
+ def windows?
Gem.win_platform?
end
+ def mswin?
+ # For backwards compatibility
+ windows?
+
+ # TODO: This should correctly be:
+ # windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin32" && Bundler.local_platform.cpu == "x86"
+ end
+
def mswin64?
- Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
+ windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
end
def mingw?
- Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
+ windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
end
def x64_mingw?
diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb
index 52c6fff194..49ce23ec88 100644
--- a/lib/bundler/dependency.rb
+++ b/lib/bundler/dependency.rb
@@ -42,6 +42,7 @@ module Bundler
:jruby => Gem::Platform::JAVA,
:jruby_18 => Gem::Platform::JAVA,
:jruby_19 => Gem::Platform::JAVA,
+ :windows => Gem::Platform::WINDOWS,
:mswin => Gem::Platform::MSWIN,
:mswin_18 => Gem::Platform::MSWIN,
:mswin_19 => Gem::Platform::MSWIN,
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index d976170f12..056053a783 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -237,6 +237,7 @@ module Gem
MINGW = Gem::Platform.new("x86-mingw32")
X64_MINGW = [Gem::Platform.new("x64-mingw32"),
Gem::Platform.new("x64-mingw-ucrt")].freeze
+ WINDOWS = [MSWIN, MSWIN64, MINGW, X64_MINGW].flatten.freeze
if Gem::Platform.new("x86_64-linux-musl") === Gem::Platform.new("x86_64-linux")
remove_method :===