rubygems-update 3.1.0 → 3.2.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CODE_OF_CONDUCT.md +55 -19
- data/CONTRIBUTING.md +2 -3
- data/History.txt +195 -7
- data/Manifest.txt +11 -23
- data/POLICIES.md +2 -9
- data/README.md +5 -5
- data/Rakefile +38 -35
- data/bin/update_rubygems +2 -2
- data/bundler/CHANGELOG.md +846 -728
- data/bundler/README.md +6 -8
- data/bundler/UPGRADING.md +16 -30
- data/bundler/bundler.gemspec +3 -3
- data/bundler/exe/bundle +3 -0
- data/bundler/lib/bundler.rb +15 -4
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli.rb +29 -9
- data/bundler/lib/bundler/cli/console.rb +1 -1
- data/bundler/lib/bundler/cli/exec.rb +3 -12
- data/bundler/lib/bundler/cli/gem.rb +74 -10
- data/bundler/lib/bundler/cli/info.rb +6 -3
- data/bundler/lib/bundler/cli/init.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +8 -16
- data/bundler/lib/bundler/cli/issue.rb +2 -2
- data/bundler/lib/bundler/cli/outdated.rb +5 -5
- data/bundler/lib/bundler/cli/plugin.rb +10 -0
- data/bundler/lib/bundler/definition.rb +32 -32
- data/bundler/lib/bundler/dependency.rb +0 -9
- data/bundler/lib/bundler/dsl.rb +1 -5
- data/bundler/lib/bundler/environment_preserver.rb +26 -2
- data/bundler/lib/bundler/errors.rb +1 -0
- data/bundler/lib/bundler/feature_flag.rb +0 -2
- data/bundler/lib/bundler/fetcher.rb +1 -0
- data/bundler/lib/bundler/friendly_errors.rb +4 -10
- data/bundler/lib/bundler/gem_helper.rb +18 -12
- data/bundler/lib/bundler/gem_version_promoter.rb +1 -1
- data/bundler/lib/bundler/injector.rb +14 -3
- data/bundler/lib/bundler/inline.rb +2 -2
- data/bundler/lib/bundler/installer.rb +29 -28
- data/bundler/lib/bundler/installer/gem_installer.rb +2 -2
- data/bundler/lib/bundler/installer/parallel_installer.rb +9 -9
- data/bundler/lib/bundler/lazy_specification.rb +16 -3
- data/bundler/lib/bundler/plugin.rb +26 -0
- data/bundler/lib/bundler/plugin/index.rb +9 -0
- data/bundler/lib/bundler/psyched_yaml.rb +0 -15
- data/bundler/lib/bundler/remote_specification.rb +4 -1
- data/bundler/lib/bundler/resolver.rb +31 -8
- data/bundler/lib/bundler/resolver/spec_group.rb +26 -5
- data/bundler/lib/bundler/rubygems_ext.rb +7 -8
- data/bundler/lib/bundler/rubygems_gem_installer.rb +1 -7
- data/bundler/lib/bundler/rubygems_integration.rb +13 -19
- data/bundler/lib/bundler/runtime.rb +2 -12
- data/bundler/lib/bundler/settings.rb +0 -3
- data/bundler/lib/bundler/setup.rb +5 -0
- data/bundler/lib/bundler/shared_helpers.rb +1 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +53 -58
- data/bundler/lib/bundler/source/path.rb +5 -1
- data/bundler/lib/bundler/source/path/installer.rb +7 -9
- data/bundler/lib/bundler/source/rubygems.rb +11 -14
- data/bundler/lib/bundler/stub_specification.rb +16 -4
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +7 -2
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +12 -5
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +18 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +5 -3
- data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +10 -0
- data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
- data/bundler/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +72 -208
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +0 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/man/bundle-add.1 +1 -1
- data/bundler/man/bundle-add.1.txt +15 -15
- data/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/man/bundle-binstubs.1.txt +10 -10
- data/bundler/man/bundle-cache.1 +1 -1
- data/bundler/man/bundle-cache.1.txt +15 -15
- data/bundler/man/bundle-check.1 +1 -1
- data/bundler/man/bundle-check.1.txt +8 -8
- data/bundler/man/bundle-clean.1 +1 -1
- data/bundler/man/bundle-clean.1.txt +6 -6
- data/bundler/man/bundle-config.1 +3 -9
- data/bundler/man/bundle-config.1.txt +271 -272
- data/bundler/man/bundle-config.ronn +5 -9
- data/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/man/bundle-doctor.1.txt +9 -9
- data/bundler/man/bundle-exec.1 +1 -1
- data/bundler/man/bundle-exec.1.txt +84 -81
- data/bundler/man/bundle-gem.1 +25 -3
- data/bundler/man/bundle-gem.1.txt +65 -39
- data/bundler/man/bundle-gem.ronn +30 -7
- data/bundler/man/bundle-info.1 +1 -1
- data/bundler/man/bundle-info.1.txt +2 -2
- data/bundler/man/bundle-init.1 +1 -1
- data/bundler/man/bundle-init.1.txt +9 -9
- data/bundler/man/bundle-inject.1 +1 -1
- data/bundler/man/bundle-inject.1.txt +4 -4
- data/bundler/man/bundle-install.1 +1 -1
- data/bundler/man/bundle-install.1.txt +169 -169
- data/bundler/man/bundle-list.1 +1 -1
- data/bundler/man/bundle-list.1.txt +7 -7
- data/bundler/man/bundle-lock.1 +1 -1
- data/bundler/man/bundle-lock.1.txt +28 -28
- data/bundler/man/bundle-open.1 +1 -1
- data/bundler/man/bundle-open.1.txt +3 -3
- data/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/man/bundle-outdated.1.txt +34 -34
- data/bundler/man/bundle-platform.1 +1 -1
- data/bundler/man/bundle-platform.1.txt +16 -16
- data/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/man/bundle-pristine.1.txt +8 -8
- data/bundler/man/bundle-remove.1 +1 -1
- data/bundler/man/bundle-remove.1.txt +9 -9
- data/bundler/man/bundle-show.1 +1 -1
- data/bundler/man/bundle-show.1.txt +8 -8
- data/bundler/man/bundle-update.1 +1 -1
- data/bundler/man/bundle-update.1.txt +149 -148
- data/bundler/man/bundle-viz.1 +1 -1
- data/bundler/man/bundle-viz.1.txt +11 -11
- data/bundler/man/bundle.1 +1 -1
- data/bundler/man/bundle.1.txt +31 -31
- data/bundler/man/gemfile.5 +1 -1
- data/bundler/man/gemfile.5.txt +218 -216
- data/lib/rubygems.rb +135 -185
- data/lib/rubygems/available_set.rb +4 -4
- data/lib/rubygems/basic_specification.rb +12 -6
- data/lib/rubygems/bundler_version_finder.rb +14 -9
- data/lib/rubygems/command.rb +17 -15
- data/lib/rubygems/command_manager.rb +4 -3
- data/lib/rubygems/commands/cert_command.rb +1 -1
- data/lib/rubygems/commands/cleanup_command.rb +3 -3
- data/lib/rubygems/commands/contents_command.rb +4 -4
- data/lib/rubygems/commands/dependency_command.rb +6 -6
- data/lib/rubygems/commands/fetch_command.rb +2 -2
- data/lib/rubygems/commands/help_command.rb +2 -2
- data/lib/rubygems/commands/info_command.rb +9 -4
- data/lib/rubygems/commands/install_command.rb +3 -3
- data/lib/rubygems/commands/list_command.rb +9 -6
- data/lib/rubygems/commands/lock_command.rb +1 -1
- data/lib/rubygems/commands/open_command.rb +0 -2
- data/lib/rubygems/commands/pristine_command.rb +10 -2
- data/lib/rubygems/commands/push_command.rb +4 -42
- data/lib/rubygems/commands/query_command.rb +7 -352
- data/lib/rubygems/commands/search_command.rb +8 -6
- data/lib/rubygems/commands/setup_command.rb +156 -45
- data/lib/rubygems/commands/sources_command.rb +3 -3
- data/lib/rubygems/commands/specification_command.rb +2 -2
- data/lib/rubygems/commands/stale_command.rb +1 -1
- data/lib/rubygems/commands/uninstall_command.rb +2 -2
- data/lib/rubygems/commands/unpack_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +40 -10
- data/lib/rubygems/config_file.rb +11 -2
- data/lib/rubygems/core_ext/kernel_require.rb +26 -36
- data/lib/rubygems/defaults.rb +99 -5
- data/lib/rubygems/dependency.rb +2 -5
- data/lib/rubygems/dependency_installer.rb +1 -73
- data/lib/rubygems/dependency_list.rb +7 -7
- data/lib/rubygems/deprecate.rb +46 -1
- data/lib/rubygems/doctor.rb +4 -2
- data/lib/rubygems/errors.rb +3 -2
- data/lib/rubygems/exceptions.rb +2 -13
- data/lib/rubygems/ext.rb +6 -6
- data/lib/rubygems/ext/build_error.rb +2 -0
- data/lib/rubygems/ext/builder.rb +4 -2
- data/lib/rubygems/ext/cmake_builder.rb +1 -1
- data/lib/rubygems/ext/ext_conf_builder.rb +6 -7
- data/lib/rubygems/gem_runner.rb +3 -8
- data/lib/rubygems/gemcutter_utilities.rb +1 -1
- data/lib/rubygems/indexer.rb +1 -19
- data/lib/rubygems/install_update_options.rb +5 -5
- data/lib/rubygems/installer.rb +45 -42
- data/lib/rubygems/installer_test_case.rb +19 -2
- data/lib/rubygems/installer_uninstaller_utils.rb +24 -0
- data/lib/rubygems/local_remote_options.rb +1 -1
- data/lib/rubygems/name_tuple.rb +2 -4
- data/lib/rubygems/package.rb +8 -13
- data/lib/rubygems/package/old.rb +1 -1
- data/lib/rubygems/package/tar_header.rb +3 -3
- data/lib/rubygems/package/tar_reader.rb +0 -1
- data/lib/rubygems/package/tar_reader/entry.rb +0 -1
- data/lib/rubygems/package/tar_test_case.rb +1 -1
- data/lib/rubygems/package/tar_writer.rb +2 -6
- data/lib/rubygems/package_task.rb +1 -5
- data/lib/rubygems/path_support.rb +1 -1
- data/lib/rubygems/platform.rb +3 -3
- data/lib/rubygems/query_utils.rb +362 -0
- data/lib/rubygems/rdoc.rb +0 -12
- data/lib/rubygems/remote_fetcher.rb +5 -19
- data/lib/rubygems/request/connection_pools.rb +1 -1
- data/lib/rubygems/request_set.rb +5 -5
- data/lib/rubygems/request_set/gem_dependency_api.rb +2 -2
- data/lib/rubygems/request_set/lockfile.rb +8 -8
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +1 -1
- data/lib/rubygems/requirement.rb +14 -15
- data/lib/rubygems/resolver.rb +7 -8
- data/lib/rubygems/resolver/api_set.rb +4 -4
- data/lib/rubygems/resolver/api_specification.rb +1 -1
- data/lib/rubygems/resolver/composed_set.rb +3 -3
- data/lib/rubygems/resolver/conflict.rb +1 -1
- data/lib/rubygems/resolver/index_set.rb +1 -1
- data/lib/rubygems/resolver/installer_set.rb +3 -3
- data/lib/rubygems/resolver/lock_set.rb +1 -1
- data/lib/rubygems/safe_yaml.rb +4 -4
- data/lib/rubygems/security.rb +25 -25
- data/lib/rubygems/security/policy.rb +3 -3
- data/lib/rubygems/security/signer.rb +4 -4
- data/lib/rubygems/security/trust_dir.rb +1 -1
- data/lib/rubygems/server.rb +9 -9
- data/lib/rubygems/source/git.rb +7 -6
- data/lib/rubygems/source/local.rb +2 -2
- data/lib/rubygems/source_list.rb +6 -5
- data/lib/rubygems/spec_fetcher.rb +18 -15
- data/lib/rubygems/specification.rb +91 -112
- data/lib/rubygems/specification_policy.rb +88 -28
- data/lib/rubygems/test_case.rb +122 -81
- data/lib/rubygems/test_utilities.rb +6 -6
- data/lib/rubygems/uninstaller.rb +35 -14
- data/lib/rubygems/user_interaction.rb +1 -10
- data/lib/rubygems/util.rb +17 -3
- data/lib/rubygems/util/licenses.rb +4 -4
- data/lib/rubygems/validator.rb +1 -1
- data/lib/rubygems/version.rb +5 -5
- data/rubygems-update.gemspec +2 -2
- data/setup.rb +2 -7
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +12 -0
- data/test/rubygems/test_bundled_ca.rb +1 -5
- data/test/rubygems/test_deprecate.rb +43 -4
- data/test/rubygems/test_gem.rb +150 -101
- data/test/rubygems/test_gem_available_set.rb +3 -3
- data/test/rubygems/test_gem_bundler_version_finder.rb +19 -1
- data/test/rubygems/test_gem_command.rb +24 -3
- data/test/rubygems/test_gem_command_manager.rb +37 -4
- data/test/rubygems/test_gem_commands_build_command.rb +25 -3
- 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 +48 -15
- data/test/rubygems/test_gem_commands_environment_command.rb +21 -21
- data/test/rubygems/test_gem_commands_generate_index_command.rb +1 -5
- data/test/rubygems/test_gem_commands_info_command.rb +6 -6
- data/test/rubygems/test_gem_commands_install_command.rb +31 -31
- data/test/rubygems/test_gem_commands_mirror.rb +1 -1
- data/test/rubygems/test_gem_commands_open_command.rb +4 -4
- data/test/rubygems/test_gem_commands_owner_command.rb +11 -3
- data/test/rubygems/test_gem_commands_pristine_command.rb +41 -8
- data/test/rubygems/test_gem_commands_push_command.rb +7 -2
- data/test/rubygems/test_gem_commands_query_command.rb +9 -5
- data/test/rubygems/test_gem_commands_setup_command.rb +212 -114
- data/test/rubygems/test_gem_commands_signin_command.rb +6 -4
- data/test/rubygems/test_gem_commands_signout_command.rb +0 -5
- data/test/rubygems/test_gem_commands_sources_command.rb +39 -1
- data/test/rubygems/test_gem_commands_specification_command.rb +18 -18
- data/test/rubygems/test_gem_commands_uninstall_command.rb +2 -1
- data/test/rubygems/test_gem_commands_update_command.rb +68 -5
- data/test/rubygems/test_gem_commands_which_command.rb +3 -3
- data/test/rubygems/test_gem_commands_yank_command.rb +14 -6
- data/test/rubygems/test_gem_config_file.rb +7 -10
- data/test/rubygems/test_gem_dependency_installer.rb +52 -189
- data/test/rubygems/test_gem_dependency_list.rb +8 -8
- data/test/rubygems/test_gem_dependency_resolution_error.rb +1 -1
- data/test/rubygems/test_gem_doctor.rb +28 -0
- data/test/rubygems/test_gem_ext_builder.rb +14 -25
- data/test/rubygems/test_gem_ext_cmake_builder.rb +13 -12
- data/test/rubygems/test_gem_ext_configure_builder.rb +1 -9
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +0 -1
- data/test/rubygems/test_gem_ext_rake_builder.rb +9 -9
- data/test/rubygems/test_gem_gem_runner.rb +42 -0
- data/test/rubygems/test_gem_gemcutter_utilities.rb +5 -0
- data/test/rubygems/test_gem_indexer.rb +9 -13
- data/test/rubygems/test_gem_installer.rb +158 -67
- data/test/rubygems/test_gem_package.rb +16 -20
- data/test/rubygems/test_gem_package_tar_header.rb +19 -0
- data/test/rubygems/test_gem_package_tar_writer.rb +8 -3
- data/test/rubygems/test_gem_package_task.rb +46 -11
- data/test/rubygems/test_gem_remote_fetcher.rb +152 -190
- data/test/rubygems/test_gem_request.rb +11 -11
- data/test/rubygems/test_gem_request_set.rb +72 -20
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +3 -3
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +9 -9
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +118 -118
- data/test/rubygems/test_gem_requirement.rb +2 -2
- data/test/rubygems/test_gem_resolver.rb +6 -6
- data/test/rubygems/test_gem_resolver_api_set.rb +3 -3
- data/test/rubygems/test_gem_resolver_best_set.rb +2 -2
- data/test/rubygems/test_gem_resolver_index_set.rb +2 -2
- data/test/rubygems/test_gem_resolver_installer_set.rb +7 -7
- data/test/rubygems/test_gem_resolver_lock_set.rb +3 -3
- data/test/rubygems/test_gem_security.rb +20 -20
- data/test/rubygems/test_gem_security_policy.rb +5 -8
- data/test/rubygems/test_gem_security_signer.rb +8 -8
- data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
- data/test/rubygems/test_gem_server.rb +10 -10
- data/test/rubygems/test_gem_source.rb +12 -14
- data/test/rubygems/test_gem_source_git.rb +12 -11
- data/test/rubygems/test_gem_source_installed.rb +7 -7
- data/test/rubygems/test_gem_source_local.rb +8 -8
- data/test/rubygems/test_gem_source_lock.rb +10 -10
- data/test/rubygems/test_gem_source_specific_file.rb +7 -7
- data/test/rubygems/test_gem_source_vendor.rb +7 -7
- data/test/rubygems/test_gem_spec_fetcher.rb +11 -2
- data/test/rubygems/test_gem_specification.rb +169 -119
- data/test/rubygems/test_gem_stream_ui.rb +3 -1
- data/test/rubygems/test_gem_stub_specification.rb +0 -1
- data/test/rubygems/test_gem_text.rb +1 -1
- data/test/rubygems/test_gem_uninstaller.rb +134 -10
- data/test/rubygems/test_gem_util.rb +7 -5
- data/test/rubygems/test_gem_version.rb +1 -1
- data/test/rubygems/test_kernel.rb +25 -8
- data/test/rubygems/test_project_sanity.rb +8 -1
- data/test/rubygems/test_require.rb +242 -40
- metadata +33 -46
- data/.bundle/config +0 -2
- data/.rubocop.yml +0 -91
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -43
- data/bundler/CODE_OF_CONDUCT.md +0 -136
- data/lib/rubygems/source_local.rb +0 -7
- data/lib/rubygems/source_specific_file.rb +0 -6
- data/lib/ubygems.rb +0 -14
- data/tmp/.keep +0 -0
- data/util/CL2notes +0 -55
- data/util/bisect +0 -10
- data/util/ci.sh +0 -62
- data/util/cops/deprecations.rb +0 -52
- data/util/create_certs.rb +0 -171
- data/util/create_certs.sh +0 -27
- data/util/create_encrypted_key.rb +0 -16
- data/util/generate_spdx_license_list.rb +0 -63
- data/util/patch_with_prs.rb +0 -77
- data/util/rubocop +0 -8
- data/util/update_bundled_ca_certificates.rb +0 -139
- data/util/update_changelog.rb +0 -67
@@ -8,7 +8,7 @@ class Gem::SpecificationPolicy
|
|
8
8
|
|
9
9
|
SPECIAL_CHARACTERS = /\A[#{Regexp.escape('.-_')}]+/.freeze # :nodoc:
|
10
10
|
|
11
|
-
VALID_URI_PATTERN = %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}.freeze
|
11
|
+
VALID_URI_PATTERN = %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}.freeze # :nodoc:
|
12
12
|
|
13
13
|
METADATA_LINK_KEYS = %w[
|
14
14
|
bug_tracker_uri
|
@@ -18,6 +18,7 @@ class Gem::SpecificationPolicy
|
|
18
18
|
mailing_list_uri
|
19
19
|
source_code_uri
|
20
20
|
wiki_uri
|
21
|
+
funding_uri
|
21
22
|
].freeze # :nodoc:
|
22
23
|
|
23
24
|
def initialize(specification)
|
@@ -32,13 +33,32 @@ class Gem::SpecificationPolicy
|
|
32
33
|
attr_accessor :packaging
|
33
34
|
|
34
35
|
##
|
35
|
-
#
|
36
|
-
# very basic sanity check.
|
36
|
+
# Does a sanity check on the specification.
|
37
37
|
#
|
38
38
|
# Raises InvalidSpecificationException if the spec does not pass the
|
39
39
|
# checks.
|
40
|
+
#
|
41
|
+
# It also performs some validations that do not raise but print warning
|
42
|
+
# messages instead.
|
40
43
|
|
41
44
|
def validate(strict = false)
|
45
|
+
validate_required!
|
46
|
+
|
47
|
+
validate_optional(strict) if packaging || strict
|
48
|
+
|
49
|
+
true
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Does a sanity check on the specification.
|
54
|
+
#
|
55
|
+
# Raises InvalidSpecificationException if the spec does not pass the
|
56
|
+
# checks.
|
57
|
+
#
|
58
|
+
# Only runs checks that are considered necessary for the specification to be
|
59
|
+
# functional.
|
60
|
+
|
61
|
+
def validate_required!
|
42
62
|
validate_nil_attributes
|
43
63
|
|
44
64
|
validate_rubygems_version
|
@@ -65,16 +85,26 @@ class Gem::SpecificationPolicy
|
|
65
85
|
|
66
86
|
validate_metadata
|
67
87
|
|
88
|
+
validate_licenses_length
|
89
|
+
|
90
|
+
validate_lazy_metadata
|
91
|
+
|
92
|
+
validate_duplicate_dependencies
|
93
|
+
end
|
94
|
+
|
95
|
+
def validate_optional(strict)
|
68
96
|
validate_licenses
|
69
97
|
|
70
98
|
validate_permissions
|
71
99
|
|
72
|
-
validate_lazy_metadata
|
73
|
-
|
74
100
|
validate_values
|
75
101
|
|
76
102
|
validate_dependencies
|
77
103
|
|
104
|
+
validate_extensions
|
105
|
+
|
106
|
+
validate_removed_attributes
|
107
|
+
|
78
108
|
if @warnings > 0
|
79
109
|
if strict
|
80
110
|
error "specification has warnings"
|
@@ -82,8 +112,6 @@ class Gem::SpecificationPolicy
|
|
82
112
|
alert_warning help_text
|
83
113
|
end
|
84
114
|
end
|
85
|
-
|
86
|
-
true
|
87
115
|
end
|
88
116
|
|
89
117
|
##
|
@@ -122,14 +150,13 @@ class Gem::SpecificationPolicy
|
|
122
150
|
end
|
123
151
|
|
124
152
|
##
|
125
|
-
#
|
153
|
+
# Checks that no duplicate dependencies are specified.
|
126
154
|
|
127
|
-
def
|
155
|
+
def validate_duplicate_dependencies # :nodoc:
|
128
156
|
# NOTE: see REFACTOR note in Gem::Dependency about types - this might be brittle
|
129
|
-
seen = Gem::Dependency::TYPES.inject({}) {
|
157
|
+
seen = Gem::Dependency::TYPES.inject({}) {|types, type| types.merge({ type => {}}) }
|
130
158
|
|
131
159
|
error_messages = []
|
132
|
-
warning_messages = []
|
133
160
|
@specification.dependencies.each do |dep|
|
134
161
|
if prev = seen[dep.type][dep.name]
|
135
162
|
error_messages << <<-MESSAGE
|
@@ -139,7 +166,20 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
139
166
|
end
|
140
167
|
|
141
168
|
seen[dep.type][dep.name] = dep
|
169
|
+
end
|
170
|
+
if error_messages.any?
|
171
|
+
error error_messages.join
|
172
|
+
end
|
173
|
+
end
|
142
174
|
|
175
|
+
##
|
176
|
+
# Checks that dependencies use requirements as we recommend. Warnings are
|
177
|
+
# issued when dependencies are open-ended or overly strict for semantic
|
178
|
+
# versioning.
|
179
|
+
|
180
|
+
def validate_dependencies # :nodoc:
|
181
|
+
warning_messages = []
|
182
|
+
@specification.dependencies.each do |dep|
|
143
183
|
prerelease_dep = dep.requirements_list.any? do |req|
|
144
184
|
Gem::Requirement.new(req).prerelease?
|
145
185
|
end
|
@@ -174,11 +214,8 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
174
214
|
warning_messages << ["open-ended dependency on #{dep} is not recommended", recommendation].join("\n") + "\n"
|
175
215
|
end
|
176
216
|
end
|
177
|
-
if error_messages.any?
|
178
|
-
error error_messages.join
|
179
|
-
end
|
180
217
|
if warning_messages.any?
|
181
|
-
warning_messages.each {
|
218
|
+
warning_messages.each {|warning_message| warning warning_message }
|
182
219
|
end
|
183
220
|
end
|
184
221
|
|
@@ -255,7 +292,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
255
292
|
def validate_non_files
|
256
293
|
return unless packaging
|
257
294
|
|
258
|
-
non_files = @specification.files.reject {|x| File.file?(x) || File.symlink?(x)}
|
295
|
+
non_files = @specification.files.reject {|x| File.file?(x) || File.symlink?(x) }
|
259
296
|
|
260
297
|
unless non_files.empty?
|
261
298
|
error "[\"#{non_files.join "\", \""}\"] are not files"
|
@@ -280,7 +317,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
280
317
|
platform = @specification.platform
|
281
318
|
|
282
319
|
case platform
|
283
|
-
when Gem::Platform, Gem::Platform::RUBY
|
320
|
+
when Gem::Platform, Gem::Platform::RUBY # ok
|
284
321
|
else
|
285
322
|
error "invalid platform #{platform.inspect}, see Gem::Platform"
|
286
323
|
end
|
@@ -301,9 +338,8 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
301
338
|
String
|
302
339
|
end
|
303
340
|
|
304
|
-
unless Array === val and val.all? {|x| x.kind_of?(klass)}
|
305
|
-
|
306
|
-
"#{field} must be an Array of #{klass}")
|
341
|
+
unless Array === val and val.all? {|x| x.kind_of?(klass) }
|
342
|
+
error "#{field} must be an Array of #{klass}"
|
307
343
|
end
|
308
344
|
end
|
309
345
|
|
@@ -313,29 +349,35 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
313
349
|
error "authors may not be empty"
|
314
350
|
end
|
315
351
|
|
316
|
-
def
|
352
|
+
def validate_licenses_length
|
317
353
|
licenses = @specification.licenses
|
318
354
|
|
319
355
|
licenses.each do |license|
|
320
356
|
if license.length > 64
|
321
357
|
error "each license must be 64 characters or less"
|
322
358
|
end
|
359
|
+
end
|
360
|
+
end
|
323
361
|
|
362
|
+
def validate_licenses
|
363
|
+
licenses = @specification.licenses
|
364
|
+
|
365
|
+
licenses.each do |license|
|
324
366
|
if !Gem::Licenses.match?(license)
|
325
367
|
suggestions = Gem::Licenses.suggestions(license)
|
326
|
-
message = <<-
|
368
|
+
message = <<-WARNING
|
327
369
|
license value '#{license}' is invalid. Use a license identifier from
|
328
370
|
http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license.
|
329
|
-
|
330
|
-
message += "Did you mean #{suggestions.map {
|
371
|
+
WARNING
|
372
|
+
message += "Did you mean #{suggestions.map {|s| "'#{s}'" }.join(', ')}?\n" unless suggestions.nil?
|
331
373
|
warning(message)
|
332
374
|
end
|
333
375
|
end
|
334
376
|
|
335
|
-
warning <<-
|
377
|
+
warning <<-WARNING if licenses.empty?
|
336
378
|
licenses is empty, but is recommended. Use a license identifier from
|
337
379
|
http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license.
|
338
|
-
|
380
|
+
WARNING
|
339
381
|
end
|
340
382
|
|
341
383
|
LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, '')
|
@@ -391,7 +433,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
|
|
391
433
|
validate_shebang_line_in(executable)
|
392
434
|
end
|
393
435
|
|
394
|
-
@specification.files.select {
|
436
|
+
@specification.files.select {|f| File.symlink?(f) }.each do |file|
|
395
437
|
warning "#{file} is a symlink, which is not supported on all platforms"
|
396
438
|
end
|
397
439
|
end
|
@@ -408,6 +450,24 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
|
|
408
450
|
warning "#{executable_path} is missing #! line"
|
409
451
|
end
|
410
452
|
|
453
|
+
def validate_removed_attributes # :nodoc:
|
454
|
+
@specification.removed_method_calls.each do |attr|
|
455
|
+
warning("#{attr} is deprecated and ignored. Please remove this from your gemspec to ensure that your gem continues to build in the future.")
|
456
|
+
end
|
457
|
+
end
|
458
|
+
|
459
|
+
def validate_extensions # :nodoc:
|
460
|
+
require_relative 'ext'
|
461
|
+
builder = Gem::Ext::Builder.new(@specification)
|
462
|
+
|
463
|
+
rake_extension = @specification.extensions.any? {|s| builder.builder_for(s) == Gem::Ext::RakeBuilder }
|
464
|
+
rake_dependency = @specification.dependencies.any? {|d| d.name == 'rake' }
|
465
|
+
|
466
|
+
warning <<-WARNING if rake_extension && !rake_dependency
|
467
|
+
You have specified rake based extension, but rake is not added as dependency. It is recommended to add rake as a dependency in gemspec since there's no guarantee rake will be already installed.
|
468
|
+
WARNING
|
469
|
+
end
|
470
|
+
|
411
471
|
def warning(statement) # :nodoc:
|
412
472
|
@warnings += 1
|
413
473
|
|
@@ -421,7 +481,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
|
|
421
481
|
end
|
422
482
|
|
423
483
|
def help_text # :nodoc:
|
424
|
-
"See
|
484
|
+
"See https://guides.rubygems.org/specification-reference/ for help"
|
425
485
|
end
|
426
486
|
|
427
487
|
end
|
data/lib/rubygems/test_case.rb
CHANGED
@@ -12,7 +12,7 @@ if File.exist?(bundler_gemspec)
|
|
12
12
|
end
|
13
13
|
|
14
14
|
begin
|
15
|
-
gem 'minitest', '~> 5.
|
15
|
+
gem 'minitest', '~> 5.13'
|
16
16
|
rescue Gem::LoadError
|
17
17
|
end
|
18
18
|
|
@@ -30,6 +30,8 @@ require 'bundler'
|
|
30
30
|
|
31
31
|
require 'minitest/autorun'
|
32
32
|
|
33
|
+
ENV["JARS_SKIP"] = "true" if Gem.java_platform? # avoid unnecessary and noisy `jar-dependencies` post install hook
|
34
|
+
|
33
35
|
require 'rubygems/deprecate'
|
34
36
|
|
35
37
|
require 'fileutils'
|
@@ -78,13 +80,27 @@ module Gem
|
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
83
|
+
require "rubygems/command"
|
84
|
+
|
85
|
+
class Gem::Command
|
86
|
+
|
87
|
+
##
|
88
|
+
# Allows resetting the hash of specific args per command. This method is
|
89
|
+
# available when requiring 'rubygems/test_case'
|
90
|
+
|
91
|
+
def self.specific_extra_args_hash=(value)
|
92
|
+
@specific_extra_args_hash = value
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
81
97
|
##
|
82
98
|
# RubyGemTestCase provides a variety of methods for testing rubygems and
|
83
99
|
# gem-related behavior in a sandbox. Through RubyGemTestCase you can install
|
84
100
|
# and uninstall gems, fetch remote gems through a stub fetcher and be assured
|
85
101
|
# your normal set of gems is not affected.
|
86
102
|
|
87
|
-
class Gem::TestCase <
|
103
|
+
class Gem::TestCase < Minitest::Test
|
88
104
|
|
89
105
|
extend Gem::Deprecate
|
90
106
|
|
@@ -96,6 +112,8 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
96
112
|
|
97
113
|
TEST_PATH = ENV.fetch('RUBYGEMS_TEST_PATH', File.expand_path('../../../test/rubygems', __FILE__))
|
98
114
|
|
115
|
+
SPECIFICATIONS = File.expand_path(File.join(TEST_PATH, "specifications"), __FILE__)
|
116
|
+
|
99
117
|
def assert_activate(expected, *specs)
|
100
118
|
specs.each do |spec|
|
101
119
|
case spec
|
@@ -113,12 +131,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
113
131
|
assert_equal expected.sort, loaded.sort if expected
|
114
132
|
end
|
115
133
|
|
116
|
-
# TODO: move to minitest
|
117
|
-
def assert_path_exists(path, msg = nil)
|
118
|
-
msg = message(msg) { "Expected path '#{path}' to exist" }
|
119
|
-
assert File.exist?(path), msg
|
120
|
-
end
|
121
|
-
|
122
134
|
def assert_directory_exists(path, msg = nil)
|
123
135
|
msg = message(msg) { "Expected path '#{path}' to be a directory" }
|
124
136
|
assert_path_exists path
|
@@ -164,10 +176,52 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
164
176
|
end
|
165
177
|
end
|
166
178
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
179
|
+
##
|
180
|
+
# Sets the bindir entry in RbConfig::CONFIG to +value+ and restores the
|
181
|
+
# original value when the block ends
|
182
|
+
#
|
183
|
+
def bindir(value)
|
184
|
+
with_clean_path_to_ruby do
|
185
|
+
bindir = RbConfig::CONFIG['bindir']
|
186
|
+
|
187
|
+
if value
|
188
|
+
RbConfig::CONFIG['bindir'] = value
|
189
|
+
else
|
190
|
+
RbConfig::CONFIG.delete 'bindir'
|
191
|
+
end
|
192
|
+
|
193
|
+
begin
|
194
|
+
yield
|
195
|
+
ensure
|
196
|
+
if bindir
|
197
|
+
RbConfig::CONFIG['bindir'] = bindir
|
198
|
+
else
|
199
|
+
RbConfig::CONFIG.delete 'bindir'
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
##
|
206
|
+
# Sets the EXEEXT entry in RbConfig::CONFIG to +value+ and restores the
|
207
|
+
# original value when the block ends
|
208
|
+
#
|
209
|
+
def exeext(value)
|
210
|
+
exeext = RbConfig::CONFIG['EXEEXT']
|
211
|
+
|
212
|
+
if value
|
213
|
+
RbConfig::CONFIG['EXEEXT'] = value
|
214
|
+
else
|
215
|
+
RbConfig::CONFIG.delete 'EXEEXT'
|
216
|
+
end
|
217
|
+
|
218
|
+
yield
|
219
|
+
ensure
|
220
|
+
if exeext
|
221
|
+
RbConfig::CONFIG['EXEEXT'] = exeext
|
222
|
+
else
|
223
|
+
RbConfig::CONFIG.delete 'EXEEXT'
|
224
|
+
end
|
171
225
|
end
|
172
226
|
|
173
227
|
def scan_make_command_lines(output)
|
@@ -215,7 +269,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
215
269
|
end
|
216
270
|
end
|
217
271
|
|
218
|
-
assert scan_make_command_lines(output).any? {
|
272
|
+
assert scan_make_command_lines(output).any? {|line|
|
219
273
|
make = parse_make_command_line(line)
|
220
274
|
|
221
275
|
if make[:targets].include?(target)
|
@@ -244,10 +298,14 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
244
298
|
super
|
245
299
|
|
246
300
|
@orig_env = ENV.to_hash
|
301
|
+
@tmp = File.expand_path("tmp")
|
302
|
+
|
303
|
+
FileUtils.mkdir_p @tmp
|
247
304
|
|
248
305
|
ENV['GEM_VENDOR'] = nil
|
249
306
|
ENV['GEMRC'] = nil
|
250
307
|
ENV['SOURCE_DATE_EPOCH'] = nil
|
308
|
+
ENV["TMPDIR"] = @tmp
|
251
309
|
|
252
310
|
@current_dir = Dir.pwd
|
253
311
|
@fetcher = nil
|
@@ -266,16 +324,10 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
266
324
|
|
267
325
|
FileUtils.mkdir_p @tempdir
|
268
326
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
# name. Only Dir[] (= Dir.glob) works.
|
274
|
-
# Short and long path name is specific to Windows filesystem.
|
275
|
-
if win_platform?
|
276
|
-
@tempdir = Dir[@tempdir][0]
|
277
|
-
@tempdir.tap(&Gem::UNTAINT)
|
278
|
-
end
|
327
|
+
@orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
|
328
|
+
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
|
329
|
+
Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
|
330
|
+
File.join(@tempdir, 'system-gemrc')
|
279
331
|
|
280
332
|
@gemhome = File.join @tempdir, 'gemhome'
|
281
333
|
@userhome = File.join @tempdir, 'userhome'
|
@@ -287,7 +339,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
287
339
|
ruby
|
288
340
|
end
|
289
341
|
|
290
|
-
@git = ENV['GIT'] || 'git'
|
342
|
+
@git = ENV['GIT'] || (win_platform? ? 'git.exe' : 'git')
|
291
343
|
|
292
344
|
Gem.ensure_gem_subdirectories @gemhome
|
293
345
|
|
@@ -309,6 +361,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
309
361
|
|
310
362
|
ENV['HOME'] = @userhome
|
311
363
|
Gem.instance_variable_set :@user_home, nil
|
364
|
+
Gem.instance_variable_set :@data_home, nil
|
312
365
|
Gem.instance_variable_set :@gemdeps, nil
|
313
366
|
Gem.instance_variable_set :@env_requirements_by_name, nil
|
314
367
|
Gem.send :remove_instance_variable, :@ruby_version if
|
@@ -335,6 +388,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
335
388
|
Gem::Security.reset
|
336
389
|
|
337
390
|
Gem.loaded_specs.clear
|
391
|
+
Gem.instance_variable_set(:@activated_gem_paths, 0)
|
338
392
|
Gem.clear_default_specs
|
339
393
|
Bundler.reset!
|
340
394
|
|
@@ -375,11 +429,8 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
375
429
|
$LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
|
376
430
|
if @orig_LOADED_FEATURES
|
377
431
|
if @orig_LOAD_PATH
|
378
|
-
paths = @orig_LOAD_PATH.map {|path| File.join(File.expand_path(path), "/")}
|
379
432
|
($LOADED_FEATURES - @orig_LOADED_FEATURES).each do |feat|
|
380
|
-
|
381
|
-
$LOADED_FEATURES.delete(feat)
|
382
|
-
end
|
433
|
+
$LOADED_FEATURES.delete(feat) if feat.start_with?(@tmp)
|
383
434
|
end
|
384
435
|
else
|
385
436
|
$LOADED_FEATURES.replace @orig_LOADED_FEATURES
|
@@ -398,6 +449,10 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
398
449
|
|
399
450
|
ENV.replace(@orig_env)
|
400
451
|
|
452
|
+
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
|
453
|
+
Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
|
454
|
+
@orig_SYSTEM_WIDE_CONFIG_FILE
|
455
|
+
|
401
456
|
Gem.ruby = @orig_ruby if @orig_ruby
|
402
457
|
|
403
458
|
if Gem.java_platform?
|
@@ -417,6 +472,17 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
417
472
|
@back_ui.close
|
418
473
|
end
|
419
474
|
|
475
|
+
def credential_setup
|
476
|
+
@temp_cred = File.join(@userhome, '.gem', 'credentials')
|
477
|
+
FileUtils.mkdir_p File.dirname(@temp_cred)
|
478
|
+
File.write @temp_cred, ':rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97'
|
479
|
+
File.chmod 0600, @temp_cred
|
480
|
+
end
|
481
|
+
|
482
|
+
def credential_teardown
|
483
|
+
FileUtils.rm_rf @temp_cred
|
484
|
+
end
|
485
|
+
|
420
486
|
def common_installer_setup
|
421
487
|
common_installer_teardown
|
422
488
|
|
@@ -505,7 +571,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
505
571
|
end
|
506
572
|
|
507
573
|
def in_path?(executable) # :nodoc:
|
508
|
-
return true if %r
|
574
|
+
return true if %r{\A([A-Z]:|/)} =~ executable and File.exist? executable
|
509
575
|
|
510
576
|
ENV['PATH'].split(File::PATH_SEPARATOR).any? do |directory|
|
511
577
|
File.exist? File.join directory, executable
|
@@ -518,7 +584,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
518
584
|
def install_gem(spec, options = {})
|
519
585
|
require 'rubygems/installer'
|
520
586
|
|
521
|
-
gem =
|
587
|
+
gem = spec.cache_file
|
522
588
|
|
523
589
|
unless File.exist? gem
|
524
590
|
use_ui Gem::MockGemUi.new do
|
@@ -527,7 +593,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
527
593
|
end
|
528
594
|
end
|
529
595
|
|
530
|
-
gem = File.join(@tempdir, File.basename(
|
596
|
+
gem = File.join(@tempdir, File.basename(gem)).tap(&Gem::UNTAINT)
|
531
597
|
end
|
532
598
|
|
533
599
|
Gem::Installer.at(gem, options.merge({:wrappers => true})).install
|
@@ -623,8 +689,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
623
689
|
yield(s) if block_given?
|
624
690
|
end
|
625
691
|
|
626
|
-
Gem::Specification.map # HACK: force specs to (re-)load before we write
|
627
|
-
|
628
692
|
written_path = write_file spec.spec_file do |io|
|
629
693
|
io.write spec.to_ruby_for_cache
|
630
694
|
end
|
@@ -728,7 +792,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
728
792
|
ensure
|
729
793
|
prefix = File.dirname(__FILE__) + "/"
|
730
794
|
new_features = ($LOADED_FEATURES - old_loaded_features)
|
731
|
-
old_loaded_features.concat(new_features.select {|f| f.rindex(prefix, 0)})
|
795
|
+
old_loaded_features.concat(new_features.select {|f| f.rindex(prefix, 0) })
|
732
796
|
$LOADED_FEATURES.replace old_loaded_features
|
733
797
|
end
|
734
798
|
|
@@ -740,6 +804,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
740
804
|
|
741
805
|
lib_dir = File.join(@tempdir, "default_gems", "lib")
|
742
806
|
lib_dir.instance_variable_set(:@gem_prelude_index, lib_dir)
|
807
|
+
Gem.instance_variable_set(:@default_gem_load_paths, [*Gem.instance_variable_get(:@default_gem_load_paths), lib_dir])
|
743
808
|
$LOAD_PATH.unshift(lib_dir)
|
744
809
|
files.each do |file|
|
745
810
|
rb_path = File.join(lib_dir, file)
|
@@ -775,9 +840,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
775
840
|
end
|
776
841
|
|
777
842
|
if deps
|
778
|
-
|
779
|
-
# way so the tests are deterministic on all implementations.
|
780
|
-
deps.keys.sort.each do |n|
|
843
|
+
deps.keys.each do |n|
|
781
844
|
spec.add_dependency n, (deps[n] || '>= 0')
|
782
845
|
end
|
783
846
|
end
|
@@ -789,9 +852,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
789
852
|
|
790
853
|
util_build_gem spec
|
791
854
|
|
792
|
-
cache_file = File.join @tempdir, 'gems', "#{spec.full_name}.gem"
|
793
|
-
FileUtils.mkdir_p File.dirname cache_file
|
794
|
-
FileUtils.mv spec.cache_file, cache_file
|
795
855
|
FileUtils.rm spec.spec_file
|
796
856
|
end
|
797
857
|
|
@@ -807,10 +867,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
807
867
|
def util_gem(name, version, deps = nil, &block)
|
808
868
|
if deps
|
809
869
|
block = proc do |s|
|
810
|
-
|
811
|
-
# the keys and iterate that way so the tests are
|
812
|
-
# deterministic on all implementations.
|
813
|
-
deps.keys.sort.each do |n|
|
870
|
+
deps.keys.each do |n|
|
814
871
|
s.add_dependency n, (deps[n] || '>= 0')
|
815
872
|
end
|
816
873
|
end
|
@@ -958,7 +1015,7 @@ Also, a list:
|
|
958
1015
|
|
959
1016
|
spec_fetcher = Gem::SpecFetcher.fetcher
|
960
1017
|
|
961
|
-
prerelease, all = all_specs.partition {
|
1018
|
+
prerelease, all = all_specs.partition {|spec| spec.version.prerelease? }
|
962
1019
|
latest = Gem::Specification._latest_specs all_specs
|
963
1020
|
|
964
1021
|
spec_fetcher.specs[@uri] = []
|
@@ -980,7 +1037,7 @@ Also, a list:
|
|
980
1037
|
unless Gem::RemoteFetcher === @fetcher
|
981
1038
|
v = Gem.marshal_version
|
982
1039
|
|
983
|
-
specs = all.map {
|
1040
|
+
specs = all.map {|spec| spec.name_tuple }
|
984
1041
|
s_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic specs
|
985
1042
|
|
986
1043
|
latest_specs = latest.map do |spec|
|
@@ -989,7 +1046,7 @@ Also, a list:
|
|
989
1046
|
|
990
1047
|
l_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic latest_specs
|
991
1048
|
|
992
|
-
prerelease_specs = prerelease.map {
|
1049
|
+
prerelease_specs = prerelease.map {|spec| spec.name_tuple }
|
993
1050
|
p_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic prerelease_specs
|
994
1051
|
|
995
1052
|
@fetcher.data["#{@gem_repo}specs.#{v}.gz"] = s_zip
|
@@ -1160,7 +1217,7 @@ Also, a list:
|
|
1160
1217
|
|
1161
1218
|
def build_rake_in(good=true)
|
1162
1219
|
gem_ruby = Gem.ruby
|
1163
|
-
Gem.ruby =
|
1220
|
+
Gem.ruby = self.class.rubybin
|
1164
1221
|
env_rake = ENV["rake"]
|
1165
1222
|
rake = (good ? @@good_rake : @@bad_rake)
|
1166
1223
|
ENV["rake"] = rake
|
@@ -1194,15 +1251,26 @@ Also, a list:
|
|
1194
1251
|
end
|
1195
1252
|
|
1196
1253
|
begin
|
1197
|
-
|
1198
|
-
File.join(RbConfig::CONFIG["bindir"],
|
1199
|
-
RbConfig::CONFIG["ruby_install_name"] +
|
1200
|
-
RbConfig::CONFIG["EXEEXT"])
|
1254
|
+
Gem.ruby
|
1201
1255
|
rescue LoadError
|
1202
1256
|
"ruby"
|
1203
1257
|
end
|
1204
1258
|
end
|
1205
1259
|
|
1260
|
+
def ruby_with_rubygems_in_load_path
|
1261
|
+
[Gem.ruby, "-I", File.expand_path("..", __dir__)]
|
1262
|
+
end
|
1263
|
+
|
1264
|
+
def with_clean_path_to_ruby
|
1265
|
+
orig_ruby = Gem.ruby
|
1266
|
+
|
1267
|
+
Gem.instance_variable_set :@ruby, nil
|
1268
|
+
|
1269
|
+
yield
|
1270
|
+
ensure
|
1271
|
+
Gem.instance_variable_set :@ruby, orig_ruby
|
1272
|
+
end
|
1273
|
+
|
1206
1274
|
class << self
|
1207
1275
|
|
1208
1276
|
# :nodoc:
|
@@ -1213,7 +1281,7 @@ Also, a list:
|
|
1213
1281
|
|
1214
1282
|
def escape_path(*path)
|
1215
1283
|
path = File.join(*path)
|
1216
|
-
if %r
|
1284
|
+
if %r{\A[-+:/=@,.\w]+\z} =~ path
|
1217
1285
|
path
|
1218
1286
|
else
|
1219
1287
|
"\"#{path.gsub(/[`$"]/, '\\&')}\""
|
@@ -1222,7 +1290,6 @@ Also, a list:
|
|
1222
1290
|
|
1223
1291
|
end
|
1224
1292
|
|
1225
|
-
@@ruby = rubybin
|
1226
1293
|
@@good_rake = "#{rubybin} #{escape_path(TEST_PATH, 'good_rake.rb')}"
|
1227
1294
|
@@bad_rake = "#{rubybin} #{escape_path(TEST_PATH, 'bad_rake.rb')}"
|
1228
1295
|
|
@@ -1375,7 +1442,7 @@ Also, a list:
|
|
1375
1442
|
# Finds all gems matching +dep+ in this set.
|
1376
1443
|
|
1377
1444
|
def find_all(dep)
|
1378
|
-
@specs.find_all {
|
1445
|
+
@specs.find_all {|s| dep.match? s, @prerelease }
|
1379
1446
|
end
|
1380
1447
|
|
1381
1448
|
##
|
@@ -1464,30 +1531,4 @@ Also, a list:
|
|
1464
1531
|
|
1465
1532
|
end
|
1466
1533
|
|
1467
|
-
# require dependencies that are not discoverable once GEM_HOME and GEM_PATH
|
1468
|
-
# are wiped
|
1469
|
-
begin
|
1470
|
-
gem 'rake'
|
1471
|
-
rescue Gem::LoadError
|
1472
|
-
end
|
1473
|
-
|
1474
|
-
begin
|
1475
|
-
require 'rake/packagetask'
|
1476
|
-
rescue LoadError
|
1477
|
-
end
|
1478
|
-
|
1479
|
-
begin
|
1480
|
-
gem 'rdoc'
|
1481
|
-
require 'rdoc'
|
1482
|
-
|
1483
|
-
require 'rubygems/rdoc'
|
1484
|
-
rescue LoadError, Gem::LoadError
|
1485
|
-
end
|
1486
|
-
|
1487
|
-
begin
|
1488
|
-
gem 'builder'
|
1489
|
-
require 'builder/xchar'
|
1490
|
-
rescue LoadError, Gem::LoadError
|
1491
|
-
end
|
1492
|
-
|
1493
1534
|
require 'rubygems/test_utilities'
|