ruby-changes:54230
From: hsbt <ko1@a...>
Date: Wed, 19 Dec 2018 16:20:22 +0900 (JST)
Subject: [ruby-changes:54230] hsbt:r66451 (trunk): Merge RubyGems 3.0.0 from upstream.
hsbt 2018-12-19 16:20:17 +0900 (Wed, 19 Dec 2018) New Revision: 66451 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66451 Log: Merge RubyGems 3.0.0 from upstream. https://blog.rubygems.org/2018/12/19/3.0.0-released.html Modified files: trunk/lib/rubygems/request.rb trunk/lib/rubygems.rb trunk/test/rubygems/test_bundled_ca.rb trunk/test/rubygems/test_gem.rb trunk/test/rubygems/test_gem_commands_setup_command.rb trunk/test/rubygems/test_gem_remote_fetcher.rb Index: lib/rubygems.rb =================================================================== --- lib/rubygems.rb (revision 66450) +++ lib/rubygems.rb (revision 66451) @@ -9,7 +9,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L9 require 'rbconfig' module Gem - VERSION = "3.0.0.beta3".freeze + VERSION = "3.0.0".freeze end # Must be first since it unloads the prelude from 1.9.2 Index: lib/rubygems/request.rb =================================================================== --- lib/rubygems/request.rb (revision 66450) +++ lib/rubygems/request.rb (revision 66451) @@ -45,6 +45,7 @@ class Gem::Request https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request.rb#L45 end def self.configure_connection_for_https(connection, cert_files) + require 'net/https' connection.use_ssl = true connection.verify_mode = Gem.configuration.ssl_verify_mode || OpenSSL::SSL::VERIFY_PEER Index: test/rubygems/test_gem_remote_fetcher.rb =================================================================== --- test/rubygems/test_gem_remote_fetcher.rb (revision 66450) +++ test/rubygems/test_gem_remote_fetcher.rb (revision 66451) @@ -835,11 +835,27 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_remote_fetcher.rb#L835 def test_do_not_follow_insecure_redirect ssl_server = self.class.start_ssl_server - temp_ca_cert = File.join(DIR, 'ca_cert.pem'), + temp_ca_cert = File.join(DIR, 'ca_cert.pem') + expected_error_message = + "redirecting to non-https resource: #{@server_uri} (https://localhost:#{ssl_server.config[:Port]}/insecure_redirect?to=#{@server_uri})" + with_configured_fetcher(":ssl_ca_cert: #{temp_ca_cert}") do |fetcher| - assert_raises Gem::RemoteFetcher::FetchError do + err = assert_raises Gem::RemoteFetcher::FetchError do fetcher.fetch_path("https://localhost:#{ssl_server.config[:Port]}/insecure_redirect?to=#{@server_uri}") end + + assert_equal(err.message, expected_error_message) + end + end + + def test_nil_ca_cert + ssl_server = self.class.start_ssl_server + temp_ca_cert = nil + + with_configured_fetcher(":ssl_ca_cert: #{temp_ca_cert}") do |fetcher| + assert_raises Gem::RemoteFetcher::FetchError do + fetcher.fetch_path("https://localhost:#{ssl_server.config[:Port]}") + end end end Index: test/rubygems/test_gem_commands_setup_command.rb =================================================================== --- test/rubygems/test_gem_commands_setup_command.rb (revision 66450) +++ test/rubygems/test_gem_commands_setup_command.rb (revision 66451) @@ -113,9 +113,11 @@ class TestGemCommandsSetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_setup_command.rb#L113 @cmd.options[:env_shebang] = true @cmd.execute - default_gem_bin_path = File.join @install_dir, 'bin', 'gem' + gem_exec = sprintf Gem.default_exec_format, 'gem' + default_gem_bin_path = File.join @install_dir, 'bin', gem_exec if Gem::USE_BUNDLER_FOR_GEMDEPS - default_bundle_bin_path = File.join @install_dir, 'bin', 'bundle' + bundle_exec = sprintf Gem.default_exec_format, 'bundle' + default_bundle_bin_path = File.join @install_dir, 'bin', bundle_exec end ruby_exec = sprintf Gem.default_exec_format, 'ruby' Index: test/rubygems/test_gem.rb =================================================================== --- test/rubygems/test_gem.rb (revision 66450) +++ test/rubygems/test_gem.rb (revision 66451) @@ -5,6 +5,7 @@ require 'rubygems/command' https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L5 require 'rubygems/installer' require 'pathname' require 'tmpdir' +require 'rbconfig' # TODO: push this up to test_case.rb once battle tested @@ -13,6 +14,7 @@ $LOAD_PATH.map! do |path| https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L14 end class TestGem < Gem::TestCase + RUBY_INSTALL_NAME = RbConfig::CONFIG['RUBY_INSTALL_NAME'] PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant @@ -181,7 +183,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L183 dir_mode = (options[:dir_mode] & mask).to_s(8) data_mode = (options[:data_mode] & mask).to_s(8) expected = { - 'bin/foo.cmd' => prog_mode, + "bin/#{RUBY_INSTALL_NAME.sub('ruby', 'foo.cmd')}" => prog_mode, 'gems/foo-1' => dir_mode, 'gems/foo-1/bin' => dir_mode, 'gems/foo-1/data' => dir_mode, Index: test/rubygems/test_bundled_ca.rb =================================================================== --- test/rubygems/test_bundled_ca.rb (revision 66450) +++ test/rubygems/test_bundled_ca.rb (revision 66451) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_bundled_ca.rb#L1 # frozen_string_literal: true require 'rubygems/test_case' -require 'net/http' +require 'net/https' require 'rubygems/request' # = Testing Bundled CA -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/