rubygems-update 2.7.11 → 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 +289 -19
- data/MAINTAINERS.txt +1 -0
- data/Manifest.txt +16 -11
- 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/ssl_certs/{rubygems.org → index.rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -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_bundled_ca.rb +4 -7
- 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 +15 -14
- data/util/update_changelog.rb +1 -1
- metadata +67 -59
- 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/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +0 -21
- data/test/rubygems/fix_openssl_warnings.rb +0 -13
data/test/rubygems/simple_gem.rb
CHANGED
@@ -51,16 +51,13 @@ if ENV["CI"] || ENV["TEST_SSL"]
|
|
51
51
|
assert_https('rubygems.org')
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
55
|
-
assert_https('
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_accessing_staging
|
59
|
-
assert_https('staging.rubygems.org')
|
54
|
+
def test_accessing_fastly
|
55
|
+
assert_https('rubygems.global.ssl.fastly.net')
|
60
56
|
end
|
61
57
|
|
62
58
|
def test_accessing_new_index
|
63
|
-
assert_https('
|
59
|
+
assert_https('fastly.rubygems.org')
|
64
60
|
end
|
61
|
+
|
65
62
|
end
|
66
63
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'rubygems/test_case'
|
3
3
|
require 'rubygems'
|
4
|
+
require 'shellwords'
|
4
5
|
|
5
6
|
class TestConfig < Gem::TestCase
|
6
7
|
|
@@ -13,12 +14,16 @@ class TestConfig < Gem::TestCase
|
|
13
14
|
|
14
15
|
def test_good_rake_path_is_escaped
|
15
16
|
path = Gem::TestCase.class_eval('@@good_rake')
|
16
|
-
|
17
|
+
ruby, rake = path.shellsplit
|
18
|
+
assert_equal(Gem.ruby, ruby)
|
19
|
+
assert_match(/\/good_rake.rb\z/, rake)
|
17
20
|
end
|
18
21
|
|
19
22
|
def test_bad_rake_path_is_escaped
|
20
23
|
path = Gem::TestCase.class_eval('@@bad_rake')
|
21
|
-
|
24
|
+
ruby, rake = path.shellsplit
|
25
|
+
assert_equal(Gem.ruby, ruby)
|
26
|
+
assert_match(/\/bad_rake.rb\z/, rake)
|
22
27
|
end
|
23
28
|
|
24
29
|
end
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -5,6 +5,7 @@ require 'rubygems/command'
|
|
5
5
|
require 'rubygems/installer'
|
6
6
|
require 'pathname'
|
7
7
|
require 'tmpdir'
|
8
|
+
require 'rbconfig'
|
8
9
|
|
9
10
|
# TODO: push this up to test_case.rb once battle tested
|
10
11
|
|
@@ -13,8 +14,9 @@ $LOAD_PATH.map! do |path|
|
|
13
14
|
end
|
14
15
|
|
15
16
|
class TestGem < Gem::TestCase
|
17
|
+
RUBY_INSTALL_NAME = RbConfig::CONFIG['RUBY_INSTALL_NAME']
|
16
18
|
|
17
|
-
PLUGINS_LOADED = []
|
19
|
+
PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
|
18
20
|
|
19
21
|
def setup
|
20
22
|
super
|
@@ -31,11 +33,11 @@ class TestGem < Gem::TestCase
|
|
31
33
|
|
32
34
|
def test_self_finish_resolve
|
33
35
|
save_loaded_features do
|
34
|
-
a1 =
|
35
|
-
b1 =
|
36
|
-
b2 =
|
37
|
-
c1 =
|
38
|
-
c2 =
|
36
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
37
|
+
b1 = util_spec "b", "1", "c" => ">= 1"
|
38
|
+
b2 = util_spec "b", "2", "c" => ">= 2"
|
39
|
+
c1 = util_spec "c", "1"
|
40
|
+
c2 = util_spec "c", "2"
|
39
41
|
|
40
42
|
install_specs c1, c2, b1, b2, a1
|
41
43
|
|
@@ -53,13 +55,13 @@ class TestGem < Gem::TestCase
|
|
53
55
|
|
54
56
|
def test_self_finish_resolve_wtf
|
55
57
|
save_loaded_features do
|
56
|
-
a1 =
|
57
|
-
b1 =
|
58
|
-
b2 =
|
59
|
-
c1 =
|
60
|
-
c2 =
|
61
|
-
d1 =
|
62
|
-
d2 =
|
58
|
+
a1 = util_spec "a", "1", "b" => "> 0", "d" => "> 0" # this
|
59
|
+
b1 = util_spec "b", "1", { "c" => ">= 1" }, "lib/b.rb" # this
|
60
|
+
b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/b.rb"
|
61
|
+
c1 = util_spec "c", "1" # this
|
62
|
+
c2 = util_spec "c", "2"
|
63
|
+
d1 = util_spec "d", "1", { "c" => "< 2" }, "lib/d.rb"
|
64
|
+
d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d.rb" # this
|
63
65
|
|
64
66
|
install_specs c1, c2, b1, b2, d1, d2, a1
|
65
67
|
|
@@ -77,11 +79,11 @@ class TestGem < Gem::TestCase
|
|
77
79
|
|
78
80
|
def test_self_finish_resolve_respects_loaded_specs
|
79
81
|
save_loaded_features do
|
80
|
-
a1 =
|
81
|
-
b1 =
|
82
|
-
b2 =
|
83
|
-
c1 =
|
84
|
-
c2 =
|
82
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
83
|
+
b1 = util_spec "b", "1", "c" => ">= 1"
|
84
|
+
b2 = util_spec "b", "2", "c" => ">= 2"
|
85
|
+
c1 = util_spec "c", "1"
|
86
|
+
c2 = util_spec "c", "2"
|
85
87
|
|
86
88
|
install_specs c1, c2, b1, b2, a1
|
87
89
|
|
@@ -130,6 +132,75 @@ class TestGem < Gem::TestCase
|
|
130
132
|
assert_equal %w[a-1], installed.map { |spec| spec.full_name }
|
131
133
|
end
|
132
134
|
|
135
|
+
def test_self_install_permissions
|
136
|
+
assert_self_install_permissions
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_self_install_permissions_umask_0
|
140
|
+
umask = File.umask(0)
|
141
|
+
assert_self_install_permissions
|
142
|
+
ensure
|
143
|
+
File.umask(umask)
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_self_install_permissions_umask_077
|
147
|
+
umask = File.umask(077)
|
148
|
+
assert_self_install_permissions
|
149
|
+
ensure
|
150
|
+
File.umask(umask)
|
151
|
+
end
|
152
|
+
|
153
|
+
def assert_self_install_permissions
|
154
|
+
mask = /mingw|mswin/ =~ RUBY_PLATFORM ? 0700 : 0777
|
155
|
+
options = {
|
156
|
+
:dir_mode => 0500,
|
157
|
+
:prog_mode => 0510,
|
158
|
+
:data_mode => 0640,
|
159
|
+
:wrappers => true,
|
160
|
+
}
|
161
|
+
Dir.chdir @tempdir do
|
162
|
+
Dir.mkdir 'bin'
|
163
|
+
File.open 'bin/foo.cmd', 'w' do |fp|
|
164
|
+
fp.chmod(0755)
|
165
|
+
fp.puts 'p'
|
166
|
+
end
|
167
|
+
|
168
|
+
Dir.mkdir 'data'
|
169
|
+
File.open 'data/foo.txt', 'w' do |fp|
|
170
|
+
fp.puts 'blah'
|
171
|
+
end
|
172
|
+
|
173
|
+
spec_fetcher do |f|
|
174
|
+
f.gem 'foo', 1 do |s|
|
175
|
+
s.executables = ['foo.cmd']
|
176
|
+
s.files = %w[bin/foo.cmd data/foo.txt]
|
177
|
+
end
|
178
|
+
end
|
179
|
+
Gem.install 'foo', Gem::Requirement.default, options
|
180
|
+
end
|
181
|
+
|
182
|
+
prog_mode = (options[:prog_mode] & mask).to_s(8)
|
183
|
+
dir_mode = (options[:dir_mode] & mask).to_s(8)
|
184
|
+
data_mode = (options[:data_mode] & mask).to_s(8)
|
185
|
+
expected = {
|
186
|
+
"bin/#{RUBY_INSTALL_NAME.sub('ruby', 'foo.cmd')}" => prog_mode,
|
187
|
+
'gems/foo-1' => dir_mode,
|
188
|
+
'gems/foo-1/bin' => dir_mode,
|
189
|
+
'gems/foo-1/data' => dir_mode,
|
190
|
+
'gems/foo-1/bin/foo.cmd' => prog_mode,
|
191
|
+
'gems/foo-1/data/foo.txt' => data_mode,
|
192
|
+
}
|
193
|
+
result = {}
|
194
|
+
Dir.chdir @gemhome do
|
195
|
+
expected.each_key do |n|
|
196
|
+
result[n] = (File.stat(n).mode & mask).to_s(8)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
assert_equal(expected, result)
|
200
|
+
ensure
|
201
|
+
File.chmod(0700, *Dir.glob(@gemhome+'/gems/**/').map {|path| path.untaint})
|
202
|
+
end
|
203
|
+
|
133
204
|
def test_require_missing
|
134
205
|
save_loaded_features do
|
135
206
|
assert_raises ::LoadError do
|
@@ -140,7 +211,7 @@ class TestGem < Gem::TestCase
|
|
140
211
|
|
141
212
|
def test_require_does_not_glob
|
142
213
|
save_loaded_features do
|
143
|
-
a1 =
|
214
|
+
a1 = util_spec "a", "1", nil, "lib/a1.rb"
|
144
215
|
|
145
216
|
install_specs a1
|
146
217
|
|
@@ -423,7 +494,6 @@ class TestGem < Gem::TestCase
|
|
423
494
|
end
|
424
495
|
|
425
496
|
def test_self_use_gemdeps
|
426
|
-
skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
|
427
497
|
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
|
428
498
|
|
429
499
|
FileUtils.mkdir_p 'detect/a/b'
|
@@ -498,7 +568,7 @@ class TestGem < Gem::TestCase
|
|
498
568
|
assert File.directory?(util_cache_dir)
|
499
569
|
end
|
500
570
|
|
501
|
-
unless win_platform? || Process.uid.zero?
|
571
|
+
unless win_platform? || Process.uid.zero? # only for FS that support write protection
|
502
572
|
def test_self_ensure_gem_directories_write_protected
|
503
573
|
gemdir = File.join @tempdir, "egd"
|
504
574
|
FileUtils.rm_r gemdir rescue nil
|
@@ -577,9 +647,6 @@ class TestGem < Gem::TestCase
|
|
577
647
|
end
|
578
648
|
|
579
649
|
def test_self_find_files_with_gemfile
|
580
|
-
# write_file(File.join Dir.pwd, 'Gemfile') fails on travis 1.8.7 with $SAFE=1
|
581
|
-
skip if RUBY_VERSION <= "1.8.7"
|
582
|
-
|
583
650
|
cwd = File.expand_path("test/rubygems", @@project_dir)
|
584
651
|
actual_load_path = $LOAD_PATH.unshift(cwd).dup
|
585
652
|
|
@@ -612,7 +679,7 @@ class TestGem < Gem::TestCase
|
|
612
679
|
assert_equal expected, Gem.find_files('sff/discover').sort
|
613
680
|
assert_equal expected, Gem.find_files('sff/**.rb').sort, '[ruby-core:31730]'
|
614
681
|
ensure
|
615
|
-
assert_equal cwd, actual_load_path.shift
|
682
|
+
assert_equal cwd, actual_load_path.shift
|
616
683
|
end
|
617
684
|
|
618
685
|
def test_self_find_latest_files
|
@@ -828,7 +895,6 @@ class TestGem < Gem::TestCase
|
|
828
895
|
end
|
829
896
|
|
830
897
|
def test_self_refresh
|
831
|
-
skip 'Insecure operation - mkdir' if RUBY_VERSION <= "1.8.7"
|
832
898
|
util_make_gems
|
833
899
|
|
834
900
|
a1_spec = @a1.spec_file
|
@@ -848,7 +914,6 @@ class TestGem < Gem::TestCase
|
|
848
914
|
end
|
849
915
|
|
850
916
|
def test_self_refresh_keeps_loaded_specs_activated
|
851
|
-
skip 'Insecure operation - mkdir' if RUBY_VERSION <= "1.8.7"
|
852
917
|
util_make_gems
|
853
918
|
|
854
919
|
a1_spec = @a1.spec_file
|
@@ -930,7 +995,7 @@ class TestGem < Gem::TestCase
|
|
930
995
|
assert_equal Gem::Requirement.default, Gem.env_requirement('qux')
|
931
996
|
end
|
932
997
|
|
933
|
-
def
|
998
|
+
def test_self_ruby_version_with_patchlevel_less_ancient_rubies
|
934
999
|
util_set_RUBY_VERSION '1.8.5'
|
935
1000
|
|
936
1001
|
assert_equal Gem::Version.new('1.8.5'), Gem.ruby_version
|
@@ -938,7 +1003,7 @@ class TestGem < Gem::TestCase
|
|
938
1003
|
util_restore_RUBY_VERSION
|
939
1004
|
end
|
940
1005
|
|
941
|
-
def
|
1006
|
+
def test_self_ruby_version_with_release
|
942
1007
|
util_set_RUBY_VERSION '1.8.6', 287
|
943
1008
|
|
944
1009
|
assert_equal Gem::Version.new('1.8.6.287'), Gem.ruby_version
|
@@ -946,10 +1011,34 @@ class TestGem < Gem::TestCase
|
|
946
1011
|
util_restore_RUBY_VERSION
|
947
1012
|
end
|
948
1013
|
|
949
|
-
def
|
950
|
-
util_set_RUBY_VERSION '
|
1014
|
+
def test_self_ruby_version_with_non_mri_implementations
|
1015
|
+
util_set_RUBY_VERSION '2.5.0', 0, 60928, 'jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]'
|
1016
|
+
|
1017
|
+
assert_equal Gem::Version.new('2.5.0'), Gem.ruby_version
|
1018
|
+
ensure
|
1019
|
+
util_restore_RUBY_VERSION
|
1020
|
+
end
|
1021
|
+
|
1022
|
+
def test_self_ruby_version_with_prerelease
|
1023
|
+
util_set_RUBY_VERSION '2.6.0', -1, 63539, 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]'
|
951
1024
|
|
952
|
-
assert_equal Gem::Version.new('
|
1025
|
+
assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
|
1026
|
+
ensure
|
1027
|
+
util_restore_RUBY_VERSION
|
1028
|
+
end
|
1029
|
+
|
1030
|
+
def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
|
1031
|
+
util_set_RUBY_VERSION '2.6.0', -1, 63539, 'weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]', 'weirdjruby', '9.2.0.0'
|
1032
|
+
|
1033
|
+
assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
|
1034
|
+
ensure
|
1035
|
+
util_restore_RUBY_VERSION
|
1036
|
+
end
|
1037
|
+
|
1038
|
+
def test_self_ruby_version_with_trunk
|
1039
|
+
util_set_RUBY_VERSION '1.9.2', -1, 23493, 'ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]'
|
1040
|
+
|
1041
|
+
assert_equal Gem::Version.new('1.9.2.dev'), Gem.ruby_version
|
953
1042
|
ensure
|
954
1043
|
util_restore_RUBY_VERSION
|
955
1044
|
end
|
@@ -1197,7 +1286,7 @@ class TestGem < Gem::TestCase
|
|
1197
1286
|
end
|
1198
1287
|
|
1199
1288
|
def test_self_user_home
|
1200
|
-
if ENV['HOME']
|
1289
|
+
if ENV['HOME']
|
1201
1290
|
assert_equal ENV['HOME'], Gem.user_home
|
1202
1291
|
else
|
1203
1292
|
assert true, 'count this test'
|
@@ -1223,13 +1312,12 @@ class TestGem < Gem::TestCase
|
|
1223
1312
|
end
|
1224
1313
|
|
1225
1314
|
def test_self_needs_picks_up_unresolved_deps
|
1226
|
-
skip 'loading from unsafe file' if RUBY_VERSION <= "1.8.7"
|
1227
1315
|
save_loaded_features do
|
1228
1316
|
util_clear_gems
|
1229
1317
|
a = util_spec "a", "1"
|
1230
1318
|
b = util_spec "b", "1", "c" => nil
|
1231
1319
|
c = util_spec "c", "2"
|
1232
|
-
d =
|
1320
|
+
d = util_spec "d", "1", {'e' => '= 1'}, "lib/d.rb"
|
1233
1321
|
e = util_spec "e", "1"
|
1234
1322
|
|
1235
1323
|
install_specs a, c, b, e, d
|
@@ -1252,9 +1340,6 @@ class TestGem < Gem::TestCase
|
|
1252
1340
|
output = Gem::Util.gunzip input
|
1253
1341
|
|
1254
1342
|
assert_equal 'hello', output
|
1255
|
-
|
1256
|
-
return unless Object.const_defined? :Encoding
|
1257
|
-
|
1258
1343
|
assert_equal Encoding::BINARY, output.encoding
|
1259
1344
|
end
|
1260
1345
|
|
@@ -1266,55 +1351,9 @@ class TestGem < Gem::TestCase
|
|
1266
1351
|
zipped = StringIO.new output
|
1267
1352
|
|
1268
1353
|
assert_equal 'hello', Zlib::GzipReader.new(zipped).read
|
1269
|
-
|
1270
|
-
return unless Object.const_defined? :Encoding
|
1271
|
-
|
1272
1354
|
assert_equal Encoding::BINARY, output.encoding
|
1273
1355
|
end
|
1274
1356
|
|
1275
|
-
if Gem.win_platform? && '1.9' > RUBY_VERSION
|
1276
|
-
# Ruby 1.9 properly handles ~ path expansion, so no need to run such tests.
|
1277
|
-
def test_self_user_home_userprofile
|
1278
|
-
|
1279
|
-
Gem.clear_paths
|
1280
|
-
|
1281
|
-
# safe-keep env variables
|
1282
|
-
orig_home, orig_user_profile = ENV['HOME'], ENV['USERPROFILE']
|
1283
|
-
|
1284
|
-
# prepare for the test
|
1285
|
-
ENV.delete('HOME')
|
1286
|
-
ENV['USERPROFILE'] = "W:\\Users\\RubyUser"
|
1287
|
-
|
1288
|
-
assert_equal 'W:/Users/RubyUser', Gem.user_home
|
1289
|
-
|
1290
|
-
ensure
|
1291
|
-
ENV['HOME'] = orig_home
|
1292
|
-
ENV['USERPROFILE'] = orig_user_profile
|
1293
|
-
end
|
1294
|
-
|
1295
|
-
def test_self_user_home_user_drive_and_path
|
1296
|
-
Gem.clear_paths
|
1297
|
-
|
1298
|
-
# safe-keep env variables
|
1299
|
-
orig_home, orig_user_profile = ENV['HOME'], ENV['USERPROFILE']
|
1300
|
-
orig_home_drive, orig_home_path = ENV['HOMEDRIVE'], ENV['HOMEPATH']
|
1301
|
-
|
1302
|
-
# prepare the environment
|
1303
|
-
ENV.delete('HOME')
|
1304
|
-
ENV.delete('USERPROFILE')
|
1305
|
-
ENV['HOMEDRIVE'] = 'Z:'
|
1306
|
-
ENV['HOMEPATH'] = "\\Users\\RubyUser"
|
1307
|
-
|
1308
|
-
assert_equal 'Z:/Users/RubyUser', Gem.user_home
|
1309
|
-
|
1310
|
-
ensure
|
1311
|
-
ENV['HOME'] = orig_home
|
1312
|
-
ENV['USERPROFILE'] = orig_user_profile
|
1313
|
-
ENV['HOMEDRIVE'] = orig_home_drive
|
1314
|
-
ENV['HOMEPATH'] = orig_home_path
|
1315
|
-
end
|
1316
|
-
end
|
1317
|
-
|
1318
1357
|
def test_self_vendor_dir
|
1319
1358
|
expected =
|
1320
1359
|
File.join RbConfig::CONFIG['vendordir'], 'gems',
|
@@ -1340,7 +1379,6 @@ class TestGem < Gem::TestCase
|
|
1340
1379
|
end
|
1341
1380
|
|
1342
1381
|
def test_load_plugins
|
1343
|
-
skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
|
1344
1382
|
plugin_path = File.join "lib", "rubygems_plugin.rb"
|
1345
1383
|
|
1346
1384
|
Dir.chdir @tempdir do
|
@@ -1395,8 +1433,8 @@ class TestGem < Gem::TestCase
|
|
1395
1433
|
write_file File.join(@tempdir, 'lib', "g.rb") { |fp| fp.puts "" }
|
1396
1434
|
write_file File.join(@tempdir, 'lib', 'm.rb') { |fp| fp.puts "" }
|
1397
1435
|
|
1398
|
-
g =
|
1399
|
-
m =
|
1436
|
+
g = util_spec 'g', '1', nil, "lib/g.rb"
|
1437
|
+
m = util_spec 'm', '1', nil, "lib/m.rb"
|
1400
1438
|
|
1401
1439
|
install_gem g, :install_dir => Gem.dir
|
1402
1440
|
m0 = install_gem m, :install_dir => Gem.dir
|
@@ -1451,8 +1489,8 @@ class TestGem < Gem::TestCase
|
|
1451
1489
|
write_file File.join(@tempdir, 'lib', "g.rb") { |fp| fp.puts "" }
|
1452
1490
|
write_file File.join(@tempdir, 'lib', 'm.rb') { |fp| fp.puts "" }
|
1453
1491
|
|
1454
|
-
g =
|
1455
|
-
m =
|
1492
|
+
g = util_spec 'g', '1', nil, "lib/g.rb"
|
1493
|
+
m = util_spec 'm', '1', nil, "lib/m.rb"
|
1456
1494
|
|
1457
1495
|
install_gem g, :install_dir => Gem.dir
|
1458
1496
|
install_gem m, :install_dir => Gem.dir
|
@@ -1469,9 +1507,9 @@ class TestGem < Gem::TestCase
|
|
1469
1507
|
def test_auto_activation_of_specific_gemdeps_file
|
1470
1508
|
util_clear_gems
|
1471
1509
|
|
1472
|
-
a =
|
1473
|
-
b =
|
1474
|
-
c =
|
1510
|
+
a = util_spec "a", "1", nil, "lib/a.rb"
|
1511
|
+
b = util_spec "b", "1", nil, "lib/b.rb"
|
1512
|
+
c = util_spec "c", "1", nil, "lib/c.rb"
|
1475
1513
|
|
1476
1514
|
install_specs a, b, c
|
1477
1515
|
|
@@ -1491,12 +1529,11 @@ class TestGem < Gem::TestCase
|
|
1491
1529
|
end
|
1492
1530
|
|
1493
1531
|
def test_auto_activation_of_used_gemdeps_file
|
1494
|
-
skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
|
1495
1532
|
util_clear_gems
|
1496
1533
|
|
1497
|
-
a =
|
1498
|
-
b =
|
1499
|
-
c =
|
1534
|
+
a = util_spec "a", "1", nil, "lib/a.rb"
|
1535
|
+
b = util_spec "b", "1", nil, "lib/b.rb"
|
1536
|
+
c = util_spec "c", "1", nil, "lib/c.rb"
|
1500
1537
|
|
1501
1538
|
install_specs a, b, c
|
1502
1539
|
|
@@ -1518,7 +1555,7 @@ class TestGem < Gem::TestCase
|
|
1518
1555
|
|
1519
1556
|
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1520
1557
|
BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }.dup.untaint
|
1521
|
-
BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}"
|
1558
|
+
BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}".freeze
|
1522
1559
|
end
|
1523
1560
|
|
1524
1561
|
def add_bundler_full_name(names)
|
@@ -1531,9 +1568,9 @@ class TestGem < Gem::TestCase
|
|
1531
1568
|
def test_looks_for_gemdeps_files_automatically_on_start
|
1532
1569
|
util_clear_gems
|
1533
1570
|
|
1534
|
-
a =
|
1535
|
-
b =
|
1536
|
-
c =
|
1571
|
+
a = util_spec "a", "1", nil, "lib/a.rb"
|
1572
|
+
b = util_spec "b", "1", nil, "lib/b.rb"
|
1573
|
+
c = util_spec "c", "1", nil, "lib/c.rb"
|
1537
1574
|
|
1538
1575
|
install_specs a, b, c
|
1539
1576
|
|
@@ -1548,12 +1585,7 @@ class TestGem < Gem::TestCase
|
|
1548
1585
|
path = File.join @tempdir, "gem.deps.rb"
|
1549
1586
|
cmd = [Gem.ruby.dup.untaint, "-I#{LIB_PATH.untaint}",
|
1550
1587
|
"-I#{BUNDLER_LIB_PATH.untaint}", "-rrubygems"]
|
1551
|
-
|
1552
|
-
cmd << "-e 'puts Gem.loaded_specs.values.map(&:full_name).sort'"
|
1553
|
-
cmd = cmd.join(' ')
|
1554
|
-
else
|
1555
|
-
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1556
|
-
end
|
1588
|
+
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1557
1589
|
|
1558
1590
|
File.open path, "w" do |f|
|
1559
1591
|
f.puts "gem 'a'"
|
@@ -1572,9 +1604,9 @@ class TestGem < Gem::TestCase
|
|
1572
1604
|
def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
|
1573
1605
|
util_clear_gems
|
1574
1606
|
|
1575
|
-
a =
|
1576
|
-
b =
|
1577
|
-
c =
|
1607
|
+
a = util_spec "a", "1", nil, "lib/a.rb"
|
1608
|
+
b = util_spec "b", "1", nil, "lib/b.rb"
|
1609
|
+
c = util_spec "c", "1", nil, "lib/c.rb"
|
1578
1610
|
|
1579
1611
|
install_specs a, b, c
|
1580
1612
|
|
@@ -1591,12 +1623,7 @@ class TestGem < Gem::TestCase
|
|
1591
1623
|
path = File.join @tempdir, "gem.deps.rb"
|
1592
1624
|
cmd = [Gem.ruby.dup.untaint, "-Csub1", "-I#{LIB_PATH.untaint}",
|
1593
1625
|
"-I#{BUNDLER_LIB_PATH.untaint}", "-rrubygems"]
|
1594
|
-
|
1595
|
-
cmd << "-e 'puts Gem.loaded_specs.values.map(&:full_name).sort'"
|
1596
|
-
cmd = cmd.join(' ')
|
1597
|
-
else
|
1598
|
-
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1599
|
-
end
|
1626
|
+
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1600
1627
|
|
1601
1628
|
File.open path, "w" do |f|
|
1602
1629
|
f.puts "gem 'a'"
|
@@ -1644,7 +1671,7 @@ class TestGem < Gem::TestCase
|
|
1644
1671
|
|
1645
1672
|
def test_default_gems_use_full_paths
|
1646
1673
|
begin
|
1647
|
-
if defined?(RUBY_ENGINE)
|
1674
|
+
if defined?(RUBY_ENGINE)
|
1648
1675
|
engine = RUBY_ENGINE
|
1649
1676
|
Object.send :remove_const, :RUBY_ENGINE
|
1650
1677
|
end
|
@@ -1657,7 +1684,7 @@ class TestGem < Gem::TestCase
|
|
1657
1684
|
end
|
1658
1685
|
|
1659
1686
|
begin
|
1660
|
-
if defined?(RUBY_ENGINE)
|
1687
|
+
if defined?(RUBY_ENGINE)
|
1661
1688
|
engine = RUBY_ENGINE
|
1662
1689
|
Object.send :remove_const, :RUBY_ENGINE
|
1663
1690
|
end
|
@@ -1731,7 +1758,6 @@ class TestGem < Gem::TestCase
|
|
1731
1758
|
end
|
1732
1759
|
|
1733
1760
|
def test_use_gemdeps_automatic
|
1734
|
-
skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
|
1735
1761
|
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
|
1736
1762
|
|
1737
1763
|
spec = util_spec 'a', 1
|
@@ -1752,7 +1778,6 @@ class TestGem < Gem::TestCase
|
|
1752
1778
|
end
|
1753
1779
|
|
1754
1780
|
def test_use_gemdeps_automatic_missing
|
1755
|
-
skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
|
1756
1781
|
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
|
1757
1782
|
|
1758
1783
|
Gem.use_gemdeps
|
@@ -1781,7 +1806,6 @@ class TestGem < Gem::TestCase
|
|
1781
1806
|
end
|
1782
1807
|
|
1783
1808
|
def test_use_gemdeps_missing_gem
|
1784
|
-
skip 'Insecure operation - read' if RUBY_VERSION <= "1.8.7"
|
1785
1809
|
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
|
1786
1810
|
|
1787
1811
|
File.open 'x', 'w' do |io|
|
@@ -1794,19 +1818,20 @@ class TestGem < Gem::TestCase
|
|
1794
1818
|
else
|
1795
1819
|
platform = " #{platform}"
|
1796
1820
|
end
|
1797
|
-
expected =
|
1798
|
-
|
1821
|
+
expected =
|
1822
|
+
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1823
|
+
<<-EXPECTED
|
1799
1824
|
Could not find gem 'a#{platform}' in any of the gem sources listed in your Gemfile.
|
1800
1825
|
You may need to `gem install -g` to install missing gems
|
1801
1826
|
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1827
|
+
EXPECTED
|
1828
|
+
else
|
1829
|
+
<<-EXPECTED
|
1805
1830
|
Unable to resolve dependency: user requested 'a (>= 0)'
|
1806
1831
|
You may need to `gem install -g` to install missing gems
|
1807
1832
|
|
1808
|
-
|
1809
|
-
|
1833
|
+
EXPECTED
|
1834
|
+
end
|
1810
1835
|
|
1811
1836
|
assert_output nil, expected do
|
1812
1837
|
Gem.use_gemdeps
|
@@ -1816,7 +1841,6 @@ You may need to `gem install -g` to install missing gems
|
|
1816
1841
|
end if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1817
1842
|
|
1818
1843
|
def test_use_gemdeps_specific
|
1819
|
-
skip 'Insecure operation - read' if RUBY_VERSION <= "1.8.7"
|
1820
1844
|
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
|
1821
1845
|
|
1822
1846
|
spec = util_spec 'a', 1
|
@@ -1836,6 +1860,13 @@ You may need to `gem install -g` to install missing gems
|
|
1836
1860
|
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1837
1861
|
end
|
1838
1862
|
|
1863
|
+
def test_operating_system_defaults
|
1864
|
+
operating_system_defaults = Gem.operating_system_defaults
|
1865
|
+
|
1866
|
+
assert operating_system_defaults != nil
|
1867
|
+
assert operating_system_defaults.is_a? Hash
|
1868
|
+
end
|
1869
|
+
|
1839
1870
|
def test_platform_defaults
|
1840
1871
|
platform_defaults = Gem.platform_defaults
|
1841
1872
|
|
@@ -1843,13 +1874,13 @@ You may need to `gem install -g` to install missing gems
|
|
1843
1874
|
assert platform_defaults.is_a? Hash
|
1844
1875
|
end
|
1845
1876
|
|
1846
|
-
def ruby_install_name
|
1877
|
+
def ruby_install_name(name)
|
1847
1878
|
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
|
1848
1879
|
RbConfig::CONFIG['ruby_install_name'] = name
|
1849
1880
|
|
1850
1881
|
yield
|
1851
1882
|
ensure
|
1852
|
-
if orig_RUBY_INSTALL_NAME
|
1883
|
+
if orig_RUBY_INSTALL_NAME
|
1853
1884
|
RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
|
1854
1885
|
else
|
1855
1886
|
RbConfig::CONFIG.delete 'ruby_install_name'
|