rubygems-update 3.2.0.rc.2 → 3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{History.txt → CHANGELOG.md} +520 -501
- data/Manifest.txt +62 -55
- data/POLICIES.md +4 -3
- data/Rakefile +23 -7
- data/bundler/CHANGELOG.md +84 -19
- data/bundler/UPGRADING.md +1 -1
- data/bundler/bundler.gemspec +1 -1
- data/bundler/lib/bundler.rb +11 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli.rb +5 -5
- data/bundler/lib/bundler/cli/binstubs.rb +6 -2
- data/bundler/lib/bundler/cli/exec.rb +3 -3
- data/bundler/lib/bundler/cli/install.rb +14 -5
- data/bundler/lib/bundler/cli/outdated.rb +0 -2
- data/bundler/lib/bundler/cli/update.rb +1 -1
- data/bundler/lib/bundler/compact_index_client/cache.rb +5 -13
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +5 -5
- data/bundler/lib/bundler/definition.rb +23 -25
- data/bundler/lib/bundler/dependency.rb +3 -1
- data/bundler/lib/bundler/env.rb +1 -1
- data/bundler/lib/bundler/feature_flag.rb +0 -1
- data/bundler/lib/bundler/fetcher/index.rb +2 -3
- data/bundler/lib/bundler/friendly_errors.rb +15 -0
- data/bundler/lib/bundler/gem_helpers.rb +30 -24
- data/bundler/lib/bundler/index.rb +5 -1
- data/bundler/lib/bundler/injector.rb +9 -2
- data/bundler/lib/bundler/installer.rb +7 -5
- data/bundler/lib/bundler/lazy_specification.rb +20 -9
- data/bundler/lib/bundler/man/.document +1 -0
- data/bundler/{man → lib/bundler/man}/bundle-add.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-add.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-binstubs.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-cache.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-cache.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-check.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-clean.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-clean.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-config.1 +2 -5
- data/bundler/{man → lib/bundler/man}/bundle-config.1.ronn +1 -9
- data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-doctor.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-exec.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-exec.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-gem.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-gem.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-info.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-init.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-init.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-inject.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-inject.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-install.1 +2 -2
- data/bundler/{man → lib/bundler/man}/bundle-install.1.ronn +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-list.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-list.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-lock.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-open.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-open.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-outdated.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-platform.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-platform.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-pristine.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-remove.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-show.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-update.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-update.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-viz.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-viz.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/gemfile.5 +1 -1
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +0 -0
- data/bundler/lib/bundler/man/index.txt +25 -0
- data/bundler/lib/bundler/plugin/api/source.rb +1 -1
- data/bundler/lib/bundler/plugin/dsl.rb +1 -1
- data/bundler/lib/bundler/resolver.rb +25 -29
- data/bundler/lib/bundler/resolver/spec_group.rb +19 -25
- data/bundler/lib/bundler/rubygems_integration.rb +4 -6
- data/bundler/lib/bundler/settings.rb +0 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +28 -41
- data/bundler/lib/bundler/spec_set.rb +6 -8
- data/bundler/lib/bundler/stub_specification.rb +0 -2
- data/bundler/lib/bundler/templates/newgem/README.md.tt +0 -1
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +2 -2
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -0
- data/bundler/lib/bundler/uri_credentials_filter.rb +2 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +34 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +38 -40
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +12 -8
- data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/bundler/lib/bundler/vendored_tmpdir.rb +4 -0
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems.rb +6 -2
- data/lib/rubygems/available_set.rb +1 -1
- data/lib/rubygems/command_manager.rb +2 -2
- data/lib/rubygems/commands/build_command.rb +37 -20
- data/lib/rubygems/commands/cert_command.rb +1 -1
- data/lib/rubygems/commands/help_command.rb +2 -0
- data/lib/rubygems/commands/owner_command.rb +10 -3
- data/lib/rubygems/commands/pristine_command.rb +1 -1
- data/lib/rubygems/commands/push_command.rb +7 -4
- data/lib/rubygems/commands/query_command.rb +17 -0
- data/lib/rubygems/commands/server_command.rb +4 -0
- data/lib/rubygems/commands/setup_command.rb +26 -90
- data/lib/rubygems/commands/sources_command.rb +6 -2
- data/lib/rubygems/commands/specification_command.rb +6 -0
- data/lib/rubygems/commands/yank_command.rb +4 -5
- data/lib/rubygems/core_ext/kernel_require.rb +3 -0
- data/lib/rubygems/core_ext/kernel_warn.rb +6 -7
- data/lib/rubygems/defaults.rb +2 -2
- data/lib/rubygems/dependency.rb +1 -1
- data/lib/rubygems/dependency_installer.rb +5 -3
- data/lib/rubygems/ext/builder.rb +16 -35
- data/lib/rubygems/ext/cmake_builder.rb +5 -6
- data/lib/rubygems/ext/configure_builder.rb +5 -6
- data/lib/rubygems/ext/ext_conf_builder.rb +19 -14
- data/lib/rubygems/ext/rake_builder.rb +4 -4
- data/lib/rubygems/gemcutter_utilities.rb +101 -20
- data/lib/rubygems/indexer.rb +0 -1
- data/lib/rubygems/install_update_options.rb +2 -2
- data/lib/rubygems/installer.rb +12 -32
- data/lib/rubygems/installer_test_case.rb +7 -6
- data/lib/rubygems/name_tuple.rb +1 -1
- data/lib/rubygems/openssl.rb +4 -4
- data/lib/rubygems/package.rb +3 -2
- data/lib/rubygems/package/tar_header.rb +1 -1
- data/lib/rubygems/package/tar_test_case.rb +1 -1
- data/lib/rubygems/platform.rb +18 -7
- data/lib/rubygems/query_utils.rb +0 -9
- data/lib/rubygems/remote_fetcher.rb +5 -4
- data/lib/rubygems/request.rb +4 -3
- data/lib/rubygems/request_set.rb +2 -13
- data/lib/rubygems/request_set/gem_dependency_api.rb +4 -4
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver.rb +7 -2
- data/lib/rubygems/resolver/activation_request.rb +9 -1
- data/lib/rubygems/resolver/api_set.rb +29 -20
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_specification.rb +8 -3
- data/lib/rubygems/resolver/best_set.rb +2 -2
- data/lib/rubygems/resolver/conflict.rb +1 -1
- data/lib/rubygems/resolver/dependency_request.rb +1 -1
- data/lib/rubygems/resolver/index_specification.rb +29 -0
- data/lib/rubygems/resolver/installer_set.rb +58 -9
- data/lib/rubygems/resolver/lock_set.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +39 -5
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +43 -10
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +75 -7
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +506 -165
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/rubygems/resolver/spec_specification.rb +14 -0
- data/lib/rubygems/resolver/specification.rb +13 -1
- data/lib/rubygems/s3_uri_signer.rb +1 -1
- data/lib/rubygems/security.rb +1 -2
- data/lib/rubygems/security/policy.rb +1 -1
- data/lib/rubygems/security/signer.rb +1 -1
- data/lib/rubygems/server.rb +7 -2
- data/lib/rubygems/source.rb +20 -9
- data/lib/rubygems/spec_fetcher.rb +1 -1
- data/lib/rubygems/specification.rb +8 -8
- data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +1 -1
- data/lib/rubygems/test_case.rb +14 -27
- data/lib/rubygems/test_utilities.rb +6 -5
- data/lib/rubygems/uri_formatter.rb +2 -1
- data/lib/rubygems/version_option.rb +6 -0
- data/rubygems-update.gemspec +2 -2
- data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
- data/test/rubygems/test_bundled_ca.rb +9 -5
- data/test/rubygems/test_gem.rb +3 -3
- data/test/rubygems/test_gem_commands_build_command.rb +197 -5
- data/test/rubygems/test_gem_commands_cert_command.rb +2 -2
- data/test/rubygems/test_gem_commands_cleanup_command.rb +1 -1
- data/test/rubygems/test_gem_commands_contents_command.rb +2 -2
- data/test/rubygems/test_gem_commands_help_command.rb +15 -2
- data/test/rubygems/test_gem_commands_install_command.rb +132 -1
- data/test/rubygems/test_gem_commands_owner_command.rb +49 -1
- data/test/rubygems/test_gem_commands_pristine_command.rb +2 -2
- data/test/rubygems/test_gem_commands_push_command.rb +70 -5
- data/test/rubygems/test_gem_commands_query_command.rb +3 -3
- data/test/rubygems/test_gem_commands_setup_command.rb +20 -48
- data/test/rubygems/test_gem_commands_signin_command.rb +27 -3
- data/test/rubygems/test_gem_commands_sources_command.rb +60 -0
- data/test/rubygems/test_gem_commands_specification_command.rb +28 -0
- data/test/rubygems/test_gem_commands_update_command.rb +2 -2
- data/test/rubygems/test_gem_commands_yank_command.rb +31 -1
- data/test/rubygems/test_gem_dependency_installer.rb +63 -49
- data/test/rubygems/test_gem_dependency_list.rb +2 -2
- data/test/rubygems/test_gem_ext_builder.rb +16 -20
- data/test/rubygems/test_gem_ext_cmake_builder.rb +5 -13
- data/test/rubygems/test_gem_ext_configure_builder.rb +5 -11
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +9 -26
- data/test/rubygems/test_gem_ext_rake_builder.rb +30 -13
- data/test/rubygems/test_gem_gem_runner.rb +5 -4
- data/test/rubygems/test_gem_gemcutter_utilities.rb +3 -3
- data/test/rubygems/test_gem_install_update_options.rb +15 -3
- data/test/rubygems/test_gem_installer.rb +80 -71
- data/test/rubygems/test_gem_package.rb +8 -8
- data/test/rubygems/test_gem_package_old.rb +4 -4
- data/test/rubygems/test_gem_package_tar_writer.rb +1 -1
- data/test/rubygems/test_gem_platform.rb +63 -4
- data/test/rubygems/test_gem_remote_fetcher.rb +15 -19
- data/test/rubygems/test_gem_request.rb +2 -2
- data/test/rubygems/test_gem_request_set_lockfile.rb +4 -4
- data/test/rubygems/test_gem_resolver_api_set.rb +58 -55
- data/test/rubygems/test_gem_resolver_api_specification.rb +3 -3
- data/test/rubygems/test_gem_resolver_best_set.rb +26 -3
- data/test/rubygems/test_gem_resolver_conflict.rb +1 -1
- data/test/rubygems/test_gem_resolver_vendor_set.rb +1 -1
- 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 +2 -2
- data/test/rubygems/test_gem_source.rb +7 -2
- data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
- data/test/rubygems/test_gem_specification.rb +6 -7
- data/test/rubygems/test_gem_uninstaller.rb +7 -7
- data/test/rubygems/test_gem_validator.rb +1 -1
- data/test/rubygems/test_gem_version_option.rb +1 -1
- data/test/rubygems/test_require.rb +50 -9
- data/test/test_changelog_generator.rb +17 -0
- metadata +69 -86
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -247,7 +247,7 @@ EOF
|
|
247
247
|
|
248
248
|
@stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [
|
249
249
|
[response_fail, 401, 'Unauthorized'],
|
250
|
-
[response_success, 200, 'OK']
|
250
|
+
[response_success, 200, 'OK'],
|
251
251
|
]
|
252
252
|
|
253
253
|
@otp_ui = Gem::MockGemUi.new "111111\n"
|
@@ -275,4 +275,52 @@ EOF
|
|
275
275
|
assert_match 'Code: ', @otp_ui.output
|
276
276
|
assert_equal '111111', @stub_fetcher.last_request['OTP']
|
277
277
|
end
|
278
|
+
|
279
|
+
def test_remove_owners_unathorized_api_key
|
280
|
+
response_forbidden = "The API key doesn't have access"
|
281
|
+
response_success = "Owner removed successfully."
|
282
|
+
|
283
|
+
@stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [
|
284
|
+
[response_forbidden, 403, 'Forbidden'],
|
285
|
+
[response_success, 200, "OK"],
|
286
|
+
]
|
287
|
+
@stub_fetcher.data["#{Gem.host}/api/v1/api_key"] = ["", 200, "OK"]
|
288
|
+
@cmd.instance_variable_set :@scope, :remove_owner
|
289
|
+
|
290
|
+
@stub_ui = Gem::MockGemUi.new "some@mail.com\npass\n"
|
291
|
+
use_ui @stub_ui do
|
292
|
+
@cmd.remove_owners("freewill", ["some@example"])
|
293
|
+
end
|
294
|
+
|
295
|
+
access_notice = "The existing key doesn't have access of remove_owner on RubyGems.org. Please sign in to update access."
|
296
|
+
assert_match access_notice, @stub_ui.output
|
297
|
+
assert_match "Email:", @stub_ui.output
|
298
|
+
assert_match "Password:", @stub_ui.output
|
299
|
+
assert_match "Added remove_owner scope to the existing API key", @stub_ui.output
|
300
|
+
assert_match response_success, @stub_ui.output
|
301
|
+
end
|
302
|
+
|
303
|
+
def test_add_owners_unathorized_api_key
|
304
|
+
response_forbidden = "The API key doesn't have access"
|
305
|
+
response_success = "Owner added successfully."
|
306
|
+
|
307
|
+
@stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [
|
308
|
+
[response_forbidden, 403, 'Forbidden'],
|
309
|
+
[response_success, 200, "OK"],
|
310
|
+
]
|
311
|
+
@stub_fetcher.data["#{Gem.host}/api/v1/api_key"] = ["", 200, "OK"]
|
312
|
+
@cmd.instance_variable_set :@scope, :add_owner
|
313
|
+
|
314
|
+
@stub_ui = Gem::MockGemUi.new "some@mail.com\npass\n"
|
315
|
+
use_ui @stub_ui do
|
316
|
+
@cmd.add_owners("freewill", ["some@example"])
|
317
|
+
end
|
318
|
+
|
319
|
+
access_notice = "The existing key doesn't have access of add_owner on RubyGems.org. Please sign in to update access."
|
320
|
+
assert_match access_notice, @stub_ui.output
|
321
|
+
assert_match "Email:", @stub_ui.output
|
322
|
+
assert_match "Password:", @stub_ui.output
|
323
|
+
assert_match "Added add_owner scope to the existing API key", @stub_ui.output
|
324
|
+
assert_match response_success, @stub_ui.output
|
325
|
+
end
|
278
326
|
end
|
@@ -568,7 +568,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
568
568
|
assert_equal([
|
569
569
|
"Restoring gems to pristine condition...",
|
570
570
|
"Cached gem for a-2 not found, attempting to fetch...",
|
571
|
-
"Skipped a-2, it was not found from cache and remote sources"
|
571
|
+
"Skipped a-2, it was not found from cache and remote sources",
|
572
572
|
], @ui.output.split("\n"))
|
573
573
|
|
574
574
|
assert_empty @ui.error
|
@@ -577,7 +577,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
577
577
|
def test_execute_default_gem
|
578
578
|
default_gem_spec = new_default_spec("default", "2.0.0.0",
|
579
579
|
nil, "default/gem.rb")
|
580
|
-
|
580
|
+
install_default_gems(default_gem_spec)
|
581
581
|
|
582
582
|
@cmd.options[:args] = %w[default]
|
583
583
|
|
@@ -152,7 +152,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
152
152
|
|
153
153
|
keys = {
|
154
154
|
:rubygems_api_key => 'KEY',
|
155
|
-
@host => @api_key
|
155
|
+
@host => @api_key,
|
156
156
|
}
|
157
157
|
|
158
158
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
@@ -187,7 +187,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
187
187
|
|
188
188
|
keys = {
|
189
189
|
:rubygems_api_key => 'KEY',
|
190
|
-
@host => @api_key
|
190
|
+
@host => @api_key,
|
191
191
|
}
|
192
192
|
|
193
193
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
@@ -271,7 +271,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
271
271
|
|
272
272
|
keys = {
|
273
273
|
:rubygems_api_key => 'KEY',
|
274
|
-
@host => @api_key
|
274
|
+
@host => @api_key,
|
275
275
|
}
|
276
276
|
|
277
277
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
@@ -302,7 +302,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
302
302
|
api_key = "PRIVKEY"
|
303
303
|
|
304
304
|
keys = {
|
305
|
-
host => api_key
|
305
|
+
host => api_key,
|
306
306
|
}
|
307
307
|
|
308
308
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
@@ -373,7 +373,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
373
373
|
|
374
374
|
@fetcher.data["#{Gem.host}/api/v1/gems"] = [
|
375
375
|
[response_fail, 401, 'Unauthorized'],
|
376
|
-
[response_success, 200, 'OK']
|
376
|
+
[response_success, 200, 'OK'],
|
377
377
|
]
|
378
378
|
|
379
379
|
@otp_ui = Gem::MockGemUi.new "111111\n"
|
@@ -404,6 +404,71 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
404
404
|
assert_equal '111111', @fetcher.last_request['OTP']
|
405
405
|
end
|
406
406
|
|
407
|
+
def test_sending_gem_unathorized_api_key_with_mfa_enabled
|
408
|
+
response_mfa_enabled = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
|
409
|
+
response_forbidden = "The API key doesn't have access"
|
410
|
+
response_success = 'Successfully registered gem: freewill (1.0.0)'
|
411
|
+
|
412
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [
|
413
|
+
[response_mfa_enabled, 401, 'Unauthorized'],
|
414
|
+
[response_forbidden, 403, 'Forbidden'],
|
415
|
+
[response_success, 200, "OK"],
|
416
|
+
]
|
417
|
+
|
418
|
+
@fetcher.data["#{@host}/api/v1/api_key"] = ["", 200, "OK"]
|
419
|
+
@cmd.instance_variable_set :@host, @host
|
420
|
+
@cmd.instance_variable_set :@scope, :push_rubygem
|
421
|
+
|
422
|
+
@ui = Gem::MockGemUi.new "11111\nsome@mail.com\npass\n"
|
423
|
+
use_ui @ui do
|
424
|
+
@cmd.send_gem(@path)
|
425
|
+
end
|
426
|
+
|
427
|
+
mfa_notice = "You have enabled multi-factor authentication. Please enter OTP code."
|
428
|
+
access_notice = "The existing key doesn't have access of push_rubygem on https://rubygems.example. Please sign in to update access."
|
429
|
+
assert_match mfa_notice, @ui.output
|
430
|
+
assert_match access_notice, @ui.output
|
431
|
+
assert_match "Email:", @ui.output
|
432
|
+
assert_match "Password:", @ui.output
|
433
|
+
assert_match "Added push_rubygem scope to the existing API key", @ui.output
|
434
|
+
assert_match response_success, @ui.output
|
435
|
+
assert_equal '11111', @fetcher.last_request['OTP']
|
436
|
+
end
|
437
|
+
|
438
|
+
def test_sending_gem_with_no_local_creds
|
439
|
+
Gem.configuration.rubygems_api_key = nil
|
440
|
+
|
441
|
+
response_mfa_enabled = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
|
442
|
+
response_success = 'Successfully registered gem: freewill (1.0.0)'
|
443
|
+
|
444
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [
|
445
|
+
[response_success, 200, "OK"],
|
446
|
+
]
|
447
|
+
|
448
|
+
@fetcher.data["#{@host}/api/v1/api_key"] = [
|
449
|
+
[response_mfa_enabled, 401, 'Unauthorized'],
|
450
|
+
["", 200, "OK"],
|
451
|
+
]
|
452
|
+
|
453
|
+
@cmd.instance_variable_set :@scope, :push_rubygem
|
454
|
+
@cmd.options[:args] = [@path]
|
455
|
+
@cmd.options[:host] = @host
|
456
|
+
|
457
|
+
@ui = Gem::MockGemUi.new "some@mail.com\npass\n11111\n"
|
458
|
+
use_ui @ui do
|
459
|
+
@cmd.execute
|
460
|
+
end
|
461
|
+
|
462
|
+
mfa_notice = "You have enabled multi-factor authentication. Please enter OTP code."
|
463
|
+
assert_match mfa_notice, @ui.output
|
464
|
+
assert_match "Enter your https://rubygems.example credentials.", @ui.output
|
465
|
+
assert_match "Email:", @ui.output
|
466
|
+
assert_match "Password:", @ui.output
|
467
|
+
assert_match "Signed in with API key:", @ui.output
|
468
|
+
assert_match response_success, @ui.output
|
469
|
+
assert_equal '11111', @fetcher.last_request['OTP']
|
470
|
+
end
|
471
|
+
|
407
472
|
private
|
408
473
|
|
409
474
|
def singleton_gem_class
|
@@ -644,7 +644,7 @@ a (2 universal-darwin, 1 ruby x86-linux)
|
|
644
644
|
spec_fetcher {|fetcher| fetcher.spec 'a', 2 }
|
645
645
|
|
646
646
|
a1 = new_default_spec 'a', 1
|
647
|
-
|
647
|
+
install_default_gems a1
|
648
648
|
|
649
649
|
use_ui @stub_ui do
|
650
650
|
@cmd.execute
|
@@ -663,7 +663,7 @@ EOF
|
|
663
663
|
def test_execute_show_default_gems_with_platform
|
664
664
|
a1 = new_default_spec 'a', 1
|
665
665
|
a1.platform = 'java'
|
666
|
-
|
666
|
+
install_default_gems a1
|
667
667
|
|
668
668
|
use_ui @stub_ui do
|
669
669
|
@cmd.execute
|
@@ -685,7 +685,7 @@ EOF
|
|
685
685
|
end
|
686
686
|
|
687
687
|
a1 = new_default_spec 'a', 1
|
688
|
-
|
688
|
+
install_default_gems a1
|
689
689
|
|
690
690
|
@cmd.handle_options %w[-l -d]
|
691
691
|
|
@@ -26,12 +26,12 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
26
26
|
bundler/exe/bundle
|
27
27
|
bundler/lib/bundler.rb
|
28
28
|
bundler/lib/bundler/b.rb
|
29
|
+
bundler/bin/bundler/man/bundle-b.1
|
30
|
+
bundler/lib/bundler/man/bundle-b.1.ronn
|
31
|
+
bundler/lib/bundler/man/gemfile.5
|
32
|
+
bundler/lib/bundler/man/gemfile.5.ronn
|
29
33
|
bundler/lib/bundler/templates/.circleci/config.yml
|
30
34
|
bundler/lib/bundler/templates/.travis.yml
|
31
|
-
bundler/man/bundle-b.1
|
32
|
-
bundler/man/bundle-b.1.ronn
|
33
|
-
bundler/man/gemfile.5
|
34
|
-
bundler/man/gemfile.5.ronn
|
35
35
|
]
|
36
36
|
|
37
37
|
create_dummy_files(filelist)
|
@@ -155,24 +155,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
155
155
|
assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(gem_bin_path)
|
156
156
|
end
|
157
157
|
|
158
|
-
def
|
159
|
-
assert_equal %w[rubygems/ssl_certs/rubygems.org/foo.pem],
|
160
|
-
@cmd.
|
161
|
-
end
|
162
|
-
|
163
|
-
def test_rb_files_in
|
164
|
-
assert_equal %w[rubygems.rb rubygems/test_case.rb],
|
165
|
-
@cmd.rb_files_in('lib').sort
|
166
|
-
end
|
167
|
-
|
168
|
-
def test_bundler_man1_files_in
|
169
|
-
assert_equal %w[bundle-b.1 bundle-b.1.ronn],
|
170
|
-
@cmd.bundler_man1_files_in('bundler/man').sort
|
171
|
-
end
|
172
|
-
|
173
|
-
def test_bundler_man5_files_in
|
174
|
-
assert_equal %w[gemfile.5 gemfile.5.ronn],
|
175
|
-
@cmd.bundler_man5_files_in('bundler/man').sort
|
158
|
+
def test_files_in
|
159
|
+
assert_equal %w[rubygems.rb rubygems/ssl_certs/rubygems.org/foo.pem rubygems/test_case.rb],
|
160
|
+
@cmd.files_in('lib').sort
|
176
161
|
end
|
177
162
|
|
178
163
|
def test_install_lib
|
@@ -187,24 +172,11 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
187
172
|
assert_path_exists File.join(dir, 'bundler.rb')
|
188
173
|
assert_path_exists File.join(dir, 'bundler/b.rb')
|
189
174
|
|
190
|
-
assert_path_exists File.join(dir, 'bundler/templates/.circleci/config.yml')
|
175
|
+
assert_path_exists File.join(dir, 'bundler/templates/.circleci/config.yml') unless RUBY_ENGINE == "truffleruby" # https://github.com/oracle/truffleruby/issues/2116
|
191
176
|
assert_path_exists File.join(dir, 'bundler/templates/.travis.yml')
|
192
177
|
end
|
193
178
|
end
|
194
179
|
|
195
|
-
def test_install_man
|
196
|
-
@cmd.extend FileUtils
|
197
|
-
|
198
|
-
Dir.mktmpdir 'man' do |dir|
|
199
|
-
@cmd.install_man dir
|
200
|
-
|
201
|
-
assert_path_exists File.join("#{dir}/man1", 'bundle-b.1')
|
202
|
-
assert_path_exists File.join("#{dir}/man1", 'bundle-b.1.ronn')
|
203
|
-
assert_path_exists File.join("#{dir}/man5", 'gemfile.5')
|
204
|
-
assert_path_exists File.join("#{dir}/man5", 'gemfile.5.ronn')
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
180
|
def test_install_default_bundler_gem
|
209
181
|
@cmd.extend FileUtils
|
210
182
|
|
@@ -297,7 +269,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
297
269
|
|
298
270
|
@cmd.remove_old_lib_files lib
|
299
271
|
|
300
|
-
files_that_go.each {|file| refute_path_exists file }
|
272
|
+
files_that_go.each {|file| refute_path_exists(file) unless file == old_bundler_ci && RUBY_ENGINE == "truffleruby" } # https://github.com/oracle/truffleruby/issues/2116
|
301
273
|
|
302
274
|
files_that_stay.each {|file| assert_path_exists file }
|
303
275
|
end
|
@@ -313,8 +285,8 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
313
285
|
gemfile_5_ronn = File.join man, 'man5', 'gemfile.5.ronn'
|
314
286
|
gemfile_5_txt = File.join man, 'man5', 'gemfile.5.txt'
|
315
287
|
|
316
|
-
files_that_go = [bundle_b_1_txt, gemfile_5_txt]
|
317
|
-
files_that_stay = [ruby_1
|
288
|
+
files_that_go = [bundle_b_1, bundle_b_1_txt, bundle_b_1_ronn, gemfile_5, gemfile_5_txt, gemfile_5_ronn]
|
289
|
+
files_that_stay = [ruby_1]
|
318
290
|
|
319
291
|
create_dummy_files(files_that_go + files_that_stay)
|
320
292
|
|
@@ -331,22 +303,22 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
331
303
|
|
332
304
|
@cmd.options[:previous_version] = Gem::Version.new '2.0.2'
|
333
305
|
|
334
|
-
File.open '
|
306
|
+
File.open 'CHANGELOG.md', 'w' do |io|
|
335
307
|
io.puts <<-HISTORY_TXT
|
336
|
-
|
308
|
+
# #{Gem::VERSION} / 2013-03-26
|
337
309
|
|
338
|
-
|
310
|
+
## Bug fixes:
|
339
311
|
* Fixed release note display for LANG=C when installing rubygems
|
340
312
|
* π is tasty
|
341
313
|
|
342
|
-
|
314
|
+
# 2.0.2 / 2013-03-06
|
343
315
|
|
344
|
-
|
316
|
+
## Bug fixes:
|
345
317
|
* Other bugs fixed
|
346
318
|
|
347
|
-
|
319
|
+
# 2.0.1 / 2013-03-05
|
348
320
|
|
349
|
-
|
321
|
+
## Bug fixes:
|
350
322
|
* Yet more bugs fixed
|
351
323
|
HISTORY_TXT
|
352
324
|
end
|
@@ -356,9 +328,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
356
328
|
end
|
357
329
|
|
358
330
|
expected = <<-EXPECTED
|
359
|
-
|
331
|
+
# #{Gem::VERSION} / 2013-03-26
|
360
332
|
|
361
|
-
|
333
|
+
## Bug fixes:
|
362
334
|
* Fixed release note display for LANG=C when installing rubygems
|
363
335
|
* π is tasty
|
364
336
|
|
@@ -73,14 +73,38 @@ class TestGemCommandsSigninCommand < Gem::TestCase
|
|
73
73
|
assert_equal api_key, credentials[:rubygems_api_key]
|
74
74
|
end
|
75
75
|
|
76
|
+
def test_excute_with_key_name_and_scope
|
77
|
+
email = 'you@example.com'
|
78
|
+
password = 'secret'
|
79
|
+
api_key = '1234'
|
80
|
+
fetcher = Gem::RemoteFetcher.fetcher
|
81
|
+
|
82
|
+
key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\n"
|
83
|
+
util_capture(key_name_ui, nil, api_key, fetcher) { @cmd.execute }
|
84
|
+
|
85
|
+
user = ENV["USER"] || ENV["USERNAME"]
|
86
|
+
|
87
|
+
assert_match "API Key name [#{Socket.gethostname}-#{user}", key_name_ui.output
|
88
|
+
assert_match "index_rubygems [y/N]", key_name_ui.output
|
89
|
+
assert_match "push_rubygem [y/N]", key_name_ui.output
|
90
|
+
assert_match "yank_rubygem [y/N]", key_name_ui.output
|
91
|
+
assert_match "add_owner [y/N]", key_name_ui.output
|
92
|
+
assert_match "remove_owner [y/N]", key_name_ui.output
|
93
|
+
assert_match "access_webhooks [y/N]", key_name_ui.output
|
94
|
+
assert_match "show_dashboard [y/N]", key_name_ui.output
|
95
|
+
assert_equal "name=test-key&push_rubygem=true", fetcher.last_request.body
|
96
|
+
|
97
|
+
credentials = YAML.load_file Gem.configuration.credentials_path
|
98
|
+
assert_equal api_key, credentials[:rubygems_api_key]
|
99
|
+
end
|
100
|
+
|
76
101
|
# Utility method to capture IO/UI within the block passed
|
77
102
|
|
78
|
-
def util_capture(ui_stub = nil, host = nil, api_key = nil)
|
103
|
+
def util_capture(ui_stub = nil, host = nil, api_key = nil, fetcher = Gem::FakeFetcher.new)
|
79
104
|
api_key ||= 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
|
80
105
|
response = [api_key, 200, 'OK']
|
81
106
|
email = 'you@example.com'
|
82
107
|
password = 'secret'
|
83
|
-
fetcher = Gem::FakeFetcher.new
|
84
108
|
|
85
109
|
# Set the expected response for the Web-API supplied
|
86
110
|
ENV['RUBYGEMS_HOST'] = host || Gem::DEFAULT_HOST
|
@@ -88,7 +112,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
|
|
88
112
|
fetcher.data[data_key] = response
|
89
113
|
Gem::RemoteFetcher.fetcher = fetcher
|
90
114
|
|
91
|
-
sign_in_ui = ui_stub || Gem::MockGemUi.new("#{email}\n#{password}\n")
|
115
|
+
sign_in_ui = ui_stub || Gem::MockGemUi.new("#{email}\n#{password}\n\n\n\n\n\n\n\n\n")
|
92
116
|
|
93
117
|
use_ui sign_in_ui do
|
94
118
|
yield
|
@@ -107,6 +107,36 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
|
|
107
107
|
assert_empty ui.error
|
108
108
|
end
|
109
109
|
|
110
|
+
def test_execute_add_allow_typo_squatting_source_forced
|
111
|
+
rubygems_org = "https://rubyems.org"
|
112
|
+
|
113
|
+
spec_fetcher do |fetcher|
|
114
|
+
fetcher.spec("a", 1)
|
115
|
+
end
|
116
|
+
|
117
|
+
specs = Gem::Specification.map do |spec|
|
118
|
+
[spec.name, spec.version, spec.original_platform]
|
119
|
+
end
|
120
|
+
|
121
|
+
specs_dump_gz = StringIO.new
|
122
|
+
Zlib::GzipWriter.wrap(specs_dump_gz) do |io|
|
123
|
+
Marshal.dump(specs, io)
|
124
|
+
end
|
125
|
+
|
126
|
+
@fetcher.data["#{rubygems_org}/specs.#{@marshal_version}.gz"] = specs_dump_gz.string
|
127
|
+
@cmd.handle_options %W[--force --add #{rubygems_org}]
|
128
|
+
|
129
|
+
@cmd.execute
|
130
|
+
|
131
|
+
expected = "https://rubyems.org added to sources\n"
|
132
|
+
assert_equal expected, ui.output
|
133
|
+
|
134
|
+
source = Gem::Source.new(rubygems_org)
|
135
|
+
assert Gem.sources.include?(source)
|
136
|
+
|
137
|
+
assert_empty ui.error
|
138
|
+
end
|
139
|
+
|
110
140
|
def test_execute_add_deny_typo_squatting_source
|
111
141
|
rubygems_org = "https://rubyems.org"
|
112
142
|
|
@@ -283,6 +313,36 @@ source http://gems.example.com/ already present in the cache
|
|
283
313
|
assert_empty @ui.error
|
284
314
|
end
|
285
315
|
|
316
|
+
def test_execute_add_http_rubygems_org_forced
|
317
|
+
rubygems_org = "http://rubygems.org"
|
318
|
+
|
319
|
+
spec_fetcher do |fetcher|
|
320
|
+
fetcher.spec("a", 1)
|
321
|
+
end
|
322
|
+
|
323
|
+
specs = Gem::Specification.map do |spec|
|
324
|
+
[spec.name, spec.version, spec.original_platform]
|
325
|
+
end
|
326
|
+
|
327
|
+
specs_dump_gz = StringIO.new
|
328
|
+
Zlib::GzipWriter.wrap(specs_dump_gz) do |io|
|
329
|
+
Marshal.dump(specs, io)
|
330
|
+
end
|
331
|
+
|
332
|
+
@fetcher.data["#{rubygems_org}/specs.#{@marshal_version}.gz"] = specs_dump_gz.string
|
333
|
+
@cmd.handle_options %W[--force --add #{rubygems_org}]
|
334
|
+
|
335
|
+
@cmd.execute
|
336
|
+
|
337
|
+
expected = "http://rubygems.org added to sources\n"
|
338
|
+
assert_equal expected, ui.output
|
339
|
+
|
340
|
+
source = Gem::Source.new(rubygems_org)
|
341
|
+
assert Gem.sources.include?(source)
|
342
|
+
|
343
|
+
assert_empty ui.error
|
344
|
+
end
|
345
|
+
|
286
346
|
def test_execute_add_https_rubygems_org
|
287
347
|
https_rubygems_org = 'https://rubygems.org/'
|
288
348
|
|