rubygems-update 3.3.10 → 3.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Manifest.txt +14 -0
- data/bundler/CHANGELOG.md +11 -0
- data/bundler/exe/bundler +1 -1
- data/bundler/lib/bundler/build_metadata.rb +3 -3
- data/bundler/lib/bundler/cli/info.rb +1 -1
- data/bundler/lib/bundler/cli/init.rb +1 -1
- data/bundler/lib/bundler/cli/show.rb +1 -1
- data/bundler/lib/bundler/cli.rb +1 -1
- data/bundler/lib/bundler/installer.rb +2 -2
- data/bundler/lib/bundler/man/bundle-config.1 +3 -3
- data/bundler/lib/bundler/man/bundle-config.1.ronn +8 -6
- data/bundler/lib/bundler/shared_helpers.rb +4 -4
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/templates/Executable +2 -4
- data/bundler/lib/bundler/templates/Executable.bundler +1 -1
- data/bundler/lib/bundler/templates/Executable.standalone +2 -4
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +1 -1
- data/lib/rubygems/commands/setup_command.rb +1 -1
- data/lib/rubygems/ext/builder.rb +3 -0
- data/lib/rubygems/ext/cargo_builder.rb +305 -0
- data/lib/rubygems/ext/ext_conf_builder.rb +1 -1
- data/lib/rubygems/ext.rb +1 -0
- data/lib/rubygems/gemcutter_utilities.rb +34 -5
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/source/git.rb +1 -0
- data/lib/rubygems.rb +2 -2
- data/rubygems-update.gemspec +1 -1
- data/setup.rb +1 -1
- data/test/rubygems/helper.rb +5 -5
- data/test/rubygems/test_gem.rb +1 -1
- data/test/rubygems/test_gem_command_manager.rb +1 -1
- data/test/rubygems/test_gem_commands_help_command.rb +1 -1
- data/test/rubygems/test_gem_commands_push_command.rb +5 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +1 -1
- data/test/rubygems/test_gem_commands_signin_command.rb +100 -11
- data/test/rubygems/test_gem_dependency_installer.rb +2 -2
- data/test/rubygems/test_gem_ext_builder.rb +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +374 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +21 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/src/lib.rs +30 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +374 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +21 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec +8 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +42 -0
- data/test/rubygems/test_gem_ext_cargo_builder.rb +148 -0
- data/test/rubygems/test_gem_ext_cmake_builder.rb +2 -0
- data/test/rubygems/test_gem_gemcutter_utilities.rb +4 -2
- data/test/rubygems/test_gem_source_git.rb +1 -0
- data/test/rubygems/test_gem_specification.rb +1 -1
- data/test/rubygems/test_project_sanity.rb +1 -1
- data/test/rubygems/test_require.rb +1 -1
- data/test/test_changelog_generator.rb +1 -0
- metadata +17 -3
@@ -39,7 +39,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
39
39
|
# workaround for https://github.com/oracle/truffleruby/issues/2115
|
40
40
|
siteconf_path = RUBY_ENGINE == "truffleruby" ? siteconf.path.dup : siteconf.path
|
41
41
|
require "shellwords"
|
42
|
-
cmd = Gem.ruby.shellsplit << "-I" << File.expand_path(
|
42
|
+
cmd = Gem.ruby.shellsplit << "-I" << File.expand_path('../..', __dir__) <<
|
43
43
|
"-r" << get_relative_path(siteconf_path, extension_dir) << File.basename(extension)
|
44
44
|
cmd.push(*args)
|
45
45
|
|
data/lib/rubygems/ext.rb
CHANGED
@@ -163,12 +163,14 @@ module Gem::GemcutterUtilities
|
|
163
163
|
|
164
164
|
key_name = get_key_name(scope)
|
165
165
|
scope_params = get_scope_params(scope)
|
166
|
+
mfa_params = get_mfa_params(email, password)
|
167
|
+
all_params = scope_params.merge(mfa_params)
|
166
168
|
|
167
169
|
response = rubygems_api_request(:post, "api/v1/api_key",
|
168
170
|
sign_in_host, scope: scope) do |request|
|
169
171
|
request.basic_auth email, password
|
170
172
|
request["OTP"] = otp if otp
|
171
|
-
request.body = URI.encode_www_form({ name: key_name }.merge(
|
173
|
+
request.body = URI.encode_www_form({ name: key_name }.merge(all_params))
|
172
174
|
end
|
173
175
|
|
174
176
|
with_response response do |resp|
|
@@ -219,7 +221,7 @@ module Gem::GemcutterUtilities
|
|
219
221
|
# +response+ text and no otp provided by options.
|
220
222
|
|
221
223
|
def set_api_key(host, key)
|
222
|
-
if
|
224
|
+
if default_host?
|
223
225
|
Gem.configuration.rubygems_api_key = key
|
224
226
|
else
|
225
227
|
Gem.configuration.set_api_key host, key
|
@@ -243,7 +245,7 @@ module Gem::GemcutterUtilities
|
|
243
245
|
end
|
244
246
|
|
245
247
|
def pretty_host(host)
|
246
|
-
if
|
248
|
+
if default_host?
|
247
249
|
'RubyGems.org'
|
248
250
|
else
|
249
251
|
host
|
@@ -258,8 +260,8 @@ module Gem::GemcutterUtilities
|
|
258
260
|
else
|
259
261
|
say "Please select scopes you want to enable for the API key (y/n)"
|
260
262
|
API_SCOPES.each do |scope|
|
261
|
-
selected =
|
262
|
-
scope_params[scope] = true if selected
|
263
|
+
selected = ask_yes_no("#{scope}", false)
|
264
|
+
scope_params[scope] = true if selected
|
263
265
|
end
|
264
266
|
say "\n"
|
265
267
|
end
|
@@ -267,6 +269,33 @@ module Gem::GemcutterUtilities
|
|
267
269
|
scope_params
|
268
270
|
end
|
269
271
|
|
272
|
+
def default_host?
|
273
|
+
self.host == Gem::DEFAULT_HOST
|
274
|
+
end
|
275
|
+
|
276
|
+
def get_mfa_params(email, password)
|
277
|
+
return {} unless default_host?
|
278
|
+
|
279
|
+
mfa_level = get_user_mfa_level(email, password)
|
280
|
+
params = {}
|
281
|
+
if mfa_level == "ui_only" || mfa_level == "ui_and_gem_signin"
|
282
|
+
selected = ask_yes_no("Would you like to enable MFA for this key? (strongly recommended)")
|
283
|
+
params["mfa"] = true if selected
|
284
|
+
end
|
285
|
+
params
|
286
|
+
end
|
287
|
+
|
288
|
+
def get_user_mfa_level(email, password)
|
289
|
+
response = rubygems_api_request(:get, "api/v1/profile/me.yaml") do |request|
|
290
|
+
request.basic_auth email, password
|
291
|
+
end
|
292
|
+
|
293
|
+
with_response response do |resp|
|
294
|
+
body = Gem::SafeYAML.load clean_text(resp.body)
|
295
|
+
body["mfa"]
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
270
299
|
def get_key_name(scope)
|
271
300
|
hostname = Socket.gethostname || "unknown-host"
|
272
301
|
user = ENV["USER"] || ENV["USERNAME"] || "unknown-user"
|
data/lib/rubygems/request.rb
CHANGED
@@ -39,7 +39,7 @@ class Gem::Request
|
|
39
39
|
def cert_files; @connection_pool.cert_files; end
|
40
40
|
|
41
41
|
def self.get_cert_files
|
42
|
-
pattern = File.expand_path("./ssl_certs/*/*.pem",
|
42
|
+
pattern = File.expand_path("./ssl_certs/*/*.pem", __dir__)
|
43
43
|
Dir.glob(pattern)
|
44
44
|
end
|
45
45
|
|
data/lib/rubygems/source/git.rb
CHANGED
@@ -102,6 +102,7 @@ class Gem::Source::Git < Gem::Source
|
|
102
102
|
success = system @git, 'reset', '--quiet', '--hard', rev_parse
|
103
103
|
|
104
104
|
if @need_submodules
|
105
|
+
require "open3"
|
105
106
|
_, status = Open3.capture2e(@git, 'submodule', 'update', '--quiet', '--init', '--recursive')
|
106
107
|
|
107
108
|
success &&= status.success?
|
data/lib/rubygems.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
require 'rbconfig'
|
9
9
|
|
10
10
|
module Gem
|
11
|
-
VERSION = "3.3.
|
11
|
+
VERSION = "3.3.11".freeze
|
12
12
|
end
|
13
13
|
|
14
14
|
# Must be first since it unloads the prelude from 1.9.2
|
@@ -112,7 +112,7 @@ require_relative 'rubygems/errors'
|
|
112
112
|
# -The RubyGems Team
|
113
113
|
|
114
114
|
module Gem
|
115
|
-
RUBYGEMS_DIR =
|
115
|
+
RUBYGEMS_DIR = __dir__
|
116
116
|
|
117
117
|
# Taint support is deprecated in Ruby 2.7.
|
118
118
|
# This allows switching ".untaint" to ".tap(&Gem::UNTAINT)",
|
data/rubygems-update.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rubygems-update"
|
5
|
-
s.version = "3.3.
|
5
|
+
s.version = "3.3.11"
|
6
6
|
s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
|
7
7
|
s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
|
8
8
|
|
data/setup.rb
CHANGED
data/test/rubygems/helper.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
|
5
5
|
# If bundler gemspec exists, add to stubs
|
6
|
-
bundler_gemspec = File.expand_path(
|
6
|
+
bundler_gemspec = File.expand_path('../../bundler/bundler.gemspec', __dir__)
|
7
7
|
if File.exist?(bundler_gemspec)
|
8
8
|
Gem::Specification.dirs.unshift File.dirname(bundler_gemspec)
|
9
9
|
Gem::Specification.class_variable_set :@@stubs, nil
|
@@ -302,11 +302,15 @@ class Gem::TestCase < Test::Unit::TestCase
|
|
302
302
|
# or <tt>i686-darwin8.10.1</tt> otherwise.
|
303
303
|
|
304
304
|
def setup
|
305
|
+
@orig_hooks = {}
|
305
306
|
@orig_env = ENV.to_hash
|
306
307
|
@tmp = File.expand_path("tmp")
|
307
308
|
|
308
309
|
FileUtils.mkdir_p @tmp
|
309
310
|
|
311
|
+
@tempdir = Dir.mktmpdir("test_rubygems_", @tmp)
|
312
|
+
@tempdir.tap(&Gem::UNTAINT)
|
313
|
+
|
310
314
|
ENV['GEM_VENDOR'] = nil
|
311
315
|
ENV['GEMRC'] = nil
|
312
316
|
ENV['XDG_CACHE_HOME'] = nil
|
@@ -324,9 +328,6 @@ class Gem::TestCase < Test::Unit::TestCase
|
|
324
328
|
# capture output
|
325
329
|
Gem::DefaultUserInteraction.ui = Gem::MockGemUi.new
|
326
330
|
|
327
|
-
@tempdir = Dir.mktmpdir("test_rubygems_", @tmp)
|
328
|
-
@tempdir.tap(&Gem::UNTAINT)
|
329
|
-
|
330
331
|
ENV["TMPDIR"] = @tempdir
|
331
332
|
|
332
333
|
@orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
|
@@ -426,7 +427,6 @@ class Gem::TestCase < Test::Unit::TestCase
|
|
426
427
|
util_set_arch 'i686-darwin8.10.1'
|
427
428
|
end
|
428
429
|
|
429
|
-
@orig_hooks = {}
|
430
430
|
%w[post_install_hooks done_installing_hooks post_uninstall_hooks pre_uninstall_hooks pre_install_hooks pre_reset_hooks post_reset_hooks post_build_hooks].each do |name|
|
431
431
|
@orig_hooks[name] = Gem.send(name).dup
|
432
432
|
end
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -10,7 +10,7 @@ require 'rbconfig'
|
|
10
10
|
class TestGem < Gem::TestCase
|
11
11
|
PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
|
12
12
|
|
13
|
-
PROJECT_DIR = File.expand_path('
|
13
|
+
PROJECT_DIR = File.expand_path('../..', __dir__).tap(&Gem::UNTAINT)
|
14
14
|
|
15
15
|
def setup
|
16
16
|
super
|
@@ -3,7 +3,7 @@ require_relative 'helper'
|
|
3
3
|
require 'rubygems/command_manager'
|
4
4
|
|
5
5
|
class TestGemCommandManager < Gem::TestCase
|
6
|
-
PROJECT_DIR = File.expand_path('
|
6
|
+
PROJECT_DIR = File.expand_path('../..', __dir__).tap(&Gem::UNTAINT)
|
7
7
|
|
8
8
|
def setup
|
9
9
|
super
|
@@ -11,7 +11,7 @@ class TestGemCommandsHelpCommand < Gem::TestCase
|
|
11
11
|
|
12
12
|
@cmd = Gem::Commands::HelpCommand.new
|
13
13
|
|
14
|
-
load File.expand_path('
|
14
|
+
load File.expand_path('rubygems_plugin.rb', __dir__) unless Gem::Commands.const_defined? :InterruptCommand
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_gem_help_bad
|
@@ -435,6 +435,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
435
435
|
|
436
436
|
response_mfa_enabled = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
|
437
437
|
response_success = 'Successfully registered gem: freewill (1.0.0)'
|
438
|
+
response_profile = "mfa: disabled\n"
|
438
439
|
|
439
440
|
@fetcher.data["#{@host}/api/v1/gems"] = [
|
440
441
|
[response_success, 200, "OK"],
|
@@ -445,6 +446,10 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
445
446
|
["", 200, "OK"],
|
446
447
|
]
|
447
448
|
|
449
|
+
@fetcher.data["#{@host}/api/v1/profile/me.yaml"] = [
|
450
|
+
[response_profile, 200, "OK"],
|
451
|
+
]
|
452
|
+
|
448
453
|
@cmd.instance_variable_set :@scope, :push_rubygem
|
449
454
|
@cmd.options[:args] = [@path]
|
450
455
|
@cmd.options[:host] = @host
|
@@ -4,7 +4,7 @@ require_relative 'helper'
|
|
4
4
|
require 'rubygems/commands/setup_command'
|
5
5
|
|
6
6
|
class TestGemCommandsSetupCommand < Gem::TestCase
|
7
|
-
bundler_gemspec = File.expand_path(
|
7
|
+
bundler_gemspec = File.expand_path('../../bundler/lib/bundler/version.rb', __dir__)
|
8
8
|
if File.exist?(bundler_gemspec)
|
9
9
|
BUNDLER_VERS = File.read(bundler_gemspec).match(/VERSION = "(#{Gem::Version::VERSION_PATTERN})"/)[1]
|
10
10
|
else
|
@@ -92,31 +92,120 @@ class TestGemCommandsSigninCommand < Gem::TestCase
|
|
92
92
|
user = ENV["USER"] || ENV["USERNAME"]
|
93
93
|
|
94
94
|
assert_match "API Key name [#{Socket.gethostname}-#{user}", key_name_ui.output
|
95
|
-
assert_match "index_rubygems [
|
96
|
-
assert_match "push_rubygem [
|
97
|
-
assert_match "yank_rubygem [
|
98
|
-
assert_match "add_owner [
|
99
|
-
assert_match "remove_owner [
|
100
|
-
assert_match "access_webhooks [
|
101
|
-
assert_match "show_dashboard [
|
95
|
+
assert_match "index_rubygems [yN]", key_name_ui.output
|
96
|
+
assert_match "push_rubygem [yN]", key_name_ui.output
|
97
|
+
assert_match "yank_rubygem [yN]", key_name_ui.output
|
98
|
+
assert_match "add_owner [yN]", key_name_ui.output
|
99
|
+
assert_match "remove_owner [yN]", key_name_ui.output
|
100
|
+
assert_match "access_webhooks [yN]", key_name_ui.output
|
101
|
+
assert_match "show_dashboard [yN]", key_name_ui.output
|
102
102
|
assert_equal "name=test-key&push_rubygem=true", fetcher.last_request.body
|
103
103
|
|
104
104
|
credentials = load_yaml_file Gem.configuration.credentials_path
|
105
105
|
assert_equal api_key, credentials[:rubygems_api_key]
|
106
106
|
end
|
107
107
|
|
108
|
-
|
108
|
+
def test_execute_with_key_name_scope_and_mfa_level_of_ui_only
|
109
|
+
email = 'you@example.com'
|
110
|
+
password = 'secret'
|
111
|
+
api_key = '1234'
|
112
|
+
fetcher = Gem::RemoteFetcher.fetcher
|
113
|
+
mfa_level = "ui_only"
|
114
|
+
|
115
|
+
key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\ny"
|
116
|
+
util_capture(key_name_ui, nil, api_key, fetcher, mfa_level) { @cmd.execute }
|
117
|
+
|
118
|
+
user = ENV["USER"] || ENV["USERNAME"]
|
119
|
+
|
120
|
+
assert_match "API Key name [#{Socket.gethostname}-#{user}", key_name_ui.output
|
121
|
+
assert_match "index_rubygems [yN]", key_name_ui.output
|
122
|
+
assert_match "push_rubygem [yN]", key_name_ui.output
|
123
|
+
assert_match "yank_rubygem [yN]", key_name_ui.output
|
124
|
+
assert_match "add_owner [yN]", key_name_ui.output
|
125
|
+
assert_match "remove_owner [yN]", key_name_ui.output
|
126
|
+
assert_match "access_webhooks [yN]", key_name_ui.output
|
127
|
+
assert_match "show_dashboard [yN]", key_name_ui.output
|
128
|
+
assert_match "Would you like to enable MFA for this key? (strongly recommended) [yn]", key_name_ui.output
|
129
|
+
assert_equal "name=test-key&push_rubygem=true&mfa=true", fetcher.last_request.body
|
130
|
+
|
131
|
+
credentials = load_yaml_file Gem.configuration.credentials_path
|
132
|
+
assert_equal api_key, credentials[:rubygems_api_key]
|
133
|
+
end
|
109
134
|
|
110
|
-
def
|
111
|
-
api_key ||= 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
|
112
|
-
response = [api_key, 200, 'OK']
|
135
|
+
def test_execute_with_key_name_scope_and_mfa_level_of_gem_signin
|
113
136
|
email = 'you@example.com'
|
114
137
|
password = 'secret'
|
138
|
+
api_key = '1234'
|
139
|
+
fetcher = Gem::RemoteFetcher.fetcher
|
140
|
+
mfa_level = "ui_and_gem_signin"
|
141
|
+
|
142
|
+
key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\ny"
|
143
|
+
util_capture(key_name_ui, nil, api_key, fetcher, mfa_level) { @cmd.execute }
|
144
|
+
|
145
|
+
user = ENV["USER"] || ENV["USERNAME"]
|
146
|
+
|
147
|
+
assert_match "API Key name [#{Socket.gethostname}-#{user}", key_name_ui.output
|
148
|
+
assert_match "index_rubygems [yN]", key_name_ui.output
|
149
|
+
assert_match "push_rubygem [yN]", key_name_ui.output
|
150
|
+
assert_match "yank_rubygem [yN]", key_name_ui.output
|
151
|
+
assert_match "add_owner [yN]", key_name_ui.output
|
152
|
+
assert_match "remove_owner [yN]", key_name_ui.output
|
153
|
+
assert_match "access_webhooks [yN]", key_name_ui.output
|
154
|
+
assert_match "show_dashboard [yN]", key_name_ui.output
|
155
|
+
assert_match "Would you like to enable MFA for this key? (strongly recommended) [yn]", key_name_ui.output
|
156
|
+
assert_equal "name=test-key&push_rubygem=true&mfa=true", fetcher.last_request.body
|
157
|
+
|
158
|
+
credentials = load_yaml_file Gem.configuration.credentials_path
|
159
|
+
assert_equal api_key, credentials[:rubygems_api_key]
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_execute_on_gemserver_without_profile_me_endpoint
|
163
|
+
host = 'http://some-gemcutter-compatible-host.org'
|
164
|
+
|
165
|
+
email = 'you@example.com'
|
166
|
+
password = 'secret'
|
167
|
+
api_key = '1234'
|
168
|
+
fetcher = Gem::RemoteFetcher.fetcher
|
169
|
+
|
170
|
+
key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\ny"
|
171
|
+
|
172
|
+
# Set the expected response for the Web-API supplied
|
173
|
+
ENV['RUBYGEMS_HOST'] = host
|
174
|
+
data_key = "#{ENV['RUBYGEMS_HOST']}/api/v1/api_key"
|
175
|
+
fetcher.data[data_key] = [api_key, 200, 'OK']
|
176
|
+
|
177
|
+
use_ui key_name_ui do
|
178
|
+
@cmd.execute
|
179
|
+
end
|
180
|
+
|
181
|
+
user = ENV["USER"] || ENV["USERNAME"]
|
182
|
+
|
183
|
+
assert_match "API Key name [#{Socket.gethostname}-#{user}", key_name_ui.output
|
184
|
+
assert_match "index_rubygems [yN]", key_name_ui.output
|
185
|
+
assert_match "push_rubygem [yN]", key_name_ui.output
|
186
|
+
assert_match "yank_rubygem [yN]", key_name_ui.output
|
187
|
+
assert_match "add_owner [yN]", key_name_ui.output
|
188
|
+
assert_match "remove_owner [yN]", key_name_ui.output
|
189
|
+
assert_match "access_webhooks [yN]", key_name_ui.output
|
190
|
+
assert_match "show_dashboard [yN]", key_name_ui.output
|
191
|
+
assert_equal "name=test-key&push_rubygem=true", fetcher.last_request.body
|
192
|
+
end
|
193
|
+
|
194
|
+
# Utility method to capture IO/UI within the block passed
|
195
|
+
|
196
|
+
def util_capture(ui_stub = nil, host = nil, api_key = nil, fetcher = Gem::FakeFetcher.new, mfa_level = "disabled")
|
197
|
+
api_key ||= 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
|
198
|
+
response = [api_key, 200, 'OK']
|
199
|
+
profile_response = [ "mfa: #{mfa_level}\n" , 200, 'OK']
|
200
|
+
email = 'you@example.com'
|
201
|
+
password = 'secret'
|
115
202
|
|
116
203
|
# Set the expected response for the Web-API supplied
|
117
204
|
ENV['RUBYGEMS_HOST'] = host || Gem::DEFAULT_HOST
|
118
205
|
data_key = "#{ENV['RUBYGEMS_HOST']}/api/v1/api_key"
|
119
206
|
fetcher.data[data_key] = response
|
207
|
+
profile = "#{ENV['RUBYGEMS_HOST']}/api/v1/profile/me.yaml"
|
208
|
+
fetcher.data[profile] = profile_response
|
120
209
|
Gem::RemoteFetcher.fetcher = fetcher
|
121
210
|
|
122
211
|
sign_in_ui = ui_stub || Gem::MockGemUi.new("#{email}\n#{password}\n\n\n\n\n\n\n\n\n")
|
@@ -941,7 +941,7 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
941
941
|
end
|
942
942
|
|
943
943
|
def test_install_legacy_spec_with_nil_required_ruby_version
|
944
|
-
path = File.expand_path
|
944
|
+
path = File.expand_path 'data/null-required-ruby-version.gemspec.rz', __dir__
|
945
945
|
spec = Marshal.load Gem.read_binary(path)
|
946
946
|
def spec.validate(*args); end
|
947
947
|
|
@@ -966,7 +966,7 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
966
966
|
end
|
967
967
|
|
968
968
|
def test_install_legacy_spec_with_nil_required_rubygems_version
|
969
|
-
path = File.expand_path
|
969
|
+
path = File.expand_path 'data/null-required-rubygems-version.gemspec.rz', __dir__
|
970
970
|
spec = Marshal.load Gem.read_binary(path)
|
971
971
|
def spec.validate(*args); end
|
972
972
|
|
@@ -291,7 +291,7 @@ install:
|
|
291
291
|
File.open File.join(@spec.gem_dir, "extconf.rb"), "w" do |f|
|
292
292
|
f.write <<-'RUBY'
|
293
293
|
puts "IN EXTCONF"
|
294
|
-
extconf_args = File.join
|
294
|
+
extconf_args = File.join __dir__, 'extconf_args'
|
295
295
|
File.open extconf_args, 'w' do |f|
|
296
296
|
f.puts ARGV.inspect
|
297
297
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
target/
|