1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Merge RubyGems 3.0.0 from upstream.

https://blog.rubygems.org/2018/12/19/3.0.0-released.html

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2018-12-19 07:20:17 +00:00
parent b0f6781e2f
commit 92e726628e
6 changed files with 28 additions and 7 deletions

View file

@ -9,7 +9,7 @@
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

View file

@ -45,6 +45,7 @@ class Gem::Request
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

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'rubygems/test_case'
require 'net/http'
require 'net/https'
require 'rubygems/request'
# = Testing Bundled CA

View file

@ -5,6 +5,7 @@ require 'rubygems/command'
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|
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
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,

View file

@ -113,9 +113,11 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@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'

View file

@ -835,10 +835,26 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
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|
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]}/insecure_redirect?to=#{@server_uri}")
fetcher.fetch_path("https://localhost:#{ssl_server.config[:Port]}")
end
end
end