rubygems-update 3.4.20 → 3.4.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +55 -0
- data/Manifest.txt +6 -0
- data/bundler/CHANGELOG.md +55 -3
- data/bundler/README.md +1 -2
- data/bundler/lib/bundler/build_metadata.rb +3 -3
- data/bundler/lib/bundler/cli/check.rb +1 -1
- data/bundler/lib/bundler/cli/gem.rb +4 -3
- data/bundler/lib/bundler/cli/install.rb +2 -2
- data/bundler/lib/bundler/cli/lock.rb +26 -23
- data/bundler/lib/bundler/cli/open.rb +5 -7
- data/bundler/lib/bundler/definition.rb +43 -26
- data/bundler/lib/bundler/endpoint_specification.rb +1 -1
- data/bundler/lib/bundler/env.rb +2 -2
- data/bundler/lib/bundler/errors.rb +15 -0
- data/bundler/lib/bundler/gem_helpers.rb +7 -0
- data/bundler/lib/bundler/gem_version_promoter.rb +2 -2
- data/bundler/lib/bundler/injector.rb +1 -1
- data/bundler/lib/bundler/installer/gem_installer.rb +5 -5
- data/bundler/lib/bundler/installer/parallel_installer.rb +0 -26
- data/bundler/lib/bundler/installer/standalone.rb +13 -6
- data/bundler/lib/bundler/lazy_specification.rb +4 -0
- data/bundler/lib/bundler/lockfile_parser.rb +29 -24
- data/bundler/lib/bundler/man/bundle-add.1 +1 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +1 -1
- data/bundler/lib/bundler/man/bundle-console.1 +1 -1
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +2 -2
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +2 -3
- data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
- data/bundler/lib/bundler/man/bundle-help.1 +1 -1
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
- data/bundler/lib/bundler/man/bundle-install.1 +1 -1
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
- data/bundler/lib/bundler/man/bundle-plugin.1 +17 -17
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +5 -5
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-version.1 +1 -1
- data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
- data/bundler/lib/bundler/man/bundle.1 +1 -1
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/plugin/index.rb +8 -0
- data/bundler/lib/bundler/plugin.rb +9 -2
- data/bundler/lib/bundler/resolver/package.rb +5 -0
- data/bundler/lib/bundler/resolver.rb +27 -7
- data/bundler/lib/bundler/ruby_version.rb +8 -1
- data/bundler/lib/bundler/rubygems_ext.rb +3 -4
- data/bundler/lib/bundler/rubygems_gem_installer.rb +23 -8
- data/bundler/lib/bundler/settings.rb +53 -16
- data/bundler/lib/bundler/shared_helpers.rb +16 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +21 -4
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/spec_set.rb +7 -4
- data/bundler/lib/bundler/stub_specification.rb +4 -2
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +6 -2
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/bundler/lib/bundler/ui/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +1 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +21 -9
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +3 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +8 -10
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +15 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +15 -15
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +140 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +13 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +4 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +16 -25
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +20 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +33 -17
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +27 -8
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +44 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +40 -30
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +26 -150
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +4 -46
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -45
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb +49 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +134 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +155 -8
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler/yaml_serializer.rb +12 -8
- data/bundler/lib/bundler.rb +0 -8
- data/lib/rubygems/basic_specification.rb +1 -1
- data/lib/rubygems/command.rb +5 -5
- data/lib/rubygems/command_manager.rb +1 -1
- data/lib/rubygems/commands/cert_command.rb +3 -3
- data/lib/rubygems/commands/check_command.rb +5 -1
- data/lib/rubygems/commands/cleanup_command.rb +1 -1
- data/lib/rubygems/commands/contents_command.rb +2 -2
- data/lib/rubygems/commands/environment_command.rb +2 -2
- data/lib/rubygems/commands/help_command.rb +3 -3
- data/lib/rubygems/commands/open_command.rb +1 -3
- data/lib/rubygems/commands/owner_command.rb +1 -1
- data/lib/rubygems/commands/setup_command.rb +10 -10
- data/lib/rubygems/commands/specification_command.rb +5 -1
- data/lib/rubygems/commands/stale_command.rb +1 -1
- data/lib/rubygems/commands/uninstall_command.rb +4 -4
- data/lib/rubygems/commands/unpack_command.rb +3 -3
- data/lib/rubygems/commands/update_command.rb +4 -4
- data/lib/rubygems/commands/yank_command.rb +1 -1
- data/lib/rubygems/config_file.rb +63 -16
- data/lib/rubygems/core_ext/kernel_gem.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +2 -2
- data/lib/rubygems/defaults.rb +6 -2
- data/lib/rubygems/dependency_installer.rb +4 -4
- data/lib/rubygems/deprecate.rb +2 -1
- data/lib/rubygems/doctor.rb +2 -2
- data/lib/rubygems/errors.rb +1 -1
- data/lib/rubygems/exceptions.rb +1 -1
- data/lib/rubygems/ext/builder.rb +5 -4
- data/lib/rubygems/ext/cargo_builder.rb +2 -2
- data/lib/rubygems/ext/ext_conf_builder.rb +1 -1
- data/lib/rubygems/ext/rake_builder.rb +1 -1
- data/lib/rubygems/gem_runner.rb +5 -1
- data/lib/rubygems/gemcutter_utilities.rb +2 -2
- data/lib/rubygems/indexer.rb +1 -1
- data/lib/rubygems/install_update_options.rb +1 -1
- data/lib/rubygems/installer.rb +15 -20
- data/lib/rubygems/local_remote_options.rb +1 -1
- data/lib/rubygems/package/digest_io.rb +1 -1
- data/lib/rubygems/package/old.rb +1 -1
- data/lib/rubygems/package/tar_header.rb +2 -2
- data/lib/rubygems/package/tar_reader.rb +9 -2
- data/lib/rubygems/package/tar_writer.rb +2 -2
- data/lib/rubygems/package.rb +9 -9
- data/lib/rubygems/path_support.rb +1 -1
- data/lib/rubygems/platform.rb +12 -6
- data/lib/rubygems/query_utils.rb +4 -4
- data/lib/rubygems/remote_fetcher.rb +12 -4
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
- data/lib/rubygems/request_set.rb +2 -1
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver/api_set.rb +2 -1
- data/lib/rubygems/resolver/api_specification.rb +1 -1
- data/lib/rubygems/resolver.rb +3 -3
- data/lib/rubygems/security/signer.rb +10 -2
- data/lib/rubygems/security/trust_dir.rb +5 -5
- data/lib/rubygems/security.rb +1 -1
- data/lib/rubygems/security_option.rb +1 -1
- data/lib/rubygems/source/local.rb +2 -1
- data/lib/rubygems/source.rb +5 -1
- data/lib/rubygems/source_list.rb +1 -1
- data/lib/rubygems/spec_fetcher.rb +2 -2
- data/lib/rubygems/specification.rb +30 -23
- data/lib/rubygems/specification_policy.rb +11 -11
- data/lib/rubygems/uninstaller.rb +3 -3
- data/lib/rubygems/update_suggestion.rb +1 -1
- data/lib/rubygems/user_interaction.rb +2 -2
- data/lib/rubygems/util/licenses.rb +48 -0
- data/lib/rubygems/util.rb +5 -1
- data/lib/rubygems/validator.rb +1 -1
- data/lib/rubygems/version.rb +6 -5
- data/lib/rubygems/yaml_serializer.rb +93 -0
- data/lib/rubygems.rb +9 -9
- data/rubygems-update.gemspec +1 -1
- data/setup.rb +2 -0
- data/test/rubygems/bundler_test_gem.rb +6 -3
- data/test/rubygems/helper.rb +29 -21
- data/test/rubygems/package/tar_test_case.rb +2 -2
- data/test/rubygems/test_gem.rb +51 -26
- data/test/rubygems/test_gem_command.rb +3 -1
- data/test/rubygems/test_gem_command_manager.rb +6 -6
- data/test/rubygems/test_gem_commands_cert_command.rb +23 -23
- data/test/rubygems/test_gem_commands_cleanup_command.rb +2 -2
- data/test/rubygems/test_gem_commands_environment_command.rb +2 -1
- data/test/rubygems/test_gem_commands_exec_command.rb +5 -1
- data/test/rubygems/test_gem_commands_install_command.rb +5 -5
- data/test/rubygems/test_gem_commands_open_command.rb +5 -2
- data/test/rubygems/test_gem_commands_pristine_command.rb +2 -2
- data/test/rubygems/test_gem_commands_push_command.rb +7 -6
- data/test/rubygems/test_gem_commands_signin_command.rb +8 -8
- data/test/rubygems/test_gem_commands_uninstall_command.rb +21 -1
- data/test/rubygems/test_gem_commands_unpack_command.rb +2 -2
- data/test/rubygems/test_gem_config_file.rb +46 -12
- data/test/rubygems/test_gem_ext_builder.rb +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder.rb +2 -2
- data/test/rubygems/test_gem_gemcutter_utilities.rb +8 -5
- data/test/rubygems/test_gem_install_update_options.rb +3 -3
- data/test/rubygems/test_gem_installer.rb +16 -16
- data/test/rubygems/test_gem_package.rb +35 -34
- data/test/rubygems/test_gem_package_old.rb +1 -1
- data/test/rubygems/test_gem_package_tar_header.rb +3 -3
- data/test/rubygems/test_gem_package_tar_reader.rb +19 -4
- data/test/rubygems/test_gem_package_tar_writer.rb +28 -28
- data/test/rubygems/test_gem_rdoc.rb +2 -2
- data/test/rubygems/test_gem_remote_fetcher.rb +13 -9
- data/test/rubygems/test_gem_request.rb +5 -5
- data/test/rubygems/test_gem_request_connection_pools.rb +2 -1
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +14 -7
- data/test/rubygems/test_gem_security.rb +2 -2
- data/test/rubygems/test_gem_security_policy.rb +2 -2
- data/test/rubygems/test_gem_security_signer.rb +2 -2
- data/test/rubygems/test_gem_security_trust_dir.rb +6 -6
- data/test/rubygems/test_gem_spec_fetcher.rb +2 -2
- data/test/rubygems/test_gem_specification.rb +29 -29
- data/test/rubygems/test_gem_stream_ui.rb +1 -1
- data/test/rubygems/test_gem_update_suggestion.rb +12 -6
- data/test/rubygems/test_gem_util.rb +2 -2
- data/test/rubygems/test_gem_version.rb +4 -2
- data/test/rubygems/utilities.rb +4 -3
- metadata +9 -3
@@ -22,20 +22,23 @@ class TestGemCommandsOpenCommand < Gem::TestCase
|
|
22
22
|
|
23
23
|
def test_execute
|
24
24
|
@cmd.options[:args] = %w[foo]
|
25
|
-
@cmd.options[:editor] =
|
25
|
+
@cmd.options[:editor] = (ruby_with_rubygems_in_load_path + ["-e", "puts(ARGV,Dir.pwd)", "--"]).join(" ")
|
26
26
|
|
27
27
|
gem "foo", "1.0.0"
|
28
28
|
spec = gem "foo", "1.0.1"
|
29
29
|
|
30
30
|
assert_nothing_raised Gem::MockGemUi::TermError do
|
31
|
-
|
31
|
+
stdout, stderr = capture_subprocess_io do
|
32
32
|
use_ui @ui do
|
33
33
|
@cmd.execute
|
34
34
|
end
|
35
35
|
end
|
36
|
+
assert_equal [spec.full_gem_path, spec.full_gem_path], stdout.split("\n")
|
37
|
+
assert_equal "", stderr
|
36
38
|
end
|
37
39
|
|
38
40
|
assert_equal "", @ui.error
|
41
|
+
assert_equal "", @ui.output
|
39
42
|
end
|
40
43
|
|
41
44
|
def test_wrong_version
|
@@ -54,7 +54,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_execute_user_install
|
57
|
-
FileUtils.chmod
|
57
|
+
FileUtils.chmod 0o555, @gemhome
|
58
58
|
|
59
59
|
a = util_spec "a" do |s|
|
60
60
|
s.executables = %w[foo]
|
@@ -99,7 +99,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
99
99
|
assert_equal "Restored #{a.full_name}", out.shift
|
100
100
|
assert_empty out, out.inspect
|
101
101
|
ensure
|
102
|
-
FileUtils.chmod(
|
102
|
+
FileUtils.chmod(0o755, @gemhome)
|
103
103
|
end
|
104
104
|
|
105
105
|
def test_execute_all
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require_relative "helper"
|
4
4
|
require_relative "multifactor_auth_utilities"
|
5
5
|
require "rubygems/commands/push_command"
|
6
|
+
require "rubygems/config_file"
|
6
7
|
|
7
8
|
class TestGemCommandsPushCommand < Gem::TestCase
|
8
9
|
def setup
|
@@ -107,7 +108,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
107
108
|
end
|
108
109
|
|
109
110
|
@response = "Successfully registered gem: freewill (1.0.0)"
|
110
|
-
@fetcher.data["#{@spec.metadata[
|
111
|
+
@fetcher.data["#{@spec.metadata["allowed_push_host"]}/api/v1/gems"] = HTTPResponseFactory.create(body: @response, code: 200, msg: "OK")
|
111
112
|
@fetcher.data["#{Gem.host}/api/v1/gems"] =
|
112
113
|
["fail", 500, "Internal Server Error"]
|
113
114
|
|
@@ -158,7 +159,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
158
159
|
}
|
159
160
|
|
160
161
|
File.open Gem.configuration.credentials_path, "w" do |f|
|
161
|
-
f.write keys
|
162
|
+
f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys)
|
162
163
|
end
|
163
164
|
Gem.configuration.load_api_keys
|
164
165
|
|
@@ -192,7 +193,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
192
193
|
}
|
193
194
|
|
194
195
|
File.open Gem.configuration.credentials_path, "w" do |f|
|
195
|
-
f.write keys
|
196
|
+
f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys)
|
196
197
|
end
|
197
198
|
Gem.configuration.load_api_keys
|
198
199
|
|
@@ -233,7 +234,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
233
234
|
}
|
234
235
|
|
235
236
|
File.open Gem.configuration.credentials_path, "w" do |f|
|
236
|
-
f.write keys
|
237
|
+
f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys)
|
237
238
|
end
|
238
239
|
Gem.configuration.load_api_keys
|
239
240
|
|
@@ -274,7 +275,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
274
275
|
}
|
275
276
|
|
276
277
|
File.open Gem.configuration.credentials_path, "w" do |f|
|
277
|
-
f.write keys
|
278
|
+
f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys)
|
278
279
|
end
|
279
280
|
Gem.configuration.load_api_keys
|
280
281
|
|
@@ -304,7 +305,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
304
305
|
}
|
305
306
|
|
306
307
|
File.open Gem.configuration.credentials_path, "w" do |f|
|
307
|
-
f.write keys
|
308
|
+
f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys)
|
308
309
|
end
|
309
310
|
Gem.configuration.load_api_keys
|
310
311
|
|
@@ -109,7 +109,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
|
|
109
109
|
def test_execute_with_key_name_and_scope
|
110
110
|
email = "you@example.com"
|
111
111
|
password = "secret"
|
112
|
-
api_key = "
|
112
|
+
api_key = "1234abcd"
|
113
113
|
fetcher = Gem::RemoteFetcher.fetcher
|
114
114
|
|
115
115
|
key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\n"
|
@@ -134,7 +134,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
|
|
134
134
|
def test_execute_with_key_name_scope_and_mfa_level_of_ui_only
|
135
135
|
email = "you@example.com"
|
136
136
|
password = "secret"
|
137
|
-
api_key = "
|
137
|
+
api_key = "1234abcd"
|
138
138
|
fetcher = Gem::RemoteFetcher.fetcher
|
139
139
|
mfa_level = "ui_only"
|
140
140
|
|
@@ -161,7 +161,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
|
|
161
161
|
def test_execute_with_key_name_scope_and_mfa_level_of_gem_signin
|
162
162
|
email = "you@example.com"
|
163
163
|
password = "secret"
|
164
|
-
api_key = "
|
164
|
+
api_key = "1234abcd"
|
165
165
|
fetcher = Gem::RemoteFetcher.fetcher
|
166
166
|
mfa_level = "ui_and_gem_signin"
|
167
167
|
|
@@ -188,7 +188,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
|
|
188
188
|
def test_execute_with_warnings
|
189
189
|
email = "you@example.com"
|
190
190
|
password = "secret"
|
191
|
-
api_key = "
|
191
|
+
api_key = "1234abcd"
|
192
192
|
fetcher = Gem::RemoteFetcher.fetcher
|
193
193
|
mfa_level = "disabled"
|
194
194
|
warning = "/[WARNING/] For protection of your account and gems"
|
@@ -204,14 +204,14 @@ class TestGemCommandsSigninCommand < Gem::TestCase
|
|
204
204
|
|
205
205
|
email = "you@example.com"
|
206
206
|
password = "secret"
|
207
|
-
api_key = "
|
207
|
+
api_key = "1234abcd"
|
208
208
|
fetcher = Gem::RemoteFetcher.fetcher
|
209
209
|
|
210
210
|
key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\ny"
|
211
211
|
|
212
212
|
# Set the expected response for the Web-API supplied
|
213
213
|
ENV["RUBYGEMS_HOST"] = host
|
214
|
-
data_key = "#{ENV[
|
214
|
+
data_key = "#{ENV["RUBYGEMS_HOST"]}/api/v1/api_key"
|
215
215
|
fetcher.data[data_key] = HTTPResponseFactory.create(body: api_key, code: 200, msg: "OK")
|
216
216
|
|
217
217
|
use_ui key_name_ui do
|
@@ -242,9 +242,9 @@ class TestGemCommandsSigninCommand < Gem::TestCase
|
|
242
242
|
|
243
243
|
# Set the expected response for the Web-API supplied
|
244
244
|
ENV["RUBYGEMS_HOST"] = host || Gem::DEFAULT_HOST
|
245
|
-
data_key = "#{ENV[
|
245
|
+
data_key = "#{ENV["RUBYGEMS_HOST"]}/api/v1/api_key"
|
246
246
|
fetcher.data[data_key] = response
|
247
|
-
profile = "#{ENV[
|
247
|
+
profile = "#{ENV["RUBYGEMS_HOST"]}/api/v1/profile/me.yaml"
|
248
248
|
fetcher.data[profile] = profile_response
|
249
249
|
Gem::RemoteFetcher.fetcher = fetcher
|
250
250
|
|
@@ -158,7 +158,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
|
158
158
|
@cmd.execute
|
159
159
|
|
160
160
|
assert_equal false, File.exist?(formatted_executable)
|
161
|
-
rescue
|
161
|
+
rescue StandardError
|
162
162
|
Gem::Installer.exec_format = nil
|
163
163
|
end
|
164
164
|
|
@@ -229,6 +229,26 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
|
229
229
|
assert File.exist? File.join(@gemhome, "bin", "executable")
|
230
230
|
end
|
231
231
|
|
232
|
+
def test_execute_with_multiple_version_specified_as_colon
|
233
|
+
initial_install
|
234
|
+
|
235
|
+
ui = Gem::MockGemUi.new "y\n"
|
236
|
+
|
237
|
+
util_make_gems
|
238
|
+
|
239
|
+
assert_equal 3, Gem::Specification.find_all_by_name("a").length
|
240
|
+
|
241
|
+
@cmd.options[:force] = true
|
242
|
+
@cmd.options[:args] = ["a:1", "a:2"]
|
243
|
+
|
244
|
+
use_ui ui do
|
245
|
+
@cmd.execute
|
246
|
+
end
|
247
|
+
|
248
|
+
assert_equal 1, Gem::Specification.find_all_by_name("a").length
|
249
|
+
assert_equal Gem::Version.new("3.a"), Gem::Specification.find_by_name("a").version
|
250
|
+
end
|
251
|
+
|
232
252
|
def test_uninstall_selection
|
233
253
|
ui = Gem::MockGemUi.new "1\n"
|
234
254
|
|
@@ -156,7 +156,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
|
|
156
156
|
|
157
157
|
util_make_gems
|
158
158
|
|
159
|
-
FileUtils.chmod
|
159
|
+
FileUtils.chmod 0o555, @gemhome
|
160
160
|
|
161
161
|
@cmd.options[:args] = %w[b]
|
162
162
|
|
@@ -168,7 +168,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
|
|
168
168
|
|
169
169
|
assert File.exist?(File.join(@tempdir, "b-2")), "b should be unpacked"
|
170
170
|
ensure
|
171
|
-
FileUtils.chmod
|
171
|
+
FileUtils.chmod 0o755, @gemhome
|
172
172
|
end
|
173
173
|
|
174
174
|
def test_execute_with_target_option
|
@@ -185,7 +185,7 @@ class TestGemConfigFile < Gem::TestCase
|
|
185
185
|
|
186
186
|
temp_cred = File.join Gem.user_home, ".gem", "credentials"
|
187
187
|
FileUtils.mkdir_p File.dirname(temp_cred)
|
188
|
-
File.open temp_cred, "w",
|
188
|
+
File.open temp_cred, "w", 0o600 do |fp|
|
189
189
|
fp.puts ":rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97"
|
190
190
|
end
|
191
191
|
|
@@ -200,7 +200,7 @@ class TestGemConfigFile < Gem::TestCase
|
|
200
200
|
|
201
201
|
@cfg.rubygems_api_key = "x"
|
202
202
|
|
203
|
-
File.chmod
|
203
|
+
File.chmod 0o644, @cfg.credentials_path
|
204
204
|
|
205
205
|
use_ui @ui do
|
206
206
|
assert_raise Gem::MockGemUi::TermError do
|
@@ -323,15 +323,20 @@ if you believe they were disclosed to a third party.
|
|
323
323
|
def test_load_api_keys
|
324
324
|
temp_cred = File.join Gem.user_home, ".gem", "credentials"
|
325
325
|
FileUtils.mkdir_p File.dirname(temp_cred)
|
326
|
-
File.open temp_cred, "w",
|
327
|
-
fp.puts ":rubygems_api_key:
|
328
|
-
fp.puts ":other:
|
326
|
+
File.open temp_cred, "w", 0o600 do |fp|
|
327
|
+
fp.puts ":rubygems_api_key: rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c"
|
328
|
+
fp.puts ":other: rubygems_9636a120106ea8b81fbc792188251738665711d2ece160c5"
|
329
|
+
fp.puts "http://localhost:3000: rubygems_be293ad9dd71550a012b17d848893b41960b811ce9312b47"
|
329
330
|
end
|
330
331
|
|
331
332
|
util_config_file
|
332
333
|
|
333
|
-
assert_equal(
|
334
|
-
|
334
|
+
assert_equal(
|
335
|
+
{ :rubygems => "rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c",
|
336
|
+
:other => "rubygems_9636a120106ea8b81fbc792188251738665711d2ece160c5",
|
337
|
+
"http://localhost:3000" => "rubygems_be293ad9dd71550a012b17d848893b41960b811ce9312b47" },
|
338
|
+
@cfg.api_keys
|
339
|
+
)
|
335
340
|
end
|
336
341
|
|
337
342
|
def test_load_api_keys_bad_permission
|
@@ -339,7 +344,7 @@ if you believe they were disclosed to a third party.
|
|
339
344
|
|
340
345
|
@cfg.rubygems_api_key = "x"
|
341
346
|
|
342
|
-
File.chmod
|
347
|
+
File.chmod 0o644, @cfg.credentials_path
|
343
348
|
|
344
349
|
assert_raise Gem::MockGemUi::TermError do
|
345
350
|
@cfg.load_api_keys
|
@@ -372,7 +377,7 @@ if you believe they were disclosed to a third party.
|
|
372
377
|
unless win_platform?
|
373
378
|
stat = File.stat @cfg.credentials_path
|
374
379
|
|
375
|
-
assert_equal
|
380
|
+
assert_equal 0o600, stat.mode & 0o600
|
376
381
|
end
|
377
382
|
end
|
378
383
|
|
@@ -381,7 +386,7 @@ if you believe they were disclosed to a third party.
|
|
381
386
|
|
382
387
|
@cfg.rubygems_api_key = "x"
|
383
388
|
|
384
|
-
File.chmod
|
389
|
+
File.chmod 0o644, @cfg.credentials_path
|
385
390
|
|
386
391
|
assert_raise Gem::MockGemUi::TermError do
|
387
392
|
@cfg.rubygems_api_key = "y"
|
@@ -395,7 +400,7 @@ if you believe they were disclosed to a third party.
|
|
395
400
|
|
396
401
|
stat = File.stat @cfg.credentials_path
|
397
402
|
|
398
|
-
assert_equal
|
403
|
+
assert_equal 0o644, stat.mode & 0o644
|
399
404
|
end
|
400
405
|
|
401
406
|
def test_write
|
@@ -471,7 +476,8 @@ if you believe they were disclosed to a third party.
|
|
471
476
|
end
|
472
477
|
|
473
478
|
begin
|
474
|
-
verbose
|
479
|
+
verbose = $VERBOSE
|
480
|
+
$VERBOSE = nil
|
475
481
|
|
476
482
|
util_config_file
|
477
483
|
ensure
|
@@ -514,4 +520,32 @@ if you believe they were disclosed to a third party.
|
|
514
520
|
util_config_file
|
515
521
|
assert_equal(true, @cfg.disable_default_gem_server)
|
516
522
|
end
|
523
|
+
|
524
|
+
def test_load_with_rubygems_config_hash
|
525
|
+
yaml = <<~YAML
|
526
|
+
---
|
527
|
+
:foo: bar
|
528
|
+
bar: 100
|
529
|
+
buzz: true
|
530
|
+
alpha: :bravo
|
531
|
+
charlie: ""
|
532
|
+
delta:
|
533
|
+
YAML
|
534
|
+
actual = Gem::ConfigFile.load_with_rubygems_config_hash(yaml)
|
535
|
+
|
536
|
+
assert_equal "bar", actual[:foo]
|
537
|
+
assert_equal 100, actual["bar"]
|
538
|
+
assert_equal true, actual["buzz"]
|
539
|
+
assert_equal :bravo, actual["alpha"]
|
540
|
+
assert_equal nil, actual["charlie"]
|
541
|
+
assert_equal nil, actual["delta"]
|
542
|
+
end
|
543
|
+
|
544
|
+
def test_dump_with_rubygems_yaml
|
545
|
+
symbol_key_hash = { :foo => "bar" }
|
546
|
+
|
547
|
+
actual = Gem::ConfigFile.dump_with_rubygems_yaml(symbol_key_hash)
|
548
|
+
|
549
|
+
assert_equal("---\n:foo: \"bar\"\n", actual)
|
550
|
+
end
|
517
551
|
end
|
@@ -52,7 +52,7 @@ install:
|
|
52
52
|
assert_match %r{DESTDIR\\=#{ENV['DESTDIR']}$}, results
|
53
53
|
assert_match %r{DESTDIR\\=#{ENV['DESTDIR']} install$}, results
|
54
54
|
|
55
|
-
|
55
|
+
unless /nmake/.match?(results)
|
56
56
|
assert_match %r{^clean: destination$}, results
|
57
57
|
assert_match %r{^all: destination$}, results
|
58
58
|
assert_match %r{^install: destination$}, results
|
@@ -36,7 +36,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
|
36
36
|
end
|
37
37
|
|
38
38
|
output = output.join "\n"
|
39
|
-
bundle = File.join(@dest_path, "rust_ruby_example.#{RbConfig::CONFIG[
|
39
|
+
bundle = File.join(@dest_path, "rust_ruby_example.#{RbConfig::CONFIG["DLEXT"]}")
|
40
40
|
|
41
41
|
assert_match(/Finished/, output)
|
42
42
|
assert_match(/release/, output)
|
@@ -62,7 +62,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
|
62
62
|
end
|
63
63
|
|
64
64
|
output = output.join "\n"
|
65
|
-
bundle = File.join(@dest_path, "rust_ruby_example.#{RbConfig::CONFIG[
|
65
|
+
bundle = File.join(@dest_path, "rust_ruby_example.#{RbConfig::CONFIG["DLEXT"]}")
|
66
66
|
|
67
67
|
assert_ffi_handle bundle, "hello_from_rubygems"
|
68
68
|
assert_ffi_handle bundle, "hello_from_rubygems_version"
|
@@ -5,6 +5,7 @@ require_relative "multifactor_auth_utilities"
|
|
5
5
|
require "rubygems"
|
6
6
|
require "rubygems/command"
|
7
7
|
require "rubygems/gemcutter_utilities"
|
8
|
+
require "rubygems/config_file"
|
8
9
|
|
9
10
|
class TestGemGemcutterUtilities < Gem::TestCase
|
10
11
|
def setup
|
@@ -41,7 +42,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
|
|
41
42
|
}
|
42
43
|
|
43
44
|
File.open Gem.configuration.credentials_path, "w" do |f|
|
44
|
-
f.write keys
|
45
|
+
f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys)
|
45
46
|
end
|
46
47
|
|
47
48
|
ENV["RUBYGEMS_HOST"] = "http://rubygems.engineyard.com"
|
@@ -55,7 +56,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
|
|
55
56
|
keys = { :rubygems_api_key => "KEY" }
|
56
57
|
|
57
58
|
File.open Gem.configuration.credentials_path, "w" do |f|
|
58
|
-
f.write keys
|
59
|
+
f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys)
|
59
60
|
end
|
60
61
|
|
61
62
|
Gem.configuration.load_api_keys
|
@@ -67,7 +68,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
|
|
67
68
|
keys = { :rubygems_api_key => "KEY", :other => "OTHER" }
|
68
69
|
|
69
70
|
File.open Gem.configuration.credentials_path, "w" do |f|
|
70
|
-
f.write keys
|
71
|
+
f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys)
|
71
72
|
end
|
72
73
|
|
73
74
|
Gem.configuration.load_api_keys
|
@@ -163,8 +164,10 @@ class TestGemGemcutterUtilities < Gem::TestCase
|
|
163
164
|
def test_sign_in_with_other_credentials_doesnt_overwrite_other_keys
|
164
165
|
other_api_key = "f46dbb18bb6a9c97cdc61b5b85c186a17403cdcbf"
|
165
166
|
|
167
|
+
config = Hash[:other_api_key, other_api_key]
|
168
|
+
|
166
169
|
File.open Gem.configuration.credentials_path, "w" do |f|
|
167
|
-
f.write
|
170
|
+
f.write Gem::ConfigFile.dump_with_rubygems_yaml(config)
|
168
171
|
end
|
169
172
|
util_sign_in
|
170
173
|
|
@@ -317,7 +320,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
|
|
317
320
|
def test_verify_api_key
|
318
321
|
keys = { :other => "a5fdbb6ba150cbb83aad2bb2fede64cf040453903" }
|
319
322
|
File.open Gem.configuration.credentials_path, "w" do |f|
|
320
|
-
f.write keys
|
323
|
+
f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys)
|
321
324
|
end
|
322
325
|
Gem.configuration.load_api_keys
|
323
326
|
|
@@ -146,8 +146,8 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
|
146
146
|
|
147
147
|
refute @cmd.options[:user_install]
|
148
148
|
|
149
|
-
FileUtils.chmod
|
150
|
-
FileUtils.chmod
|
149
|
+
FileUtils.chmod 0o755, @userhome
|
150
|
+
FileUtils.chmod 0o000, @gemhome
|
151
151
|
|
152
152
|
Gem.use_paths @gemhome, @userhome
|
153
153
|
|
@@ -156,7 +156,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
|
156
156
|
end
|
157
157
|
end
|
158
158
|
ensure
|
159
|
-
FileUtils.chmod
|
159
|
+
FileUtils.chmod 0o755, @gemhome
|
160
160
|
end
|
161
161
|
|
162
162
|
def test_vendor
|
@@ -204,8 +204,8 @@ gem 'other', version
|
|
204
204
|
bin_dir = bin_dir.downcase
|
205
205
|
end
|
206
206
|
|
207
|
-
orig_PATH
|
208
|
-
|
207
|
+
orig_PATH = ENV["PATH"]
|
208
|
+
ENV["PATH"] = [ENV["PATH"], bin_dir].join(File::PATH_SEPARATOR)
|
209
209
|
|
210
210
|
use_ui @ui do
|
211
211
|
installer.check_that_user_bin_dir_is_in_path
|
@@ -229,8 +229,8 @@ gem 'other', version
|
|
229
229
|
def test_check_that_user_bin_dir_is_in_path_tilde
|
230
230
|
pend "Tilde is PATH is not supported under MS Windows" if win_platform?
|
231
231
|
|
232
|
-
orig_PATH
|
233
|
-
|
232
|
+
orig_PATH = ENV["PATH"]
|
233
|
+
ENV["PATH"] = [ENV["PATH"], "~/bin"].join(File::PATH_SEPARATOR)
|
234
234
|
|
235
235
|
installer = setup_base_installer
|
236
236
|
installer.bin_dir.replace File.join @userhome, "bin"
|
@@ -467,14 +467,14 @@ gem 'other', version
|
|
467
467
|
elsif Process.uid.zero?
|
468
468
|
pend("test_generate_bin_script_no_perms skipped in root privilege")
|
469
469
|
else
|
470
|
-
FileUtils.chmod
|
470
|
+
FileUtils.chmod 0o000, util_inst_bindir
|
471
471
|
|
472
472
|
assert_raise Gem::FilePermissionError do
|
473
473
|
installer.generate_bin
|
474
474
|
end
|
475
475
|
end
|
476
476
|
ensure
|
477
|
-
FileUtils.chmod
|
477
|
+
FileUtils.chmod 0o755, util_inst_bindir unless ($DEBUG || win_platform?)
|
478
478
|
end
|
479
479
|
|
480
480
|
def test_generate_bin_script_no_shebang
|
@@ -498,7 +498,7 @@ gem 'other', version
|
|
498
498
|
|
499
499
|
wrapper = File.read installed_exec
|
500
500
|
assert_match %r{generated by RubyGems}, wrapper
|
501
|
-
# HACK some gems don't have #! in their executables, restore 2008/06
|
501
|
+
# HACK: some gems don't have #! in their executables, restore 2008/06
|
502
502
|
#assert_no_match %r|generated by RubyGems|, wrapper
|
503
503
|
end
|
504
504
|
|
@@ -571,14 +571,14 @@ gem 'other', version
|
|
571
571
|
elsif Process.uid.zero?
|
572
572
|
pend("test_user_install_disabled_read_only test skipped in root privilege")
|
573
573
|
else
|
574
|
-
FileUtils.chmod
|
574
|
+
FileUtils.chmod 0o000, util_inst_bindir
|
575
575
|
|
576
576
|
assert_raise Gem::FilePermissionError do
|
577
577
|
installer.generate_bin
|
578
578
|
end
|
579
579
|
end
|
580
580
|
ensure
|
581
|
-
FileUtils.chmod
|
581
|
+
FileUtils.chmod 0o755, util_inst_bindir unless ($DEBUG || win_platform?)
|
582
582
|
end
|
583
583
|
|
584
584
|
def test_generate_bin_symlink_update_newer
|
@@ -816,7 +816,7 @@ gem 'other', version
|
|
816
816
|
|
817
817
|
util_build_gem spec
|
818
818
|
|
819
|
-
File.chmod(
|
819
|
+
File.chmod(0o555, Gem.plugindir)
|
820
820
|
system_path = File.join(Gem.plugindir, "a_plugin.rb")
|
821
821
|
user_path = File.join(Gem.plugindir(Gem.user_dir), "a_plugin.rb")
|
822
822
|
installer = util_installer spec, Gem.dir, :user
|
@@ -838,7 +838,7 @@ gem 'other', version
|
|
838
838
|
|
839
839
|
util_build_gem spec
|
840
840
|
|
841
|
-
File.chmod(
|
841
|
+
File.chmod(0o555, Gem.plugindir)
|
842
842
|
system_path = File.join(Gem.plugindir, "a_plugin.rb")
|
843
843
|
|
844
844
|
build_root = File.join(@tempdir, "build_root")
|
@@ -1032,8 +1032,8 @@ end
|
|
1032
1032
|
exe = File.join gemdir, "bin", "executable"
|
1033
1033
|
assert_path_exist exe
|
1034
1034
|
|
1035
|
-
exe_mode = File.stat(exe).mode &
|
1036
|
-
assert_equal
|
1035
|
+
exe_mode = File.stat(exe).mode & 0o111
|
1036
|
+
assert_equal 0o111, exe_mode, "0%o" % exe_mode unless win_platform?
|
1037
1037
|
|
1038
1038
|
assert_path_exist File.join gemdir, "lib", "code.rb"
|
1039
1039
|
|
@@ -1617,7 +1617,7 @@ end
|
|
1617
1617
|
installer.install
|
1618
1618
|
end
|
1619
1619
|
assert_path_exist so
|
1620
|
-
rescue
|
1620
|
+
rescue StandardError
|
1621
1621
|
puts "-" * 78
|
1622
1622
|
puts File.read File.join(@gemhome, "gems", "a-2", "Makefile")
|
1623
1623
|
puts "-" * 78
|
@@ -2021,7 +2021,7 @@ end
|
|
2021
2021
|
|
2022
2022
|
bin_env = get_bin_env
|
2023
2023
|
|
2024
|
-
assert_equal("#!#{bin_env} #{RbConfig::CONFIG[
|
2024
|
+
assert_equal("#!#{bin_env} #{RbConfig::CONFIG["ruby_install_name"]}",
|
2025
2025
|
shebang)
|
2026
2026
|
end
|
2027
2027
|
|
@@ -2498,7 +2498,7 @@ end
|
|
2498
2498
|
end
|
2499
2499
|
|
2500
2500
|
def mask
|
2501
|
-
|
2501
|
+
0o100755
|
2502
2502
|
end
|
2503
2503
|
|
2504
2504
|
def load_relative(value)
|