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

ruby-changes:62482

From: David <ko1@a...>
Date: Fri, 31 Jul 2020 21:08:58 +0900 (JST)
Subject: [ruby-changes:62482] 1b2bda72fc (master): [rubygems/rubygems] Extend the script to allow reverting the patch when tried locally

https://git.ruby-lang.org/ruby.git/commit/?id=1b2bda72fc

From 1b2bda72fcb765c0a1ca8991ad840d37ac27198d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Sun, 12 Jul 2020 12:35:57 +0200
Subject: [rubygems/rubygems] Extend the script to allow reverting the patch
 when tried locally

https://github.com/rubygems/rubygems/commit/00ebf8c9f7

diff --git a/util/remove_openssl.rb b/util/remove_openssl.rb
index c47e335..a98f227 100644
--- a/util/remove_openssl.rb
+++ b/util/remove_openssl.rb
@@ -3,19 +3,53 @@ https://github.com/ruby/ruby/blob/trunk/util/remove_openssl.rb#L3
 require "rbconfig"
 require "fileutils"
 
-archdir = RbConfig::CONFIG["archdir"]
-rubylibdir = RbConfig::CONFIG["rubylibdir"]
-default_specifications_dir = Gem.default_specifications_dir
-
-openssl_rb = File.join(rubylibdir, "openssl.rb")
-openssl_gemspec = Dir.glob("#{default_specifications_dir}/openssl-*.gemspec").first
-
-openssl_ext = if RUBY_PLATFORM == "java"
-                File.join(rubylibdir, "jopenssl.jar")
-              else
-                File.join(archdir, "openssl.so")
-              end
-
-FileUtils.mv openssl_rb, openssl_rb + "_"
-FileUtils.mv openssl_ext, openssl_ext + "_"
-FileUtils.mv openssl_gemspec, openssl_gemspec + "_" if openssl_gemspec
+class OpensslSimulator
+  attr_reader :openssl_rb, :openssl_gemspec, :openssl_ext
+
+  def initialize
+    archdir = RbConfig::CONFIG["archdir"]
+    rubylibdir = RbConfig::CONFIG["rubylibdir"]
+    default_specifications_dir = Gem.default_specifications_dir
+
+    @openssl_rb = File.join(rubylibdir, "openssl.rb")
+    @openssl_gemspec = Dir.glob("#{default_specifications_dir}/openssl-*.gemspec").first
+
+    @openssl_ext = if RUBY_PLATFORM == "java"
+                     File.join(rubylibdir, "jopenssl.jar")
+                   else
+                     File.join(archdir, "openssl.so")
+                   end
+  end
+
+  def hide_openssl
+    hide_file openssl_rb
+    hide_file openssl_ext
+    hide_file openssl_gemspec if openssl_gemspec
+  end
+
+  def unhide_openssl
+    unhide_file openssl_gemspec if openssl_gemspec
+    unhide_file openssl_ext
+    unhide_file openssl_rb
+  end
+
+  private
+
+  def hide_file(file)
+    FileUtils.mv file, file + "_"
+  end
+
+  def unhide_file(file)
+    FileUtils.mv file + "_", file
+  end
+end
+
+if $0 == __FILE__
+  openssl_simulate = OpensslSimulator.new
+
+  if ARGV[0] == "--revert"
+    openssl_simulate.unhide_openssl
+  else
+    openssl_simulate.hide_openssl
+  end
+end
-- 
cgit v0.10.2


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

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