rubygems-update 3.3.18 → 3.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +65 -0
- data/Manifest.txt +11 -0
- data/bin/gem +2 -2
- data/bin/update_rubygems +4 -4
- data/bundler/CHANGELOG.md +100 -0
- data/bundler/UPGRADING.md +11 -4
- data/bundler/bundler.gemspec +6 -8
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/common.rb +1 -0
- data/bundler/lib/bundler/cli/install.rb +5 -2
- data/bundler/lib/bundler/cli/outdated.rb +12 -3
- data/bundler/lib/bundler/cli/platform.rb +1 -1
- data/bundler/lib/bundler/cli.rb +7 -4
- data/bundler/lib/bundler/current_ruby.rb +14 -5
- data/bundler/lib/bundler/definition.rb +102 -31
- data/bundler/lib/bundler/dependency.rb +18 -85
- data/bundler/lib/bundler/dsl.rb +2 -2
- data/bundler/lib/bundler/endpoint_specification.rb +2 -13
- data/bundler/lib/bundler/feature_flag.rb +0 -1
- data/bundler/lib/bundler/fetcher.rb +6 -6
- data/bundler/lib/bundler/gem_helpers.rb +7 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +8 -18
- data/bundler/lib/bundler/index.rb +10 -12
- data/bundler/lib/bundler/injector.rb +2 -1
- data/bundler/lib/bundler/inline.rb +1 -1
- data/bundler/lib/bundler/installer/standalone.rb +1 -1
- data/bundler/lib/bundler/installer.rb +14 -12
- data/bundler/lib/bundler/lazy_specification.rb +30 -23
- data/bundler/lib/bundler/lockfile_generator.rb +1 -1
- data/bundler/lib/bundler/man/bundle-add.1 +6 -2
- data/bundler/lib/bundler/man/bundle-add.1.ronn +4 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +7 -1
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +7 -0
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +25 -6
- data/bundler/lib/bundler/man/bundle-config.1.ronn +16 -6
- data/bundler/lib/bundler/man/bundle-console.1 +53 -0
- data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +2 -2
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
- data/bundler/lib/bundler/man/bundle-help.1 +13 -0
- data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +5 -2
- data/bundler/lib/bundler/man/bundle-inject.1.ronn +3 -1
- data/bundler/lib/bundler/man/bundle-install.1 +5 -1
- data/bundler/lib/bundler/man/bundle-install.1.ronn +6 -0
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +16 -6
- data/bundler/lib/bundler/man/bundle-platform.1.ronn +14 -7
- data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-version.1 +35 -0
- data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/bundler/lib/bundler/man/bundle-viz.1 +4 -1
- data/bundler/lib/bundler/man/bundle-viz.1.ronn +2 -0
- data/bundler/lib/bundler/man/bundle.1 +15 -10
- data/bundler/lib/bundler/man/bundle.1.ronn +12 -7
- data/bundler/lib/bundler/man/gemfile.5 +23 -47
- data/bundler/lib/bundler/man/gemfile.5.ronn +32 -43
- data/bundler/lib/bundler/man/index.txt +4 -0
- data/bundler/lib/bundler/match_metadata.rb +13 -0
- data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
- data/bundler/lib/bundler/plugin.rb +2 -0
- data/bundler/lib/bundler/remote_specification.rb +6 -11
- data/bundler/lib/bundler/resolver/base.rb +50 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +11 -8
- data/bundler/lib/bundler/resolver.rb +95 -90
- data/bundler/lib/bundler/ruby_dsl.rb +1 -1
- data/bundler/lib/bundler/ruby_version.rb +5 -5
- data/bundler/lib/bundler/rubygems_ext.rb +52 -1
- data/bundler/lib/bundler/rubygems_gem_installer.rb +19 -12
- data/bundler/lib/bundler/settings.rb +1 -1
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/source_list.rb +4 -0
- data/bundler/lib/bundler/spec_set.rb +48 -33
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +3 -3
- data/lib/rubygems/available_set.rb +3 -3
- data/lib/rubygems/basic_specification.rb +4 -4
- data/lib/rubygems/command.rb +25 -25
- data/lib/rubygems/command_manager.rb +9 -9
- data/lib/rubygems/commands/build_command.rb +8 -8
- data/lib/rubygems/commands/cert_command.rb +33 -33
- data/lib/rubygems/commands/check_command.rb +20 -20
- data/lib/rubygems/commands/cleanup_command.rb +17 -17
- data/lib/rubygems/commands/contents_command.rb +13 -13
- data/lib/rubygems/commands/dependency_command.rb +16 -16
- data/lib/rubygems/commands/environment_command.rb +5 -5
- data/lib/rubygems/commands/fetch_command.rb +8 -8
- data/lib/rubygems/commands/generate_index_command.rb +17 -17
- data/lib/rubygems/commands/help_command.rb +3 -3
- data/lib/rubygems/commands/info_command.rb +3 -3
- data/lib/rubygems/commands/install_command.rb +20 -20
- data/lib/rubygems/commands/list_command.rb +3 -3
- data/lib/rubygems/commands/lock_command.rb +4 -4
- data/lib/rubygems/commands/mirror_command.rb +3 -3
- data/lib/rubygems/commands/open_command.rb +9 -9
- data/lib/rubygems/commands/outdated_command.rb +5 -5
- data/lib/rubygems/commands/owner_command.rb +11 -11
- data/lib/rubygems/commands/pristine_command.rb +36 -36
- data/lib/rubygems/commands/push_command.rb +8 -8
- data/lib/rubygems/commands/query_command.rb +8 -8
- data/lib/rubygems/commands/rdoc_command.rb +17 -17
- data/lib/rubygems/commands/search_command.rb +3 -3
- data/lib/rubygems/commands/server_command.rb +3 -3
- data/lib/rubygems/commands/setup_command.rb +96 -106
- data/lib/rubygems/commands/signin_command.rb +9 -9
- data/lib/rubygems/commands/signout_command.rb +7 -7
- data/lib/rubygems/commands/sources_command.rb +21 -21
- data/lib/rubygems/commands/specification_command.rb +13 -13
- data/lib/rubygems/commands/stale_command.rb +2 -2
- data/lib/rubygems/commands/uninstall_command.rb +40 -40
- data/lib/rubygems/commands/unpack_command.rb +12 -12
- data/lib/rubygems/commands/update_command.rb +40 -56
- data/lib/rubygems/commands/which_command.rb +7 -7
- data/lib/rubygems/commands/yank_command.rb +11 -11
- data/lib/rubygems/config_file.rb +21 -21
- data/lib/rubygems/core_ext/kernel_gem.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +1 -1
- data/lib/rubygems/core_ext/kernel_warn.rb +1 -1
- data/lib/rubygems/core_ext/tcpsocket_init.rb +1 -1
- data/lib/rubygems/defaults.rb +16 -16
- data/lib/rubygems/dependency.rb +9 -9
- data/lib/rubygems/dependency_installer.rb +13 -13
- data/lib/rubygems/dependency_list.rb +6 -6
- data/lib/rubygems/doctor.rb +18 -18
- data/lib/rubygems/errors.rb +2 -2
- data/lib/rubygems/exceptions.rb +5 -5
- data/lib/rubygems/ext/build_error.rb +1 -1
- data/lib/rubygems/ext/builder.rb +16 -16
- data/lib/rubygems/ext/cargo_builder.rb +7 -7
- data/lib/rubygems/ext/cmake_builder.rb +2 -2
- data/lib/rubygems/ext/configure_builder.rb +1 -1
- data/lib/rubygems/ext/ext_conf_builder.rb +8 -8
- data/lib/rubygems/ext/rake_builder.rb +3 -3
- data/lib/rubygems/ext.rb +7 -7
- data/lib/rubygems/gem_runner.rb +5 -5
- data/lib/rubygems/gemcutter_utilities.rb +31 -28
- data/lib/rubygems/indexer.rb +27 -27
- data/lib/rubygems/install_default_message.rb +2 -2
- data/lib/rubygems/install_message.rb +2 -2
- data/lib/rubygems/install_update_options.rb +55 -55
- data/lib/rubygems/installer.rb +32 -40
- data/lib/rubygems/installer_uninstaller_utils.rb +2 -2
- data/lib/rubygems/local_remote_options.rb +18 -20
- data/lib/rubygems/mock_gem_ui.rb +2 -2
- data/lib/rubygems/name_tuple.rb +4 -4
- data/lib/rubygems/optparse.rb +1 -1
- data/lib/rubygems/package/file_source.rb +2 -2
- data/lib/rubygems/package/old.rb +8 -8
- data/lib/rubygems/package/tar_header.rb +50 -50
- data/lib/rubygems/package/tar_reader/entry.rb +2 -2
- data/lib/rubygems/package/tar_reader.rb +1 -1
- data/lib/rubygems/package/tar_writer.rb +7 -7
- data/lib/rubygems/package.rb +54 -43
- data/lib/rubygems/package_task.rb +4 -4
- data/lib/rubygems/platform.rb +66 -55
- data/lib/rubygems/psych_tree.rb +1 -1
- data/lib/rubygems/query_utils.rb +35 -35
- data/lib/rubygems/rdoc.rb +2 -2
- data/lib/rubygems/remote_fetcher.rb +22 -22
- data/lib/rubygems/request/connection_pools.rb +4 -4
- data/lib/rubygems/request/http_pool.rb +1 -1
- data/lib/rubygems/request.rb +22 -22
- data/lib/rubygems/request_set/gem_dependency_api.rb +18 -18
- data/lib/rubygems/request_set/lockfile/parser.rb +26 -26
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +4 -4
- data/lib/rubygems/request_set/lockfile.rb +5 -5
- data/lib/rubygems/request_set.rb +17 -17
- data/lib/rubygems/requirement.rb +6 -6
- data/lib/rubygems/resolver/activation_request.rb +3 -3
- data/lib/rubygems/resolver/api_set.rb +4 -4
- data/lib/rubygems/resolver/api_specification.rb +6 -6
- data/lib/rubygems/resolver/best_set.rb +5 -5
- data/lib/rubygems/resolver/conflict.rb +10 -10
- data/lib/rubygems/resolver/dependency_request.rb +2 -2
- data/lib/rubygems/resolver/git_set.rb +2 -2
- data/lib/rubygems/resolver/git_specification.rb +6 -6
- data/lib/rubygems/resolver/index_set.rb +3 -3
- data/lib/rubygems/resolver/index_specification.rb +6 -5
- data/lib/rubygems/resolver/installed_specification.rb +4 -4
- data/lib/rubygems/resolver/installer_set.rb +11 -16
- data/lib/rubygems/resolver/local_specification.rb +2 -2
- data/lib/rubygems/resolver/lock_set.rb +4 -4
- data/lib/rubygems/resolver/lock_specification.rb +4 -4
- data/lib/rubygems/resolver/molinillo.rb +1 -1
- data/lib/rubygems/resolver/specification.rb +1 -1
- data/lib/rubygems/resolver/vendor_set.rb +1 -1
- data/lib/rubygems/resolver/vendor_specification.rb +3 -3
- data/lib/rubygems/resolver.rb +39 -39
- data/lib/rubygems/s3_uri_signer.rb +6 -6
- data/lib/rubygems/safe_yaml.rb +2 -2
- data/lib/rubygems/security/policies.rb +11 -11
- data/lib/rubygems/security/policy.rb +18 -18
- data/lib/rubygems/security/signer.rb +5 -5
- data/lib/rubygems/security/trust_dir.rb +3 -3
- data/lib/rubygems/security.rb +28 -28
- data/lib/rubygems/security_option.rb +5 -5
- data/lib/rubygems/source/git.rb +21 -21
- data/lib/rubygems/source/installed.rb +1 -1
- data/lib/rubygems/source/local.rb +2 -2
- data/lib/rubygems/source/specific_file.rb +1 -1
- data/lib/rubygems/source.rb +16 -16
- data/lib/rubygems/spec_fetcher.rb +9 -9
- data/lib/rubygems/specification.rb +63 -62
- data/lib/rubygems/specification_policy.rb +15 -15
- data/lib/rubygems/stub_specification.rb +5 -5
- data/lib/rubygems/tsort.rb +1 -1
- data/lib/rubygems/uninstaller.rb +18 -18
- data/lib/rubygems/uri.rb +4 -4
- data/lib/rubygems/uri_formatter.rb +1 -1
- data/lib/rubygems/user_interaction.rb +33 -19
- data/lib/rubygems/util/licenses.rb +3 -3
- data/lib/rubygems/util.rb +10 -10
- data/lib/rubygems/validator.rb +5 -5
- data/lib/rubygems/version.rb +15 -9
- data/lib/rubygems/version_option.rb +3 -3
- data/lib/rubygems.rb +62 -61
- data/rubygems-update.gemspec +2 -2
- data/setup.rb +9 -9
- data/test/rubygems/helper.rb +132 -134
- data/test/rubygems/installer_test_case.rb +13 -13
- data/test/rubygems/package/tar_test_case.rb +2 -2
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
- data/test/rubygems/rubygems_plugin.rb +2 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +4 -4
- data/test/rubygems/test_bundled_ca.rb +10 -10
- data/test/rubygems/test_config.rb +3 -3
- data/test/rubygems/test_deprecate.rb +3 -3
- data/test/rubygems/test_exit.rb +2 -2
- data/test/rubygems/test_gem.rb +342 -342
- data/test/rubygems/test_gem_available_set.rb +21 -21
- data/test/rubygems/test_gem_bundler_version_finder.rb +1 -1
- data/test/rubygems/test_gem_command.rb +44 -44
- data/test/rubygems/test_gem_command_manager.rb +29 -29
- data/test/rubygems/test_gem_commands_build_command.rb +63 -63
- data/test/rubygems/test_gem_commands_cert_command.rb +97 -99
- data/test/rubygems/test_gem_commands_check_command.rb +4 -4
- data/test/rubygems/test_gem_commands_cleanup_command.rb +40 -40
- data/test/rubygems/test_gem_commands_contents_command.rb +27 -27
- data/test/rubygems/test_gem_commands_dependency_command.rb +36 -36
- data/test/rubygems/test_gem_commands_environment_command.rb +16 -16
- data/test/rubygems/test_gem_commands_fetch_command.rb +37 -37
- data/test/rubygems/test_gem_commands_generate_index_command.rb +7 -7
- data/test/rubygems/test_gem_commands_help_command.rb +13 -13
- data/test/rubygems/test_gem_commands_info_command.rb +28 -2
- data/test/rubygems/test_gem_commands_install_command.rb +131 -131
- data/test/rubygems/test_gem_commands_list_command.rb +4 -4
- data/test/rubygems/test_gem_commands_lock_command.rb +10 -10
- data/test/rubygems/test_gem_commands_mirror.rb +2 -2
- data/test/rubygems/test_gem_commands_open_command.rb +4 -4
- data/test/rubygems/test_gem_commands_outdated_command.rb +9 -9
- data/test/rubygems/test_gem_commands_owner_command.rb +41 -41
- data/test/rubygems/test_gem_commands_pristine_command.rb +92 -92
- data/test/rubygems/test_gem_commands_push_command.rb +54 -54
- data/test/rubygems/test_gem_commands_query_command.rb +73 -73
- data/test/rubygems/test_gem_commands_search_command.rb +2 -2
- data/test/rubygems/test_gem_commands_server_command.rb +2 -2
- data/test/rubygems/test_gem_commands_setup_command.rb +119 -85
- data/test/rubygems/test_gem_commands_signin_command.rb +45 -31
- data/test/rubygems/test_gem_commands_signout_command.rb +3 -3
- data/test/rubygems/test_gem_commands_sources_command.rb +28 -29
- data/test/rubygems/test_gem_commands_specification_command.rb +32 -32
- data/test/rubygems/test_gem_commands_stale_command.rb +4 -4
- data/test/rubygems/test_gem_commands_uninstall_command.rb +75 -75
- data/test/rubygems/test_gem_commands_unpack_command.rb +31 -31
- data/test/rubygems/test_gem_commands_update_command.rb +89 -89
- data/test/rubygems/test_gem_commands_which_command.rb +6 -6
- data/test/rubygems/test_gem_commands_yank_command.rb +40 -40
- data/test/rubygems/test_gem_config_file.rb +93 -81
- data/test/rubygems/test_gem_dependency.rb +73 -73
- data/test/rubygems/test_gem_dependency_installer.rb +165 -165
- data/test/rubygems/test_gem_dependency_list.rb +47 -47
- data/test/rubygems/test_gem_dependency_resolution_error.rb +4 -4
- data/test/rubygems/test_gem_doctor.rb +26 -26
- data/test/rubygems/test_gem_ext_builder.rb +59 -59
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +6 -6
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +8 -8
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +6 -6
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +8 -8
- data/test/rubygems/test_gem_ext_cargo_builder.rb +26 -26
- data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +3 -3
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +23 -23
- data/test/rubygems/test_gem_ext_cmake_builder.rb +15 -15
- data/test/rubygems/test_gem_ext_configure_builder.rb +13 -13
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +51 -52
- data/test/rubygems/test_gem_ext_rake_builder.rb +15 -15
- data/test/rubygems/test_gem_gem_runner.rb +7 -7
- data/test/rubygems/test_gem_gemcutter_utilities.rb +66 -66
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -4
- data/test/rubygems/test_gem_indexer.rb +48 -48
- data/test/rubygems/test_gem_install_update_options.rb +16 -16
- data/test/rubygems/test_gem_installer.rb +303 -300
- data/test/rubygems/test_gem_local_remote_options.rb +10 -10
- data/test/rubygems/test_gem_name_tuple.rb +4 -4
- data/test/rubygems/test_gem_package.rb +228 -206
- data/test/rubygems/test_gem_package_old.rb +13 -13
- data/test/rubygems/test_gem_package_tar_header.rb +42 -42
- data/test/rubygems/test_gem_package_tar_reader.rb +8 -8
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +10 -10
- data/test/rubygems/test_gem_package_tar_writer.rb +76 -76
- data/test/rubygems/test_gem_package_task.rb +18 -18
- data/test/rubygems/test_gem_path_support.rb +14 -14
- data/test/rubygems/test_gem_platform.rb +298 -227
- data/test/rubygems/test_gem_rdoc.rb +14 -14
- data/test/rubygems/test_gem_remote_fetcher.rb +149 -149
- data/test/rubygems/test_gem_request.rb +55 -55
- data/test/rubygems/test_gem_request_connection_pools.rb +29 -29
- data/test/rubygems/test_gem_request_set.rb +99 -99
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +204 -206
- data/test/rubygems/test_gem_request_set_lockfile.rb +86 -86
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +56 -56
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +62 -62
- data/test/rubygems/test_gem_requirement.rb +47 -41
- data/test/rubygems/test_gem_resolver.rb +133 -99
- data/test/rubygems/test_gem_resolver_activation_request.rb +6 -6
- data/test/rubygems/test_gem_resolver_api_set.rb +33 -33
- data/test/rubygems/test_gem_resolver_api_specification.rb +47 -47
- data/test/rubygems/test_gem_resolver_best_set.rb +22 -22
- data/test/rubygems/test_gem_resolver_composed_set.rb +1 -1
- data/test/rubygems/test_gem_resolver_conflict.rb +12 -12
- data/test/rubygems/test_gem_resolver_dependency_request.rb +15 -15
- data/test/rubygems/test_gem_resolver_git_set.rb +21 -21
- data/test/rubygems/test_gem_resolver_git_specification.rb +21 -21
- data/test/rubygems/test_gem_resolver_index_set.rb +12 -12
- data/test/rubygems/test_gem_resolver_index_specification.rb +16 -16
- data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -5
- data/test/rubygems/test_gem_resolver_installer_set.rb +78 -34
- data/test/rubygems/test_gem_resolver_local_specification.rb +7 -7
- data/test/rubygems/test_gem_resolver_lock_set.rb +12 -12
- data/test/rubygems/test_gem_resolver_lock_specification.rb +17 -17
- data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -1
- data/test/rubygems/test_gem_resolver_specification.rb +8 -8
- data/test/rubygems/test_gem_resolver_vendor_set.rb +6 -6
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +10 -10
- data/test/rubygems/test_gem_security.rb +67 -67
- data/test/rubygems/test_gem_security_policy.rb +62 -62
- data/test/rubygems/test_gem_security_signer.rb +28 -28
- data/test/rubygems/test_gem_security_trust_dir.rb +4 -4
- data/test/rubygems/test_gem_silent_ui.rb +38 -32
- data/test/rubygems/test_gem_source.rb +44 -44
- data/test/rubygems/test_gem_source_fetch_problem.rb +9 -9
- data/test/rubygems/test_gem_source_git.rb +59 -59
- data/test/rubygems/test_gem_source_installed.rb +16 -16
- data/test/rubygems/test_gem_source_list.rb +5 -5
- data/test/rubygems/test_gem_source_local.rb +14 -14
- data/test/rubygems/test_gem_source_lock.rb +31 -31
- data/test/rubygems/test_gem_source_specific_file.rb +17 -17
- data/test/rubygems/test_gem_source_subpath_problem.rb +7 -7
- data/test/rubygems/test_gem_source_vendor.rb +13 -13
- data/test/rubygems/test_gem_spec_fetcher.rb +72 -72
- data/test/rubygems/test_gem_specification.rb +444 -436
- data/test/rubygems/test_gem_stream_ui.rb +19 -19
- data/test/rubygems/test_gem_stub_specification.rb +32 -32
- data/test/rubygems/test_gem_text.rb +1 -1
- data/test/rubygems/test_gem_uninstaller.rb +112 -112
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -3
- data/test/rubygems/test_gem_uri.rb +4 -4
- data/test/rubygems/test_gem_uri_formatter.rb +14 -14
- data/test/rubygems/test_gem_util.rb +23 -23
- data/test/rubygems/test_gem_validator.rb +8 -8
- data/test/rubygems/test_gem_version.rb +22 -15
- data/test/rubygems/test_gem_version_option.rb +15 -15
- data/test/rubygems/test_kernel.rb +31 -31
- data/test/rubygems/test_project_sanity.rb +1 -1
- data/test/rubygems/test_remote_fetch_error.rb +6 -6
- data/test/rubygems/test_require.rb +43 -43
- data/test/rubygems/test_rubygems.rb +8 -8
- data/test/rubygems/utilities.rb +19 -19
- metadata +14 -3
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
3
|
-
require_relative
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
2
|
+
require "benchmark"
|
3
|
+
require_relative "helper"
|
4
|
+
require "date"
|
5
|
+
require "pathname"
|
6
|
+
require "stringio"
|
7
|
+
require "rubygems/ext"
|
8
|
+
require "rubygems/specification"
|
9
|
+
require "rubygems/installer"
|
10
|
+
require "rubygems/platform"
|
11
11
|
|
12
12
|
class TestGemSpecification < Gem::TestCase
|
13
13
|
LEGACY_YAML_SPEC = <<-EOF.freeze
|
@@ -44,16 +44,16 @@ end
|
|
44
44
|
EOF
|
45
45
|
|
46
46
|
def make_spec_c1
|
47
|
-
@c1 = util_spec
|
48
|
-
s.executable =
|
49
|
-
s.extensions <<
|
50
|
-
s.test_file =
|
51
|
-
s.requirements <<
|
52
|
-
s.license =
|
47
|
+
@c1 = util_spec "a", "1" do |s|
|
48
|
+
s.executable = "exec"
|
49
|
+
s.extensions << "ext/a/extconf.rb"
|
50
|
+
s.test_file = "test/suite.rb"
|
51
|
+
s.requirements << "A working computer"
|
52
|
+
s.license = "MIT"
|
53
53
|
|
54
|
-
s.add_dependency
|
55
|
-
s.add_dependency
|
56
|
-
s.add_dependency
|
54
|
+
s.add_dependency "rake", "> 0.4"
|
55
|
+
s.add_dependency "jabber4r", "> 0.0.0"
|
56
|
+
s.add_dependency "pqa", ["> 0.4", "<= 0.6"]
|
57
57
|
|
58
58
|
s.mark_version
|
59
59
|
s.files = %w[lib/code.rb]
|
@@ -61,16 +61,16 @@ end
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def ext_spec(platform: Gem::Platform::RUBY)
|
64
|
-
@ext = util_spec
|
65
|
-
s.executable =
|
66
|
-
s.test_file =
|
64
|
+
@ext = util_spec "ext", "1" do |s|
|
65
|
+
s.executable = "exec"
|
66
|
+
s.test_file = "test/suite.rb"
|
67
67
|
s.extensions = %w[ext/extconf.rb]
|
68
|
-
s.license =
|
68
|
+
s.license = "MIT"
|
69
69
|
s.platform = platform
|
70
70
|
|
71
71
|
s.mark_version
|
72
72
|
s.files = %w[lib/code.rb]
|
73
|
-
s.installed_by_version = v(
|
73
|
+
s.installed_by_version = v("2.2")
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -88,40 +88,40 @@ end
|
|
88
88
|
# is not set.
|
89
89
|
Gem.instance_variable_set(:'@default_source_date_epoch', nil)
|
90
90
|
|
91
|
-
@a1 = util_spec
|
92
|
-
s.executable =
|
93
|
-
s.test_file =
|
94
|
-
s.requirements <<
|
95
|
-
s.license =
|
91
|
+
@a1 = util_spec "a", "1" do |s|
|
92
|
+
s.executable = "exec"
|
93
|
+
s.test_file = "test/suite.rb"
|
94
|
+
s.requirements << "A working computer"
|
95
|
+
s.license = "MIT"
|
96
96
|
|
97
97
|
s.mark_version
|
98
98
|
s.files = %w[lib/code.rb]
|
99
99
|
end
|
100
100
|
|
101
|
-
@a2 = util_spec
|
101
|
+
@a2 = util_spec "a", "2" do |s|
|
102
102
|
s.files = %w[lib/code.rb]
|
103
103
|
end
|
104
104
|
|
105
|
-
@a3 = util_spec
|
106
|
-
s.metadata[
|
105
|
+
@a3 = util_spec "a", "3" do |s|
|
106
|
+
s.metadata["allowed_push_host"] = "https://privategemserver.com"
|
107
107
|
end
|
108
108
|
|
109
109
|
@current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
110
110
|
end
|
111
111
|
|
112
112
|
def test_self_find_active_stub_by_path
|
113
|
-
spec = util_spec(
|
113
|
+
spec = util_spec("a", "1", nil, "lib/foo.rb")
|
114
114
|
spec.activated = true
|
115
115
|
|
116
116
|
# There used to be a bug (introduced in a9c1aaf) when Gem::Specification
|
117
117
|
# objects are present in the @stubs collection. This test verifies that
|
118
118
|
# this scenario works correctly.
|
119
119
|
Gem::Specification.all = [spec]
|
120
|
-
assert_equal spec, Gem::Specification.find_active_stub_by_path(
|
120
|
+
assert_equal spec, Gem::Specification.find_active_stub_by_path("foo")
|
121
121
|
end
|
122
122
|
|
123
123
|
def test_self_activate
|
124
|
-
foo = util_spec
|
124
|
+
foo = util_spec "foo", "1"
|
125
125
|
|
126
126
|
assert_activate %w[foo-1], foo
|
127
127
|
end
|
@@ -147,7 +147,7 @@ end
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def test_find_in_unresolved_tree_is_not_exponentiental
|
150
|
-
pend "currently slower in CI on TruffleRuby" if RUBY_ENGINE ==
|
150
|
+
pend "currently slower in CI on TruffleRuby" if RUBY_ENGINE == "truffleruby"
|
151
151
|
num_of_pkg = 7
|
152
152
|
num_of_version_per_pkg = 3
|
153
153
|
packages = (0..num_of_pkg).map do |pkgi|
|
@@ -166,7 +166,7 @@ end
|
|
166
166
|
base.activate
|
167
167
|
|
168
168
|
tms = Benchmark.measure do
|
169
|
-
assert_raise(LoadError) { require
|
169
|
+
assert_raise(LoadError) { require "no_such_file_foo" }
|
170
170
|
end
|
171
171
|
assert_operator tms.total, :<=, 10
|
172
172
|
end
|
@@ -372,13 +372,13 @@ end
|
|
372
372
|
# [B] ~> 1.0 (satisfied by 1.0)
|
373
373
|
|
374
374
|
def test_self_activate_checks_dependencies
|
375
|
-
a = util_spec
|
376
|
-
a.add_dependency
|
377
|
-
a.add_dependency
|
375
|
+
a = util_spec "a", "1.0"
|
376
|
+
a.add_dependency "c", "= 1.0"
|
377
|
+
a.add_dependency "b", "~> 1.0"
|
378
378
|
|
379
|
-
b1 = util_spec
|
380
|
-
b2 = util_spec
|
381
|
-
c = util_spec
|
379
|
+
b1 = util_spec "b", "1.0"
|
380
|
+
b2 = util_spec "b", "2.0"
|
381
|
+
c = util_spec "c", "1.0", "b" => "= 2.0"
|
382
382
|
install_specs b1, b2, c, a
|
383
383
|
|
384
384
|
e = assert_raise Gem::LoadError do
|
@@ -396,10 +396,10 @@ end
|
|
396
396
|
# [B] = 2.0
|
397
397
|
|
398
398
|
def test_self_activate_divergent
|
399
|
-
a = util_spec
|
400
|
-
b1 = util_spec
|
401
|
-
b2 = util_spec
|
402
|
-
c = util_spec
|
399
|
+
a = util_spec "a", "1.0", "b" => "~> 1.0", "c" => "= 1.0"
|
400
|
+
b1 = util_spec "b", "1.0"
|
401
|
+
b2 = util_spec "b", "2.0"
|
402
|
+
c = util_spec "c", "1.0", "b" => "= 2.0"
|
403
403
|
|
404
404
|
install_specs b1, b2, c, a
|
405
405
|
|
@@ -415,9 +415,9 @@ end
|
|
415
415
|
# DOC
|
416
416
|
|
417
417
|
def test_self_activate_old_required
|
418
|
-
e1, = util_spec
|
419
|
-
@d1 = util_spec
|
420
|
-
@d2 = util_spec
|
418
|
+
e1, = util_spec "e", "1", "d" => "= 1"
|
419
|
+
@d1 = util_spec "d", "1"
|
420
|
+
@d2 = util_spec "d", "2"
|
421
421
|
|
422
422
|
install_specs @d1, @d2, e1
|
423
423
|
|
@@ -428,17 +428,17 @@ end
|
|
428
428
|
# DOC
|
429
429
|
|
430
430
|
def test_self_activate_platform_alternate
|
431
|
-
@x1_m = util_spec
|
431
|
+
@x1_m = util_spec "x", "1" do |s|
|
432
432
|
s.platform = Gem::Platform.new %w[cpu my_platform 1]
|
433
433
|
end
|
434
434
|
|
435
|
-
@x1_o = util_spec
|
435
|
+
@x1_o = util_spec "x", "1" do |s|
|
436
436
|
s.platform = Gem::Platform.new %w[cpu other_platform 1]
|
437
437
|
end
|
438
438
|
|
439
|
-
@w1 = util_spec
|
439
|
+
@w1 = util_spec "w", "1", "x" => nil
|
440
440
|
|
441
|
-
util_set_arch
|
441
|
+
util_set_arch "cpu-my_platform1"
|
442
442
|
install_specs @x1_m, @x1_o, @w1
|
443
443
|
|
444
444
|
assert_activate %w[x-1-cpu-my_platform-1 w-1], @w1, @x1_m
|
@@ -448,13 +448,13 @@ end
|
|
448
448
|
# DOC
|
449
449
|
|
450
450
|
def test_self_activate_platform_bump
|
451
|
-
@y1 = util_spec
|
451
|
+
@y1 = util_spec "y", "1"
|
452
452
|
|
453
|
-
@y1_1_p = util_spec
|
453
|
+
@y1_1_p = util_spec "y", "1.1" do |s|
|
454
454
|
s.platform = Gem::Platform.new %w[cpu my_platform 1]
|
455
455
|
end
|
456
456
|
|
457
|
-
@z1 = util_spec
|
457
|
+
@z1 = util_spec "z", "1", "y" => nil
|
458
458
|
install_specs @y1, @y1_1_p, @z1
|
459
459
|
|
460
460
|
assert_activate %w[y-1 z-1], @z1, @y1
|
@@ -467,11 +467,11 @@ end
|
|
467
467
|
# [A] >= 0 (satisfied by 1.a)
|
468
468
|
|
469
469
|
def test_self_activate_prerelease
|
470
|
-
@c1_pre = util_spec
|
471
|
-
@a1_pre = util_spec
|
472
|
-
@b1 = util_spec
|
473
|
-
s.add_dependency
|
474
|
-
s.add_development_dependency
|
470
|
+
@c1_pre = util_spec "c", "1.a", "a" => "1.a", "b" => "1"
|
471
|
+
@a1_pre = util_spec "a", "1.a"
|
472
|
+
@b1 = util_spec "b", "1" do |s|
|
473
|
+
s.add_dependency "a"
|
474
|
+
s.add_development_dependency "aa"
|
475
475
|
end
|
476
476
|
install_specs @a1_pre, @b1, @c1_pre
|
477
477
|
|
@@ -533,7 +533,7 @@ end
|
|
533
533
|
end
|
534
534
|
|
535
535
|
def test_self_activate_loaded
|
536
|
-
foo = util_spec
|
536
|
+
foo = util_spec "foo", "1"
|
537
537
|
|
538
538
|
assert foo.activate
|
539
539
|
refute foo.activate
|
@@ -545,9 +545,9 @@ end
|
|
545
545
|
# [C] depends on nothing
|
546
546
|
|
547
547
|
def test_self_activate_unrelated
|
548
|
-
a = util_spec
|
549
|
-
b = util_spec
|
550
|
-
c = util_spec
|
548
|
+
a = util_spec "a", "1.0", "b" => ">= 1.0"
|
549
|
+
b = util_spec "b", "1.0"
|
550
|
+
c = util_spec "c", "1.0"
|
551
551
|
install_specs b, c, a
|
552
552
|
|
553
553
|
assert_activate %w[b-1.0 c-1.0 a-1.0], a, c, "b"
|
@@ -563,11 +563,11 @@ end
|
|
563
563
|
# TODO: move these to specification
|
564
564
|
|
565
565
|
def test_self_activate_over
|
566
|
-
a = util_spec
|
567
|
-
install_specs util_spec
|
568
|
-
install_specs util_spec
|
569
|
-
install_specs util_spec
|
570
|
-
install_specs util_spec
|
566
|
+
a = util_spec "a", "1.0", "b" => ">= 1.0", "c" => "= 1.0"
|
567
|
+
install_specs util_spec "b", "1.0"
|
568
|
+
install_specs util_spec "b", "1.1"
|
569
|
+
install_specs util_spec "b", "2.0"
|
570
|
+
install_specs util_spec "c", "1.0", "b" => "~> 1.0"
|
571
571
|
install_specs a
|
572
572
|
|
573
573
|
a.activate
|
@@ -588,10 +588,10 @@ end
|
|
588
588
|
# first resolve through a dependency that is later pruned.
|
589
589
|
|
590
590
|
def test_self_activate_under
|
591
|
-
a = util_spec
|
592
|
-
b1 = util_spec
|
593
|
-
b1_1 = util_spec
|
594
|
-
c = util_spec
|
591
|
+
a = util_spec "a", "1.0", "b" => "~> 1.0", "c" => "= 1.0"
|
592
|
+
b1 = util_spec "b", "1.0"
|
593
|
+
b1_1 = util_spec "b", "1.1"
|
594
|
+
c = util_spec "c", "1.0", "b" => "= 1.0"
|
595
595
|
|
596
596
|
install_specs b1, b1_1, c, a
|
597
597
|
|
@@ -607,10 +607,10 @@ end
|
|
607
607
|
# [C1] depends on nothing
|
608
608
|
|
609
609
|
def test_self_activate_dropped
|
610
|
-
a1 = util_spec
|
611
|
-
b1 = util_spec
|
612
|
-
b2 = util_spec
|
613
|
-
c1 = util_spec
|
610
|
+
a1 = util_spec "a", "1", "b" => nil
|
611
|
+
b1 = util_spec "b", "1", "c" => nil
|
612
|
+
b2 = util_spec "b", "2"
|
613
|
+
c1 = util_spec "c", "1"
|
614
614
|
install_specs c1, b1, b2, a1
|
615
615
|
|
616
616
|
assert_activate %w[b-2 a-1], a1, "b"
|
@@ -627,11 +627,11 @@ end
|
|
627
627
|
# resolve.
|
628
628
|
|
629
629
|
def test_self_activate_raggi_the_edgecase_generator
|
630
|
-
a = util_spec
|
631
|
-
b1 = util_spec
|
632
|
-
b1_0 = util_spec
|
633
|
-
c = util_spec
|
634
|
-
z = util_spec
|
630
|
+
a = util_spec "a", "1.0", "b" => ">= 1.0", "c" => ">= 1.0"
|
631
|
+
b1 = util_spec "b", "1.0"
|
632
|
+
b1_0 = util_spec "b", "1.1", "z" => ">= 1.0"
|
633
|
+
c = util_spec "c", "1.0", "b" => "= 1.0"
|
634
|
+
z = util_spec "z", "1"
|
635
635
|
|
636
636
|
install_specs z, b1, b1_0, c, z
|
637
637
|
|
@@ -639,8 +639,8 @@ end
|
|
639
639
|
end
|
640
640
|
|
641
641
|
def test_self_activate_conflict
|
642
|
-
install_specs util_spec
|
643
|
-
install_specs util_spec
|
642
|
+
install_specs util_spec "b", "1.0"
|
643
|
+
install_specs util_spec "b", "2.0"
|
644
644
|
|
645
645
|
gem "b", "= 1.0"
|
646
646
|
|
@@ -655,7 +655,7 @@ end
|
|
655
655
|
install_specs a
|
656
656
|
Gem::Specification.all = [a]
|
657
657
|
|
658
|
-
assert_equal a, Gem::Specification.find_inactive_by_path(
|
658
|
+
assert_equal a, Gem::Specification.find_inactive_by_path("foo")
|
659
659
|
end
|
660
660
|
|
661
661
|
def test_self_attribute_names
|
@@ -698,13 +698,13 @@ end
|
|
698
698
|
|
699
699
|
def test_self__load_future
|
700
700
|
spec = Gem::Specification.new
|
701
|
-
spec.name =
|
702
|
-
spec.version =
|
701
|
+
spec.name = "a"
|
702
|
+
spec.version = "1"
|
703
703
|
spec.specification_version = @current_version + 1
|
704
704
|
|
705
705
|
load_spec = Marshal.load Marshal.dump(spec)
|
706
706
|
|
707
|
-
assert_equal
|
707
|
+
assert_equal "a", load_spec.name
|
708
708
|
assert_equal Gem::Version.new(1), load_spec.version
|
709
709
|
assert_equal @current_version, load_spec.specification_version
|
710
710
|
end
|
@@ -783,20 +783,20 @@ dependencies: []
|
|
783
783
|
end
|
784
784
|
|
785
785
|
def test_self_load_relative
|
786
|
-
File.open
|
786
|
+
File.open "a-2.gemspec", "w" do |io|
|
787
787
|
io.write @a2.to_ruby_for_cache
|
788
788
|
end
|
789
789
|
|
790
|
-
spec = Gem::Specification.load
|
790
|
+
spec = Gem::Specification.load "a-2.gemspec"
|
791
791
|
|
792
792
|
@a2.files.clear
|
793
793
|
|
794
794
|
assert_equal @a2, spec
|
795
795
|
|
796
|
-
assert_equal File.join(@tempdir,
|
796
|
+
assert_equal File.join(@tempdir, "a-2.gemspec"), spec.loaded_from
|
797
797
|
end
|
798
798
|
|
799
|
-
if RUBY_ENGINE ==
|
799
|
+
if RUBY_ENGINE == "ruby" && RUBY_VERSION < "2.7"
|
800
800
|
def test_self_load_tainted
|
801
801
|
full_path = @a2.spec_file
|
802
802
|
write_file full_path do |io|
|
@@ -874,13 +874,13 @@ dependencies: []
|
|
874
874
|
end
|
875
875
|
|
876
876
|
def test_self_load_utf8_with_ascii_encoding
|
877
|
-
with_internal_encoding(
|
877
|
+
with_internal_encoding("US-ASCII") do
|
878
878
|
spec2 = @a2.dup
|
879
879
|
bin = "\u5678".dup
|
880
880
|
spec2.authors = [bin]
|
881
881
|
full_path = spec2.spec_file
|
882
882
|
write_file full_path do |io|
|
883
|
-
io.write spec2.to_ruby_for_cache.force_encoding(
|
883
|
+
io.write spec2.to_ruby_for_cache.force_encoding("BINARY").sub("\\u{5678}", bin.force_encoding("BINARY"))
|
884
884
|
end
|
885
885
|
|
886
886
|
spec = Gem::Specification.load full_path
|
@@ -895,10 +895,10 @@ dependencies: []
|
|
895
895
|
spec = Gem::Deprecate.skip_during do
|
896
896
|
eval LEGACY_RUBY_SPEC
|
897
897
|
end
|
898
|
-
assert_equal
|
899
|
-
assert_equal
|
898
|
+
assert_equal "keyedlist", spec.name
|
899
|
+
assert_equal "0.4.0", spec.version.to_s
|
900
900
|
assert_kind_of Time, spec.date
|
901
|
-
assert spec.required_ruby_version.satisfied_by?(Gem::Version.new(
|
901
|
+
assert spec.required_ruby_version.satisfied_by?(Gem::Version.new("1"))
|
902
902
|
assert_equal false, spec.has_unit_tests?
|
903
903
|
end
|
904
904
|
|
@@ -933,9 +933,9 @@ dependencies: []
|
|
933
933
|
|
934
934
|
def test_self_outdated
|
935
935
|
spec_fetcher do |fetcher|
|
936
|
-
fetcher.download
|
936
|
+
fetcher.download "a", 4
|
937
937
|
|
938
|
-
fetcher.spec
|
938
|
+
fetcher.spec "a", 3
|
939
939
|
end
|
940
940
|
|
941
941
|
assert_equal %w[a], Gem::Specification.outdated
|
@@ -943,16 +943,16 @@ dependencies: []
|
|
943
943
|
|
944
944
|
def test_self_outdated_and_latest_remotes
|
945
945
|
spec_fetcher do |fetcher|
|
946
|
-
fetcher.download
|
947
|
-
fetcher.download
|
946
|
+
fetcher.download "a", 4
|
947
|
+
fetcher.download "b", 3
|
948
948
|
|
949
|
-
fetcher.spec
|
950
|
-
fetcher.spec
|
949
|
+
fetcher.spec "a", "3.a"
|
950
|
+
fetcher.spec "b", 2
|
951
951
|
end
|
952
952
|
|
953
953
|
expected = [
|
954
|
-
[Gem::Specification.stubs.find {|s| s.full_name ==
|
955
|
-
[Gem::Specification.stubs.find {|s| s.full_name ==
|
954
|
+
[Gem::Specification.stubs.find {|s| s.full_name == "a-3.a" }, v(4)],
|
955
|
+
[Gem::Specification.stubs.find {|s| s.full_name == "b-2" }, v(3)],
|
956
956
|
]
|
957
957
|
|
958
958
|
assert_equal expected, Gem::Specification.outdated_and_latest_version.to_a
|
@@ -961,18 +961,18 @@ dependencies: []
|
|
961
961
|
def test_self_remove_spec
|
962
962
|
install_specs @a1
|
963
963
|
|
964
|
-
assert_includes Gem::Specification.all_names,
|
965
|
-
assert_includes Gem::Specification.stubs.map {|s| s.full_name },
|
964
|
+
assert_includes Gem::Specification.all_names, "a-1"
|
965
|
+
assert_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
|
966
966
|
|
967
967
|
uninstall_gem @a1
|
968
968
|
Gem::Specification.reset
|
969
969
|
|
970
|
-
refute_includes Gem::Specification.all_names,
|
971
|
-
refute_includes Gem::Specification.stubs.map {|s| s.full_name },
|
970
|
+
refute_includes Gem::Specification.all_names, "a-1"
|
971
|
+
refute_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
|
972
972
|
end
|
973
973
|
|
974
974
|
def test_self_remove_spec_removed
|
975
|
-
File.open @a1.spec_file,
|
975
|
+
File.open @a1.spec_file, "w" do |io|
|
976
976
|
io.write @a1.to_ruby
|
977
977
|
end
|
978
978
|
|
@@ -982,40 +982,40 @@ dependencies: []
|
|
982
982
|
|
983
983
|
Gem::Specification.reset
|
984
984
|
|
985
|
-
refute_includes Gem::Specification.all_names,
|
986
|
-
refute_includes Gem::Specification.stubs.map {|s| s.full_name },
|
985
|
+
refute_includes Gem::Specification.all_names, "a-1"
|
986
|
+
refute_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
|
987
987
|
end
|
988
988
|
|
989
989
|
def test_self_stubs_for_lazy_loading
|
990
990
|
Gem.loaded_specs.clear
|
991
991
|
Gem::Specification.class_variable_set(:@@stubs, nil)
|
992
992
|
|
993
|
-
dir_standard_specs = File.join Gem.dir,
|
993
|
+
dir_standard_specs = File.join Gem.dir, "specifications"
|
994
994
|
|
995
|
-
save_gemspec(
|
996
|
-
save_gemspec(
|
995
|
+
save_gemspec("a-1", "1", dir_standard_specs) {|s| s.name = "a" }
|
996
|
+
save_gemspec("b-1", "1", dir_standard_specs) {|s| s.name = "b" }
|
997
997
|
|
998
|
-
assert_equal [
|
998
|
+
assert_equal ["a-1"], Gem::Specification.stubs_for("a").map {|s| s.full_name }
|
999
999
|
assert_equal 1, Gem::Specification.class_variable_get(:@@stubs_by_name).length
|
1000
|
-
assert_equal [
|
1000
|
+
assert_equal ["b-1"], Gem::Specification.stubs_for("b").map {|s| s.full_name }
|
1001
1001
|
assert_equal 2, Gem::Specification.class_variable_get(:@@stubs_by_name).length
|
1002
1002
|
|
1003
1003
|
assert_equal(
|
1004
|
-
Gem::Specification.stubs_for(
|
1005
|
-
Gem::Specification.stubs_for(
|
1004
|
+
Gem::Specification.stubs_for("a").map {|s| s.object_id },
|
1005
|
+
Gem::Specification.stubs_for("a").map {|s| s.object_id }
|
1006
1006
|
)
|
1007
1007
|
|
1008
|
-
Gem.loaded_specs.delete
|
1009
|
-
Gem.loaded_specs.delete
|
1008
|
+
Gem.loaded_specs.delete "a"
|
1009
|
+
Gem.loaded_specs.delete "b"
|
1010
1010
|
Gem::Specification.class_variable_set(:@@stubs, nil)
|
1011
1011
|
end
|
1012
1012
|
|
1013
1013
|
def test_self_stubs_for_no_lazy_loading_after_all_specs_setup
|
1014
|
-
Gem::Specification.all = [util_spec(
|
1014
|
+
Gem::Specification.all = [util_spec("a", "1")]
|
1015
1015
|
|
1016
|
-
save_gemspec(
|
1016
|
+
save_gemspec("b-1", "1", File.join(Gem.dir, "specifications")) {|s| s.name = "b" }
|
1017
1017
|
|
1018
|
-
assert_equal [], Gem::Specification.stubs_for(
|
1018
|
+
assert_equal [], Gem::Specification.stubs_for("b").map {|s| s.full_name }
|
1019
1019
|
end
|
1020
1020
|
|
1021
1021
|
def test_self_stubs_for_mult_platforms
|
@@ -1025,30 +1025,30 @@ dependencies: []
|
|
1025
1025
|
orig_platform = Gem.platforms.dup
|
1026
1026
|
|
1027
1027
|
# create user spec
|
1028
|
-
user_spec_dir = File.join Gem.user_dir,
|
1028
|
+
user_spec_dir = File.join Gem.user_dir, "specifications"
|
1029
1029
|
FileUtils.mkdir_p(user_spec_dir) unless Dir.exist? user_spec_dir
|
1030
1030
|
# dirs doesn't include user ?
|
1031
1031
|
Gem::Specification.dirs << user_spec_dir
|
1032
1032
|
|
1033
|
-
gem =
|
1034
|
-
v =
|
1035
|
-
platforms = [
|
1033
|
+
gem = "mingw"
|
1034
|
+
v = "1.1.1"
|
1035
|
+
platforms = ["x86-mingw32", "x64-mingw32"]
|
1036
1036
|
|
1037
1037
|
#create specs
|
1038
1038
|
platforms.each do |plat|
|
1039
1039
|
spec = Gem::Specification.new(gem, v) {|s| s.platform = plat }
|
1040
|
-
File.open File.join(user_spec_dir, "#{gem}-#{v}-#{plat}.gemspec"),
|
1040
|
+
File.open File.join(user_spec_dir, "#{gem}-#{v}-#{plat}.gemspec"), "w" do |io|
|
1041
1041
|
io.write spec.to_ruby
|
1042
1042
|
end
|
1043
1043
|
end
|
1044
1044
|
|
1045
1045
|
platforms.each do |plat|
|
1046
1046
|
cur_plat = Gem::Platform.new plat
|
1047
|
-
Gem.platforms = [
|
1047
|
+
Gem.platforms = ["ruby", cur_plat]
|
1048
1048
|
|
1049
1049
|
Gem::Specification.class_variable_set :@@stubs, nil
|
1050
1050
|
Gem::Specification.stubs if plat == platforms.last # test loading via stubs
|
1051
|
-
t = Gem::Specification.stubs_for
|
1051
|
+
t = Gem::Specification.stubs_for "mingw"
|
1052
1052
|
|
1053
1053
|
assert_equal 1, t.length
|
1054
1054
|
assert_equal cur_plat, t.first.platform
|
@@ -1058,17 +1058,17 @@ dependencies: []
|
|
1058
1058
|
end
|
1059
1059
|
|
1060
1060
|
def test_self_stubs_returns_only_specified_named_specs
|
1061
|
-
dir_standard_specs = File.join Gem.dir,
|
1061
|
+
dir_standard_specs = File.join Gem.dir, "specifications"
|
1062
1062
|
|
1063
|
-
save_gemspec(
|
1064
|
-
save_gemspec(
|
1065
|
-
save_gemspec(
|
1063
|
+
save_gemspec("a-1", "1", dir_standard_specs) {|s| s.name = "a" }
|
1064
|
+
save_gemspec("a-2", "2", dir_standard_specs) {|s| s.name = "a" }
|
1065
|
+
save_gemspec("a-a", "3", dir_standard_specs) {|s| s.name = "a-a" }
|
1066
1066
|
|
1067
|
-
assert_equal [
|
1067
|
+
assert_equal ["a-1", "a-2"], Gem::Specification.stubs_for("a").map(&:full_name).sort
|
1068
1068
|
end
|
1069
1069
|
|
1070
1070
|
def test_handles_private_null_type
|
1071
|
-
path = File.expand_path
|
1071
|
+
path = File.expand_path "data/pry-0.4.7.gemspec.rz", __dir__
|
1072
1072
|
|
1073
1073
|
data = Marshal.load Gem::Util.inflate(Gem.read_binary(path))
|
1074
1074
|
|
@@ -1076,7 +1076,7 @@ dependencies: []
|
|
1076
1076
|
end
|
1077
1077
|
|
1078
1078
|
def test_handles_dependencies_with_syck_requirements_bug
|
1079
|
-
path = File.expand_path
|
1079
|
+
path = File.expand_path "data/excon-0.7.7.gemspec.rz", __dir__
|
1080
1080
|
|
1081
1081
|
data = Marshal.load Gem::Util.inflate(Gem.read_binary(path))
|
1082
1082
|
|
@@ -1102,9 +1102,9 @@ dependencies: []
|
|
1102
1102
|
assert_equal [], spec.extensions
|
1103
1103
|
assert_equal [], spec.requirements
|
1104
1104
|
assert_equal [], spec.dependencies
|
1105
|
-
assert_equal
|
1106
|
-
assert_equal
|
1107
|
-
assert_equal
|
1105
|
+
assert_equal "bin", spec.bindir
|
1106
|
+
assert_equal ">= 0", spec.required_ruby_version.to_s
|
1107
|
+
assert_equal ">= 0", spec.required_rubygems_version.to_s
|
1108
1108
|
end
|
1109
1109
|
|
1110
1110
|
def test_initialize_future
|
@@ -1126,18 +1126,18 @@ dependencies: []
|
|
1126
1126
|
spec = Gem::Specification.new do |s|
|
1127
1127
|
s.name = "blah"
|
1128
1128
|
s.version = "1.3.5"
|
1129
|
-
s.summary =
|
1130
|
-
s.description =
|
1131
|
-
s.authors =
|
1132
|
-
s.licenses =
|
1133
|
-
s.files =
|
1134
|
-
s.test_files =
|
1135
|
-
s.rdoc_options =
|
1136
|
-
s.extra_rdoc_files =
|
1137
|
-
s.executables =
|
1138
|
-
s.extensions =
|
1139
|
-
s.requirements =
|
1140
|
-
s.add_dependency
|
1129
|
+
s.summary = "summary"
|
1130
|
+
s.description = "description"
|
1131
|
+
s.authors = "author a", "author b"
|
1132
|
+
s.licenses = "BSD-2-Clause"
|
1133
|
+
s.files = "lib/file.rb"
|
1134
|
+
s.test_files = "test/file.rb"
|
1135
|
+
s.rdoc_options = "--foo"
|
1136
|
+
s.extra_rdoc_files = "README.txt"
|
1137
|
+
s.executables = "exec"
|
1138
|
+
s.extensions = "ext/extconf.rb"
|
1139
|
+
s.requirements = "requirement"
|
1140
|
+
s.add_dependency "some_gem"
|
1141
1141
|
end
|
1142
1142
|
|
1143
1143
|
dup_spec = spec.dup
|
@@ -1151,84 +1151,93 @@ dependencies: []
|
|
1151
1151
|
assert_equal Gem::Platform::RUBY, spec.platform
|
1152
1152
|
assert_same spec.platform, dup_spec.platform
|
1153
1153
|
|
1154
|
-
assert_equal
|
1154
|
+
assert_equal "summary", spec.summary
|
1155
1155
|
assert_same spec.summary, dup_spec.summary
|
1156
1156
|
|
1157
1157
|
assert_equal %w[README.txt bin/exec ext/extconf.rb lib/file.rb
|
1158
1158
|
test/file.rb].sort,
|
1159
1159
|
spec.files
|
1160
|
-
refute_same spec.files, dup_spec.files,
|
1160
|
+
refute_same spec.files, dup_spec.files, "files"
|
1161
1161
|
|
1162
1162
|
assert_equal %w[test/file.rb], spec.test_files
|
1163
|
-
refute_same spec.test_files, dup_spec.test_files,
|
1163
|
+
refute_same spec.test_files, dup_spec.test_files, "test_files"
|
1164
1164
|
|
1165
1165
|
assert_equal %w[--foo], spec.rdoc_options
|
1166
|
-
refute_same spec.rdoc_options, dup_spec.rdoc_options,
|
1166
|
+
refute_same spec.rdoc_options, dup_spec.rdoc_options, "rdoc_options"
|
1167
1167
|
|
1168
1168
|
assert_equal %w[README.txt], spec.extra_rdoc_files
|
1169
1169
|
refute_same spec.extra_rdoc_files, dup_spec.extra_rdoc_files,
|
1170
|
-
|
1170
|
+
"extra_rdoc_files"
|
1171
1171
|
|
1172
1172
|
assert_equal %w[exec], spec.executables
|
1173
|
-
refute_same spec.executables, dup_spec.executables,
|
1173
|
+
refute_same spec.executables, dup_spec.executables, "executables"
|
1174
1174
|
|
1175
1175
|
assert_equal %w[ext/extconf.rb], spec.extensions
|
1176
|
-
refute_same spec.extensions, dup_spec.extensions,
|
1176
|
+
refute_same spec.extensions, dup_spec.extensions, "extensions"
|
1177
1177
|
|
1178
1178
|
assert_equal %w[requirement], spec.requirements
|
1179
|
-
refute_same spec.requirements, dup_spec.requirements,
|
1179
|
+
refute_same spec.requirements, dup_spec.requirements, "requirements"
|
1180
1180
|
|
1181
|
-
assert_equal [Gem::Dependency.new(
|
1181
|
+
assert_equal [Gem::Dependency.new("some_gem", Gem::Requirement.default)],
|
1182
1182
|
spec.dependencies
|
1183
|
-
refute_same spec.dependencies, dup_spec.dependencies,
|
1183
|
+
refute_same spec.dependencies, dup_spec.dependencies, "dependencies"
|
1184
1184
|
|
1185
|
-
assert_equal
|
1185
|
+
assert_equal "bin", spec.bindir
|
1186
1186
|
assert_same spec.bindir, dup_spec.bindir
|
1187
1187
|
|
1188
|
-
assert_equal
|
1188
|
+
assert_equal ">= 0", spec.required_ruby_version.to_s
|
1189
1189
|
assert_same spec.required_ruby_version, dup_spec.required_ruby_version
|
1190
1190
|
|
1191
|
-
assert_equal
|
1191
|
+
assert_equal ">= 0", spec.required_rubygems_version.to_s
|
1192
1192
|
assert_same spec.required_rubygems_version,
|
1193
1193
|
dup_spec.required_rubygems_version
|
1194
1194
|
end
|
1195
1195
|
|
1196
1196
|
def test_initialize_copy_broken
|
1197
1197
|
spec = Gem::Specification.new do |s|
|
1198
|
-
s.name =
|
1199
|
-
s.version =
|
1198
|
+
s.name = "a"
|
1199
|
+
s.version = "1"
|
1200
1200
|
end
|
1201
1201
|
|
1202
1202
|
spec.instance_variable_set :@licenses, (class << (Object.new);self;end)
|
1203
|
-
spec.loaded_from =
|
1203
|
+
spec.loaded_from = "/path/to/file"
|
1204
1204
|
|
1205
1205
|
e = assert_raise Gem::FormatException do
|
1206
1206
|
spec.dup
|
1207
1207
|
end
|
1208
1208
|
|
1209
|
-
assert_equal
|
1210
|
-
assert_equal
|
1209
|
+
assert_equal "a-1 has an invalid value for @licenses", e.message
|
1210
|
+
assert_equal "/path/to/file", e.file_path
|
1211
1211
|
end
|
1212
1212
|
|
1213
1213
|
def test_initialize_prerelease_version_before_name
|
1214
1214
|
spec = Gem::Specification.new do |s|
|
1215
|
-
s.version =
|
1216
|
-
s.name =
|
1215
|
+
s.version = "1.0.0.dev"
|
1216
|
+
s.name = "a"
|
1217
1217
|
end
|
1218
1218
|
|
1219
1219
|
assert_equal "a", spec.name
|
1220
1220
|
assert_equal "1.0.0.dev", spec.version.to_s
|
1221
1221
|
end
|
1222
1222
|
|
1223
|
+
def test_initialize_nil_version
|
1224
|
+
expected = "nil versions are discouraged and will be deprecated in Rubygems 4\n"
|
1225
|
+
actual_stdout, actual_stderr = capture_output do
|
1226
|
+
Gem::Specification.new.version = nil
|
1227
|
+
end
|
1228
|
+
assert_empty actual_stdout
|
1229
|
+
assert_equal(expected, actual_stderr)
|
1230
|
+
end
|
1231
|
+
|
1223
1232
|
def test__dump
|
1224
1233
|
@a2.platform = Gem::Platform.local
|
1225
|
-
@a2.instance_variable_set :@original_platform,
|
1234
|
+
@a2.instance_variable_set :@original_platform, "old_platform"
|
1226
1235
|
|
1227
1236
|
data = Marshal.dump @a2
|
1228
1237
|
|
1229
1238
|
same_spec = Marshal.load data
|
1230
1239
|
|
1231
|
-
assert_equal
|
1240
|
+
assert_equal "old_platform", same_spec.original_platform
|
1232
1241
|
end
|
1233
1242
|
|
1234
1243
|
def test_activate
|
@@ -1247,7 +1256,7 @@ dependencies: []
|
|
1247
1256
|
end
|
1248
1257
|
|
1249
1258
|
def test_add_dependency_from_existing_dependency
|
1250
|
-
dep = Gem::Dependency.new("existing_dep", Gem::Requirement.new(
|
1259
|
+
dep = Gem::Dependency.new("existing_dep", Gem::Requirement.new("> 1"), :runtime)
|
1251
1260
|
spec = Gem::Specification.new {|s| s.add_dependency dep }
|
1252
1261
|
assert_equal dep, spec.dependencies.first
|
1253
1262
|
end
|
@@ -1262,22 +1271,22 @@ dependencies: []
|
|
1262
1271
|
end
|
1263
1272
|
|
1264
1273
|
def test_author
|
1265
|
-
assert_equal
|
1274
|
+
assert_equal "A User", @a1.author
|
1266
1275
|
end
|
1267
1276
|
|
1268
1277
|
def test_authors
|
1269
|
-
assert_equal [
|
1278
|
+
assert_equal ["A User"], @a1.authors
|
1270
1279
|
end
|
1271
1280
|
|
1272
1281
|
def test_bindir_equals
|
1273
|
-
@a1.bindir =
|
1282
|
+
@a1.bindir = "apps"
|
1274
1283
|
|
1275
|
-
assert_equal
|
1284
|
+
assert_equal "apps", @a1.bindir
|
1276
1285
|
end
|
1277
1286
|
|
1278
1287
|
def test_bindir_equals_nil
|
1279
1288
|
@a2.bindir = nil
|
1280
|
-
@a2.executable =
|
1289
|
+
@a2.executable = "app"
|
1281
1290
|
|
1282
1291
|
assert_nil @a2.bindir
|
1283
1292
|
assert_equal %w[app lib/code.rb].sort, @a2.files
|
@@ -1313,14 +1322,14 @@ dependencies: []
|
|
1313
1322
|
|
1314
1323
|
assert_empty @ext.build_args
|
1315
1324
|
|
1316
|
-
File.open @ext.build_info_file,
|
1325
|
+
File.open @ext.build_info_file, "w" do |io|
|
1317
1326
|
io.puts
|
1318
1327
|
end
|
1319
1328
|
|
1320
1329
|
assert_empty @ext.build_args
|
1321
1330
|
|
1322
|
-
File.open @ext.build_info_file,
|
1323
|
-
io.puts
|
1331
|
+
File.open @ext.build_info_file, "w" do |io|
|
1332
|
+
io.puts "--with-foo-dir=wherever"
|
1324
1333
|
end
|
1325
1334
|
|
1326
1335
|
assert_equal %w[--with-foo-dir=wherever], @ext.build_args
|
@@ -1330,13 +1339,13 @@ dependencies: []
|
|
1330
1339
|
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1331
1340
|
ext_spec
|
1332
1341
|
|
1333
|
-
assert_path_not_exist @ext.extension_dir,
|
1334
|
-
refute_empty @ext.extensions,
|
1342
|
+
assert_path_not_exist @ext.extension_dir, "sanity check"
|
1343
|
+
refute_empty @ext.extensions, "sanity check"
|
1335
1344
|
|
1336
1345
|
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1337
1346
|
FileUtils.mkdir_p File.dirname extconf_rb
|
1338
1347
|
|
1339
|
-
File.open extconf_rb,
|
1348
|
+
File.open extconf_rb, "w" do |f|
|
1340
1349
|
f.write <<-'RUBY'
|
1341
1350
|
File.open 'Makefile', 'w' do |f|
|
1342
1351
|
f.puts "clean:\n\techo clean"
|
@@ -1352,13 +1361,13 @@ dependencies: []
|
|
1352
1361
|
end
|
1353
1362
|
|
1354
1363
|
def test_default_spec_stub_is_marked_default
|
1355
|
-
default = new_default_spec
|
1364
|
+
default = new_default_spec "default", 2
|
1356
1365
|
install_default_gems default
|
1357
1366
|
|
1358
|
-
stub = Gem::Specification.stubs.find {|s| s.name ==
|
1367
|
+
stub = Gem::Specification.stubs.find {|s| s.name == "default" }
|
1359
1368
|
assert_predicate stub, :default_gem?
|
1360
1369
|
|
1361
|
-
stub = Gem::Specification.find_all_by_name(
|
1370
|
+
stub = Gem::Specification.find_all_by_name("default").first
|
1362
1371
|
assert_predicate stub, :default_gem?
|
1363
1372
|
end
|
1364
1373
|
|
@@ -1366,28 +1375,28 @@ dependencies: []
|
|
1366
1375
|
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1367
1376
|
ext_spec
|
1368
1377
|
|
1369
|
-
refute_empty @ext.extensions,
|
1378
|
+
refute_empty @ext.extensions, "sanity check"
|
1370
1379
|
|
1371
1380
|
gem_build_complete =
|
1372
|
-
File.join @ext.extension_dir,
|
1381
|
+
File.join @ext.extension_dir, "gem.build_complete"
|
1373
1382
|
|
1374
1383
|
FileUtils.mkdir_p @ext.extension_dir
|
1375
1384
|
FileUtils.touch gem_build_complete
|
1376
1385
|
|
1377
1386
|
@ext.build_extensions
|
1378
1387
|
|
1379
|
-
gem_make_out = File.join @ext.extension_dir,
|
1388
|
+
gem_make_out = File.join @ext.extension_dir, "gem_make.out"
|
1380
1389
|
assert_path_not_exist gem_make_out
|
1381
1390
|
end
|
1382
1391
|
|
1383
1392
|
def test_build_extensions_default_gem
|
1384
|
-
spec = new_default_spec
|
1385
|
-
spec.extensions <<
|
1393
|
+
spec = new_default_spec "default", 1
|
1394
|
+
spec.extensions << "extconf.rb"
|
1386
1395
|
|
1387
1396
|
extconf_rb = File.join spec.gem_dir, spec.extensions.first
|
1388
1397
|
FileUtils.mkdir_p File.dirname extconf_rb
|
1389
1398
|
|
1390
|
-
File.open extconf_rb,
|
1399
|
+
File.open extconf_rb, "w" do |f|
|
1391
1400
|
f.write <<-'RUBY'
|
1392
1401
|
File.open 'Makefile', 'w' do |f|
|
1393
1402
|
f.puts "default:\n\techo built"
|
@@ -1405,7 +1414,7 @@ dependencies: []
|
|
1405
1414
|
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1406
1415
|
ext_spec
|
1407
1416
|
|
1408
|
-
refute_empty @ext.extensions,
|
1417
|
+
refute_empty @ext.extensions, "sanity check"
|
1409
1418
|
|
1410
1419
|
assert_raise Gem::Ext::BuildError do
|
1411
1420
|
@ext.build_extensions
|
@@ -1413,18 +1422,18 @@ dependencies: []
|
|
1413
1422
|
end
|
1414
1423
|
|
1415
1424
|
def test_build_extensions_extensions_dir_unwritable
|
1416
|
-
pend
|
1417
|
-
pend
|
1425
|
+
pend "chmod not supported" if Gem.win_platform?
|
1426
|
+
pend "skipped in root privilege" if Process.uid.zero?
|
1418
1427
|
|
1419
1428
|
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1420
1429
|
ext_spec
|
1421
1430
|
|
1422
|
-
refute_empty @ext.extensions,
|
1431
|
+
refute_empty @ext.extensions, "sanity check"
|
1423
1432
|
|
1424
1433
|
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1425
1434
|
FileUtils.mkdir_p File.dirname extconf_rb
|
1426
1435
|
|
1427
|
-
File.open extconf_rb,
|
1436
|
+
File.open extconf_rb, "w" do |f|
|
1428
1437
|
f.write <<-'RUBY'
|
1429
1438
|
File.open 'Makefile', 'w' do |f|
|
1430
1439
|
f.puts "clean:\n\techo clean"
|
@@ -1434,30 +1443,30 @@ dependencies: []
|
|
1434
1443
|
RUBY
|
1435
1444
|
end
|
1436
1445
|
|
1437
|
-
FileUtils.mkdir_p File.join @ext.base_dir,
|
1446
|
+
FileUtils.mkdir_p File.join @ext.base_dir, "extensions"
|
1438
1447
|
FileUtils.chmod 0555, @ext.base_dir
|
1439
|
-
FileUtils.chmod 0555, File.join(@ext.base_dir,
|
1448
|
+
FileUtils.chmod 0555, File.join(@ext.base_dir, "extensions")
|
1440
1449
|
|
1441
1450
|
@ext.build_extensions
|
1442
1451
|
assert_path_not_exist @ext.extension_dir
|
1443
1452
|
ensure
|
1444
|
-
unless ($DEBUG
|
1445
|
-
FileUtils.chmod 0755, File.join(@ext.base_dir,
|
1453
|
+
unless ($DEBUG || win_platform? || Process.uid.zero? || Gem.java_platform?)
|
1454
|
+
FileUtils.chmod 0755, File.join(@ext.base_dir, "extensions")
|
1446
1455
|
FileUtils.chmod 0755, @ext.base_dir
|
1447
1456
|
end
|
1448
1457
|
end
|
1449
1458
|
|
1450
1459
|
def test_build_extensions_no_extensions_dir_unwritable
|
1451
|
-
pend
|
1460
|
+
pend "chmod not supported" if Gem.win_platform?
|
1452
1461
|
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1453
1462
|
ext_spec
|
1454
1463
|
|
1455
|
-
refute_empty @ext.extensions,
|
1464
|
+
refute_empty @ext.extensions, "sanity check"
|
1456
1465
|
|
1457
1466
|
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1458
1467
|
FileUtils.mkdir_p File.dirname extconf_rb
|
1459
1468
|
|
1460
|
-
File.open extconf_rb,
|
1469
|
+
File.open extconf_rb, "w" do |f|
|
1461
1470
|
f.write <<-'RUBY'
|
1462
1471
|
File.open 'Makefile', 'w' do |f|
|
1463
1472
|
f.puts "clean:\n\techo clean"
|
@@ -1467,20 +1476,20 @@ dependencies: []
|
|
1467
1476
|
RUBY
|
1468
1477
|
end
|
1469
1478
|
|
1470
|
-
FileUtils.rm_r File.join @gemhome,
|
1479
|
+
FileUtils.rm_r File.join @gemhome, "extensions"
|
1471
1480
|
FileUtils.chmod 0555, @gemhome
|
1472
1481
|
|
1473
1482
|
@ext.build_extensions
|
1474
1483
|
|
1475
|
-
gem_make_out = File.join @ext.extension_dir,
|
1484
|
+
gem_make_out = File.join @ext.extension_dir, "gem_make.out"
|
1476
1485
|
assert_path_not_exist gem_make_out
|
1477
1486
|
ensure
|
1478
1487
|
FileUtils.chmod 0755, @gemhome
|
1479
1488
|
end
|
1480
1489
|
|
1481
1490
|
def test_build_extensions_none
|
1482
|
-
assert_path_not_exist @a1.extension_dir,
|
1483
|
-
assert_empty @a1.extensions,
|
1491
|
+
assert_path_not_exist @a1.extension_dir, "sanity check"
|
1492
|
+
assert_empty @a1.extensions, "sanity check"
|
1484
1493
|
|
1485
1494
|
@a1.build_extensions
|
1486
1495
|
|
@@ -1494,7 +1503,7 @@ dependencies: []
|
|
1494
1503
|
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1495
1504
|
FileUtils.mkdir_p File.dirname extconf_rb
|
1496
1505
|
|
1497
|
-
File.open extconf_rb,
|
1506
|
+
File.open extconf_rb, "w" do |f|
|
1498
1507
|
f.write <<-'RUBY'
|
1499
1508
|
File.open 'Makefile', 'w' do |f|
|
1500
1509
|
f.puts "clean:\n\techo clean"
|
@@ -1504,22 +1513,22 @@ dependencies: []
|
|
1504
1513
|
RUBY
|
1505
1514
|
end
|
1506
1515
|
|
1507
|
-
refute_empty @ext.extensions,
|
1516
|
+
refute_empty @ext.extensions, "sanity check"
|
1508
1517
|
|
1509
|
-
@ext.installed_by_version = v(
|
1518
|
+
@ext.installed_by_version = v("2.2.0.preview.2")
|
1510
1519
|
|
1511
1520
|
@ext.build_extensions
|
1512
1521
|
|
1513
|
-
gem_make_out = File.join @ext.extension_dir,
|
1522
|
+
gem_make_out = File.join @ext.extension_dir, "gem_make.out"
|
1514
1523
|
assert_path_exist gem_make_out
|
1515
1524
|
end
|
1516
1525
|
|
1517
1526
|
def test_contains_requirable_file_eh
|
1518
|
-
code_rb = File.join @a1.gem_dir,
|
1527
|
+
code_rb = File.join @a1.gem_dir, "lib", "code.rb"
|
1519
1528
|
FileUtils.mkdir_p File.dirname code_rb
|
1520
1529
|
FileUtils.touch code_rb
|
1521
1530
|
|
1522
|
-
assert @a1.contains_requirable_file?
|
1531
|
+
assert @a1.contains_requirable_file? "code"
|
1523
1532
|
end
|
1524
1533
|
|
1525
1534
|
def test_contains_requirable_file_eh_extension
|
@@ -1527,7 +1536,7 @@ dependencies: []
|
|
1527
1536
|
ext_spec
|
1528
1537
|
|
1529
1538
|
_, err = capture_output do
|
1530
|
-
refute @ext.contains_requirable_file?
|
1539
|
+
refute @ext.contains_requirable_file? "nonexistent"
|
1531
1540
|
end
|
1532
1541
|
|
1533
1542
|
expected = "Ignoring ext-1 because its extensions are not built. " +
|
@@ -1540,7 +1549,7 @@ dependencies: []
|
|
1540
1549
|
ext_spec(platform: Gem::Platform.new("java"))
|
1541
1550
|
|
1542
1551
|
_, err = capture_output do
|
1543
|
-
refute @ext.contains_requirable_file?
|
1552
|
+
refute @ext.contains_requirable_file? "nonexistent"
|
1544
1553
|
end
|
1545
1554
|
|
1546
1555
|
assert_empty err
|
@@ -1556,13 +1565,13 @@ dependencies: []
|
|
1556
1565
|
end
|
1557
1566
|
|
1558
1567
|
def test_date_equals_string
|
1559
|
-
@a1.date =
|
1568
|
+
@a1.date = "2003-09-17"
|
1560
1569
|
assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date
|
1561
1570
|
end
|
1562
1571
|
|
1563
1572
|
def test_date_equals_string_bad
|
1564
1573
|
assert_raise Gem::InvalidSpecificationException do
|
1565
|
-
@a1.date =
|
1574
|
+
@a1.date = "9/11/2003"
|
1566
1575
|
end
|
1567
1576
|
end
|
1568
1577
|
|
@@ -1609,7 +1618,7 @@ dependencies: []
|
|
1609
1618
|
|
1610
1619
|
assert_empty @gem.dependent_gems
|
1611
1620
|
|
1612
|
-
bonobo = util_spec
|
1621
|
+
bonobo = util_spec "bonobo", 1
|
1613
1622
|
install_gem bonobo
|
1614
1623
|
install_gem @gem
|
1615
1624
|
|
@@ -1621,11 +1630,11 @@ dependencies: []
|
|
1621
1630
|
end
|
1622
1631
|
|
1623
1632
|
def test_doc_dir
|
1624
|
-
assert_equal File.join(@gemhome,
|
1633
|
+
assert_equal File.join(@gemhome, "doc", "a-1"), @a1.doc_dir
|
1625
1634
|
end
|
1626
1635
|
|
1627
1636
|
def test_doc_dir_type
|
1628
|
-
assert_equal File.join(@gemhome,
|
1637
|
+
assert_equal File.join(@gemhome, "doc", "a-1", "ri"), @a1.doc_dir("ri")
|
1629
1638
|
end
|
1630
1639
|
|
1631
1640
|
def test_runtime_dependencies
|
@@ -1639,12 +1648,12 @@ dependencies: []
|
|
1639
1648
|
end
|
1640
1649
|
|
1641
1650
|
def test_description
|
1642
|
-
assert_equal
|
1651
|
+
assert_equal "This is a test description", @a1.description
|
1643
1652
|
end
|
1644
1653
|
|
1645
1654
|
def test_eql_eh
|
1646
|
-
g1 = util_spec
|
1647
|
-
g2 = util_spec
|
1655
|
+
g1 = util_spec "gem", 1
|
1656
|
+
g2 = util_spec "gem", 1
|
1648
1657
|
|
1649
1658
|
assert_equal g1, g2
|
1650
1659
|
assert_equal g1.hash, g2.hash
|
@@ -1653,47 +1662,47 @@ dependencies: []
|
|
1653
1662
|
|
1654
1663
|
def test_eql_eh_extensions
|
1655
1664
|
spec = @a1.dup
|
1656
|
-
spec.extensions =
|
1665
|
+
spec.extensions = "xx"
|
1657
1666
|
|
1658
1667
|
refute_operator @a1, :eql?, spec
|
1659
1668
|
refute_operator spec, :eql?, @a1
|
1660
1669
|
end
|
1661
1670
|
|
1662
1671
|
def test_executables
|
1663
|
-
@a1.executable =
|
1672
|
+
@a1.executable = "app"
|
1664
1673
|
assert_equal %w[app], @a1.executables
|
1665
1674
|
end
|
1666
1675
|
|
1667
1676
|
def test_executable_equals
|
1668
|
-
@a2.executable =
|
1669
|
-
assert_equal
|
1677
|
+
@a2.executable = "app"
|
1678
|
+
assert_equal "app", @a2.executable
|
1670
1679
|
assert_equal %w[bin/app lib/code.rb].sort, @a2.files
|
1671
1680
|
end
|
1672
1681
|
|
1673
1682
|
def test_extensions
|
1674
|
-
assert_equal [
|
1683
|
+
assert_equal ["ext/extconf.rb"], ext_spec.extensions
|
1675
1684
|
end
|
1676
1685
|
|
1677
1686
|
def test_extension_dir
|
1678
|
-
enable_shared, RbConfig::CONFIG[
|
1679
|
-
RbConfig::CONFIG[
|
1687
|
+
enable_shared, RbConfig::CONFIG["ENABLE_SHARED"] =
|
1688
|
+
RbConfig::CONFIG["ENABLE_SHARED"], "no"
|
1680
1689
|
|
1681
1690
|
ext_spec
|
1682
1691
|
|
1683
1692
|
refute_empty @ext.extensions
|
1684
1693
|
|
1685
1694
|
expected =
|
1686
|
-
File.join(@ext.base_dir,
|
1695
|
+
File.join(@ext.base_dir, "extensions", Gem::Platform.local.to_s,
|
1687
1696
|
"#{Gem.ruby_api_version}-static", @ext.full_name)
|
1688
1697
|
|
1689
1698
|
assert_equal expected, @ext.extension_dir
|
1690
1699
|
ensure
|
1691
|
-
RbConfig::CONFIG[
|
1700
|
+
RbConfig::CONFIG["ENABLE_SHARED"] = enable_shared
|
1692
1701
|
end
|
1693
1702
|
|
1694
1703
|
def test_extension_dir_override
|
1695
|
-
enable_shared, RbConfig::CONFIG[
|
1696
|
-
RbConfig::CONFIG[
|
1704
|
+
enable_shared, RbConfig::CONFIG["ENABLE_SHARED"] =
|
1705
|
+
RbConfig::CONFIG["ENABLE_SHARED"], "no"
|
1697
1706
|
|
1698
1707
|
class << Gem
|
1699
1708
|
alias orig_default_ext_dir_for default_ext_dir_for
|
@@ -1701,7 +1710,7 @@ dependencies: []
|
|
1701
1710
|
remove_method :default_ext_dir_for
|
1702
1711
|
|
1703
1712
|
def Gem.default_ext_dir_for(base_dir)
|
1704
|
-
|
1713
|
+
"elsewhere"
|
1705
1714
|
end
|
1706
1715
|
end
|
1707
1716
|
|
@@ -1709,11 +1718,11 @@ dependencies: []
|
|
1709
1718
|
|
1710
1719
|
refute_empty @ext.extensions
|
1711
1720
|
|
1712
|
-
expected = File.join @tempdir,
|
1721
|
+
expected = File.join @tempdir, "elsewhere", @ext.full_name
|
1713
1722
|
|
1714
1723
|
assert_equal expected, @ext.extension_dir
|
1715
1724
|
ensure
|
1716
|
-
RbConfig::CONFIG[
|
1725
|
+
RbConfig::CONFIG["ENABLE_SHARED"] = enable_shared
|
1717
1726
|
|
1718
1727
|
class << Gem
|
1719
1728
|
remove_method :default_ext_dir_for
|
@@ -1803,9 +1812,9 @@ dependencies: []
|
|
1803
1812
|
end
|
1804
1813
|
|
1805
1814
|
def test_for_cache
|
1806
|
-
@a2.add_runtime_dependency
|
1815
|
+
@a2.add_runtime_dependency "b", "1"
|
1807
1816
|
@a2.dependencies.first.instance_variable_set :@type, nil
|
1808
|
-
@a2.required_rubygems_version = Gem::Requirement.new
|
1817
|
+
@a2.required_rubygems_version = Gem::Requirement.new "> 0"
|
1809
1818
|
@a2.test_files = %w[test/test_b.rb]
|
1810
1819
|
|
1811
1820
|
refute_empty @a2.files
|
@@ -1821,11 +1830,11 @@ dependencies: []
|
|
1821
1830
|
end
|
1822
1831
|
|
1823
1832
|
def test_full_gem_path
|
1824
|
-
assert_equal File.join(@gemhome,
|
1833
|
+
assert_equal File.join(@gemhome, "gems", @a1.full_name), @a1.full_gem_path
|
1825
1834
|
|
1826
|
-
@a1.original_platform =
|
1835
|
+
@a1.original_platform = "mswin32"
|
1827
1836
|
|
1828
|
-
assert_equal File.join(@gemhome,
|
1837
|
+
assert_equal File.join(@gemhome, "gems", @a1.original_name),
|
1829
1838
|
@a1.full_gem_path
|
1830
1839
|
end
|
1831
1840
|
|
@@ -1838,40 +1847,40 @@ dependencies: []
|
|
1838
1847
|
end
|
1839
1848
|
|
1840
1849
|
def test_full_name
|
1841
|
-
assert_equal
|
1850
|
+
assert_equal "a-1", @a1.full_name
|
1842
1851
|
|
1843
1852
|
@a1 = Gem::Specification.new "a", 1
|
1844
|
-
@a1.platform = Gem::Platform.new [
|
1845
|
-
assert_equal
|
1853
|
+
@a1.platform = Gem::Platform.new ["universal", "darwin", nil]
|
1854
|
+
assert_equal "a-1-universal-darwin", @a1.full_name
|
1846
1855
|
|
1847
1856
|
@a1 = Gem::Specification.new "a", 1
|
1848
|
-
@a1.instance_variable_set :@new_platform,
|
1849
|
-
assert_equal
|
1857
|
+
@a1.instance_variable_set :@new_platform, "mswin32"
|
1858
|
+
assert_equal "a-1-mswin32", @a1.full_name, "legacy"
|
1850
1859
|
|
1851
1860
|
return if win_platform?
|
1852
1861
|
|
1853
1862
|
@a1 = Gem::Specification.new "a", 1
|
1854
|
-
@a1.platform =
|
1855
|
-
assert_equal
|
1863
|
+
@a1.platform = "current"
|
1864
|
+
assert_equal "a-1-x86-darwin-8", @a1.full_name
|
1856
1865
|
end
|
1857
1866
|
|
1858
1867
|
def test_full_name_windows
|
1859
1868
|
test_cases = {
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1869
|
+
"i386-mswin32" => "a-1-x86-mswin32-60",
|
1870
|
+
"i386-mswin32_80" => "a-1-x86-mswin32-80",
|
1871
|
+
"i386-mingw32" => "a-1-x86-mingw32",
|
1863
1872
|
}
|
1864
1873
|
|
1865
1874
|
test_cases.each do |arch, expected|
|
1866
1875
|
@a1 = Gem::Specification.new "a", 1
|
1867
1876
|
util_set_arch arch
|
1868
|
-
@a1.platform =
|
1877
|
+
@a1.platform = "current"
|
1869
1878
|
assert_equal expected, @a1.full_name
|
1870
1879
|
end
|
1871
1880
|
end
|
1872
1881
|
|
1873
1882
|
def test_gem_build_complete_path
|
1874
|
-
expected = File.join @a1.extension_dir,
|
1883
|
+
expected = File.join @a1.extension_dir, "gem.build_complete"
|
1875
1884
|
assert_equal expected, @a1.gem_build_complete_path
|
1876
1885
|
end
|
1877
1886
|
|
@@ -1915,23 +1924,23 @@ dependencies: []
|
|
1915
1924
|
end
|
1916
1925
|
|
1917
1926
|
def test_license
|
1918
|
-
assert_equal
|
1927
|
+
assert_equal "MIT", @a1.license
|
1919
1928
|
end
|
1920
1929
|
|
1921
1930
|
def test_licenses
|
1922
|
-
assert_equal [
|
1931
|
+
assert_equal ["MIT"], @a1.licenses
|
1923
1932
|
end
|
1924
1933
|
|
1925
1934
|
def test_name
|
1926
|
-
assert_equal
|
1935
|
+
assert_equal "a", @a1.name
|
1927
1936
|
end
|
1928
1937
|
|
1929
1938
|
def test_original_name
|
1930
|
-
assert_equal
|
1939
|
+
assert_equal "a-1", @a1.full_name
|
1931
1940
|
|
1932
|
-
@a1.platform =
|
1933
|
-
@a1.instance_variable_set :@original_platform,
|
1934
|
-
assert_equal
|
1941
|
+
@a1.platform = "i386-linux"
|
1942
|
+
@a1.instance_variable_set :@original_platform, "i386-linux"
|
1943
|
+
assert_equal "a-1-i386-linux", @a1.original_name
|
1935
1944
|
end
|
1936
1945
|
|
1937
1946
|
def test_platform
|
@@ -1960,10 +1969,10 @@ dependencies: []
|
|
1960
1969
|
assert_equal Gem::Platform::RUBY, @a1.platform
|
1961
1970
|
|
1962
1971
|
test_cases = {
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1972
|
+
"i386-mswin32" => ["x86", "mswin32", "60"],
|
1973
|
+
"i386-mswin32_80" => ["x86", "mswin32", "80"],
|
1974
|
+
"i386-mingw32" => ["x86", "mingw32", nil ],
|
1975
|
+
"x86-darwin8" => ["x86", "darwin", "8" ],
|
1967
1976
|
}
|
1968
1977
|
|
1969
1978
|
test_cases.each do |arch, expected|
|
@@ -1980,29 +1989,29 @@ dependencies: []
|
|
1980
1989
|
end
|
1981
1990
|
|
1982
1991
|
def test_platform_equals_legacy
|
1983
|
-
@a1.platform =
|
1984
|
-
assert_equal Gem::Platform.new(
|
1992
|
+
@a1.platform = "mswin32"
|
1993
|
+
assert_equal Gem::Platform.new("x86-mswin32"), @a1.platform
|
1985
1994
|
|
1986
|
-
@a1.platform =
|
1987
|
-
assert_equal Gem::Platform.new(
|
1995
|
+
@a1.platform = "i586-linux"
|
1996
|
+
assert_equal Gem::Platform.new("x86-linux"), @a1.platform
|
1988
1997
|
|
1989
|
-
@a1.platform =
|
1990
|
-
assert_equal Gem::Platform.new(
|
1998
|
+
@a1.platform = "powerpc-darwin"
|
1999
|
+
assert_equal Gem::Platform.new("ppc-darwin"), @a1.platform
|
1991
2000
|
end
|
1992
2001
|
|
1993
2002
|
def test_prerelease_spec_adds_required_rubygems_version
|
1994
|
-
@prerelease = util_spec(
|
1995
|
-
refute @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new(
|
1996
|
-
assert @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new(
|
2003
|
+
@prerelease = util_spec("tardis", "2.2.0.a")
|
2004
|
+
refute @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new("1.3.1"))
|
2005
|
+
assert @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new("1.4.0"))
|
1997
2006
|
end
|
1998
2007
|
|
1999
2008
|
def test_require_paths
|
2000
|
-
enable_shared
|
2009
|
+
enable_shared "no" do
|
2001
2010
|
ext_spec
|
2002
2011
|
|
2003
|
-
@ext.require_paths =
|
2012
|
+
@ext.require_paths = "lib"
|
2004
2013
|
|
2005
|
-
assert_equal [@ext.extension_dir,
|
2014
|
+
assert_equal [@ext.extension_dir, "lib"], @ext.require_paths
|
2006
2015
|
end
|
2007
2016
|
end
|
2008
2017
|
|
@@ -2014,15 +2023,15 @@ dependencies: []
|
|
2014
2023
|
end
|
2015
2024
|
|
2016
2025
|
def Gem.default_ext_dir_for(base_dir)
|
2017
|
-
|
2026
|
+
"/foo"
|
2018
2027
|
end
|
2019
2028
|
|
2020
|
-
enable_shared
|
2029
|
+
enable_shared "no" do
|
2021
2030
|
ext_spec
|
2022
2031
|
|
2023
|
-
@ext.require_paths =
|
2032
|
+
@ext.require_paths = "lib"
|
2024
2033
|
|
2025
|
-
assert_equal [File.expand_path(
|
2034
|
+
assert_equal [File.expand_path("/foo/ext-1"), "lib"], @ext.require_paths
|
2026
2035
|
end
|
2027
2036
|
ensure
|
2028
2037
|
class << Gem
|
@@ -2040,7 +2049,7 @@ dependencies: []
|
|
2040
2049
|
ext_spec
|
2041
2050
|
|
2042
2051
|
@ext.require_paths = %w[lib ext foo]
|
2043
|
-
@ext.extensions <<
|
2052
|
+
@ext.extensions << "bar/baz"
|
2044
2053
|
|
2045
2054
|
expected = %w[
|
2046
2055
|
lib
|
@@ -2055,10 +2064,10 @@ dependencies: []
|
|
2055
2064
|
def test_full_require_paths
|
2056
2065
|
ext_spec
|
2057
2066
|
|
2058
|
-
@ext.require_paths =
|
2067
|
+
@ext.require_paths = "lib"
|
2059
2068
|
|
2060
2069
|
expected = [
|
2061
|
-
File.join(@gemhome,
|
2070
|
+
File.join(@gemhome, "gems", @ext.original_name, "lib"),
|
2062
2071
|
@ext.extension_dir,
|
2063
2072
|
]
|
2064
2073
|
|
@@ -2068,10 +2077,10 @@ dependencies: []
|
|
2068
2077
|
def test_to_fullpath
|
2069
2078
|
ext_spec
|
2070
2079
|
|
2071
|
-
@ext.require_paths =
|
2080
|
+
@ext.require_paths = "lib"
|
2072
2081
|
|
2073
|
-
dir = File.join(@gemhome,
|
2074
|
-
expected_rb = File.join(dir,
|
2082
|
+
dir = File.join(@gemhome, "gems", @ext.original_name, "lib")
|
2083
|
+
expected_rb = File.join(dir, "code.rb")
|
2075
2084
|
FileUtils.mkdir_p dir
|
2076
2085
|
FileUtils.touch expected_rb
|
2077
2086
|
|
@@ -2105,10 +2114,10 @@ dependencies: []
|
|
2105
2114
|
def test_fullpath_return_rb_extension_file_when_exist_the_same_name_file
|
2106
2115
|
ext_spec
|
2107
2116
|
|
2108
|
-
@ext.require_paths =
|
2117
|
+
@ext.require_paths = "lib"
|
2109
2118
|
|
2110
|
-
dir = File.join(@gemhome,
|
2111
|
-
expected_rb = File.join(dir,
|
2119
|
+
dir = File.join(@gemhome, "gems", @ext.original_name, "lib")
|
2120
|
+
expected_rb = File.join(dir, "code.rb")
|
2112
2121
|
FileUtils.mkdir_p dir
|
2113
2122
|
FileUtils.touch expected_rb
|
2114
2123
|
|
@@ -2160,12 +2169,12 @@ dependencies: []
|
|
2160
2169
|
end
|
2161
2170
|
|
2162
2171
|
def test_requirements
|
2163
|
-
assert_equal [
|
2172
|
+
assert_equal ["A working computer"], @a1.requirements
|
2164
2173
|
end
|
2165
2174
|
|
2166
2175
|
def test_allowed_push_host
|
2167
|
-
assert_nil @a1.metadata[
|
2168
|
-
assert_equal
|
2176
|
+
assert_nil @a1.metadata["allowed_push_host"]
|
2177
|
+
assert_equal "https://privategemserver.com", @a3.metadata["allowed_push_host"]
|
2169
2178
|
end
|
2170
2179
|
|
2171
2180
|
def test_runtime_dependencies_legacy
|
@@ -2181,8 +2190,8 @@ dependencies: []
|
|
2181
2190
|
end
|
2182
2191
|
|
2183
2192
|
def test_spaceship_name
|
2184
|
-
s1 = util_spec
|
2185
|
-
s2 = util_spec
|
2193
|
+
s1 = util_spec "a", "1"
|
2194
|
+
s2 = util_spec "b", "1"
|
2186
2195
|
|
2187
2196
|
assert_equal(-1, (s1 <=> s2))
|
2188
2197
|
assert_equal(0, (s1 <=> s1))
|
@@ -2190,9 +2199,9 @@ dependencies: []
|
|
2190
2199
|
end
|
2191
2200
|
|
2192
2201
|
def test_spaceship_platform
|
2193
|
-
s1 = util_spec
|
2194
|
-
s2 = util_spec
|
2195
|
-
s.platform = Gem::Platform.new
|
2202
|
+
s1 = util_spec "a", "1"
|
2203
|
+
s2 = util_spec "a", "1" do |s|
|
2204
|
+
s.platform = Gem::Platform.new "x86-my_platform1"
|
2196
2205
|
end
|
2197
2206
|
|
2198
2207
|
assert_equal(-1, (s1 <=> s2))
|
@@ -2201,8 +2210,8 @@ dependencies: []
|
|
2201
2210
|
end
|
2202
2211
|
|
2203
2212
|
def test_spaceship_version
|
2204
|
-
s1 = util_spec
|
2205
|
-
s2 = util_spec
|
2213
|
+
s1 = util_spec "a", "1"
|
2214
|
+
s2 = util_spec "a", "2"
|
2206
2215
|
|
2207
2216
|
assert_equal(-1, (s1 <=> s2))
|
2208
2217
|
assert_equal(0, (s1 <=> s1))
|
@@ -2210,25 +2219,25 @@ dependencies: []
|
|
2210
2219
|
end
|
2211
2220
|
|
2212
2221
|
def test_spec_file
|
2213
|
-
assert_equal File.join(@gemhome,
|
2222
|
+
assert_equal File.join(@gemhome, "specifications", "a-1.gemspec"),
|
2214
2223
|
@a1.spec_file
|
2215
2224
|
end
|
2216
2225
|
|
2217
2226
|
def test_spec_name
|
2218
|
-
assert_equal
|
2227
|
+
assert_equal "a-1.gemspec", @a1.spec_name
|
2219
2228
|
end
|
2220
2229
|
|
2221
2230
|
def test_summary
|
2222
|
-
assert_equal
|
2231
|
+
assert_equal "this is a summary", @a1.summary
|
2223
2232
|
end
|
2224
2233
|
|
2225
2234
|
def test_test_files
|
2226
|
-
@a1.test_file =
|
2227
|
-
assert_equal [
|
2235
|
+
@a1.test_file = "test/suite.rb"
|
2236
|
+
assert_equal ["test/suite.rb"], @a1.test_files
|
2228
2237
|
end
|
2229
2238
|
|
2230
2239
|
def test_runtime_predicate_true
|
2231
|
-
@a2.add_runtime_dependency
|
2240
|
+
@a2.add_runtime_dependency "b", "1"
|
2232
2241
|
assert_predicate @a2.dependencies.first, :runtime?
|
2233
2242
|
|
2234
2243
|
@a2.dependencies.first.instance_variable_set :@type, nil
|
@@ -2236,15 +2245,15 @@ dependencies: []
|
|
2236
2245
|
end
|
2237
2246
|
|
2238
2247
|
def test_runtime_predicate_false
|
2239
|
-
@a2.add_development_dependency
|
2248
|
+
@a2.add_development_dependency "b", "1"
|
2240
2249
|
refute_predicate @a2.dependencies.first, :runtime?
|
2241
2250
|
end
|
2242
2251
|
|
2243
2252
|
def test_to_ruby
|
2244
|
-
@a2.add_runtime_dependency
|
2253
|
+
@a2.add_runtime_dependency "b", "1"
|
2245
2254
|
@a2.dependencies.first.instance_variable_set :@type, nil
|
2246
|
-
@a2.required_rubygems_version = Gem::Requirement.new
|
2247
|
-
@a2.require_paths <<
|
2255
|
+
@a2.required_rubygems_version = Gem::Requirement.new "> 0"
|
2256
|
+
@a2.require_paths << "other"
|
2248
2257
|
|
2249
2258
|
ruby_code = @a2.to_ruby
|
2250
2259
|
|
@@ -2287,8 +2296,8 @@ end
|
|
2287
2296
|
end
|
2288
2297
|
|
2289
2298
|
def test_to_ruby_with_rsa_key
|
2290
|
-
require
|
2291
|
-
pend
|
2299
|
+
require "rubygems/openssl"
|
2300
|
+
pend "openssl is missing" unless defined?(OpenSSL::PKey::RSA)
|
2292
2301
|
|
2293
2302
|
rsa_key = OpenSSL::PKey::RSA.new(2048)
|
2294
2303
|
@a2.signing_key = rsa_key
|
@@ -2319,9 +2328,9 @@ end
|
|
2319
2328
|
end
|
2320
2329
|
|
2321
2330
|
def test_to_ruby_for_cache
|
2322
|
-
@a2.add_runtime_dependency
|
2331
|
+
@a2.add_runtime_dependency "b", "1"
|
2323
2332
|
@a2.dependencies.first.instance_variable_set :@type, nil
|
2324
|
-
@a2.required_rubygems_version = Gem::Requirement.new
|
2333
|
+
@a2.required_rubygems_version = Gem::Requirement.new "> 0"
|
2325
2334
|
@a2.installed_by_version = Gem.rubygems_version
|
2326
2335
|
|
2327
2336
|
# cached specs do not have spec.files populated:
|
@@ -2430,8 +2439,8 @@ end
|
|
2430
2439
|
end
|
2431
2440
|
|
2432
2441
|
def test_to_ruby_keeps_requirements_as_originally_specified
|
2433
|
-
spec = util_spec
|
2434
|
-
s.add_dependency
|
2442
|
+
spec = util_spec "a", "1" do |s|
|
2443
|
+
s.add_dependency "b", ["~> 1.0", ">= 1.0.0"]
|
2435
2444
|
end
|
2436
2445
|
|
2437
2446
|
assert_includes spec.to_ruby, '"~> 1.0", ">= 1.0.0"'
|
@@ -2460,13 +2469,13 @@ end
|
|
2460
2469
|
|
2461
2470
|
def test_to_ruby_platform
|
2462
2471
|
@a2.platform = Gem::Platform.local
|
2463
|
-
@a2.instance_variable_set :@original_platform,
|
2472
|
+
@a2.instance_variable_set :@original_platform, "old_platform"
|
2464
2473
|
|
2465
2474
|
ruby_code = @a2.to_ruby
|
2466
2475
|
|
2467
2476
|
same_spec = eval ruby_code
|
2468
2477
|
|
2469
|
-
assert_equal
|
2478
|
+
assert_equal "old_platform", same_spec.original_platform
|
2470
2479
|
end
|
2471
2480
|
|
2472
2481
|
def test_to_yaml
|
@@ -2491,21 +2500,21 @@ end
|
|
2491
2500
|
end
|
2492
2501
|
|
2493
2502
|
def test_to_yaml_platform_empty_string
|
2494
|
-
@a1.instance_variable_set :@original_platform,
|
2503
|
+
@a1.instance_variable_set :@original_platform, ""
|
2495
2504
|
|
2496
2505
|
assert_match %r{^platform: ruby$}, @a1.to_yaml
|
2497
2506
|
end
|
2498
2507
|
|
2499
2508
|
def test_to_yaml_platform_legacy
|
2500
|
-
@a1.platform =
|
2501
|
-
@a1.instance_variable_set :@original_platform,
|
2509
|
+
@a1.platform = "powerpc-darwin7.9.0"
|
2510
|
+
@a1.instance_variable_set :@original_platform, "powerpc-darwin7.9.0"
|
2502
2511
|
|
2503
2512
|
yaml_str = @a1.to_yaml
|
2504
2513
|
|
2505
2514
|
same_spec = load_yaml yaml_str
|
2506
2515
|
|
2507
|
-
assert_equal Gem::Platform.new(
|
2508
|
-
assert_equal
|
2516
|
+
assert_equal Gem::Platform.new("powerpc-darwin7"), same_spec.platform
|
2517
|
+
assert_equal "powerpc-darwin7.9.0", same_spec.original_platform
|
2509
2518
|
end
|
2510
2519
|
|
2511
2520
|
def test_to_yaml_platform_nil
|
@@ -2522,7 +2531,7 @@ end
|
|
2522
2531
|
end
|
2523
2532
|
end
|
2524
2533
|
|
2525
|
-
def x(s); s.gsub(/xxx/,
|
2534
|
+
def x(s); s.gsub(/xxx/, ""); end
|
2526
2535
|
def w; x "WARxxxNING"; end
|
2527
2536
|
def t; x "TOxxxDO"; end
|
2528
2537
|
def f; x "FxxxIXME"; end
|
@@ -2537,7 +2546,7 @@ end
|
|
2537
2546
|
@a1.validate
|
2538
2547
|
end
|
2539
2548
|
|
2540
|
-
assert_match "#{w}: no author specified\n", @ui.error,
|
2549
|
+
assert_match "#{w}: no author specified\n", @ui.error, "error"
|
2541
2550
|
|
2542
2551
|
@a1.authors = [Object.new]
|
2543
2552
|
|
@@ -2571,14 +2580,14 @@ end
|
|
2571
2580
|
util_setup_validate
|
2572
2581
|
|
2573
2582
|
Dir.chdir @tempdir do
|
2574
|
-
@a1.autorequire =
|
2583
|
+
@a1.autorequire = "code"
|
2575
2584
|
|
2576
2585
|
use_ui @ui do
|
2577
2586
|
@a1.validate
|
2578
2587
|
end
|
2579
2588
|
|
2580
2589
|
assert_match "#{w}: deprecated autorequire specified\n",
|
2581
|
-
@ui.error,
|
2590
|
+
@ui.error, "error"
|
2582
2591
|
end
|
2583
2592
|
end
|
2584
2593
|
|
@@ -2586,19 +2595,19 @@ end
|
|
2586
2595
|
util_setup_validate
|
2587
2596
|
|
2588
2597
|
Dir.chdir @tempdir do
|
2589
|
-
@a1.add_runtime_dependency
|
2590
|
-
@a1.add_development_dependency
|
2591
|
-
@a1.add_runtime_dependency
|
2592
|
-
@a1.add_runtime_dependency
|
2593
|
-
@a1.add_runtime_dependency
|
2594
|
-
@a1.add_runtime_dependency
|
2595
|
-
@a1.add_runtime_dependency
|
2596
|
-
@a1.add_runtime_dependency
|
2597
|
-
@a1.add_runtime_dependency
|
2598
|
-
@a1.add_runtime_dependency
|
2599
|
-
@a1.add_runtime_dependency
|
2600
|
-
@a1.add_runtime_dependency
|
2601
|
-
@a1.add_runtime_dependency
|
2598
|
+
@a1.add_runtime_dependency "b", ">= 1.0.rc1"
|
2599
|
+
@a1.add_development_dependency "c", ">= 2.0.rc2"
|
2600
|
+
@a1.add_runtime_dependency "d", "~> 1.2.3"
|
2601
|
+
@a1.add_runtime_dependency "e", "~> 1.2.3.4"
|
2602
|
+
@a1.add_runtime_dependency "g", "~> 1.2.3", ">= 1.2.3.4"
|
2603
|
+
@a1.add_runtime_dependency "h", ">= 1.2.3", "<= 2"
|
2604
|
+
@a1.add_runtime_dependency "i", ">= 1.2"
|
2605
|
+
@a1.add_runtime_dependency "j", ">= 1.2.3"
|
2606
|
+
@a1.add_runtime_dependency "k", "> 1.2"
|
2607
|
+
@a1.add_runtime_dependency "l", "> 1.2.3"
|
2608
|
+
@a1.add_runtime_dependency "m", "~> 2.1.0"
|
2609
|
+
@a1.add_runtime_dependency "n", "~> 0.1.0"
|
2610
|
+
@a1.add_runtime_dependency "o"
|
2602
2611
|
|
2603
2612
|
use_ui @ui do
|
2604
2613
|
@a1.validate
|
@@ -2624,7 +2633,7 @@ end
|
|
2624
2633
|
#{w}: See https://guides.rubygems.org/specification-reference/ for help
|
2625
2634
|
EXPECTED
|
2626
2635
|
|
2627
|
-
assert_equal expected, @ui.error,
|
2636
|
+
assert_equal expected, @ui.error, "warning"
|
2628
2637
|
end
|
2629
2638
|
end
|
2630
2639
|
|
@@ -2632,10 +2641,10 @@ end
|
|
2632
2641
|
util_setup_validate
|
2633
2642
|
|
2634
2643
|
Dir.chdir @tempdir do
|
2635
|
-
@a1.add_runtime_dependency
|
2636
|
-
@a1.add_runtime_dependency
|
2637
|
-
@a1.add_development_dependency
|
2638
|
-
@a1.add_development_dependency
|
2644
|
+
@a1.add_runtime_dependency "b", "~> 1.2"
|
2645
|
+
@a1.add_runtime_dependency "b", ">= 1.2.3"
|
2646
|
+
@a1.add_development_dependency "c", "~> 1.2"
|
2647
|
+
@a1.add_development_dependency "c", ">= 1.2.3"
|
2639
2648
|
|
2640
2649
|
use_ui @ui do
|
2641
2650
|
e = assert_raise Gem::InvalidSpecificationException do
|
@@ -2662,14 +2671,14 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2662
2671
|
util_setup_validate
|
2663
2672
|
|
2664
2673
|
Dir.chdir @tempdir do
|
2665
|
-
@a1.add_runtime_dependency
|
2666
|
-
@a1.add_development_dependency
|
2674
|
+
@a1.add_runtime_dependency "b", "~> 1.2"
|
2675
|
+
@a1.add_development_dependency "b", "= 1.2.3"
|
2667
2676
|
|
2668
2677
|
use_ui @ui do
|
2669
2678
|
@a1.validate
|
2670
2679
|
end
|
2671
2680
|
|
2672
|
-
assert_equal
|
2681
|
+
assert_equal "", @ui.error, "warning"
|
2673
2682
|
end
|
2674
2683
|
end
|
2675
2684
|
|
@@ -2677,14 +2686,14 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2677
2686
|
util_setup_validate
|
2678
2687
|
|
2679
2688
|
Dir.chdir @tempdir do
|
2680
|
-
@a1.version =
|
2681
|
-
@a1.add_runtime_dependency
|
2689
|
+
@a1.version = "1.0.0.beta.1"
|
2690
|
+
@a1.add_runtime_dependency "b", "~> 1.2.0.beta.1"
|
2682
2691
|
|
2683
2692
|
use_ui @ui do
|
2684
2693
|
@a1.validate
|
2685
2694
|
end
|
2686
2695
|
|
2687
|
-
assert_equal
|
2696
|
+
assert_equal "", @ui.error, "warning"
|
2688
2697
|
end
|
2689
2698
|
end
|
2690
2699
|
|
@@ -2692,8 +2701,8 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2692
2701
|
util_setup_validate
|
2693
2702
|
|
2694
2703
|
Dir.chdir @tempdir do
|
2695
|
-
@a1.extensions = [
|
2696
|
-
File.write File.join(@tempdir,
|
2704
|
+
@a1.extensions = ["Rakefile"]
|
2705
|
+
File.write File.join(@tempdir, "Rakefile"), ""
|
2697
2706
|
|
2698
2707
|
use_ui @ui do
|
2699
2708
|
@a1.validate
|
@@ -2707,9 +2716,9 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2707
2716
|
util_setup_validate
|
2708
2717
|
|
2709
2718
|
Dir.chdir @tempdir do
|
2710
|
-
@a1.extensions = [
|
2711
|
-
@a1.add_runtime_dependency
|
2712
|
-
File.write File.join(@tempdir,
|
2719
|
+
@a1.extensions = ["Rakefile"]
|
2720
|
+
@a1.add_runtime_dependency "rake"
|
2721
|
+
File.write File.join(@tempdir, "Rakefile"), ""
|
2713
2722
|
|
2714
2723
|
use_ui @ui do
|
2715
2724
|
@a1.validate
|
@@ -2723,7 +2732,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2723
2732
|
util_setup_validate
|
2724
2733
|
|
2725
2734
|
Dir.chdir @tempdir do
|
2726
|
-
@a1.description =
|
2735
|
+
@a1.description = ""
|
2727
2736
|
|
2728
2737
|
use_ui @ui do
|
2729
2738
|
@a1.validate
|
@@ -2813,7 +2822,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2813
2822
|
Gem::Specification.new.validate
|
2814
2823
|
end
|
2815
2824
|
|
2816
|
-
assert_equal
|
2825
|
+
assert_equal "missing value for attribute name", e.message
|
2817
2826
|
end
|
2818
2827
|
|
2819
2828
|
def test_validate_error
|
@@ -2823,15 +2832,15 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2823
2832
|
end
|
2824
2833
|
end
|
2825
2834
|
|
2826
|
-
assert_match
|
2835
|
+
assert_match "See https://guides.rubygems.org/specification-reference/ for help", @ui.error
|
2827
2836
|
end
|
2828
2837
|
|
2829
2838
|
def test_validate_executables
|
2830
2839
|
util_setup_validate
|
2831
2840
|
|
2832
|
-
FileUtils.mkdir_p File.join(@tempdir,
|
2833
|
-
File.write File.join(@tempdir,
|
2834
|
-
FileUtils.mkdir_p File.join(@tempdir,
|
2841
|
+
FileUtils.mkdir_p File.join(@tempdir, "bin")
|
2842
|
+
File.write File.join(@tempdir, "bin", "exec"), ""
|
2843
|
+
FileUtils.mkdir_p File.join(@tempdir, "exec")
|
2835
2844
|
|
2836
2845
|
use_ui @ui do
|
2837
2846
|
Dir.chdir @tempdir do
|
@@ -2841,13 +2850,13 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2841
2850
|
|
2842
2851
|
assert_equal %w[exec], @a1.executables
|
2843
2852
|
|
2844
|
-
assert_equal
|
2845
|
-
assert_match "#{w}: bin/exec is missing #! line\n", @ui.error,
|
2853
|
+
assert_equal "", @ui.output, "output"
|
2854
|
+
assert_match "#{w}: bin/exec is missing #! line\n", @ui.error, "error"
|
2846
2855
|
end
|
2847
2856
|
|
2848
2857
|
def test_validate_empty_require_paths
|
2849
2858
|
if win_platform?
|
2850
|
-
pend
|
2859
|
+
pend "test_validate_empty_require_paths skipped on MS Windows (symlink)"
|
2851
2860
|
else
|
2852
2861
|
util_setup_validate
|
2853
2862
|
|
@@ -2856,26 +2865,26 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2856
2865
|
@a1.validate
|
2857
2866
|
end
|
2858
2867
|
|
2859
|
-
assert_equal
|
2868
|
+
assert_equal "specification must have at least one require_path",
|
2860
2869
|
e.message
|
2861
2870
|
end
|
2862
2871
|
end
|
2863
2872
|
|
2864
2873
|
def test_validate_files
|
2865
|
-
pend
|
2874
|
+
pend "test_validate_files skipped on MS Windows (symlink)" if win_platform?
|
2866
2875
|
util_setup_validate
|
2867
2876
|
|
2868
|
-
@a1.files += [
|
2869
|
-
@a1.extensions <<
|
2877
|
+
@a1.files += ["lib", "lib2"]
|
2878
|
+
@a1.extensions << "ext/a/extconf.rb"
|
2870
2879
|
|
2871
2880
|
Dir.chdir @tempdir do
|
2872
|
-
FileUtils.ln_s
|
2881
|
+
FileUtils.ln_s "lib/code.rb", "lib2" unless vc_windows?
|
2873
2882
|
|
2874
2883
|
use_ui @ui do
|
2875
2884
|
@a1.validate
|
2876
2885
|
end
|
2877
2886
|
|
2878
|
-
assert_match
|
2887
|
+
assert_match "WARNING: lib2 is a symlink, which is not supported on all platforms", @ui.error
|
2879
2888
|
end
|
2880
2889
|
|
2881
2890
|
assert_equal %w[bin/exec ext/a/extconf.rb lib/code.rb lib2 test/suite.rb].sort,
|
@@ -2981,19 +2990,19 @@ Please report a bug if this causes problems.
|
|
2981
2990
|
@a1.validate
|
2982
2991
|
end
|
2983
2992
|
|
2984
|
-
assert_match "#{w}: no homepage specified\n", @ui.error,
|
2993
|
+
assert_match "#{w}: no homepage specified\n", @ui.error, "error"
|
2985
2994
|
|
2986
2995
|
@ui = Gem::MockGemUi.new
|
2987
2996
|
|
2988
|
-
@a1.homepage =
|
2997
|
+
@a1.homepage = ""
|
2989
2998
|
|
2990
2999
|
use_ui @ui do
|
2991
3000
|
@a1.validate
|
2992
3001
|
end
|
2993
3002
|
|
2994
|
-
assert_match "#{w}: no homepage specified\n", @ui.error,
|
3003
|
+
assert_match "#{w}: no homepage specified\n", @ui.error, "error"
|
2995
3004
|
|
2996
|
-
@a1.homepage =
|
3005
|
+
@a1.homepage = "over at my cool site"
|
2997
3006
|
|
2998
3007
|
e = assert_raise Gem::InvalidSpecificationException do
|
2999
3008
|
@a1.validate
|
@@ -3001,7 +3010,7 @@ Please report a bug if this causes problems.
|
|
3001
3010
|
|
3002
3011
|
assert_equal '"over at my cool site" is not a valid HTTP URI', e.message
|
3003
3012
|
|
3004
|
-
@a1.homepage =
|
3013
|
+
@a1.homepage = "ftp://rubygems.org"
|
3005
3014
|
|
3006
3015
|
e = assert_raise Gem::InvalidSpecificationException do
|
3007
3016
|
@a1.validate
|
@@ -3009,12 +3018,11 @@ Please report a bug if this causes problems.
|
|
3009
3018
|
|
3010
3019
|
assert_equal '"ftp://rubygems.org" is not a valid HTTP URI', e.message
|
3011
3020
|
|
3012
|
-
@a1.homepage =
|
3021
|
+
@a1.homepage = "https://rubygems.org/"
|
3013
3022
|
assert_equal true, @a1.validate
|
3014
3023
|
|
3015
|
-
@a1.homepage =
|
3024
|
+
@a1.homepage = "https://rubygems.org"
|
3016
3025
|
assert_equal true, @a1.validate
|
3017
|
-
|
3018
3026
|
end
|
3019
3027
|
end
|
3020
3028
|
|
@@ -3051,7 +3059,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3051
3059
|
util_setup_validate
|
3052
3060
|
|
3053
3061
|
use_ui @ui do
|
3054
|
-
@a1.rubyforge_project =
|
3062
|
+
@a1.rubyforge_project = "invalid-attribute"
|
3055
3063
|
@a1.validate
|
3056
3064
|
end
|
3057
3065
|
|
@@ -3062,7 +3070,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3062
3070
|
util_setup_validate
|
3063
3071
|
|
3064
3072
|
use_ui @ui do
|
3065
|
-
@a1.licenses = [
|
3073
|
+
@a1.licenses = ["BSD"]
|
3066
3074
|
@a1.validate
|
3067
3075
|
end
|
3068
3076
|
|
@@ -3076,7 +3084,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3076
3084
|
util_setup_validate
|
3077
3085
|
|
3078
3086
|
use_ui @ui do
|
3079
|
-
@a1.licenses = [
|
3087
|
+
@a1.licenses = ["LicenseRef-LICENSE.md"]
|
3080
3088
|
@a1.validate
|
3081
3089
|
end
|
3082
3090
|
|
@@ -3087,7 +3095,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3087
3095
|
util_setup_validate
|
3088
3096
|
|
3089
3097
|
use_ui @ui do
|
3090
|
-
@a1.licenses = [
|
3098
|
+
@a1.licenses = ["GPL-2.0+"]
|
3091
3099
|
@a1.validate
|
3092
3100
|
end
|
3093
3101
|
|
@@ -3098,7 +3106,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3098
3106
|
util_setup_validate
|
3099
3107
|
|
3100
3108
|
use_ui @ui do
|
3101
|
-
@a1.licenses = [
|
3109
|
+
@a1.licenses = ["GPL-2.0-or-later"]
|
3102
3110
|
@a1.validate
|
3103
3111
|
end
|
3104
3112
|
|
@@ -3109,7 +3117,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3109
3117
|
util_setup_validate
|
3110
3118
|
|
3111
3119
|
use_ui @ui do
|
3112
|
-
@a1.licenses = [
|
3120
|
+
@a1.licenses = ["GPL-2.0+ WITH Autoconf-exception-2.0"]
|
3113
3121
|
@a1.validate
|
3114
3122
|
end
|
3115
3123
|
|
@@ -3120,7 +3128,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3120
3128
|
util_setup_validate
|
3121
3129
|
|
3122
3130
|
use_ui @ui do
|
3123
|
-
@a1.licenses = [
|
3131
|
+
@a1.licenses = ["GPL-2.0+ FOO", "GPL-2.0 FOO"]
|
3124
3132
|
@a1.validate
|
3125
3133
|
end
|
3126
3134
|
|
@@ -3138,7 +3146,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3138
3146
|
util_setup_validate
|
3139
3147
|
|
3140
3148
|
use_ui @ui do
|
3141
|
-
@a1.licenses = [
|
3149
|
+
@a1.licenses = ["GPL-2.0+ WITH Autocofn-exception-2.0"]
|
3142
3150
|
@a1.validate
|
3143
3151
|
end
|
3144
3152
|
|
@@ -3152,7 +3160,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3152
3160
|
util_setup_validate
|
3153
3161
|
|
3154
3162
|
use_ui @ui do
|
3155
|
-
@a1.licenses = [
|
3163
|
+
@a1.licenses = ["ruby"]
|
3156
3164
|
@a1.validate
|
3157
3165
|
end
|
3158
3166
|
|
@@ -3262,13 +3270,13 @@ Did you mean 'Ruby'?
|
|
3262
3270
|
end
|
3263
3271
|
|
3264
3272
|
def test_validate_permissions
|
3265
|
-
pend
|
3273
|
+
pend "chmod not supported" if Gem.win_platform?
|
3266
3274
|
|
3267
3275
|
util_setup_validate
|
3268
3276
|
|
3269
3277
|
Dir.chdir @tempdir do
|
3270
|
-
File.chmod 0640, File.join(
|
3271
|
-
File.chmod 0640, File.join(
|
3278
|
+
File.chmod 0640, File.join("lib", "code.rb")
|
3279
|
+
File.chmod 0640, File.join("bin", "exec")
|
3272
3280
|
|
3273
3281
|
use_ui @ui do
|
3274
3282
|
@a1.validate
|
@@ -3281,12 +3289,12 @@ Did you mean 'Ruby'?
|
|
3281
3289
|
end
|
3282
3290
|
|
3283
3291
|
def test_validate_permissions_of_missing_file_non_packaging
|
3284
|
-
pend
|
3292
|
+
pend "chmod not supported" if Gem.win_platform?
|
3285
3293
|
|
3286
3294
|
util_setup_validate
|
3287
3295
|
|
3288
3296
|
Dir.chdir @tempdir do
|
3289
|
-
File.delete File.join(
|
3297
|
+
File.delete File.join("lib", "code.rb")
|
3290
3298
|
|
3291
3299
|
use_ui @ui do
|
3292
3300
|
assert @a1.validate(false)
|
@@ -3298,13 +3306,13 @@ Did you mean 'Ruby'?
|
|
3298
3306
|
util_setup_validate
|
3299
3307
|
|
3300
3308
|
Dir.chdir @tempdir do
|
3301
|
-
@a1.platform =
|
3309
|
+
@a1.platform = "mswin32"
|
3302
3310
|
assert @a1.validate
|
3303
3311
|
|
3304
|
-
@a1.platform =
|
3312
|
+
@a1.platform = "i586-linux"
|
3305
3313
|
assert @a1.validate
|
3306
3314
|
|
3307
|
-
@a1.platform =
|
3315
|
+
@a1.platform = "powerpc-darwin"
|
3308
3316
|
assert @a1.validate
|
3309
3317
|
end
|
3310
3318
|
end
|
@@ -3325,7 +3333,7 @@ Did you mean 'Ruby'?
|
|
3325
3333
|
util_setup_validate
|
3326
3334
|
|
3327
3335
|
Dir.chdir @tempdir do
|
3328
|
-
@a1.specification_version =
|
3336
|
+
@a1.specification_version = "1.0"
|
3329
3337
|
|
3330
3338
|
e = assert_raise Gem::InvalidSpecificationException do
|
3331
3339
|
use_ui @ui do
|
@@ -3333,7 +3341,7 @@ Did you mean 'Ruby'?
|
|
3333
3341
|
end
|
3334
3342
|
end
|
3335
3343
|
|
3336
|
-
err =
|
3344
|
+
err = "specification_version must be an Integer (did you mean version?)"
|
3337
3345
|
assert_equal err, e.message
|
3338
3346
|
end
|
3339
3347
|
end
|
@@ -3342,13 +3350,13 @@ Did you mean 'Ruby'?
|
|
3342
3350
|
util_setup_validate
|
3343
3351
|
|
3344
3352
|
Dir.chdir @tempdir do
|
3345
|
-
@a1.summary =
|
3353
|
+
@a1.summary = ""
|
3346
3354
|
|
3347
3355
|
use_ui @ui do
|
3348
3356
|
@a1.validate
|
3349
3357
|
end
|
3350
3358
|
|
3351
|
-
assert_match "#{w}: no summary specified\n", @ui.error,
|
3359
|
+
assert_match "#{w}: no summary specified\n", @ui.error, "error"
|
3352
3360
|
|
3353
3361
|
@a1.summary = "#{f} (describe your package)"
|
3354
3362
|
|
@@ -3376,11 +3384,11 @@ Did you mean 'Ruby'?
|
|
3376
3384
|
@a1.validate
|
3377
3385
|
end
|
3378
3386
|
|
3379
|
-
assert_match
|
3387
|
+
assert_match "See https://guides.rubygems.org/specification-reference/ for help", @ui.error
|
3380
3388
|
end
|
3381
3389
|
|
3382
3390
|
def test_version
|
3383
|
-
assert_equal Gem::Version.new(
|
3391
|
+
assert_equal Gem::Version.new("1"), @a1.version
|
3384
3392
|
end
|
3385
3393
|
|
3386
3394
|
def test_version_change_reset_full_name
|
@@ -3426,22 +3434,22 @@ Did you mean 'Ruby'?
|
|
3426
3434
|
|
3427
3435
|
def test_latest_specs
|
3428
3436
|
spec_fetcher do |fetcher|
|
3429
|
-
fetcher.spec
|
3430
|
-
s.platform = Gem::Platform.new
|
3437
|
+
fetcher.spec "a", 1 do |s|
|
3438
|
+
s.platform = Gem::Platform.new "x86-my_platform1"
|
3431
3439
|
end
|
3432
3440
|
|
3433
|
-
fetcher.spec
|
3441
|
+
fetcher.spec "a", 2
|
3434
3442
|
|
3435
|
-
fetcher.spec
|
3436
|
-
s.platform = Gem::Platform.new
|
3443
|
+
fetcher.spec "a", 2 do |s|
|
3444
|
+
s.platform = Gem::Platform.new "x86-my_platform1"
|
3437
3445
|
end
|
3438
3446
|
|
3439
|
-
fetcher.spec
|
3440
|
-
s.platform = Gem::Platform.new
|
3447
|
+
fetcher.spec "a", 2 do |s|
|
3448
|
+
s.platform = Gem::Platform.new "x86-other_platform1"
|
3441
3449
|
end
|
3442
3450
|
|
3443
|
-
fetcher.spec
|
3444
|
-
s.platform = Gem::Platform.new
|
3451
|
+
fetcher.spec "a", 3 do |s|
|
3452
|
+
s.platform = Gem::Platform.new "x86-other_platform1"
|
3445
3453
|
end
|
3446
3454
|
end
|
3447
3455
|
|
@@ -3458,7 +3466,7 @@ Did you mean 'Ruby'?
|
|
3458
3466
|
util_setup_validate
|
3459
3467
|
|
3460
3468
|
Dir.chdir @tempdir do
|
3461
|
-
@m1 = quick_gem
|
3469
|
+
@m1 = quick_gem "m", "1" do |s|
|
3462
3470
|
s.files = %w[lib/code.rb]
|
3463
3471
|
s.metadata = {
|
3464
3472
|
"one" => "two",
|
@@ -3478,7 +3486,7 @@ Did you mean 'Ruby'?
|
|
3478
3486
|
util_setup_validate
|
3479
3487
|
|
3480
3488
|
Dir.chdir @tempdir do
|
3481
|
-
@m2 = quick_gem
|
3489
|
+
@m2 = quick_gem "m", "2" do |s|
|
3482
3490
|
s.files = %w[lib/code.rb]
|
3483
3491
|
s.metadata = { 1 => "fail" }
|
3484
3492
|
end
|
@@ -3495,7 +3503,7 @@ Did you mean 'Ruby'?
|
|
3495
3503
|
util_setup_validate
|
3496
3504
|
|
3497
3505
|
Dir.chdir @tempdir do
|
3498
|
-
@m2 = quick_gem
|
3506
|
+
@m2 = quick_gem "m", "2" do |s|
|
3499
3507
|
s.files = %w[lib/code.rb]
|
3500
3508
|
s.metadata = { ("x" * 129) => "fail" }
|
3501
3509
|
end
|
@@ -3512,9 +3520,9 @@ Did you mean 'Ruby'?
|
|
3512
3520
|
util_setup_validate
|
3513
3521
|
|
3514
3522
|
Dir.chdir @tempdir do
|
3515
|
-
@m2 = quick_gem
|
3523
|
+
@m2 = quick_gem "m", "2" do |s|
|
3516
3524
|
s.files = %w[lib/code.rb]
|
3517
|
-
s.metadata = {
|
3525
|
+
s.metadata = { "fail" => [] }
|
3518
3526
|
end
|
3519
3527
|
|
3520
3528
|
e = assert_raise Gem::InvalidSpecificationException do
|
@@ -3529,9 +3537,9 @@ Did you mean 'Ruby'?
|
|
3529
3537
|
util_setup_validate
|
3530
3538
|
|
3531
3539
|
Dir.chdir @tempdir do
|
3532
|
-
@m2 = quick_gem
|
3540
|
+
@m2 = quick_gem "m", "2" do |s|
|
3533
3541
|
s.files = %w[lib/code.rb]
|
3534
|
-
s.metadata = {
|
3542
|
+
s.metadata = { "fail" => ("x" * 1025) }
|
3535
3543
|
end
|
3536
3544
|
|
3537
3545
|
e = assert_raise Gem::InvalidSpecificationException do
|
@@ -3546,9 +3554,9 @@ Did you mean 'Ruby'?
|
|
3546
3554
|
util_setup_validate
|
3547
3555
|
|
3548
3556
|
Dir.chdir @tempdir do
|
3549
|
-
@m2 = quick_gem
|
3557
|
+
@m2 = quick_gem "m", "2" do |s|
|
3550
3558
|
s.files = %w[lib/code.rb]
|
3551
|
-
s.metadata = {
|
3559
|
+
s.metadata = { "homepage_uri" => "http:/example.com" }
|
3552
3560
|
end
|
3553
3561
|
|
3554
3562
|
e = assert_raise Gem::InvalidSpecificationException do
|
@@ -3560,9 +3568,9 @@ Did you mean 'Ruby'?
|
|
3560
3568
|
end
|
3561
3569
|
|
3562
3570
|
def test_metadata_specs
|
3563
|
-
@m1 = quick_gem
|
3571
|
+
@m1 = quick_gem "m", "1" do |s|
|
3564
3572
|
s.files = %w[lib/code.rb]
|
3565
|
-
s.metadata = {
|
3573
|
+
s.metadata = { "one" => "two", "two" => "three" }
|
3566
3574
|
end
|
3567
3575
|
|
3568
3576
|
valid_ruby_spec = <<-EOF
|
@@ -3599,7 +3607,7 @@ end
|
|
3599
3607
|
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
3600
3608
|
FileUtils.mkdir_p File.dirname extconf_rb
|
3601
3609
|
|
3602
|
-
File.open extconf_rb,
|
3610
|
+
File.open extconf_rb, "w" do |f|
|
3603
3611
|
f.write <<-'RUBY'
|
3604
3612
|
File.open 'Makefile', 'w' do |f|
|
3605
3613
|
f.puts "clean:\n\techo clean"
|
@@ -3615,8 +3623,8 @@ end
|
|
3615
3623
|
end
|
3616
3624
|
|
3617
3625
|
def test_missing_extensions_eh_default_gem
|
3618
|
-
spec = new_default_spec
|
3619
|
-
spec.extensions <<
|
3626
|
+
spec = new_default_spec "default", 1
|
3627
|
+
spec.extensions << "extconf.rb"
|
3620
3628
|
|
3621
3629
|
refute spec.missing_extensions?
|
3622
3630
|
end
|
@@ -3626,7 +3634,7 @@ end
|
|
3626
3634
|
end
|
3627
3635
|
|
3628
3636
|
def test_find_all_by_full_name
|
3629
|
-
pl = Gem::Platform.new
|
3637
|
+
pl = Gem::Platform.new "i386-linux"
|
3630
3638
|
|
3631
3639
|
a1 = util_spec "a", "1"
|
3632
3640
|
a1_pre = util_spec "a", "1.0.0.pre.1"
|
@@ -3693,9 +3701,9 @@ end
|
|
3693
3701
|
|
3694
3702
|
install_specs a
|
3695
3703
|
|
3696
|
-
assert_equal a, Gem::Specification.find_by_path(
|
3704
|
+
assert_equal a, Gem::Specification.find_by_path("foo")
|
3697
3705
|
a.activate
|
3698
|
-
assert_equal a, Gem::Specification.find_by_path(
|
3706
|
+
assert_equal a, Gem::Specification.find_by_path("foo")
|
3699
3707
|
end
|
3700
3708
|
|
3701
3709
|
def test_find_inactive_by_path
|
@@ -3703,9 +3711,9 @@ end
|
|
3703
3711
|
|
3704
3712
|
install_specs a
|
3705
3713
|
|
3706
|
-
assert_equal a, Gem::Specification.find_inactive_by_path(
|
3714
|
+
assert_equal a, Gem::Specification.find_inactive_by_path("foo")
|
3707
3715
|
a.activate
|
3708
|
-
assert_nil Gem::Specification.find_inactive_by_path(
|
3716
|
+
assert_nil Gem::Specification.find_inactive_by_path("foo")
|
3709
3717
|
end
|
3710
3718
|
|
3711
3719
|
def test_load_default_gem
|