[前][次][番号順一覧][スレッド一覧]

ruby-changes:72458

From: David <ko1@a...>
Date: Fri, 8 Jul 2022 02:22:46 +0900 (JST)
Subject: [ruby-changes:72458] 7dd0a22588 (master): [rubygems/rubygems] Fix `simulate_windows` helper

https://git.ruby-lang.org/ruby.git/commit/?id=7dd0a22588

From 7dd0a2258880e433b98267ffd95dd4271c7bbf05 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Thu, 7 Jul 2022 09:57:27 +0200
Subject: [rubygems/rubygems] Fix `simulate_windows` helper

It should also set the proper class variable so that `Gem.win_platform?`
returns true.

https://github.com/rubygems/rubygems/commit/0fbf6904d1
---
 spec/bundler/support/hax.rb     | 4 ++++
 spec/bundler/support/helpers.rb | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/spec/bundler/support/hax.rb b/spec/bundler/support/hax.rb
index 3d97b93c5a..ff45bacaed 100644
--- a/spec/bundler/support/hax.rb
+++ b/spec/bundler/support/hax.rb
@@ -14,6 +14,10 @@ module Gem https://github.com/ruby/ruby/blob/trunk/spec/bundler/support/hax.rb#L14
     @default_specifications_dir = nil
   end
 
+  if ENV["BUNDLER_SPEC_WINDOWS"]
+    @@win_platform = true # rubocop:disable Sryle/ClassVars
+  end
+
   if ENV["BUNDLER_SPEC_PLATFORM"]
     class Platform
       @local = new(ENV["BUNDLER_SPEC_PLATFORM"])
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index e995418a4e..03c0df3b50 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -446,11 +446,15 @@ module Spec https://github.com/ruby/ruby/blob/trunk/spec/bundler/support/helpers.rb#L446
     end
 
     def simulate_windows(platform = mswin)
+      old = ENV["BUNDLER_SPEC_WINDOWS"]
+      ENV["BUNDLER_SPEC_WINDOWS"] = "true"
       simulate_platform platform do
         simulate_bundler_version_when_missing_prerelease_default_gem_activation do
           yield
         end
       end
+    ensure
+      ENV["BUNDLER_SPEC_WINDOWS"] = old
     end
 
     def simulate_bundler_version_when_missing_prerelease_default_gem_activation
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]