ruby-changes:61130
From: Hiroshi <ko1@a...>
Date: Fri, 8 May 2020 14:14:56 +0900 (JST)
Subject: [ruby-changes:61130] 58af4c0a1f (master): [rubygems/rubygems] Split credential helper as credential_setup and use it
https://git.ruby-lang.org/ruby.git/commit/?id=58af4c0a1f From 58af4c0a1fdf15e1624867938d5a9ce6be8403e3 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Wed, 29 Apr 2020 06:50:02 +0900 Subject: [rubygems/rubygems] Split credential helper as credential_setup and use it https://github.com/rubygems/rubygems/commit/b0c55c76ca diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index 2bf4fb0..0609519 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -359,10 +359,6 @@ class Gem::TestCase < Minitest::Test https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L359 ENV['HOME'] = @userhome FileUtils.mkdir_p File.join(@userhome, ".gem") File.write File.join(@userhome, ".gemrc"), "--- {}" - temp_cred = File.join(@userhome, '.gem', 'credentials') - FileUtils.mkdir_p File.dirname(temp_cred) - File.write temp_cred, ':rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97' - File.chmod 0600, temp_cred Gem.instance_variable_set :@user_home, nil Gem.instance_variable_set :@cache_home, nil @@ -479,6 +475,13 @@ class Gem::TestCase < Minitest::Test https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L475 @back_ui.close end + def credential_setup + @temp_cred = File.join(@userhome, '.gem', 'credentials') + FileUtils.mkdir_p File.dirname(@temp_cred) + File.write @temp_cred, ':rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97' + File.chmod 0600, @temp_cred + end + def common_installer_setup common_installer_teardown diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb index 3542462..685365e 100644 --- a/test/rubygems/test_gem_commands_owner_command.rb +++ b/test/rubygems/test_gem_commands_owner_command.rb @@ -7,6 +7,8 @@ class TestGemCommandsOwnerCommand < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_owner_command.rb#L7 def setup super + credential_setup + ENV["RUBYGEMS_HOST"] = nil @stub_ui = Gem::MockGemUi.new @stub_fetcher = Gem::FakeFetcher.new diff --git a/test/rubygems/test_gem_commands_push_command.rb b/test/rubygems/test_gem_commands_push_command.rb index ddb2873..877621d 100644 --- a/test/rubygems/test_gem_commands_push_command.rb +++ b/test/rubygems/test_gem_commands_push_command.rb @@ -6,6 +6,9 @@ class TestGemCommandsPushCommand < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_push_command.rb#L6 def setup super + + credential_setup + ENV["RUBYGEMS_HOST"] = nil Gem.host = Gem::DEFAULT_HOST Gem.configuration.disable_default_gem_server = false diff --git a/test/rubygems/test_gem_commands_signin_command.rb b/test/rubygems/test_gem_commands_signin_command.rb index fee67fe..8991f65 100644 --- a/test/rubygems/test_gem_commands_signin_command.rb +++ b/test/rubygems/test_gem_commands_signin_command.rb @@ -8,6 +8,8 @@ class TestGemCommandsSigninCommand < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_signin_command.rb#L8 def setup super + credential_setup + Gem.configuration.rubygems_api_key = nil Gem.configuration.api_keys.clear diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb index d31d55e..36725f9 100644 --- a/test/rubygems/test_gem_config_file.rb +++ b/test/rubygems/test_gem_config_file.rb @@ -7,6 +7,8 @@ class TestGemConfigFile < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_config_file.rb#L7 def setup super + credential_setup + @temp_conf = File.join @tempdir, '.gemrc' @cfg_args = %W[--config-file #{@temp_conf}] -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/