rubygems-update 2.7.10 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop.yml +66 -0
- data/.travis.yml +22 -18
- data/CONTRIBUTING.md +141 -0
- data/History.txt +291 -14
- data/MAINTAINERS.txt +1 -0
- data/Manifest.txt +13 -9
- data/POLICIES.md +92 -0
- data/README.md +47 -26
- data/Rakefile +47 -207
- data/{UPGRADING.rdoc → UPGRADING.md} +31 -32
- data/appveyor.yml +20 -45
- data/bin/gem +1 -2
- data/bin/update_rubygems +2 -3
- data/bundler/CHANGELOG.md +54 -0
- data/bundler/bundler.gemspec +7 -1
- data/bundler/lib/bundler.rb +26 -8
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli.rb +63 -21
- data/bundler/lib/bundler/cli/add.rb +15 -5
- data/bundler/lib/bundler/cli/binstubs.rb +8 -2
- data/bundler/lib/bundler/cli/doctor.rb +47 -1
- data/bundler/lib/bundler/cli/install.rb +8 -5
- data/bundler/lib/bundler/cli/list.rb +41 -5
- data/bundler/lib/bundler/cli/outdated.rb +7 -1
- data/bundler/lib/bundler/cli/pristine.rb +4 -0
- data/bundler/lib/bundler/cli/remove.rb +18 -0
- data/bundler/lib/bundler/definition.rb +15 -16
- data/bundler/lib/bundler/dependency.rb +2 -2
- data/bundler/lib/bundler/dsl.rb +19 -3
- data/bundler/lib/bundler/feature_flag.rb +7 -0
- data/bundler/lib/bundler/gem_version_promoter.rb +4 -2
- data/bundler/lib/bundler/injector.rb +168 -9
- data/bundler/lib/bundler/installer.rb +29 -6
- data/bundler/lib/bundler/installer/parallel_installer.rb +5 -0
- data/bundler/lib/bundler/plugin.rb +10 -3
- data/bundler/lib/bundler/plugin/events.rb +61 -0
- data/bundler/lib/bundler/resolver.rb +2 -2
- data/bundler/lib/bundler/runtime.rb +8 -2
- data/bundler/lib/bundler/settings.rb +24 -3
- data/bundler/lib/bundler/settings/validator.rb +23 -0
- data/bundler/lib/bundler/shared_helpers.rb +19 -3
- data/bundler/lib/bundler/source.rb +9 -9
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -0
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/man/bundle-add.ronn +13 -2
- data/bundler/man/bundle-config.ronn +21 -0
- data/bundler/man/bundle-install.ronn +1 -1
- data/bundler/man/bundle-list.ronn +19 -1
- data/bundler/man/bundle-outdated.ronn +4 -0
- data/bundler/man/bundle-remove.ronn +23 -0
- data/bundler/man/bundle-update.ronn +1 -1
- data/lib/rubygems.rb +70 -96
- data/lib/rubygems/available_set.rb +1 -1
- data/lib/rubygems/basic_specification.rb +12 -12
- data/lib/rubygems/bundler_version_finder.rb +3 -3
- data/lib/rubygems/command.rb +22 -15
- data/lib/rubygems/command_manager.rb +20 -11
- data/lib/rubygems/commands/build_command.rb +27 -8
- data/lib/rubygems/commands/cert_command.rb +45 -24
- data/lib/rubygems/commands/check_command.rb +1 -1
- data/lib/rubygems/commands/cleanup_command.rb +14 -7
- data/lib/rubygems/commands/contents_command.rb +14 -15
- data/lib/rubygems/commands/dependency_command.rb +17 -17
- data/lib/rubygems/commands/environment_command.rb +20 -1
- data/lib/rubygems/commands/fetch_command.rb +2 -3
- data/lib/rubygems/commands/generate_index_command.rb +2 -3
- data/lib/rubygems/commands/help_command.rb +12 -13
- data/lib/rubygems/commands/info_command.rb +33 -0
- data/lib/rubygems/commands/install_command.rb +21 -17
- data/lib/rubygems/commands/list_command.rb +0 -1
- data/lib/rubygems/commands/lock_command.rb +3 -4
- data/lib/rubygems/commands/open_command.rb +16 -10
- data/lib/rubygems/commands/owner_command.rb +20 -11
- data/lib/rubygems/commands/pristine_command.rb +23 -16
- data/lib/rubygems/commands/push_command.rb +17 -8
- data/lib/rubygems/commands/query_command.rb +24 -24
- data/lib/rubygems/commands/rdoc_command.rb +3 -4
- data/lib/rubygems/commands/search_command.rb +0 -1
- data/lib/rubygems/commands/server_command.rb +1 -2
- data/lib/rubygems/commands/setup_command.rb +78 -38
- data/lib/rubygems/commands/signin_command.rb +2 -1
- data/lib/rubygems/commands/signout_command.rb +2 -2
- data/lib/rubygems/commands/sources_command.rb +11 -12
- data/lib/rubygems/commands/specification_command.rb +7 -7
- data/lib/rubygems/commands/uninstall_command.rb +41 -19
- data/lib/rubygems/commands/unpack_command.rb +16 -7
- data/lib/rubygems/commands/update_command.rb +28 -23
- data/lib/rubygems/commands/which_command.rb +4 -5
- data/lib/rubygems/commands/yank_command.rb +1 -2
- data/lib/rubygems/compatibility.rb +1 -21
- data/lib/rubygems/config_file.rb +36 -36
- data/lib/rubygems/core_ext/kernel_require.rb +6 -6
- data/lib/rubygems/core_ext/kernel_warn.rb +45 -0
- data/lib/rubygems/defaults.rb +31 -12
- data/lib/rubygems/dependency.rb +14 -14
- data/lib/rubygems/dependency_installer.rb +29 -31
- data/lib/rubygems/dependency_list.rb +8 -9
- data/lib/rubygems/deprecate.rb +2 -3
- data/lib/rubygems/doctor.rb +5 -6
- data/lib/rubygems/errors.rb +3 -3
- data/lib/rubygems/exceptions.rb +11 -4
- data/lib/rubygems/ext.rb +0 -1
- data/lib/rubygems/ext/build_error.rb +0 -1
- data/lib/rubygems/ext/builder.rb +50 -23
- data/lib/rubygems/ext/cmake_builder.rb +2 -2
- data/lib/rubygems/ext/configure_builder.rb +2 -3
- data/lib/rubygems/ext/ext_conf_builder.rb +8 -7
- data/lib/rubygems/ext/rake_builder.rb +16 -18
- data/lib/rubygems/gem_runner.rb +2 -2
- data/lib/rubygems/gemcutter_utilities.rb +40 -13
- data/lib/rubygems/indexer.rb +19 -12
- data/lib/rubygems/install_default_message.rb +0 -1
- data/lib/rubygems/install_message.rb +0 -1
- data/lib/rubygems/install_update_options.rb +2 -28
- data/lib/rubygems/installer.rb +95 -75
- data/lib/rubygems/installer_test_case.rb +0 -14
- data/lib/rubygems/local_remote_options.rb +5 -4
- data/lib/rubygems/mock_gem_ui.rb +3 -4
- data/lib/rubygems/name_tuple.rb +4 -4
- data/lib/rubygems/package.rb +90 -73
- data/lib/rubygems/package/digest_io.rb +3 -4
- data/lib/rubygems/package/file_source.rb +3 -4
- data/lib/rubygems/package/io_source.rb +1 -2
- data/lib/rubygems/package/old.rb +8 -16
- data/lib/rubygems/package/source.rb +0 -1
- data/lib/rubygems/package/tar_header.rb +2 -2
- data/lib/rubygems/package/tar_reader.rb +2 -4
- data/lib/rubygems/package/tar_reader/entry.rb +20 -4
- data/lib/rubygems/package/tar_test_case.rb +2 -8
- data/lib/rubygems/package/tar_writer.rb +13 -15
- data/lib/rubygems/package_task.rb +0 -1
- data/lib/rubygems/path_support.rb +16 -6
- data/lib/rubygems/platform.rb +4 -5
- data/lib/rubygems/psych_tree.rb +1 -1
- data/lib/rubygems/rdoc.rb +0 -311
- data/lib/rubygems/remote_fetcher.rb +34 -48
- data/lib/rubygems/request.rb +16 -15
- data/lib/rubygems/request/connection_pools.rb +24 -13
- data/lib/rubygems/request/http_pool.rb +3 -4
- data/lib/rubygems/request/https_pool.rb +1 -3
- data/lib/rubygems/request_set.rb +52 -25
- data/lib/rubygems/request_set/gem_dependency_api.rb +36 -40
- data/lib/rubygems/request_set/lockfile.rb +12 -12
- data/lib/rubygems/request_set/lockfile/parser.rb +18 -29
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +9 -9
- data/lib/rubygems/requirement.rb +16 -16
- data/lib/rubygems/resolver.rb +10 -15
- data/lib/rubygems/resolver/activation_request.rb +6 -6
- data/lib/rubygems/resolver/api_set.rb +5 -6
- data/lib/rubygems/resolver/api_specification.rb +2 -3
- data/lib/rubygems/resolver/best_set.rb +5 -6
- data/lib/rubygems/resolver/composed_set.rb +5 -6
- data/lib/rubygems/resolver/conflict.rb +5 -5
- data/lib/rubygems/resolver/current_set.rb +1 -2
- data/lib/rubygems/resolver/dependency_request.rb +4 -4
- data/lib/rubygems/resolver/git_set.rb +5 -6
- data/lib/rubygems/resolver/git_specification.rb +4 -5
- data/lib/rubygems/resolver/index_set.rb +5 -6
- data/lib/rubygems/resolver/index_specification.rb +3 -4
- data/lib/rubygems/resolver/installed_specification.rb +3 -4
- data/lib/rubygems/resolver/installer_set.rb +12 -12
- data/lib/rubygems/resolver/local_specification.rb +1 -2
- data/lib/rubygems/resolver/lock_set.rb +5 -6
- data/lib/rubygems/resolver/lock_specification.rb +7 -8
- data/lib/rubygems/resolver/requirement_list.rb +1 -1
- data/lib/rubygems/resolver/set.rb +2 -2
- data/lib/rubygems/resolver/source_set.rb +4 -5
- data/lib/rubygems/resolver/spec_specification.rb +1 -2
- data/lib/rubygems/resolver/specification.rb +10 -7
- data/lib/rubygems/resolver/stats.rb +1 -1
- data/lib/rubygems/resolver/vendor_set.rb +4 -5
- data/lib/rubygems/resolver/vendor_specification.rb +2 -3
- data/lib/rubygems/safe_yaml.rb +18 -10
- data/lib/rubygems/security.rb +21 -22
- data/lib/rubygems/security/policies.rb +1 -2
- data/lib/rubygems/security/policy.rb +25 -25
- data/lib/rubygems/security/signer.rb +72 -24
- data/lib/rubygems/security/trust_dir.rb +10 -10
- data/lib/rubygems/server.rb +21 -21
- data/lib/rubygems/source.rb +16 -25
- data/lib/rubygems/source/git.rb +9 -10
- data/lib/rubygems/source/installed.rb +3 -4
- data/lib/rubygems/source/local.rb +7 -7
- data/lib/rubygems/source/lock.rb +4 -4
- data/lib/rubygems/source/specific_file.rb +5 -5
- data/lib/rubygems/source/vendor.rb +2 -3
- data/lib/rubygems/source_list.rb +2 -2
- data/lib/rubygems/source_local.rb +0 -1
- data/lib/rubygems/spec_fetcher.rb +5 -6
- data/lib/rubygems/specification.rb +199 -536
- data/lib/rubygems/specification_policy.rb +407 -0
- data/lib/rubygems/stub_specification.rb +11 -15
- data/lib/rubygems/test_case.rb +141 -66
- data/lib/rubygems/test_utilities.rb +20 -35
- data/lib/rubygems/text.rb +6 -6
- data/lib/rubygems/uninstaller.rb +37 -26
- data/lib/rubygems/uri_formatter.rb +1 -2
- data/lib/rubygems/user_interaction.rb +38 -93
- data/lib/rubygems/util.rb +20 -14
- data/lib/rubygems/util/licenses.rb +27 -1
- data/lib/rubygems/util/list.rb +1 -1
- data/lib/rubygems/validator.rb +4 -5
- data/lib/rubygems/version.rb +15 -15
- data/lib/rubygems/version_option.rb +2 -3
- data/rubygems-update.gemspec +43 -0
- data/setup.rb +2 -8
- data/test/rubygems/rubygems_plugin.rb +0 -1
- data/test/rubygems/simple_gem.rb +1 -1
- data/test/rubygems/test_config.rb +7 -2
- data/test/rubygems/test_gem.rb +161 -130
- data/test/rubygems/test_gem_command.rb +0 -1
- data/test/rubygems/test_gem_command_manager.rb +8 -3
- data/test/rubygems/test_gem_commands_build_command.rb +219 -15
- data/test/rubygems/test_gem_commands_cert_command.rb +69 -8
- data/test/rubygems/test_gem_commands_check_command.rb +1 -1
- data/test/rubygems/test_gem_commands_cleanup_command.rb +27 -1
- data/test/rubygems/test_gem_commands_contents_command.rb +1 -2
- data/test/rubygems/test_gem_commands_dependency_command.rb +33 -34
- data/test/rubygems/test_gem_commands_environment_command.rb +1 -0
- data/test/rubygems/test_gem_commands_fetch_command.rb +0 -1
- data/test/rubygems/test_gem_commands_generate_index_command.rb +0 -1
- data/test/rubygems/test_gem_commands_help_command.rb +7 -4
- data/test/rubygems/test_gem_commands_info_command.rb +44 -0
- data/test/rubygems/test_gem_commands_install_command.rb +79 -12
- data/test/rubygems/test_gem_commands_lock_command.rb +0 -1
- data/test/rubygems/test_gem_commands_open_command.rb +29 -0
- data/test/rubygems/test_gem_commands_outdated_command.rb +0 -1
- data/test/rubygems/test_gem_commands_owner_command.rb +93 -57
- data/test/rubygems/test_gem_commands_pristine_command.rb +65 -30
- data/test/rubygems/test_gem_commands_push_command.rb +39 -0
- data/test/rubygems/test_gem_commands_query_command.rb +102 -100
- data/test/rubygems/test_gem_commands_search_command.rb +0 -1
- data/test/rubygems/test_gem_commands_server_command.rb +0 -1
- data/test/rubygems/test_gem_commands_setup_command.rb +39 -8
- data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
- data/test/rubygems/test_gem_commands_sources_command.rb +0 -1
- data/test/rubygems/test_gem_commands_specification_command.rb +2 -3
- data/test/rubygems/test_gem_commands_stale_command.rb +3 -2
- data/test/rubygems/test_gem_commands_uninstall_command.rb +81 -7
- data/test/rubygems/test_gem_commands_unpack_command.rb +17 -1
- data/test/rubygems/test_gem_commands_update_command.rb +19 -2
- data/test/rubygems/test_gem_commands_which_command.rb +0 -1
- data/test/rubygems/test_gem_commands_yank_command.rb +0 -1
- data/test/rubygems/test_gem_config_file.rb +4 -2
- data/test/rubygems/test_gem_dependency.rb +0 -1
- data/test/rubygems/test_gem_dependency_installer.rb +8 -5
- data/test/rubygems/test_gem_dependency_list.rb +6 -7
- data/test/rubygems/test_gem_dependency_resolution_error.rb +0 -1
- data/test/rubygems/test_gem_doctor.rb +1 -2
- data/test/rubygems/test_gem_ext_builder.rb +10 -23
- data/test/rubygems/test_gem_ext_cmake_builder.rb +5 -4
- data/test/rubygems/test_gem_ext_configure_builder.rb +3 -3
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +8 -9
- data/test/rubygems/test_gem_ext_rake_builder.rb +20 -5
- data/test/rubygems/test_gem_gem_runner.rb +0 -1
- data/test/rubygems/test_gem_gemcutter_utilities.rb +32 -6
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -1
- data/test/rubygems/test_gem_indexer.rb +1 -2
- data/test/rubygems/test_gem_install_update_options.rb +1 -20
- data/test/rubygems/test_gem_installer.rb +69 -203
- data/test/rubygems/test_gem_local_remote_options.rb +3 -3
- data/test/rubygems/test_gem_name_tuple.rb +0 -1
- data/test/rubygems/test_gem_package.rb +59 -50
- data/test/rubygems/test_gem_package_old.rb +0 -1
- data/test/rubygems/test_gem_package_tar_header.rb +1 -2
- data/test/rubygems/test_gem_package_tar_reader.rb +0 -1
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +11 -0
- data/test/rubygems/test_gem_package_tar_writer.rb +40 -7
- data/test/rubygems/test_gem_package_task.rb +2 -2
- data/test/rubygems/test_gem_path_support.rb +28 -11
- data/test/rubygems/test_gem_platform.rb +4 -5
- data/test/rubygems/test_gem_rdoc.rb +1 -2
- data/test/rubygems/test_gem_remote_fetcher.rb +111 -130
- data/test/rubygems/test_gem_request.rb +5 -5
- data/test/rubygems/test_gem_request_connection_pools.rb +24 -3
- data/test/rubygems/test_gem_request_set.rb +5 -5
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +2 -7
- data/test/rubygems/test_gem_request_set_lockfile.rb +1 -2
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +4 -9
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
- data/test/rubygems/test_gem_requirement.rb +18 -4
- data/test/rubygems/test_gem_resolver.rb +13 -17
- data/test/rubygems/test_gem_resolver_activation_request.rb +0 -1
- data/test/rubygems/test_gem_resolver_api_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_api_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_best_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_composed_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_conflict.rb +0 -1
- data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -1
- data/test/rubygems/test_gem_resolver_git_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_git_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_index_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_index_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_installer_set.rb +2 -3
- data/test/rubygems/test_gem_resolver_local_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_lock_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -1
- data/test/rubygems/test_gem_resolver_specification.rb +1 -2
- data/test/rubygems/test_gem_resolver_vendor_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -1
- data/test/rubygems/test_gem_security.rb +1 -3
- data/test/rubygems/test_gem_security_policy.rb +4 -5
- data/test/rubygems/test_gem_security_signer.rb +4 -3
- data/test/rubygems/test_gem_security_trust_dir.rb +1 -2
- data/test/rubygems/test_gem_server.rb +4 -4
- data/test/rubygems/test_gem_source.rb +0 -13
- data/test/rubygems/test_gem_source_fetch_problem.rb +0 -1
- data/test/rubygems/test_gem_source_git.rb +0 -1
- data/test/rubygems/test_gem_source_installed.rb +0 -1
- data/test/rubygems/test_gem_source_lock.rb +0 -1
- data/test/rubygems/test_gem_source_vendor.rb +0 -1
- data/test/rubygems/test_gem_spec_fetcher.rb +0 -1
- data/test/rubygems/test_gem_specification.rb +334 -198
- data/test/rubygems/test_gem_stream_ui.rb +13 -30
- data/test/rubygems/test_gem_stub_specification.rb +0 -2
- data/test/rubygems/test_gem_text.rb +4 -5
- data/test/rubygems/test_gem_uninstaller.rb +21 -1
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -1
- data/test/rubygems/test_gem_uri_formatter.rb +0 -1
- data/test/rubygems/test_gem_util.rb +6 -11
- data/test/rubygems/test_gem_validator.rb +0 -1
- data/test/rubygems/test_gem_version.rb +11 -11
- data/test/rubygems/test_gem_version_option.rb +0 -1
- data/test/rubygems/test_remote_fetch_error.rb +0 -1
- data/test/rubygems/test_require.rb +67 -52
- data/util/CL2notes +1 -2
- data/util/ci +15 -12
- data/util/create_certs.rb +6 -7
- data/util/create_encrypted_key.rb +0 -1
- data/util/patch_with_prs.rb +1 -1
- data/util/rubocop +8 -0
- data/util/update_bundled_ca_certificates.rb +12 -13
- data/util/update_changelog.rb +1 -1
- metadata +61 -53
- data/.autotest +0 -71
- data/.document +0 -5
- data/CONTRIBUTING.rdoc +0 -130
- data/CVE-2013-4287.txt +0 -35
- data/CVE-2013-4363.txt +0 -45
- data/CVE-2015-3900.txt +0 -40
- data/POLICIES.rdoc +0 -74
- data/test/rubygems/fix_openssl_warnings.rb +0 -13
data/lib/rubygems/test_case.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# TODO: $SAFE = 1
|
3
3
|
|
4
4
|
begin
|
5
|
-
gem 'minitest', '~>
|
5
|
+
gem 'minitest', '~> 5.0'
|
6
6
|
rescue NoMethodError, Gem::LoadError
|
7
7
|
# for ruby tests
|
8
8
|
end
|
@@ -13,11 +13,30 @@ else
|
|
13
13
|
require 'rubygems'
|
14
14
|
end
|
15
15
|
|
16
|
+
# If bundler gemspec exists, add to stubs
|
17
|
+
bundler_gemspec = File.expand_path("../../../bundler/bundler.gemspec", __FILE__)
|
18
|
+
if File.exist?(bundler_gemspec)
|
19
|
+
Gem::Specification.dirs.unshift File.dirname(bundler_gemspec)
|
20
|
+
Gem::Specification.class_variable_set :@@stubs, nil
|
21
|
+
Gem::Specification.stubs
|
22
|
+
Gem::Specification.dirs.shift
|
23
|
+
end
|
24
|
+
|
16
25
|
begin
|
17
26
|
gem 'minitest'
|
18
27
|
rescue Gem::LoadError
|
19
28
|
end
|
20
29
|
|
30
|
+
begin
|
31
|
+
require 'simplecov'
|
32
|
+
SimpleCov.start do
|
33
|
+
add_filter "/test/"
|
34
|
+
add_filter "/bundler/"
|
35
|
+
add_filter "/lib/rubygems/resolver/molinillo"
|
36
|
+
end
|
37
|
+
rescue LoadError
|
38
|
+
end
|
39
|
+
|
21
40
|
# We have to load these up front because otherwise we'll try to load
|
22
41
|
# them while we're testing rubygems, and thus we can't actually load them.
|
23
42
|
unless Gem::Dependency.new('rdoc', '>= 3.10').matching_specs.empty?
|
@@ -65,7 +84,7 @@ module Gem
|
|
65
84
|
# Allows setting path to Ruby. This method is available when requiring
|
66
85
|
# 'rubygems/test_case'
|
67
86
|
|
68
|
-
def self.ruby=
|
87
|
+
def self.ruby=(ruby)
|
69
88
|
@ruby = ruby
|
70
89
|
end
|
71
90
|
|
@@ -96,7 +115,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
96
115
|
|
97
116
|
attr_accessor :uri # :nodoc:
|
98
117
|
|
99
|
-
def assert_activate
|
118
|
+
def assert_activate(expected, *specs)
|
100
119
|
specs.each do |spec|
|
101
120
|
case spec
|
102
121
|
when String then
|
@@ -114,7 +133,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
114
133
|
end
|
115
134
|
|
116
135
|
# TODO: move to minitest
|
117
|
-
def assert_path_exists
|
136
|
+
def assert_path_exists(path, msg = nil)
|
118
137
|
msg = message(msg) { "Expected path '#{path}' to exist" }
|
119
138
|
assert File.exist?(path), msg
|
120
139
|
end
|
@@ -123,13 +142,13 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
123
142
|
# Sets the ENABLE_SHARED entry in RbConfig::CONFIG to +value+ and restores
|
124
143
|
# the original value when the block ends
|
125
144
|
|
126
|
-
def enable_shared
|
145
|
+
def enable_shared(value)
|
127
146
|
enable_shared = RbConfig::CONFIG['ENABLE_SHARED']
|
128
147
|
RbConfig::CONFIG['ENABLE_SHARED'] = value
|
129
148
|
|
130
149
|
yield
|
131
150
|
ensure
|
132
|
-
if enable_shared
|
151
|
+
if enable_shared
|
133
152
|
RbConfig::CONFIG['enable_shared'] = enable_shared
|
134
153
|
else
|
135
154
|
RbConfig::CONFIG.delete 'enable_shared'
|
@@ -137,7 +156,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
137
156
|
end
|
138
157
|
|
139
158
|
# TODO: move to minitest
|
140
|
-
def refute_path_exists
|
159
|
+
def refute_path_exists(path, msg = nil)
|
141
160
|
msg = message(msg) { "Expected path '#{path}' to not exist" }
|
142
161
|
refute File.exist?(path), msg
|
143
162
|
end
|
@@ -251,7 +270,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
251
270
|
tmpdir = File.expand_path Dir.tmpdir
|
252
271
|
tmpdir.untaint
|
253
272
|
|
254
|
-
if ENV['KEEP_FILES']
|
273
|
+
if ENV['KEEP_FILES']
|
255
274
|
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}.#{Time.now.to_i}")
|
256
275
|
else
|
257
276
|
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}")
|
@@ -285,7 +304,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
285
304
|
@userhome = File.join @tempdir, 'userhome'
|
286
305
|
ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'
|
287
306
|
|
288
|
-
@orig_ruby = if ENV['RUBY']
|
307
|
+
@orig_ruby = if ENV['RUBY']
|
289
308
|
ruby = Gem.ruby
|
290
309
|
Gem.ruby = ENV['RUBY']
|
291
310
|
ruby
|
@@ -372,6 +391,11 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
372
391
|
util_set_arch 'i686-darwin8.10.1'
|
373
392
|
end
|
374
393
|
|
394
|
+
@orig_hooks = {}
|
395
|
+
%w[post_install_hooks done_installing_hooks post_uninstall_hooks pre_uninstall_hooks pre_install_hooks pre_reset_hooks post_reset_hooks post_build_hooks].each do |name|
|
396
|
+
@orig_hooks[name] = Gem.send(name).dup
|
397
|
+
end
|
398
|
+
|
375
399
|
@marshal_version = "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}"
|
376
400
|
@orig_LOADED_FEATURES = $LOADED_FEATURES.dup
|
377
401
|
end
|
@@ -402,7 +426,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
402
426
|
end
|
403
427
|
RbConfig::CONFIG['arch'] = @orig_arch
|
404
428
|
|
405
|
-
if defined? Gem::RemoteFetcher
|
429
|
+
if defined? Gem::RemoteFetcher
|
406
430
|
Gem::RemoteFetcher.fetcher = nil
|
407
431
|
end
|
408
432
|
|
@@ -425,7 +449,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
425
449
|
|
426
450
|
Gem.ruby = @orig_ruby if @orig_ruby
|
427
451
|
|
428
|
-
if @orig_ENV_HOME
|
452
|
+
if @orig_ENV_HOME
|
429
453
|
ENV['HOME'] = @orig_ENV_HOME
|
430
454
|
else
|
431
455
|
ENV.delete 'HOME'
|
@@ -439,6 +463,10 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
439
463
|
Gem::Specification.unresolved_deps.clear
|
440
464
|
Gem::refresh
|
441
465
|
|
466
|
+
@orig_hooks.each do |name, hooks|
|
467
|
+
Gem.send(name).replace hooks
|
468
|
+
end
|
469
|
+
|
442
470
|
@back_ui.close
|
443
471
|
end
|
444
472
|
|
@@ -485,7 +513,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
485
513
|
#
|
486
514
|
# Yields the +specification+ to the block, if given
|
487
515
|
|
488
|
-
def git_gem
|
516
|
+
def git_gem(name = 'a', version = 1)
|
489
517
|
have_git?
|
490
518
|
|
491
519
|
directory = File.join 'git', name
|
@@ -506,7 +534,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
506
534
|
head = nil
|
507
535
|
|
508
536
|
Dir.chdir directory do
|
509
|
-
unless File.exist? '.git'
|
537
|
+
unless File.exist? '.git'
|
510
538
|
system @git, 'init', '--quiet'
|
511
539
|
system @git, 'config', 'user.name', 'RubyGems Tests'
|
512
540
|
system @git, 'config', 'user.email', 'rubygems@example'
|
@@ -529,7 +557,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
529
557
|
skip 'cannot find git executable, use GIT environment variable to set'
|
530
558
|
end
|
531
559
|
|
532
|
-
def in_path?
|
560
|
+
def in_path?(executable) # :nodoc:
|
533
561
|
return true if %r%\A([A-Z]:|/)% =~ executable and File.exist? executable
|
534
562
|
|
535
563
|
ENV['PATH'].split(File::PATH_SEPARATOR).any? do |directory|
|
@@ -540,12 +568,12 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
540
568
|
##
|
541
569
|
# Builds and installs the Gem::Specification +spec+
|
542
570
|
|
543
|
-
def install_gem
|
571
|
+
def install_gem(spec, options = {})
|
544
572
|
require 'rubygems/installer'
|
545
573
|
|
546
574
|
gem = File.join @tempdir, "gems", "#{spec.full_name}.gem"
|
547
575
|
|
548
|
-
unless File.exist? gem
|
576
|
+
unless File.exist? gem
|
549
577
|
use_ui Gem::MockGemUi.new do
|
550
578
|
Dir.chdir @tempdir do
|
551
579
|
Gem::Package.build spec
|
@@ -561,17 +589,17 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
561
589
|
##
|
562
590
|
# Builds and installs the Gem::Specification +spec+ into the user dir
|
563
591
|
|
564
|
-
def install_gem_user
|
592
|
+
def install_gem_user(spec)
|
565
593
|
install_gem spec, :user_install => true
|
566
594
|
end
|
567
595
|
|
568
596
|
##
|
569
597
|
# Uninstalls the Gem::Specification +spec+
|
570
|
-
def uninstall_gem
|
598
|
+
def uninstall_gem(spec)
|
571
599
|
require 'rubygems/uninstaller'
|
572
600
|
|
573
601
|
Class.new(Gem::Uninstaller) {
|
574
|
-
def ask_if_ok
|
602
|
+
def ask_if_ok(spec)
|
575
603
|
true
|
576
604
|
end
|
577
605
|
}.new(spec.name, :executables => true, :user_install => true).uninstall
|
@@ -595,7 +623,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
595
623
|
def mu_pp(obj)
|
596
624
|
s = String.new
|
597
625
|
s = PP.pp obj, s
|
598
|
-
s = s.force_encoding(Encoding.default_external)
|
626
|
+
s = s.force_encoding(Encoding.default_external)
|
599
627
|
s.chomp
|
600
628
|
end
|
601
629
|
|
@@ -676,7 +704,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
676
704
|
##
|
677
705
|
# TODO: remove in RubyGems 4.0
|
678
706
|
|
679
|
-
def quick_spec
|
707
|
+
def quick_spec(name, version = '2') # :nodoc:
|
680
708
|
util_spec name, version
|
681
709
|
end
|
682
710
|
deprecate :quick_spec, :util_spec, 2018, 12
|
@@ -780,7 +808,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
780
808
|
#
|
781
809
|
# TODO: remove in RubyGems 4.0
|
782
810
|
|
783
|
-
def new_spec
|
811
|
+
def new_spec(name, version, deps = nil, *files) # :nodoc:
|
784
812
|
require 'rubygems/specification'
|
785
813
|
|
786
814
|
spec = Gem::Specification.new do |s|
|
@@ -804,7 +832,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
804
832
|
|
805
833
|
spec.loaded_from = spec.spec_file
|
806
834
|
|
807
|
-
unless files.empty?
|
835
|
+
unless files.empty?
|
808
836
|
write_file spec.spec_file do |io|
|
809
837
|
io.write spec.to_ruby_for_cache
|
810
838
|
end
|
@@ -819,8 +847,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
819
847
|
|
820
848
|
spec
|
821
849
|
end
|
822
|
-
|
823
|
-
# deprecate :new_spec, :none, 2018, 12
|
850
|
+
deprecate :new_spec, :none, 2018, 12
|
824
851
|
|
825
852
|
def new_default_spec(name, version, deps = nil, *files)
|
826
853
|
spec = util_spec name, version, deps
|
@@ -845,7 +872,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
845
872
|
# Creates a spec with +name+, +version+. +deps+ can specify the dependency
|
846
873
|
# or a +block+ can be given for full customization of the specification.
|
847
874
|
|
848
|
-
def util_spec
|
875
|
+
def util_spec(name, version = 2, deps = nil, *files) # :yields: specification
|
849
876
|
raise "deps or block, not both" if deps and block_given?
|
850
877
|
|
851
878
|
spec = Gem::Specification.new do |s|
|
@@ -858,10 +885,12 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
858
885
|
s.summary = "this is a summary"
|
859
886
|
s.description = "This is a test description"
|
860
887
|
|
888
|
+
s.files.push(*files) unless files.empty?
|
889
|
+
|
861
890
|
yield s if block_given?
|
862
891
|
end
|
863
892
|
|
864
|
-
if deps
|
893
|
+
if deps
|
865
894
|
# Since Hash#each is unordered in 1.8, sort the keys and iterate that
|
866
895
|
# way so the tests are deterministic on all implementations.
|
867
896
|
deps.keys.sort.each do |n|
|
@@ -869,6 +898,19 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
869
898
|
end
|
870
899
|
end
|
871
900
|
|
901
|
+
unless files.empty?
|
902
|
+
write_file spec.spec_file do |io|
|
903
|
+
io.write spec.to_ruby_for_cache
|
904
|
+
end
|
905
|
+
|
906
|
+
util_build_gem spec
|
907
|
+
|
908
|
+
cache_file = File.join @tempdir, 'gems', "#{spec.full_name}.gem"
|
909
|
+
FileUtils.mkdir_p File.dirname cache_file
|
910
|
+
FileUtils.mv spec.cache_file, cache_file
|
911
|
+
FileUtils.rm spec.spec_file
|
912
|
+
end
|
913
|
+
|
872
914
|
Gem::Specification.reset
|
873
915
|
|
874
916
|
return spec
|
@@ -884,7 +926,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
884
926
|
# TODO: deprecate
|
885
927
|
raise "deps or block, not both" if deps and block
|
886
928
|
|
887
|
-
if deps
|
929
|
+
if deps
|
888
930
|
block = proc do |s|
|
889
931
|
# Since Hash#each is unordered in 1.8, sort
|
890
932
|
# the keys and iterate that way so the tests are
|
@@ -1080,7 +1122,7 @@ Also, a list:
|
|
1080
1122
|
end
|
1081
1123
|
|
1082
1124
|
# HACK for test_download_to_cache
|
1083
|
-
unless Gem::RemoteFetcher === @fetcher
|
1125
|
+
unless Gem::RemoteFetcher === @fetcher
|
1084
1126
|
v = Gem.marshal_version
|
1085
1127
|
|
1086
1128
|
specs = all.map { |spec| spec.name_tuple }
|
@@ -1119,35 +1161,51 @@ Also, a list:
|
|
1119
1161
|
Zlib::Deflate.deflate data
|
1120
1162
|
end
|
1121
1163
|
|
1122
|
-
def util_set_RUBY_VERSION(version, patchlevel = nil, revision = nil)
|
1164
|
+
def util_set_RUBY_VERSION(version, patchlevel = nil, revision = nil, description = nil, engine = "ruby", engine_version = nil)
|
1123
1165
|
if Gem.instance_variables.include? :@ruby_version or
|
1124
|
-
Gem.instance_variables.include? '@ruby_version'
|
1166
|
+
Gem.instance_variables.include? '@ruby_version'
|
1125
1167
|
Gem.send :remove_instance_variable, :@ruby_version
|
1126
1168
|
end
|
1127
1169
|
|
1128
|
-
@RUBY_VERSION
|
1129
|
-
@RUBY_PATCHLEVEL
|
1130
|
-
@RUBY_REVISION
|
1170
|
+
@RUBY_VERSION = RUBY_VERSION
|
1171
|
+
@RUBY_PATCHLEVEL = RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1172
|
+
@RUBY_REVISION = RUBY_REVISION if defined?(RUBY_REVISION)
|
1173
|
+
@RUBY_DESCRIPTION = RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION)
|
1174
|
+
@RUBY_ENGINE = RUBY_ENGINE
|
1175
|
+
@RUBY_ENGINE_VERSION = RUBY_ENGINE_VERSION if defined?(RUBY_ENGINE_VERSION)
|
1131
1176
|
|
1132
|
-
|
1133
|
-
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1134
|
-
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
1177
|
+
util_clear_RUBY_VERSION
|
1135
1178
|
|
1136
|
-
Object.const_set :RUBY_VERSION,
|
1137
|
-
Object.const_set :RUBY_PATCHLEVEL,
|
1138
|
-
Object.const_set :RUBY_REVISION,
|
1179
|
+
Object.const_set :RUBY_VERSION, version
|
1180
|
+
Object.const_set :RUBY_PATCHLEVEL, patchlevel if patchlevel
|
1181
|
+
Object.const_set :RUBY_REVISION, revision if revision
|
1182
|
+
Object.const_set :RUBY_DESCRIPTION, description if description
|
1183
|
+
Object.const_set :RUBY_ENGINE, engine
|
1184
|
+
Object.const_set :RUBY_ENGINE_VERSION, engine_version if engine_version
|
1139
1185
|
end
|
1140
1186
|
|
1141
1187
|
def util_restore_RUBY_VERSION
|
1142
|
-
|
1143
|
-
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1144
|
-
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
1188
|
+
util_clear_RUBY_VERSION
|
1145
1189
|
|
1146
|
-
Object.const_set :RUBY_VERSION,
|
1147
|
-
Object.const_set :RUBY_PATCHLEVEL,
|
1190
|
+
Object.const_set :RUBY_VERSION, @RUBY_VERSION
|
1191
|
+
Object.const_set :RUBY_PATCHLEVEL, @RUBY_PATCHLEVEL if
|
1148
1192
|
defined?(@RUBY_PATCHLEVEL)
|
1149
|
-
Object.const_set :RUBY_REVISION,
|
1193
|
+
Object.const_set :RUBY_REVISION, @RUBY_REVISION if
|
1150
1194
|
defined?(@RUBY_REVISION)
|
1195
|
+
Object.const_set :RUBY_DESCRIPTION, @RUBY_DESCRIPTION if
|
1196
|
+
defined?(@RUBY_DESCRIPTION)
|
1197
|
+
Object.const_set :RUBY_ENGINE, @RUBY_ENGINE
|
1198
|
+
Object.const_set :RUBY_ENGINE_VERSION, @RUBY_ENGINE_VERSION if
|
1199
|
+
defined?(@RUBY_ENGINE_VERSION)
|
1200
|
+
end
|
1201
|
+
|
1202
|
+
def util_clear_RUBY_VERSION
|
1203
|
+
Object.send :remove_const, :RUBY_VERSION
|
1204
|
+
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1205
|
+
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
1206
|
+
Object.send :remove_const, :RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION)
|
1207
|
+
Object.send :remove_const, :RUBY_ENGINE
|
1208
|
+
Object.send :remove_const, :RUBY_ENGINE_VERSION if defined?(RUBY_ENGINE_VERSION)
|
1151
1209
|
end
|
1152
1210
|
|
1153
1211
|
##
|
@@ -1277,14 +1335,31 @@ Also, a list:
|
|
1277
1335
|
end
|
1278
1336
|
end
|
1279
1337
|
|
1338
|
+
class << self
|
1339
|
+
# :nodoc:
|
1340
|
+
##
|
1341
|
+
# Return the join path, with escaping backticks, dollars, and
|
1342
|
+
# double-quotes. Unlike `shellescape`, equal-sign is not escaped.
|
1343
|
+
private
|
1344
|
+
def escape_path(*path)
|
1345
|
+
path = File.join(*path)
|
1346
|
+
if %r'\A[-+:/=@,.\w]+\z' =~ path
|
1347
|
+
path
|
1348
|
+
else
|
1349
|
+
"\"#{path.gsub(/[`$"]/, '\\&')}\""
|
1350
|
+
end
|
1351
|
+
end
|
1352
|
+
end
|
1353
|
+
|
1280
1354
|
@@ruby = rubybin
|
1281
|
-
|
1282
|
-
@@
|
1355
|
+
gempath = File.expand_path('../../../test/rubygems', __FILE__)
|
1356
|
+
@@good_rake = "#{rubybin} #{escape_path(gempath, 'good_rake.rb')}"
|
1357
|
+
@@bad_rake = "#{rubybin} #{escape_path(gempath, 'bad_rake.rb')}"
|
1283
1358
|
|
1284
1359
|
##
|
1285
1360
|
# Construct a new Gem::Dependency.
|
1286
1361
|
|
1287
|
-
def dep
|
1362
|
+
def dep(name, *requirements)
|
1288
1363
|
Gem::Dependency.new name, *requirements
|
1289
1364
|
end
|
1290
1365
|
|
@@ -1293,10 +1368,10 @@ Also, a list:
|
|
1293
1368
|
# Gem::Dependency +dep+, a +from_name+ and +from_version+ requesting the
|
1294
1369
|
# dependency and a +parent+ DependencyRequest
|
1295
1370
|
|
1296
|
-
def dependency_request
|
1371
|
+
def dependency_request(dep, from_name, from_version, parent = nil)
|
1297
1372
|
remote = Gem::Source.new @uri
|
1298
1373
|
|
1299
|
-
unless parent
|
1374
|
+
unless parent
|
1300
1375
|
parent_dep = dep from_name, from_version
|
1301
1376
|
parent = Gem::Resolver::DependencyRequest.new parent_dep, nil
|
1302
1377
|
end
|
@@ -1311,7 +1386,7 @@ Also, a list:
|
|
1311
1386
|
##
|
1312
1387
|
# Constructs a new Gem::Requirement.
|
1313
1388
|
|
1314
|
-
def req
|
1389
|
+
def req(*requirements)
|
1315
1390
|
return requirements.first if Gem::Requirement === requirements.first
|
1316
1391
|
Gem::Requirement.create requirements
|
1317
1392
|
end
|
@@ -1319,7 +1394,7 @@ Also, a list:
|
|
1319
1394
|
##
|
1320
1395
|
# Constructs a new Gem::Specification.
|
1321
1396
|
|
1322
|
-
def spec
|
1397
|
+
def spec(name, version, &block)
|
1323
1398
|
Gem::Specification.new name, v(version), &block
|
1324
1399
|
end
|
1325
1400
|
|
@@ -1343,7 +1418,7 @@ Also, a list:
|
|
1343
1418
|
# end
|
1344
1419
|
# end
|
1345
1420
|
|
1346
|
-
def spec_fetcher
|
1421
|
+
def spec_fetcher(repository = @gem_repo)
|
1347
1422
|
Gem::TestCase::SpecFetcherSetup.declare self, repository do |spec_fetcher_setup|
|
1348
1423
|
yield spec_fetcher_setup if block_given?
|
1349
1424
|
end
|
@@ -1352,7 +1427,7 @@ Also, a list:
|
|
1352
1427
|
##
|
1353
1428
|
# Construct a new Gem::Version.
|
1354
1429
|
|
1355
|
-
def v
|
1430
|
+
def v(string)
|
1356
1431
|
Gem::Version.create string
|
1357
1432
|
end
|
1358
1433
|
|
@@ -1362,7 +1437,7 @@ Also, a list:
|
|
1362
1437
|
#
|
1363
1438
|
# Yields the +specification+ to the block, if given
|
1364
1439
|
|
1365
|
-
def vendor_gem
|
1440
|
+
def vendor_gem(name = 'a', version = 1)
|
1366
1441
|
directory = File.join 'vendor', name
|
1367
1442
|
|
1368
1443
|
FileUtils.mkdir_p directory
|
@@ -1376,7 +1451,7 @@ Also, a list:
|
|
1376
1451
|
#
|
1377
1452
|
# Yields the +specification+ to the block, if given
|
1378
1453
|
|
1379
|
-
def save_gemspec
|
1454
|
+
def save_gemspec(name = 'a', version = 1, directory = '.')
|
1380
1455
|
vendor_spec = Gem::Specification.new name, version do |specification|
|
1381
1456
|
yield specification if block_given?
|
1382
1457
|
end
|
@@ -1413,7 +1488,7 @@ Also, a list:
|
|
1413
1488
|
##
|
1414
1489
|
# Adds +spec+ to this set.
|
1415
1490
|
|
1416
|
-
def add
|
1491
|
+
def add(spec)
|
1417
1492
|
@specs << spec
|
1418
1493
|
end
|
1419
1494
|
|
@@ -1437,7 +1512,7 @@ Also, a list:
|
|
1437
1512
|
# Loads a Gem::Specification from this set which has the given +name+,
|
1438
1513
|
# version +ver+, +platform+. The +source+ is ignored.
|
1439
1514
|
|
1440
|
-
def load_spec
|
1515
|
+
def load_spec(name, ver, platform, source)
|
1441
1516
|
dep = Gem::Dependency.new name, ver
|
1442
1517
|
spec = find_spec dep
|
1443
1518
|
|
@@ -1446,14 +1521,14 @@ Also, a list:
|
|
1446
1521
|
end
|
1447
1522
|
end
|
1448
1523
|
|
1449
|
-
def prefetch
|
1524
|
+
def prefetch(reqs) # :nodoc:
|
1450
1525
|
end
|
1451
1526
|
end
|
1452
1527
|
|
1453
1528
|
##
|
1454
1529
|
# Loads certificate named +cert_name+ from <tt>test/rubygems/</tt>.
|
1455
1530
|
|
1456
|
-
def self.load_cert
|
1531
|
+
def self.load_cert(cert_name)
|
1457
1532
|
cert_file = cert_path cert_name
|
1458
1533
|
|
1459
1534
|
cert = File.read cert_file
|
@@ -1465,8 +1540,8 @@ Also, a list:
|
|
1465
1540
|
# Returns the path to the certificate named +cert_name+ from
|
1466
1541
|
# <tt>test/rubygems/</tt>.
|
1467
1542
|
|
1468
|
-
def self.cert_path
|
1469
|
-
if 32 == (Time.at(2**32) rescue 32)
|
1543
|
+
def self.cert_path(cert_name)
|
1544
|
+
if 32 == (Time.at(2**32) rescue 32)
|
1470
1545
|
cert_file =
|
1471
1546
|
File.expand_path "../../../test/rubygems/#{cert_name}_cert_32.pem",
|
1472
1547
|
__FILE__
|
@@ -1480,7 +1555,7 @@ Also, a list:
|
|
1480
1555
|
##
|
1481
1556
|
# Loads an RSA private key named +key_name+ with +passphrase+ in <tt>test/rubygems/</tt>
|
1482
1557
|
|
1483
|
-
def self.load_key
|
1558
|
+
def self.load_key(key_name, passphrase = nil)
|
1484
1559
|
key_file = key_path key_name
|
1485
1560
|
|
1486
1561
|
key = File.read key_file
|
@@ -1491,14 +1566,14 @@ Also, a list:
|
|
1491
1566
|
##
|
1492
1567
|
# Returns the path to the key named +key_name+ from <tt>test/rubygems</tt>
|
1493
1568
|
|
1494
|
-
def self.key_path
|
1569
|
+
def self.key_path(key_name)
|
1495
1570
|
File.expand_path "../../../test/rubygems/#{key_name}_key.pem", __FILE__
|
1496
1571
|
end
|
1497
1572
|
|
1498
1573
|
# :stopdoc:
|
1499
1574
|
# only available in RubyGems tests
|
1500
1575
|
|
1501
|
-
PRIVATE_KEY_PASSPHRASE = 'Foo bar'
|
1576
|
+
PRIVATE_KEY_PASSPHRASE = 'Foo bar'.freeze
|
1502
1577
|
|
1503
1578
|
begin
|
1504
1579
|
PRIVATE_KEY = load_key 'private'
|