rubygems-update 3.2.0.rc.2 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +54 -51
- data/Manifest.txt +32 -29
- data/Rakefile +3 -1
- data/bundler/CHANGELOG.md +35 -1
- data/bundler/UPGRADING.md +1 -1
- data/bundler/lib/bundler.rb +4 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli.rb +5 -2
- data/bundler/lib/bundler/cli/binstubs.rb +6 -2
- data/bundler/lib/bundler/cli/exec.rb +3 -3
- data/bundler/lib/bundler/cli/outdated.rb +2 -4
- data/bundler/lib/bundler/compact_index_client/updater.rb +5 -5
- data/bundler/lib/bundler/definition.rb +4 -9
- 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/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 +5 -7
- data/bundler/lib/bundler/man/.document +1 -0
- data/bundler/{man → lib/bundler/man}/bundle-add.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-binstubs.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-cache.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-check.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-clean.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-config.1.ronn +1 -9
- data/bundler/{man → lib/bundler/man}/bundle-doctor.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-exec.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-gem.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-info.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-init.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-inject.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-install.1.ronn +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-list.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-lock.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-open.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-outdated.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-platform.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-pristine.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-remove.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-show.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-update.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-viz.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +0 -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 +2 -3
- data/bundler/lib/bundler/rubygems_integration.rb +4 -0
- data/bundler/lib/bundler/settings.rb +0 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +1 -1
- data/bundler/lib/bundler/spec_set.rb +1 -0
- 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 +4 -7
- 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/bundler/man/bundle-add.1 +1 -1
- data/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/man/bundle-cache.1 +1 -1
- data/bundler/man/bundle-check.1 +1 -1
- data/bundler/man/bundle-clean.1 +1 -1
- data/bundler/man/bundle-config.1 +2 -5
- data/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/man/bundle-exec.1 +1 -1
- data/bundler/man/bundle-gem.1 +1 -1
- data/bundler/man/bundle-info.1 +1 -1
- data/bundler/man/bundle-init.1 +1 -1
- data/bundler/man/bundle-inject.1 +1 -1
- data/bundler/man/bundle-install.1 +2 -2
- data/bundler/man/bundle-list.1 +1 -1
- data/bundler/man/bundle-lock.1 +1 -1
- data/bundler/man/bundle-open.1 +1 -1
- data/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/man/bundle-platform.1 +1 -1
- data/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/man/bundle-remove.1 +1 -1
- data/bundler/man/bundle-show.1 +1 -1
- data/bundler/man/bundle-update.1 +1 -1
- data/bundler/man/bundle-viz.1 +1 -1
- data/bundler/man/bundle.1 +1 -1
- data/bundler/man/gemfile.5 +1 -1
- data/bundler/man/index.txt +25 -0
- 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 -2
- data/lib/rubygems/commands/pristine_command.rb +1 -1
- data/lib/rubygems/commands/push_command.rb +7 -3
- 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 +25 -45
- 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 -4
- 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 +4 -3
- data/lib/rubygems/ext/builder.rb +13 -32
- data/lib/rubygems/ext/cmake_builder.rb +4 -4
- data/lib/rubygems/ext/configure_builder.rb +4 -4
- data/lib/rubygems/ext/ext_conf_builder.rb +19 -14
- data/lib/rubygems/ext/rake_builder.rb +3 -3
- data/lib/rubygems/gemcutter_utilities.rb +90 -14
- data/lib/rubygems/indexer.rb +0 -1
- data/lib/rubygems/install_update_options.rb +2 -2
- data/lib/rubygems/installer.rb +12 -9
- 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 +1 -2
- data/lib/rubygems/request.rb +4 -3
- data/lib/rubygems/request_set/gem_dependency_api.rb +4 -4
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver.rb +1 -1
- data/lib/rubygems/resolver/activation_request.rb +9 -1
- data/lib/rubygems/resolver/api_specification.rb +5 -1
- data/lib/rubygems/resolver/conflict.rb +1 -1
- data/lib/rubygems/resolver/dependency_request.rb +1 -1
- data/lib/rubygems/resolver/index_specification.rb +11 -0
- data/lib/rubygems/resolver/installer_set.rb +1 -2
- 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/specification.rb +1 -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 +1 -1
- data/lib/rubygems/source.rb +10 -4
- 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 +13 -26
- data/lib/rubygems/uri_formatter.rb +2 -1
- data/lib/rubygems/version_option.rb +6 -0
- data/rubygems-update.gemspec +1 -1
- 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 +1 -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 +31 -5
- data/test/rubygems/test_gem_commands_query_command.rb +3 -3
- data/test/rubygems/test_gem_commands_setup_command.rb +13 -18
- 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 +36 -2
- data/test/rubygems/test_gem_dependency_list.rb +2 -2
- data/test/rubygems/test_gem_ext_builder.rb +10 -14
- data/test/rubygems/test_gem_ext_cmake_builder.rb +3 -9
- data/test/rubygems/test_gem_ext_configure_builder.rb +3 -9
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +9 -26
- data/test/rubygems/test_gem_ext_rake_builder.rb +5 -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 +74 -11
- 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 +14 -18
- 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 +8 -8
- 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 +5 -0
- data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
- data/test/rubygems/test_gem_specification.rb +5 -4
- 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
- metadata +35 -32
- 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
@@ -231,7 +231,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|
231
231
|
end
|
232
232
|
|
233
233
|
assert_equal '', @ui.output
|
234
|
-
assert_equal "ERROR:
|
234
|
+
assert_equal "ERROR: Couldn't find a gemspec file matching 'some_gem' in #{@tempdir}\n", @ui.error
|
235
235
|
end
|
236
236
|
|
237
237
|
def test_execute_outside_dir
|
@@ -272,8 +272,200 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|
272
272
|
assert_equal "this is a summary", spec.summary
|
273
273
|
end
|
274
274
|
|
275
|
+
def test_execute_outside_dir_with_glob_argument
|
276
|
+
gemspec_dir = File.join @tempdir, 'build_command_gem'
|
277
|
+
gemspec_file = File.join gemspec_dir, @gem.spec_name
|
278
|
+
readme_file = File.join gemspec_dir, 'README.md'
|
279
|
+
|
280
|
+
FileUtils.mkdir_p gemspec_dir
|
281
|
+
|
282
|
+
File.open readme_file, 'w' do |f|
|
283
|
+
f.write "My awesome gem"
|
284
|
+
end
|
285
|
+
|
286
|
+
File.open gemspec_file, 'w' do |gs|
|
287
|
+
gs.write @gem.to_ruby
|
288
|
+
end
|
289
|
+
|
290
|
+
@cmd.options[:build_path] = gemspec_dir
|
291
|
+
@cmd.options[:args] = ["*.gemspec"]
|
292
|
+
|
293
|
+
use_ui @ui do
|
294
|
+
@cmd.execute
|
295
|
+
end
|
296
|
+
|
297
|
+
output = @ui.output.split "\n"
|
298
|
+
assert_equal " Successfully built RubyGem", output.shift
|
299
|
+
assert_equal " Name: some_gem", output.shift
|
300
|
+
assert_equal " Version: 2", output.shift
|
301
|
+
assert_equal " File: some_gem-2.gem", output.shift
|
302
|
+
assert_equal [], output
|
303
|
+
|
304
|
+
gem_file = File.join gemspec_dir, File.basename(@gem.cache_file)
|
305
|
+
assert File.exist?(gem_file)
|
306
|
+
|
307
|
+
spec = Gem::Package.new(gem_file).spec
|
308
|
+
|
309
|
+
assert_equal "some_gem", spec.name
|
310
|
+
assert_equal "this is a summary", spec.summary
|
311
|
+
end
|
312
|
+
|
313
|
+
def test_execute_outside_dir_no_gemspec_present
|
314
|
+
gemspec_dir = File.join @tempdir, 'build_command_gem'
|
315
|
+
gemspec_file = File.join @tempdir, @gem.spec_name
|
316
|
+
readme_file = File.join gemspec_dir, 'README.md'
|
317
|
+
|
318
|
+
FileUtils.mkdir_p gemspec_dir
|
319
|
+
|
320
|
+
File.open readme_file, 'w' do |f|
|
321
|
+
f.write "My awesome gem"
|
322
|
+
end
|
323
|
+
|
324
|
+
File.open gemspec_file, 'w' do |gs|
|
325
|
+
gs.write @gem.to_ruby
|
326
|
+
end
|
327
|
+
|
328
|
+
@cmd.options[:build_path] = gemspec_dir
|
329
|
+
@cmd.options[:args] = ["*.gemspec"]
|
330
|
+
|
331
|
+
use_ui @ui do
|
332
|
+
assert_raises Gem::MockGemUi::TermError do
|
333
|
+
@cmd.execute
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
assert_equal "", @ui.output
|
338
|
+
assert_equal "ERROR: Couldn't find a gemspec file matching '*.gemspec' in #{gemspec_dir}\n", @ui.error
|
339
|
+
|
340
|
+
gem_file = File.join gemspec_dir, File.basename(@gem.cache_file)
|
341
|
+
refute File.exist?(gem_file)
|
342
|
+
end
|
343
|
+
|
344
|
+
def test_execute_outside_dir_without_gem_name
|
345
|
+
gemspec_dir = File.join(@tempdir, 'build_command_gem')
|
346
|
+
gemspec_file = File.join(gemspec_dir, @gem.spec_name)
|
347
|
+
|
348
|
+
readme_file = File.join gemspec_dir, 'README.md'
|
349
|
+
|
350
|
+
FileUtils.mkdir_p(gemspec_dir)
|
351
|
+
|
352
|
+
File.open readme_file, 'w' do |f|
|
353
|
+
f.write "My awesome gem"
|
354
|
+
end
|
355
|
+
|
356
|
+
File.open(gemspec_file, "w") do |gs|
|
357
|
+
gs.write(@gem.to_ruby)
|
358
|
+
end
|
359
|
+
|
360
|
+
@cmd.options[:build_path] = gemspec_dir
|
361
|
+
@cmd.options[:args] = []
|
362
|
+
|
363
|
+
use_ui @ui do
|
364
|
+
Dir.chdir(gemspec_dir) do
|
365
|
+
@cmd.execute
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
output = @ui.output.split("\n")
|
370
|
+
assert_equal " Successfully built RubyGem", output.shift
|
371
|
+
assert_equal " Name: some_gem", output.shift
|
372
|
+
assert_equal " Version: 2", output.shift
|
373
|
+
assert_equal " File: some_gem-2.gem", output.shift
|
374
|
+
assert_equal [], output
|
375
|
+
|
376
|
+
gem_file = File.join gemspec_dir, File.basename(@gem.cache_file)
|
377
|
+
assert File.exist?(gem_file)
|
378
|
+
|
379
|
+
spec = Gem::Package.new(gem_file).spec
|
380
|
+
|
381
|
+
assert_equal "some_gem", spec.name
|
382
|
+
assert_equal "this is a summary", spec.summary
|
383
|
+
end
|
384
|
+
|
385
|
+
def test_execute_outside_dir_with_external_gemspec
|
386
|
+
gemspec_dir = File.join @tempdir, 'gemspec_dir'
|
387
|
+
gemspec_file = File.join gemspec_dir, @gem.spec_name
|
388
|
+
|
389
|
+
gemcode_dir = File.join @tempdir, 'build_command_gem'
|
390
|
+
readme_file = File.join gemcode_dir, 'README.md'
|
391
|
+
|
392
|
+
FileUtils.mkdir_p gemspec_dir
|
393
|
+
FileUtils.mkdir_p gemcode_dir
|
394
|
+
|
395
|
+
File.open readme_file, 'w' do |f|
|
396
|
+
f.write "My awesome gem in nested directory"
|
397
|
+
end
|
398
|
+
|
399
|
+
File.open gemspec_file, 'w' do |gs|
|
400
|
+
gs.write @gem.to_ruby
|
401
|
+
end
|
402
|
+
|
403
|
+
@cmd.options[:build_path] = gemcode_dir
|
404
|
+
@cmd.options[:args] = [gemspec_file]
|
405
|
+
|
406
|
+
use_ui @ui do
|
407
|
+
@cmd.execute
|
408
|
+
end
|
409
|
+
|
410
|
+
output = @ui.output.split "\n"
|
411
|
+
assert_equal " Successfully built RubyGem", output.shift
|
412
|
+
assert_equal " Name: some_gem", output.shift
|
413
|
+
assert_equal " Version: 2", output.shift
|
414
|
+
assert_equal " File: some_gem-2.gem", output.shift
|
415
|
+
assert_equal [], output
|
416
|
+
|
417
|
+
gem_file = File.join gemcode_dir, File.basename(@gem.cache_file)
|
418
|
+
assert File.exist?(gem_file)
|
419
|
+
|
420
|
+
spec = Gem::Package.new(gem_file).spec
|
421
|
+
|
422
|
+
assert_equal "some_gem", spec.name
|
423
|
+
assert_equal "this is a summary", spec.summary
|
424
|
+
end
|
425
|
+
|
426
|
+
def test_execute_outside_dir_with_external_relative_gemspec
|
427
|
+
gemspec_dir = File.join @tempdir, 'gemspec_dir'
|
428
|
+
gemspec_file = File.join gemspec_dir, @gem.spec_name
|
429
|
+
|
430
|
+
gemcode_dir = File.join @tempdir, 'build_command_gem'
|
431
|
+
readme_file = File.join gemcode_dir, 'README.md'
|
432
|
+
|
433
|
+
FileUtils.mkdir_p gemspec_dir
|
434
|
+
FileUtils.mkdir_p gemcode_dir
|
435
|
+
|
436
|
+
File.open readme_file, 'w' do |f|
|
437
|
+
f.write "My awesome gem in nested directory"
|
438
|
+
end
|
439
|
+
|
440
|
+
File.open gemspec_file, 'w' do |gs|
|
441
|
+
gs.write @gem.to_ruby
|
442
|
+
end
|
443
|
+
|
444
|
+
@cmd.options[:build_path] = gemcode_dir
|
445
|
+
@cmd.options[:args] = [File.join("..", "gemspec_dir", @gem.spec_name)]
|
446
|
+
|
447
|
+
use_ui @ui do
|
448
|
+
@cmd.execute
|
449
|
+
end
|
450
|
+
|
451
|
+
output = @ui.output.split "\n"
|
452
|
+
assert_equal " Successfully built RubyGem", output.shift
|
453
|
+
assert_equal " Name: some_gem", output.shift
|
454
|
+
assert_equal " Version: 2", output.shift
|
455
|
+
assert_equal " File: some_gem-2.gem", output.shift
|
456
|
+
assert_equal [], output
|
457
|
+
|
458
|
+
gem_file = File.join gemcode_dir, File.basename(@gem.cache_file)
|
459
|
+
assert File.exist?(gem_file)
|
460
|
+
|
461
|
+
spec = Gem::Package.new(gem_file).spec
|
462
|
+
|
463
|
+
assert_equal "some_gem", spec.name
|
464
|
+
assert_equal "this is a summary", spec.summary
|
465
|
+
end
|
466
|
+
|
275
467
|
def test_can_find_gemspecs_without_dot_gemspec
|
276
|
-
gemspec_file = File.join(@tempdir, @gem.
|
468
|
+
gemspec_file = File.join(@tempdir, @gem.name)
|
277
469
|
|
278
470
|
File.open gemspec_file + ".gemspec", 'w' do |gs|
|
279
471
|
gs.write @gem.to_ruby
|
@@ -390,7 +582,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|
390
582
|
end
|
391
583
|
|
392
584
|
def test_build_signed_gem
|
393
|
-
skip 'openssl is missing' unless
|
585
|
+
skip 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
|
394
586
|
|
395
587
|
trust_dir = Gem::Security.trust_dir
|
396
588
|
|
@@ -417,7 +609,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|
417
609
|
end
|
418
610
|
|
419
611
|
def test_build_signed_gem_with_cert_expiration_length_days
|
420
|
-
skip 'openssl is missing' unless
|
612
|
+
skip 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
|
421
613
|
|
422
614
|
gem_path = File.join Gem.user_home, ".gem"
|
423
615
|
Dir.mkdir gem_path
|
@@ -461,7 +653,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|
461
653
|
end
|
462
654
|
|
463
655
|
def test_build_auto_resign_cert
|
464
|
-
skip 'openssl is missing' unless
|
656
|
+
skip 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
|
465
657
|
|
466
658
|
gem_path = File.join Gem.user_home, ".gem"
|
467
659
|
Dir.mkdir gem_path
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'rubygems/test_case'
|
3
3
|
require 'rubygems/commands/cert_command'
|
4
4
|
|
5
|
-
unless
|
5
|
+
unless Gem::HAVE_OPENSSL
|
6
6
|
warn 'Skipping `gem cert` tests. openssl not found.'
|
7
7
|
end
|
8
8
|
|
@@ -805,4 +805,4 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|
805
805
|
assert_equal "invalid argument: --sign #{nonexistent}: does not exist",
|
806
806
|
e.message
|
807
807
|
end
|
808
|
-
end if
|
808
|
+
end if Gem::HAVE_OPENSSL && !Gem.java_platform?
|
@@ -227,7 +227,7 @@ lib/foo.rb
|
|
227
227
|
nil, "default/gem.rb")
|
228
228
|
default_gem_spec.executables = ["default_command"]
|
229
229
|
default_gem_spec.files += ["default_gem.so"]
|
230
|
-
|
230
|
+
install_default_gems(default_gem_spec)
|
231
231
|
|
232
232
|
@cmd.options[:args] = %w[default]
|
233
233
|
|
@@ -238,7 +238,7 @@ lib/foo.rb
|
|
238
238
|
expected = [
|
239
239
|
[RbConfig::CONFIG['bindir'], 'default_command'],
|
240
240
|
[RbConfig::CONFIG['rubylibdir'], 'default/gem.rb'],
|
241
|
-
[RbConfig::CONFIG['archdir'], 'default_gem.so']
|
241
|
+
[RbConfig::CONFIG['archdir'], 'default_gem.so'],
|
242
242
|
].sort.map{|a|File.join a }.join "\n"
|
243
243
|
|
244
244
|
assert_equal expected, @ui.output.chomp
|
@@ -40,10 +40,12 @@ class TestGemCommandsHelpCommand < Gem::TestCase
|
|
40
40
|
|
41
41
|
util_gem 'commands' do |out, err|
|
42
42
|
mgr.command_names.each do |cmd|
|
43
|
-
|
43
|
+
unless mgr[cmd].deprecated?
|
44
|
+
assert_match(/\s+#{cmd}\s+\S+/, out)
|
45
|
+
end
|
44
46
|
end
|
45
47
|
|
46
|
-
if
|
48
|
+
if Gem::HAVE_OPENSSL
|
47
49
|
assert_empty err
|
48
50
|
|
49
51
|
refute_match 'No command found for ', out
|
@@ -51,6 +53,17 @@ class TestGemCommandsHelpCommand < Gem::TestCase
|
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
56
|
+
def test_gem_help_commands_omits_deprecated_commands
|
57
|
+
mgr = Gem::CommandManager.new
|
58
|
+
|
59
|
+
util_gem 'commands' do |out, err|
|
60
|
+
deprecated_commands = mgr.command_names.select {|cmd| mgr[cmd].deprecated? }
|
61
|
+
deprecated_commands.each do |cmd|
|
62
|
+
refute_match(/\A\s+#{cmd}\s+\S+\z/, out)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
54
67
|
def test_gem_no_args_shows_help
|
55
68
|
util_gem do |out, err|
|
56
69
|
assert_match(/Usage:/, out)
|
@@ -410,7 +410,7 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
410
410
|
|
411
411
|
expected = [
|
412
412
|
"ERROR: Could not find a valid gem 'non-existent_with-hint' (>= 0) in any repository",
|
413
|
-
"ERROR: Possible alternatives: nonexistent-with_hint"
|
413
|
+
"ERROR: Possible alternatives: nonexistent-with_hint",
|
414
414
|
]
|
415
415
|
|
416
416
|
output = @ui.error.split "\n"
|
@@ -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,32 @@ 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
|
408
|
+
response_forbidden = "The API key doesn't have access"
|
409
|
+
response_success = 'Successfully registered gem: freewill (1.0.0)'
|
410
|
+
|
411
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [
|
412
|
+
[response_forbidden, 403, 'Forbidden'],
|
413
|
+
[response_success, 200, "OK"],
|
414
|
+
]
|
415
|
+
|
416
|
+
@fetcher.data["#{@host}/api/v1/api_key"] = ["", 200, "OK"]
|
417
|
+
@cmd.instance_variable_set :@host, @host
|
418
|
+
@cmd.instance_variable_set :@scope, :push_rubygem
|
419
|
+
|
420
|
+
@ui = Gem::MockGemUi.new "some@mail.com\npass\n"
|
421
|
+
use_ui @ui do
|
422
|
+
@cmd.send_gem(@path)
|
423
|
+
end
|
424
|
+
|
425
|
+
access_notice = "The existing key doesn't have access of push_rubygem on https://rubygems.example. Please sign in to update access."
|
426
|
+
assert_match access_notice, @ui.output
|
427
|
+
assert_match "Email:", @ui.output
|
428
|
+
assert_match "Password:", @ui.output
|
429
|
+
assert_match "Added push_rubygem scope to the existing API key", @ui.output
|
430
|
+
assert_match response_success, @ui.output
|
431
|
+
end
|
432
|
+
|
407
433
|
private
|
408
434
|
|
409
435
|
def singleton_gem_class
|