rubygems-update 3.1.4 → 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 +1 -2
- data/History.txt +130 -5
- data/Manifest.txt +10 -23
- data/POLICIES.md +2 -9
- data/README.md +1 -1
- data/Rakefile +30 -32
- data/bin/update_rubygems +1 -1
- data/bundler/CHANGELOG.md +806 -741
- 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 +32 -11
- data/bundler/lib/bundler/cli/console.rb +1 -1
- data/bundler/lib/bundler/cli/gem.rb +83 -10
- data/bundler/lib/bundler/cli/info.rb +13 -3
- data/bundler/lib/bundler/cli/init.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +5 -14
- data/bundler/lib/bundler/cli/issue.rb +2 -2
- data/bundler/lib/bundler/cli/list.rb +11 -9
- data/bundler/lib/bundler/cli/outdated.rb +88 -65
- data/bundler/lib/bundler/cli/plugin.rb +10 -0
- data/bundler/lib/bundler/cli/pristine.rb +5 -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 +17 -10
- data/bundler/lib/bundler/gem_version_promoter.rb +1 -1
- data/bundler/lib/bundler/injector.rb +14 -3
- data/bundler/lib/bundler/inline.rb +1 -1
- 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 +3 -48
- data/bundler/lib/bundler/runtime.rb +2 -12
- data/bundler/lib/bundler/settings.rb +0 -3
- data/bundler/lib/bundler/shared_helpers.rb +1 -1
- data/bundler/lib/bundler/source/git.rb +4 -4
- 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 +9 -1
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +19 -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 +6 -4
- 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 +75 -189
- 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 +7 -7
- data/bundler/man/bundle-list.1.txt +12 -11
- data/bundler/man/bundle-list.ronn +6 -6
- 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 +80 -157
- data/lib/rubygems/available_set.rb +4 -4
- data/lib/rubygems/basic_specification.rb +11 -5
- data/lib/rubygems/bundler_version_finder.rb +14 -9
- data/lib/rubygems/command.rb +16 -14
- 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 +1 -1
- 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 +128 -32
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +3 -3
- 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 +8 -8
- data/lib/rubygems/source/git.rb +7 -6
- data/lib/rubygems/source/local.rb +2 -2
- data/lib/rubygems/source_list.rb +4 -5
- data/lib/rubygems/spec_fetcher.rb +18 -15
- data/lib/rubygems/specification.rb +79 -104
- data/lib/rubygems/specification_policy.rb +79 -27
- data/lib/rubygems/test_case.rb +64 -83
- 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 +10 -2
- data/lib/rubygems/util/licenses.rb +4 -4
- data/lib/rubygems/validator.rb +1 -1
- data/lib/rubygems/version.rb +4 -4
- 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 +0 -2
- data/test/rubygems/test_bundled_ca.rb +1 -5
- data/test/rubygems/test_deprecate.rb +43 -4
- data/test/rubygems/test_gem.rb +79 -74
- 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 +7 -2
- 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 +160 -108
- 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_specification_command.rb +18 -18
- data/test/rubygems/test_gem_commands_uninstall_command.rb +1 -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 +149 -45
- data/test/rubygems/test_gem_package.rb +13 -12
- data/test/rubygems/test_gem_package_tar_header.rb +19 -0
- data/test/rubygems/test_gem_package_tar_writer.rb +3 -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 +20 -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 +143 -113
- data/test/rubygems/test_gem_stream_ui.rb +3 -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 +29 -43
- 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 -64
@@ -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,24 @@ 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
|
+
|
78
106
|
validate_removed_attributes
|
79
107
|
|
80
108
|
if @warnings > 0
|
@@ -84,8 +112,6 @@ class Gem::SpecificationPolicy
|
|
84
112
|
alert_warning help_text
|
85
113
|
end
|
86
114
|
end
|
87
|
-
|
88
|
-
true
|
89
115
|
end
|
90
116
|
|
91
117
|
##
|
@@ -124,14 +150,13 @@ class Gem::SpecificationPolicy
|
|
124
150
|
end
|
125
151
|
|
126
152
|
##
|
127
|
-
#
|
153
|
+
# Checks that no duplicate dependencies are specified.
|
128
154
|
|
129
|
-
def
|
155
|
+
def validate_duplicate_dependencies # :nodoc:
|
130
156
|
# NOTE: see REFACTOR note in Gem::Dependency about types - this might be brittle
|
131
|
-
seen = Gem::Dependency::TYPES.inject({}) {
|
157
|
+
seen = Gem::Dependency::TYPES.inject({}) {|types, type| types.merge({ type => {}}) }
|
132
158
|
|
133
159
|
error_messages = []
|
134
|
-
warning_messages = []
|
135
160
|
@specification.dependencies.each do |dep|
|
136
161
|
if prev = seen[dep.type][dep.name]
|
137
162
|
error_messages << <<-MESSAGE
|
@@ -141,7 +166,20 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
141
166
|
end
|
142
167
|
|
143
168
|
seen[dep.type][dep.name] = dep
|
169
|
+
end
|
170
|
+
if error_messages.any?
|
171
|
+
error error_messages.join
|
172
|
+
end
|
173
|
+
end
|
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.
|
144
179
|
|
180
|
+
def validate_dependencies # :nodoc:
|
181
|
+
warning_messages = []
|
182
|
+
@specification.dependencies.each do |dep|
|
145
183
|
prerelease_dep = dep.requirements_list.any? do |req|
|
146
184
|
Gem::Requirement.new(req).prerelease?
|
147
185
|
end
|
@@ -176,11 +214,8 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
176
214
|
warning_messages << ["open-ended dependency on #{dep} is not recommended", recommendation].join("\n") + "\n"
|
177
215
|
end
|
178
216
|
end
|
179
|
-
if error_messages.any?
|
180
|
-
error error_messages.join
|
181
|
-
end
|
182
217
|
if warning_messages.any?
|
183
|
-
warning_messages.each {
|
218
|
+
warning_messages.each {|warning_message| warning warning_message }
|
184
219
|
end
|
185
220
|
end
|
186
221
|
|
@@ -257,7 +292,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
257
292
|
def validate_non_files
|
258
293
|
return unless packaging
|
259
294
|
|
260
|
-
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) }
|
261
296
|
|
262
297
|
unless non_files.empty?
|
263
298
|
error "[\"#{non_files.join "\", \""}\"] are not files"
|
@@ -282,7 +317,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
282
317
|
platform = @specification.platform
|
283
318
|
|
284
319
|
case platform
|
285
|
-
when Gem::Platform, Gem::Platform::RUBY
|
320
|
+
when Gem::Platform, Gem::Platform::RUBY # ok
|
286
321
|
else
|
287
322
|
error "invalid platform #{platform.inspect}, see Gem::Platform"
|
288
323
|
end
|
@@ -303,9 +338,8 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
303
338
|
String
|
304
339
|
end
|
305
340
|
|
306
|
-
unless Array === val and val.all? {|x| x.kind_of?(klass)}
|
307
|
-
|
308
|
-
"#{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}"
|
309
343
|
end
|
310
344
|
end
|
311
345
|
|
@@ -315,29 +349,35 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
315
349
|
error "authors may not be empty"
|
316
350
|
end
|
317
351
|
|
318
|
-
def
|
352
|
+
def validate_licenses_length
|
319
353
|
licenses = @specification.licenses
|
320
354
|
|
321
355
|
licenses.each do |license|
|
322
356
|
if license.length > 64
|
323
357
|
error "each license must be 64 characters or less"
|
324
358
|
end
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
def validate_licenses
|
363
|
+
licenses = @specification.licenses
|
325
364
|
|
365
|
+
licenses.each do |license|
|
326
366
|
if !Gem::Licenses.match?(license)
|
327
367
|
suggestions = Gem::Licenses.suggestions(license)
|
328
|
-
message = <<-
|
368
|
+
message = <<-WARNING
|
329
369
|
license value '#{license}' is invalid. Use a license identifier from
|
330
370
|
http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license.
|
331
|
-
|
332
|
-
message += "Did you mean #{suggestions.map {
|
371
|
+
WARNING
|
372
|
+
message += "Did you mean #{suggestions.map {|s| "'#{s}'" }.join(', ')}?\n" unless suggestions.nil?
|
333
373
|
warning(message)
|
334
374
|
end
|
335
375
|
end
|
336
376
|
|
337
|
-
warning <<-
|
377
|
+
warning <<-WARNING if licenses.empty?
|
338
378
|
licenses is empty, but is recommended. Use a license identifier from
|
339
379
|
http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license.
|
340
|
-
|
380
|
+
WARNING
|
341
381
|
end
|
342
382
|
|
343
383
|
LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, '')
|
@@ -393,7 +433,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
|
|
393
433
|
validate_shebang_line_in(executable)
|
394
434
|
end
|
395
435
|
|
396
|
-
@specification.files.select {
|
436
|
+
@specification.files.select {|f| File.symlink?(f) }.each do |file|
|
397
437
|
warning "#{file} is a symlink, which is not supported on all platforms"
|
398
438
|
end
|
399
439
|
end
|
@@ -416,6 +456,18 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
|
|
416
456
|
end
|
417
457
|
end
|
418
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
|
+
|
419
471
|
def warning(statement) # :nodoc:
|
420
472
|
@warnings += 1
|
421
473
|
|
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
|
|
@@ -115,12 +131,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
115
131
|
assert_equal expected.sort, loaded.sort if expected
|
116
132
|
end
|
117
133
|
|
118
|
-
# TODO: move to minitest
|
119
|
-
def assert_path_exists(path, msg = nil)
|
120
|
-
msg = message(msg) { "Expected path '#{path}' to exist" }
|
121
|
-
assert File.exist?(path), msg
|
122
|
-
end
|
123
|
-
|
124
134
|
def assert_directory_exists(path, msg = nil)
|
125
135
|
msg = message(msg) { "Expected path '#{path}' to be a directory" }
|
126
136
|
assert_path_exists path
|
@@ -214,12 +224,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
214
224
|
end
|
215
225
|
end
|
216
226
|
|
217
|
-
# TODO: move to minitest
|
218
|
-
def refute_path_exists(path, msg = nil)
|
219
|
-
msg = message(msg) { "Expected path '#{path}' to not exist" }
|
220
|
-
refute File.exist?(path), msg
|
221
|
-
end
|
222
|
-
|
223
227
|
def scan_make_command_lines(output)
|
224
228
|
output.scan(/^#{Regexp.escape make_command}(?:[[:blank:]].*)?$/)
|
225
229
|
end
|
@@ -265,7 +269,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
265
269
|
end
|
266
270
|
end
|
267
271
|
|
268
|
-
assert scan_make_command_lines(output).any? {
|
272
|
+
assert scan_make_command_lines(output).any? {|line|
|
269
273
|
make = parse_make_command_line(line)
|
270
274
|
|
271
275
|
if make[:targets].include?(target)
|
@@ -294,10 +298,14 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
294
298
|
super
|
295
299
|
|
296
300
|
@orig_env = ENV.to_hash
|
301
|
+
@tmp = File.expand_path("tmp")
|
302
|
+
|
303
|
+
FileUtils.mkdir_p @tmp
|
297
304
|
|
298
305
|
ENV['GEM_VENDOR'] = nil
|
299
306
|
ENV['GEMRC'] = nil
|
300
307
|
ENV['SOURCE_DATE_EPOCH'] = nil
|
308
|
+
ENV["TMPDIR"] = @tmp
|
301
309
|
|
302
310
|
@current_dir = Dir.pwd
|
303
311
|
@fetcher = nil
|
@@ -316,16 +324,10 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
316
324
|
|
317
325
|
FileUtils.mkdir_p @tempdir
|
318
326
|
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
# name. Only Dir[] (= Dir.glob) works.
|
324
|
-
# Short and long path name is specific to Windows filesystem.
|
325
|
-
if win_platform?
|
326
|
-
@tempdir = Dir[@tempdir][0]
|
327
|
-
@tempdir.tap(&Gem::UNTAINT)
|
328
|
-
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')
|
329
331
|
|
330
332
|
@gemhome = File.join @tempdir, 'gemhome'
|
331
333
|
@userhome = File.join @tempdir, 'userhome'
|
@@ -337,7 +339,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
337
339
|
ruby
|
338
340
|
end
|
339
341
|
|
340
|
-
@git = ENV['GIT'] || 'git'
|
342
|
+
@git = ENV['GIT'] || (win_platform? ? 'git.exe' : 'git')
|
341
343
|
|
342
344
|
Gem.ensure_gem_subdirectories @gemhome
|
343
345
|
|
@@ -359,6 +361,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
359
361
|
|
360
362
|
ENV['HOME'] = @userhome
|
361
363
|
Gem.instance_variable_set :@user_home, nil
|
364
|
+
Gem.instance_variable_set :@data_home, nil
|
362
365
|
Gem.instance_variable_set :@gemdeps, nil
|
363
366
|
Gem.instance_variable_set :@env_requirements_by_name, nil
|
364
367
|
Gem.send :remove_instance_variable, :@ruby_version if
|
@@ -385,6 +388,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
385
388
|
Gem::Security.reset
|
386
389
|
|
387
390
|
Gem.loaded_specs.clear
|
391
|
+
Gem.instance_variable_set(:@activated_gem_paths, 0)
|
388
392
|
Gem.clear_default_specs
|
389
393
|
Bundler.reset!
|
390
394
|
|
@@ -425,11 +429,8 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
425
429
|
$LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
|
426
430
|
if @orig_LOADED_FEATURES
|
427
431
|
if @orig_LOAD_PATH
|
428
|
-
paths = @orig_LOAD_PATH.map {|path| File.join(File.expand_path(path), "/")}
|
429
432
|
($LOADED_FEATURES - @orig_LOADED_FEATURES).each do |feat|
|
430
|
-
|
431
|
-
$LOADED_FEATURES.delete(feat)
|
432
|
-
end
|
433
|
+
$LOADED_FEATURES.delete(feat) if feat.start_with?(@tmp)
|
433
434
|
end
|
434
435
|
else
|
435
436
|
$LOADED_FEATURES.replace @orig_LOADED_FEATURES
|
@@ -448,6 +449,10 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
448
449
|
|
449
450
|
ENV.replace(@orig_env)
|
450
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
|
+
|
451
456
|
Gem.ruby = @orig_ruby if @orig_ruby
|
452
457
|
|
453
458
|
if Gem.java_platform?
|
@@ -467,6 +472,17 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
467
472
|
@back_ui.close
|
468
473
|
end
|
469
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
|
+
|
470
486
|
def common_installer_setup
|
471
487
|
common_installer_teardown
|
472
488
|
|
@@ -555,7 +571,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
555
571
|
end
|
556
572
|
|
557
573
|
def in_path?(executable) # :nodoc:
|
558
|
-
return true if %r
|
574
|
+
return true if %r{\A([A-Z]:|/)} =~ executable and File.exist? executable
|
559
575
|
|
560
576
|
ENV['PATH'].split(File::PATH_SEPARATOR).any? do |directory|
|
561
577
|
File.exist? File.join directory, executable
|
@@ -568,7 +584,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
568
584
|
def install_gem(spec, options = {})
|
569
585
|
require 'rubygems/installer'
|
570
586
|
|
571
|
-
gem =
|
587
|
+
gem = spec.cache_file
|
572
588
|
|
573
589
|
unless File.exist? gem
|
574
590
|
use_ui Gem::MockGemUi.new do
|
@@ -577,7 +593,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
577
593
|
end
|
578
594
|
end
|
579
595
|
|
580
|
-
gem = File.join(@tempdir, File.basename(
|
596
|
+
gem = File.join(@tempdir, File.basename(gem)).tap(&Gem::UNTAINT)
|
581
597
|
end
|
582
598
|
|
583
599
|
Gem::Installer.at(gem, options.merge({:wrappers => true})).install
|
@@ -673,8 +689,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
673
689
|
yield(s) if block_given?
|
674
690
|
end
|
675
691
|
|
676
|
-
Gem::Specification.map # HACK: force specs to (re-)load before we write
|
677
|
-
|
678
692
|
written_path = write_file spec.spec_file do |io|
|
679
693
|
io.write spec.to_ruby_for_cache
|
680
694
|
end
|
@@ -778,7 +792,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
778
792
|
ensure
|
779
793
|
prefix = File.dirname(__FILE__) + "/"
|
780
794
|
new_features = ($LOADED_FEATURES - old_loaded_features)
|
781
|
-
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) })
|
782
796
|
$LOADED_FEATURES.replace old_loaded_features
|
783
797
|
end
|
784
798
|
|
@@ -790,6 +804,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
790
804
|
|
791
805
|
lib_dir = File.join(@tempdir, "default_gems", "lib")
|
792
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])
|
793
808
|
$LOAD_PATH.unshift(lib_dir)
|
794
809
|
files.each do |file|
|
795
810
|
rb_path = File.join(lib_dir, file)
|
@@ -825,9 +840,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
825
840
|
end
|
826
841
|
|
827
842
|
if deps
|
828
|
-
|
829
|
-
# way so the tests are deterministic on all implementations.
|
830
|
-
deps.keys.sort.each do |n|
|
843
|
+
deps.keys.each do |n|
|
831
844
|
spec.add_dependency n, (deps[n] || '>= 0')
|
832
845
|
end
|
833
846
|
end
|
@@ -839,9 +852,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
839
852
|
|
840
853
|
util_build_gem spec
|
841
854
|
|
842
|
-
cache_file = File.join @tempdir, 'gems', "#{spec.full_name}.gem"
|
843
|
-
FileUtils.mkdir_p File.dirname cache_file
|
844
|
-
FileUtils.mv spec.cache_file, cache_file
|
845
855
|
FileUtils.rm spec.spec_file
|
846
856
|
end
|
847
857
|
|
@@ -857,10 +867,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
857
867
|
def util_gem(name, version, deps = nil, &block)
|
858
868
|
if deps
|
859
869
|
block = proc do |s|
|
860
|
-
|
861
|
-
# the keys and iterate that way so the tests are
|
862
|
-
# deterministic on all implementations.
|
863
|
-
deps.keys.sort.each do |n|
|
870
|
+
deps.keys.each do |n|
|
864
871
|
s.add_dependency n, (deps[n] || '>= 0')
|
865
872
|
end
|
866
873
|
end
|
@@ -1008,7 +1015,7 @@ Also, a list:
|
|
1008
1015
|
|
1009
1016
|
spec_fetcher = Gem::SpecFetcher.fetcher
|
1010
1017
|
|
1011
|
-
prerelease, all = all_specs.partition {
|
1018
|
+
prerelease, all = all_specs.partition {|spec| spec.version.prerelease? }
|
1012
1019
|
latest = Gem::Specification._latest_specs all_specs
|
1013
1020
|
|
1014
1021
|
spec_fetcher.specs[@uri] = []
|
@@ -1030,7 +1037,7 @@ Also, a list:
|
|
1030
1037
|
unless Gem::RemoteFetcher === @fetcher
|
1031
1038
|
v = Gem.marshal_version
|
1032
1039
|
|
1033
|
-
specs = all.map {
|
1040
|
+
specs = all.map {|spec| spec.name_tuple }
|
1034
1041
|
s_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic specs
|
1035
1042
|
|
1036
1043
|
latest_specs = latest.map do |spec|
|
@@ -1039,7 +1046,7 @@ Also, a list:
|
|
1039
1046
|
|
1040
1047
|
l_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic latest_specs
|
1041
1048
|
|
1042
|
-
prerelease_specs = prerelease.map {
|
1049
|
+
prerelease_specs = prerelease.map {|spec| spec.name_tuple }
|
1043
1050
|
p_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic prerelease_specs
|
1044
1051
|
|
1045
1052
|
@fetcher.data["#{@gem_repo}specs.#{v}.gz"] = s_zip
|
@@ -1210,7 +1217,7 @@ Also, a list:
|
|
1210
1217
|
|
1211
1218
|
def build_rake_in(good=true)
|
1212
1219
|
gem_ruby = Gem.ruby
|
1213
|
-
Gem.ruby =
|
1220
|
+
Gem.ruby = self.class.rubybin
|
1214
1221
|
env_rake = ENV["rake"]
|
1215
1222
|
rake = (good ? @@good_rake : @@bad_rake)
|
1216
1223
|
ENV["rake"] = rake
|
@@ -1244,15 +1251,16 @@ Also, a list:
|
|
1244
1251
|
end
|
1245
1252
|
|
1246
1253
|
begin
|
1247
|
-
|
1248
|
-
File.join(RbConfig::CONFIG["bindir"],
|
1249
|
-
RbConfig::CONFIG["ruby_install_name"] +
|
1250
|
-
RbConfig::CONFIG["EXEEXT"])
|
1254
|
+
Gem.ruby
|
1251
1255
|
rescue LoadError
|
1252
1256
|
"ruby"
|
1253
1257
|
end
|
1254
1258
|
end
|
1255
1259
|
|
1260
|
+
def ruby_with_rubygems_in_load_path
|
1261
|
+
[Gem.ruby, "-I", File.expand_path("..", __dir__)]
|
1262
|
+
end
|
1263
|
+
|
1256
1264
|
def with_clean_path_to_ruby
|
1257
1265
|
orig_ruby = Gem.ruby
|
1258
1266
|
|
@@ -1273,7 +1281,7 @@ Also, a list:
|
|
1273
1281
|
|
1274
1282
|
def escape_path(*path)
|
1275
1283
|
path = File.join(*path)
|
1276
|
-
if %r
|
1284
|
+
if %r{\A[-+:/=@,.\w]+\z} =~ path
|
1277
1285
|
path
|
1278
1286
|
else
|
1279
1287
|
"\"#{path.gsub(/[`$"]/, '\\&')}\""
|
@@ -1282,7 +1290,6 @@ Also, a list:
|
|
1282
1290
|
|
1283
1291
|
end
|
1284
1292
|
|
1285
|
-
@@ruby = rubybin
|
1286
1293
|
@@good_rake = "#{rubybin} #{escape_path(TEST_PATH, 'good_rake.rb')}"
|
1287
1294
|
@@bad_rake = "#{rubybin} #{escape_path(TEST_PATH, 'bad_rake.rb')}"
|
1288
1295
|
|
@@ -1435,7 +1442,7 @@ Also, a list:
|
|
1435
1442
|
# Finds all gems matching +dep+ in this set.
|
1436
1443
|
|
1437
1444
|
def find_all(dep)
|
1438
|
-
@specs.find_all {
|
1445
|
+
@specs.find_all {|s| dep.match? s, @prerelease }
|
1439
1446
|
end
|
1440
1447
|
|
1441
1448
|
##
|
@@ -1524,30 +1531,4 @@ Also, a list:
|
|
1524
1531
|
|
1525
1532
|
end
|
1526
1533
|
|
1527
|
-
# require dependencies that are not discoverable once GEM_HOME and GEM_PATH
|
1528
|
-
# are wiped
|
1529
|
-
begin
|
1530
|
-
gem 'rake'
|
1531
|
-
rescue Gem::LoadError
|
1532
|
-
end
|
1533
|
-
|
1534
|
-
begin
|
1535
|
-
require 'rake/packagetask'
|
1536
|
-
rescue LoadError
|
1537
|
-
end
|
1538
|
-
|
1539
|
-
begin
|
1540
|
-
gem 'rdoc'
|
1541
|
-
require 'rdoc'
|
1542
|
-
|
1543
|
-
require 'rubygems/rdoc'
|
1544
|
-
rescue LoadError, Gem::LoadError
|
1545
|
-
end
|
1546
|
-
|
1547
|
-
begin
|
1548
|
-
gem 'builder'
|
1549
|
-
require 'builder/xchar'
|
1550
|
-
rescue LoadError, Gem::LoadError
|
1551
|
-
end
|
1552
|
-
|
1553
1534
|
require 'rubygems/test_utilities'
|