ruby-changes:57912
From: bronzdoc <ko1@a...>
Date: Thu, 26 Sep 2019 18:11:22 +0900 (JST)
Subject: [ruby-changes:57912] 8f2379b0c5 (master): [rubygems/rubygems] Make ruby_code method handle OpenSSL::PKey::RSA objects
https://git.ruby-lang.org/ruby.git/commit/?id=8f2379b0c5 From 8f2379b0c5e182eb6e417431cbdcf2a0edfba71a Mon Sep 17 00:00:00 2001 From: bronzdoc <lsagastume1990@g...> Date: Wed, 29 May 2019 20:22:52 -0600 Subject: [rubygems/rubygems] Make ruby_code method handle OpenSSL::PKey::RSA objects https://github.com/rubygems/rubygems/commit/b1d825ab3a diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index b3db311..ff54400 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -2303,6 +2303,7 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L2303 when Time then obj.strftime('%Y-%m-%d').dump when Numeric then obj.inspect when true, false, nil then obj.inspect + when OpenSSL::PKey::RSA then obj.class when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})" when Gem::Requirement then list = obj.as_list diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 7ed502f..c026ea4 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -2445,6 +2445,36 @@ end https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_specification.rb#L2445 assert_equal @a2, same_spec end + def test_to_ruby_with_rsa_key + rsa_key = OpenSSL::PKey::RSA.new(2048) + @a2.signing_key = rsa_key + ruby_code = @a2.to_ruby + + expected = <<-SPEC +# -*- encoding: utf-8 -*- +# stub: a 2 ruby lib + +Gem::Specification.new do |s| + s.name = "a".freeze + s.version = "2" + + s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= + s.require_paths = ["lib".freeze] + s.authors = ["A User".freeze] + s.date = "2019-05-30" + s.description = "This is a test description".freeze + s.email = "example@e...".freeze + s.files = ["lib/code.rb".freeze] + s.homepage = "http://example.com".freeze + s.rubygems_version = "3.1.0.pre1".freeze + s.signing_key = OpenSSL::PKey::RSA + s.summary = "this is a summary".freeze +end + SPEC + + assert_equal expected, ruby_code + end + def test_to_ruby_for_cache @a2.add_runtime_dependency 'b', '1' @a2.dependencies.first.instance_variable_set :@type, nil -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/