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

ruby-changes:62463

From: David <ko1@a...>
Date: Fri, 31 Jul 2020 21:08:29 +0900 (JST)
Subject: [ruby-changes:62463] ea8f7d4a81 (master): [rubygems/rubygems] Gem::Specification#to_ruby doesn't need `openssl`

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

From ea8f7d4a81fa9e1696930c63b106cc91be14c29d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Mon, 29 Jun 2020 18:43:40 +0200
Subject: [rubygems/rubygems] Gem::Specification#to_ruby doesn't need `openssl`

The `openssl` require when openssl not present was having the
side-effect the our custom require fallbacks would end up loading `Gem::Specification.stubs`.

Co-authored-by: Alyssa Ross <hi@a...>

https://github.com/rubygems/rubygems/commit/22c4ded4ad

diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 0bd62c3..883cad3 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -2411,7 +2411,7 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L2411
   # still have their default values are omitted.
 
   def to_ruby
-    require 'openssl'
+    require_relative 'openssl'
     mark_version
     result = []
     result << "# -*- encoding: utf-8 -*-"
@@ -2451,7 +2451,7 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L2451
       next if handled.include? attr_name
       current_value = self.send(attr_name)
       if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name)
-        result << "  s.#{attr_name} = #{ruby_code current_value}" unless current_value.is_a?(OpenSSL::PKey::RSA)
+        result << "  s.#{attr_name} = #{ruby_code current_value}" unless defined?(OpenSSL::PKey::RSA) && current_value.is_a?(OpenSSL::PKey::RSA)
       end
     end
 
-- 
cgit v0.10.2


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

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