Merge rubygems-2.7.3.

http://blog.rubygems.org/2017/11/28/2.7.3-released.html

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2017-11-28 22:30:28 +00:00
parent 89bfee6fd4
commit e82802070a
9 changed files with 212 additions and 23 deletions

View file

@ -13,6 +13,7 @@ class TestGemCommand < Gem::TestCase
@xopt = nil
@common_options = Gem::Command.common_options.dup
Gem::Command.common_options.clear
Gem::Command.common_options << [
['-x', '--exe', 'Execute'], lambda do |*a|
@ -24,6 +25,11 @@ class TestGemCommand < Gem::TestCase
@cmd = Gem::Command.new @cmd_name, 'summary'
end
def teardown
super
Gem::Command.common_options.replace @common_options
end
def test_self_add_specific_extra_args
added_args = %w[--all]
@cmd.add_option '--all' do |v,o| end

View file

@ -32,6 +32,21 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
assert @cmd.options[:dryrun]
end
def test_handle_options_check_development
@cmd.handle_options []
assert @cmd.options[:check_dev]
%w[-D --check-development].each do |options|
@cmd.handle_options [options]
assert @cmd.options[:check_dev]
end
%w[--no-check-development].each do |options|
@cmd.handle_options [options]
refute @cmd.options[:check_dev]
end
end
def test_execute
@cmd.options[:args] = %w[a]
@ -55,6 +70,34 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
refute_path_exists @b_1.gem_dir
end
def test_execute_dev_dependencies
@b_1 = util_spec 'b', 1 do |s| s.add_development_dependency 'a', '1' end
@c_1 = util_spec 'c', 1 do |s| s.add_development_dependency 'a', '2' end
install_gem @b_1
install_gem @c_1
@cmd.handle_options %w[--check-development]
@cmd.execute
assert_path_exists @a_1.gem_dir
end
def test_execute_without_dev_dependencies
@b_1 = util_spec 'b', 1 do |s| s.add_development_dependency 'a', '1' end
@c_1 = util_spec 'c', 1 do |s| s.add_development_dependency 'a', '2' end
install_gem @b_1
install_gem @c_1
@cmd.handle_options %w[--no-check-development]
@cmd.execute
refute_path_exists @a_1.gem_dir
end
def test_execute_all
gemhome2 = File.join @tempdir, 'gemhome2'

View file

@ -27,6 +27,67 @@ class TestGemCommandsSetupCommand < Gem::TestCase
open 'bundler/exe/bundle', 'w' do |io| io.puts '# bundle' end
open 'bundler/lib/bundler.rb', 'w' do |io| io.puts '# bundler.rb' end
open 'bundler/lib/bundler/b.rb', 'w' do |io| io.puts '# b.rb' end
FileUtils.mkdir_p 'default/gems'
gemspec = Gem::Specification.new
gemspec.name = "bundler"
gemspec.version = "1.16.0"
gemspec.bindir = "exe"
gemspec.executables = ["bundle"]
open 'bundler/bundler.gemspec', 'w' do |io|
io.puts gemspec.to_ruby
end
open(File.join(Gem::Specification.default_specifications_dir, "bundler-1.15.4.gemspec"), 'w') do |io|
io.puts '# bundler'
end
FileUtils.mkdir_p File.join(Gem.default_dir, "specifications")
open(File.join(Gem.default_dir, "specifications", "bundler-audit-1.0.0.gemspec"), 'w') do |io|
io.puts '# bundler-audit'
end
FileUtils.mkdir_p 'default/gems/bundler-1.15.4'
FileUtils.mkdir_p 'default/gems/bundler-audit-1.0.0'
end
def gem_install name
gem = util_spec name do |s|
s.executables = [name]
s.files = %W[bin/#{name}]
end
write_file File.join @tempdir, 'bin', name do |f|
f.puts '#!/usr/bin/ruby'
end
install_gem gem
File.join @gemhome, 'bin', name
end
def test_execute_regenerate_binstubs
gem_bin_path = gem_install 'a'
write_file gem_bin_path do |io|
io.puts 'I changed it!'
end
@cmd.options[:document] = []
@cmd.execute
assert_match %r{\A#!}, File.read(gem_bin_path)
end
def test_execute_no_regenerate_binstubs
gem_bin_path = gem_install 'a'
write_file gem_bin_path do |io|
io.puts 'I changed it!'
end
@cmd.options[:document] = []
@cmd.options[:regenerate_binstubs] = false
@cmd.execute
assert_equal "I changed it!\n", File.read(gem_bin_path)
end
def test_pem_files_in
@ -55,6 +116,33 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
end
def test_install_default_bundler_gem
@cmd.extend FileUtils
@cmd.install_default_bundler_gem
if Gem.win_platform?
bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
default_spec_path = File.join(Gem::Specification.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
spec = Gem::Specification.load(default_spec_path)
spec.executables.each do |e|
assert_path_exists File.join(spec.bin_dir, "#{e}.bat")
end
end
default_dir = Gem::Specification.default_specifications_dir
refute_path_exists File.join(default_dir, "bundler-1.15.4.gemspec")
refute_path_exists 'default/gems/bundler-1.15.4'
assert_path_exists File.join(default_dir, "bundler-1.16.0.gemspec")
assert_path_exists 'default/gems/bundler-1.16.0'
assert_path_exists File.join(Gem.default_dir, "specifications", "bundler-audit-1.0.0.gemspec")
assert_path_exists 'default/gems/bundler-audit-1.0.0'
end if Gem::USE_BUNDLER_FOR_GEMDEPS
def test_remove_old_lib_files
lib = File.join @install_dir, 'lib'
lib_rubygems = File.join lib, 'rubygems'

View file

@ -27,10 +27,11 @@ class TestGemCommandsSigninCommand < Gem::TestCase
def test_execute_when_already_signed_in_with_same_host
host = 'http://some-gemcutter-compatible-host.org'
sign_in_ui = util_capture(nil, host) { @cmd.execute }
util_capture(nil, host) { @cmd.execute }
old_credentials = YAML.load_file Gem.configuration.credentials_path
sign_in_ui = util_capture(nil, host) { @cmd.execute }
util_capture(nil, host) { @cmd.execute }
new_credentials = YAML.load_file Gem.configuration.credentials_path
assert_equal old_credentials[host], new_credentials[host]
@ -38,9 +39,11 @@ class TestGemCommandsSigninCommand < Gem::TestCase
def test_execute_when_already_signed_in_with_different_host
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf04045xxxx'
sign_in_ui = util_capture(nil, nil, api_key) { @cmd.execute }
util_capture(nil, nil, api_key) { @cmd.execute }
host = 'http://some-gemcutter-compatible-host.org'
sign_in_ui = util_capture(nil, host, api_key) { @cmd.execute }
util_capture(nil, host, api_key) { @cmd.execute }
credentials = YAML.load_file Gem.configuration.credentials_path
assert_equal credentials[:rubygems_api_key], api_key

View file

@ -54,7 +54,7 @@ class TestGemExtConfigureBuilder < Gem::TestCase
end
end
shell_error_msg = %r{(\./configure: .*)|((?:Can't|cannot) open \./configure(?:: No such file or directory)?)}
shell_error_msg = %r{(\./configure: .*)|((?:[Cc]an't|cannot) open '?\./configure'?(?:: No such file or directory)?)}
sh_prefix_configure = "sh ./configure --prefix="
assert_match 'configure failed', error.message