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,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require
|
3
|
+
require_relative "package/tar_test_case"
|
4
|
+
require "rubygems/openssl"
|
5
5
|
|
6
6
|
class TestGemPackage < Gem::Package::TarTestCase
|
7
7
|
def setup
|
8
8
|
super
|
9
9
|
|
10
|
-
@spec = quick_gem
|
11
|
-
s.description =
|
10
|
+
@spec = quick_gem "a" do |s|
|
11
|
+
s.description = "π"
|
12
12
|
s.files = %w[lib/code.rb]
|
13
13
|
end
|
14
14
|
|
@@ -16,7 +16,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
16
16
|
|
17
17
|
@gem = @spec.cache_file
|
18
18
|
|
19
|
-
@destination = File.join @tempdir,
|
19
|
+
@destination = File.join @tempdir, "extract"
|
20
20
|
|
21
21
|
FileUtils.mkdir_p @destination
|
22
22
|
end
|
@@ -24,11 +24,11 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
24
24
|
def test_class_new_old_format
|
25
25
|
pend "jruby can't require the simple_gem file" if Gem.java_platform?
|
26
26
|
require_relative "simple_gem"
|
27
|
-
File.open
|
27
|
+
File.open "old_format.gem", "wb" do |io|
|
28
28
|
io.write SIMPLE_GEM
|
29
29
|
end
|
30
30
|
|
31
|
-
package = Gem::Package.new
|
31
|
+
package = Gem::Package.new "old_format.gem"
|
32
32
|
|
33
33
|
assert package.spec
|
34
34
|
end
|
@@ -36,17 +36,17 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
36
36
|
def test_add_checksums
|
37
37
|
gem_io = StringIO.new
|
38
38
|
|
39
|
-
spec = Gem::Specification.new
|
40
|
-
spec.summary =
|
41
|
-
spec.authors =
|
42
|
-
spec.files = [
|
39
|
+
spec = Gem::Specification.new "build", "1"
|
40
|
+
spec.summary = "build"
|
41
|
+
spec.authors = "build"
|
42
|
+
spec.files = ["lib/code.rb"]
|
43
43
|
spec.date = Time.at 0
|
44
|
-
spec.rubygems_version = Gem::Version.new
|
44
|
+
spec.rubygems_version = Gem::Version.new "0"
|
45
45
|
|
46
|
-
FileUtils.mkdir
|
46
|
+
FileUtils.mkdir "lib"
|
47
47
|
|
48
|
-
File.open
|
49
|
-
io.write
|
48
|
+
File.open "lib/code.rb", "w" do |io|
|
49
|
+
io.write "# lib/code.rb"
|
50
50
|
end
|
51
51
|
|
52
52
|
package = Gem::Package.new spec.file_name
|
@@ -69,11 +69,11 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
69
69
|
|
70
70
|
reader.each_entry do |entry|
|
71
71
|
case entry.full_name
|
72
|
-
when
|
72
|
+
when "checksums.yaml.gz" then
|
73
73
|
Zlib::GzipReader.wrap entry do |io|
|
74
74
|
checksums = io.read
|
75
75
|
end
|
76
|
-
when
|
76
|
+
when "data.tar.gz" then
|
77
77
|
tar = entry.read
|
78
78
|
end
|
79
79
|
end
|
@@ -88,13 +88,13 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
88
88
|
metadata_sha512 = OpenSSL::Digest::SHA512.hexdigest s.string
|
89
89
|
|
90
90
|
expected = {
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
"SHA512" => {
|
92
|
+
"metadata.gz" => metadata_sha512,
|
93
|
+
"data.tar.gz" => OpenSSL::Digest::SHA512.hexdigest(tar),
|
94
94
|
},
|
95
|
-
|
96
|
-
|
97
|
-
|
95
|
+
"SHA256" => {
|
96
|
+
"metadata.gz" => metadata_sha256,
|
97
|
+
"data.tar.gz" => OpenSSL::Digest::SHA256.hexdigest(tar),
|
98
98
|
},
|
99
99
|
}
|
100
100
|
|
@@ -105,12 +105,12 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
105
105
|
epoch = ENV["SOURCE_DATE_EPOCH"]
|
106
106
|
ENV["SOURCE_DATE_EPOCH"] = "123456789"
|
107
107
|
|
108
|
-
spec = Gem::Specification.new
|
109
|
-
spec.summary =
|
110
|
-
spec.authors =
|
111
|
-
spec.files = [
|
108
|
+
spec = Gem::Specification.new "build", "1"
|
109
|
+
spec.summary = "build"
|
110
|
+
spec.authors = "build"
|
111
|
+
spec.files = ["lib/code.rb"]
|
112
112
|
spec.date = Time.at 0
|
113
|
-
spec.rubygems_version = Gem::Version.new
|
113
|
+
spec.rubygems_version = Gem::Version.new "0"
|
114
114
|
|
115
115
|
package = Gem::Package.new spec.file_name
|
116
116
|
|
@@ -123,11 +123,11 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
123
123
|
epoch = ENV["SOURCE_DATE_EPOCH"]
|
124
124
|
ENV["SOURCE_DATE_EPOCH"] = nil
|
125
125
|
|
126
|
-
spec = Gem::Specification.new
|
127
|
-
spec.summary =
|
128
|
-
spec.authors =
|
129
|
-
spec.files = [
|
130
|
-
spec.rubygems_version = Gem::Version.new
|
126
|
+
spec = Gem::Specification.new "build", "1"
|
127
|
+
spec.summary = "build"
|
128
|
+
spec.authors = "build"
|
129
|
+
spec.files = ["lib/code.rb"]
|
130
|
+
spec.rubygems_version = Gem::Version.new "0"
|
131
131
|
|
132
132
|
package = Gem::Package.new spec.file_name
|
133
133
|
|
@@ -144,17 +144,17 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
144
144
|
spec = Gem::Specification.new
|
145
145
|
spec.files = %w[lib/code.rb lib/empty]
|
146
146
|
|
147
|
-
FileUtils.mkdir_p
|
147
|
+
FileUtils.mkdir_p "lib/empty"
|
148
148
|
|
149
|
-
File.open
|
150
|
-
io.write
|
149
|
+
File.open "lib/code.rb", "w" do |io|
|
150
|
+
io.write "# lib/code.rb"
|
151
151
|
end
|
152
152
|
|
153
|
-
File.open
|
154
|
-
io.write
|
153
|
+
File.open "lib/extra.rb", "w" do |io|
|
154
|
+
io.write "# lib/extra.rb"
|
155
155
|
end
|
156
156
|
|
157
|
-
package = Gem::Package.new
|
157
|
+
package = Gem::Package.new "bogus.gem"
|
158
158
|
package.spec = spec
|
159
159
|
|
160
160
|
tar = util_tar do |tar_io|
|
@@ -178,16 +178,16 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
178
178
|
spec = Gem::Specification.new
|
179
179
|
spec.files = %w[lib/code.rb lib/code_sym.rb lib/code_sym2.rb]
|
180
180
|
|
181
|
-
FileUtils.mkdir_p
|
181
|
+
FileUtils.mkdir_p "lib"
|
182
182
|
|
183
|
-
File.open
|
184
|
-
io.write
|
183
|
+
File.open "lib/code.rb", "w" do |io|
|
184
|
+
io.write "# lib/code.rb"
|
185
185
|
end
|
186
186
|
|
187
187
|
# NOTE: 'code.rb' is correct, because it's relative to lib/code_sym.rb
|
188
188
|
begin
|
189
|
-
File.symlink(
|
190
|
-
File.symlink(
|
189
|
+
File.symlink("code.rb", "lib/code_sym.rb")
|
190
|
+
File.symlink("../lib/code.rb", "lib/code_sym2.rb")
|
191
191
|
rescue Errno::EACCES => e
|
192
192
|
if win_platform?
|
193
193
|
pend "symlink - must be admin with no UAC on Windows"
|
@@ -196,7 +196,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
package = Gem::Package.new
|
199
|
+
package = Gem::Package.new "bogus.gem"
|
200
200
|
package.spec = spec
|
201
201
|
|
202
202
|
tar = util_tar do |tar_io|
|
@@ -218,20 +218,20 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
218
218
|
end
|
219
219
|
|
220
220
|
assert_equal %w[lib/code.rb], files
|
221
|
-
assert_equal [{
|
221
|
+
assert_equal [{ "lib/code_sym.rb" => "code.rb" }, { "lib/code_sym2.rb" => "../lib/code.rb" }], symlinks
|
222
222
|
end
|
223
223
|
|
224
224
|
def test_build
|
225
|
-
spec = Gem::Specification.new
|
226
|
-
spec.summary =
|
227
|
-
spec.authors =
|
228
|
-
spec.files = [
|
225
|
+
spec = Gem::Specification.new "build", "1"
|
226
|
+
spec.summary = "build"
|
227
|
+
spec.authors = "build"
|
228
|
+
spec.files = ["lib/code.rb"]
|
229
229
|
spec.rubygems_version = :junk
|
230
230
|
|
231
|
-
FileUtils.mkdir
|
231
|
+
FileUtils.mkdir "lib"
|
232
232
|
|
233
|
-
File.open
|
234
|
-
io.write
|
233
|
+
File.open "lib/code.rb", "w" do |io|
|
234
|
+
io.write "# lib/code.rb"
|
235
235
|
end
|
236
236
|
|
237
237
|
package = Gem::Package.new spec.file_name
|
@@ -252,25 +252,25 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
252
252
|
end
|
253
253
|
|
254
254
|
def test_build_auto_signed
|
255
|
-
pend
|
255
|
+
pend "openssl is missing" unless Gem::HAVE_OPENSSL
|
256
256
|
|
257
|
-
FileUtils.mkdir_p File.join(Gem.user_home,
|
257
|
+
FileUtils.mkdir_p File.join(Gem.user_home, ".gem")
|
258
258
|
|
259
|
-
private_key_path = File.join Gem.user_home,
|
259
|
+
private_key_path = File.join Gem.user_home, ".gem", "gem-private_key.pem"
|
260
260
|
Gem::Security.write PRIVATE_KEY, private_key_path
|
261
261
|
|
262
|
-
public_cert_path = File.join Gem.user_home,
|
262
|
+
public_cert_path = File.join Gem.user_home, ".gem", "gem-public_cert.pem"
|
263
263
|
FileUtils.cp PUBLIC_CERT_PATH, public_cert_path
|
264
264
|
|
265
|
-
spec = Gem::Specification.new
|
266
|
-
spec.summary =
|
267
|
-
spec.authors =
|
268
|
-
spec.files = [
|
265
|
+
spec = Gem::Specification.new "build", "1"
|
266
|
+
spec.summary = "build"
|
267
|
+
spec.authors = "build"
|
268
|
+
spec.files = ["lib/code.rb"]
|
269
269
|
|
270
|
-
FileUtils.mkdir
|
270
|
+
FileUtils.mkdir "lib"
|
271
271
|
|
272
|
-
File.open
|
273
|
-
io.write
|
272
|
+
File.open "lib/code.rb", "w" do |io|
|
273
|
+
io.write "# lib/code.rb"
|
274
274
|
end
|
275
275
|
|
276
276
|
package = Gem::Package.new spec.file_name
|
@@ -295,25 +295,25 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
295
295
|
end
|
296
296
|
|
297
297
|
def test_build_auto_signed_encrypted_key
|
298
|
-
pend
|
298
|
+
pend "openssl is missing" unless Gem::HAVE_OPENSSL
|
299
299
|
|
300
|
-
FileUtils.mkdir_p File.join(Gem.user_home,
|
300
|
+
FileUtils.mkdir_p File.join(Gem.user_home, ".gem")
|
301
301
|
|
302
|
-
private_key_path = File.join Gem.user_home,
|
302
|
+
private_key_path = File.join Gem.user_home, ".gem", "gem-private_key.pem"
|
303
303
|
FileUtils.cp ENCRYPTED_PRIVATE_KEY_PATH, private_key_path
|
304
304
|
|
305
|
-
public_cert_path = File.join Gem.user_home,
|
305
|
+
public_cert_path = File.join Gem.user_home, ".gem", "gem-public_cert.pem"
|
306
306
|
Gem::Security.write PUBLIC_CERT, public_cert_path
|
307
307
|
|
308
|
-
spec = Gem::Specification.new
|
309
|
-
spec.summary =
|
310
|
-
spec.authors =
|
311
|
-
spec.files = [
|
308
|
+
spec = Gem::Specification.new "build", "1"
|
309
|
+
spec.summary = "build"
|
310
|
+
spec.authors = "build"
|
311
|
+
spec.files = ["lib/code.rb"]
|
312
312
|
|
313
|
-
FileUtils.mkdir
|
313
|
+
FileUtils.mkdir "lib"
|
314
314
|
|
315
|
-
File.open
|
316
|
-
io.write
|
315
|
+
File.open "lib/code.rb", "w" do |io|
|
316
|
+
io.write "# lib/code.rb"
|
317
317
|
end
|
318
318
|
|
319
319
|
package = Gem::Package.new spec.file_name
|
@@ -338,7 +338,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
338
338
|
end
|
339
339
|
|
340
340
|
def test_build_invalid
|
341
|
-
spec = Gem::Specification.new
|
341
|
+
spec = Gem::Specification.new "build", "1"
|
342
342
|
|
343
343
|
package = Gem::Package.new spec.file_name
|
344
344
|
package.spec = spec
|
@@ -347,11 +347,11 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
347
347
|
package.build
|
348
348
|
end
|
349
349
|
|
350
|
-
assert_equal
|
350
|
+
assert_equal "missing value for attribute summary", e.message
|
351
351
|
end
|
352
352
|
|
353
353
|
def test_build_invalid_arguments
|
354
|
-
spec = Gem::Specification.new
|
354
|
+
spec = Gem::Specification.new "build", "1"
|
355
355
|
|
356
356
|
package = Gem::Package.new spec.file_name
|
357
357
|
package.spec = spec
|
@@ -364,19 +364,19 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
364
364
|
end
|
365
365
|
|
366
366
|
def test_build_signed
|
367
|
-
pend
|
367
|
+
pend "openssl is missing" unless Gem::HAVE_OPENSSL
|
368
368
|
|
369
|
-
spec = Gem::Specification.new
|
370
|
-
spec.summary =
|
371
|
-
spec.authors =
|
372
|
-
spec.files = [
|
369
|
+
spec = Gem::Specification.new "build", "1"
|
370
|
+
spec.summary = "build"
|
371
|
+
spec.authors = "build"
|
372
|
+
spec.files = ["lib/code.rb"]
|
373
373
|
spec.cert_chain = [PUBLIC_CERT.to_pem]
|
374
374
|
spec.signing_key = PRIVATE_KEY
|
375
375
|
|
376
|
-
FileUtils.mkdir
|
376
|
+
FileUtils.mkdir "lib"
|
377
377
|
|
378
|
-
File.open
|
379
|
-
io.write
|
378
|
+
File.open "lib/code.rb", "w" do |io|
|
379
|
+
io.write "# lib/code.rb"
|
380
380
|
end
|
381
381
|
|
382
382
|
package = Gem::Package.new spec.file_name
|
@@ -401,19 +401,19 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
401
401
|
end
|
402
402
|
|
403
403
|
def test_build_signed_encrypted_key
|
404
|
-
pend
|
404
|
+
pend "openssl is missing" unless Gem::HAVE_OPENSSL
|
405
405
|
|
406
|
-
spec = Gem::Specification.new
|
407
|
-
spec.summary =
|
408
|
-
spec.authors =
|
409
|
-
spec.files = [
|
406
|
+
spec = Gem::Specification.new "build", "1"
|
407
|
+
spec.summary = "build"
|
408
|
+
spec.authors = "build"
|
409
|
+
spec.files = ["lib/code.rb"]
|
410
410
|
spec.cert_chain = [PUBLIC_CERT.to_pem]
|
411
411
|
spec.signing_key = ENCRYPTED_PRIVATE_KEY
|
412
412
|
|
413
|
-
FileUtils.mkdir
|
413
|
+
FileUtils.mkdir "lib"
|
414
414
|
|
415
|
-
File.open
|
416
|
-
io.write
|
415
|
+
File.open "lib/code.rb", "w" do |io|
|
416
|
+
io.write "# lib/code.rb"
|
417
417
|
end
|
418
418
|
|
419
419
|
package = Gem::Package.new spec.file_name
|
@@ -441,11 +441,11 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
441
441
|
data_tgz = util_tar_gz {}
|
442
442
|
|
443
443
|
gem = util_tar do |tar|
|
444
|
-
tar.add_file
|
444
|
+
tar.add_file "data.tar.gz", 0644 do |io|
|
445
445
|
io.write data_tgz.string
|
446
446
|
end
|
447
447
|
|
448
|
-
tar.add_file
|
448
|
+
tar.add_file "metadata.gz", 0644 do |io|
|
449
449
|
Zlib::GzipWriter.wrap io do |gzio|
|
450
450
|
gzio.write @spec.to_yaml
|
451
451
|
end
|
@@ -475,7 +475,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
475
475
|
|
476
476
|
package.extract_files @destination
|
477
477
|
|
478
|
-
extracted = File.join @destination,
|
478
|
+
extracted = File.join @destination, "lib/code.rb"
|
479
479
|
assert_path_exist extracted
|
480
480
|
|
481
481
|
mask = 0100666 & (~File.umask)
|
@@ -488,22 +488,22 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
488
488
|
data_tgz = util_tar_gz {}
|
489
489
|
|
490
490
|
gem = util_tar do |tar|
|
491
|
-
tar.add_file
|
491
|
+
tar.add_file "data.tar.gz", 0644 do |io|
|
492
492
|
io.write data_tgz.string
|
493
493
|
end
|
494
494
|
|
495
|
-
tar.add_file
|
495
|
+
tar.add_file "metadata.gz", 0644 do |io|
|
496
496
|
Zlib::GzipWriter.wrap io do |gzio|
|
497
497
|
gzio.write @spec.to_yaml
|
498
498
|
end
|
499
499
|
end
|
500
500
|
end
|
501
501
|
|
502
|
-
File.open
|
502
|
+
File.open "empty.gem", "wb" do |io|
|
503
503
|
io.write gem.string
|
504
504
|
end
|
505
505
|
|
506
|
-
package = Gem::Package.new
|
506
|
+
package = Gem::Package.new "empty.gem"
|
507
507
|
|
508
508
|
package.extract_files @destination
|
509
509
|
|
@@ -514,8 +514,8 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
514
514
|
package = Gem::Package.new @gem
|
515
515
|
|
516
516
|
tgz_io = util_tar_gz do |tar|
|
517
|
-
tar.add_file
|
518
|
-
io.write
|
517
|
+
tar.add_file "/absolute.rb", 0644 do |io|
|
518
|
+
io.write "hi"
|
519
519
|
end
|
520
520
|
end
|
521
521
|
|
@@ -529,14 +529,15 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
529
529
|
|
530
530
|
def test_extract_tar_gz_symlink_relative_path
|
531
531
|
package = Gem::Package.new @gem
|
532
|
+
package.verify
|
532
533
|
|
533
534
|
tgz_io = util_tar_gz do |tar|
|
534
|
-
tar.add_file
|
535
|
-
io.write
|
535
|
+
tar.add_file "relative.rb", 0644 do |io|
|
536
|
+
io.write "hi"
|
536
537
|
end
|
537
538
|
|
538
|
-
tar.mkdir
|
539
|
-
tar.add_symlink
|
539
|
+
tar.mkdir "lib", 0755
|
540
|
+
tar.add_symlink "lib/foo.rb", "../relative.rb", 0644
|
540
541
|
end
|
541
542
|
|
542
543
|
begin
|
@@ -549,29 +550,50 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
549
550
|
end
|
550
551
|
end
|
551
552
|
|
552
|
-
extracted = File.join @destination,
|
553
|
+
extracted = File.join @destination, "lib/foo.rb"
|
553
554
|
assert_path_exist extracted
|
554
|
-
assert_equal
|
555
|
+
assert_equal "../relative.rb",
|
555
556
|
File.readlink(extracted)
|
556
|
-
assert_equal
|
557
|
+
assert_equal "hi",
|
557
558
|
File.read(extracted)
|
558
559
|
end
|
559
560
|
|
561
|
+
def test_extract_tar_gz_symlink_broken_relative_path
|
562
|
+
package = Gem::Package.new @gem
|
563
|
+
package.verify
|
564
|
+
|
565
|
+
tgz_io = util_tar_gz do |tar|
|
566
|
+
tar.mkdir "lib", 0755
|
567
|
+
tar.add_symlink "lib/foo.rb", "../broken.rb", 0644
|
568
|
+
end
|
569
|
+
|
570
|
+
ui = Gem::MockGemUi.new
|
571
|
+
|
572
|
+
use_ui ui do
|
573
|
+
package.extract_tar_gz tgz_io, @destination
|
574
|
+
end
|
575
|
+
|
576
|
+
assert_equal "WARNING: a-2 ships with a dangling symlink named lib/foo.rb pointing to missing ../broken.rb file. Ignoring\n", ui.error
|
577
|
+
|
578
|
+
extracted = File.join @destination, "lib/foo.rb"
|
579
|
+
assert_path_not_exist extracted
|
580
|
+
end
|
581
|
+
|
560
582
|
def test_extract_symlink_parent
|
561
583
|
package = Gem::Package.new @gem
|
562
584
|
|
563
585
|
tgz_io = util_tar_gz do |tar|
|
564
|
-
tar.mkdir
|
565
|
-
tar.add_symlink
|
566
|
-
tar.add_file
|
567
|
-
io.write
|
586
|
+
tar.mkdir "lib", 0755
|
587
|
+
tar.add_symlink "lib/link", "../..", 0644
|
588
|
+
tar.add_file "lib/link/outside.txt", 0644 do |io|
|
589
|
+
io.write "hi"
|
568
590
|
end
|
569
591
|
end
|
570
592
|
|
571
593
|
# Extract into a subdirectory of @destination; if this test fails it writes
|
572
594
|
# a file outside destination_subdir, but we want the file to remain inside
|
573
595
|
# @destination so it will be cleaned up.
|
574
|
-
destination_subdir = File.join @destination,
|
596
|
+
destination_subdir = File.join @destination, "subdir"
|
575
597
|
FileUtils.mkdir_p destination_subdir
|
576
598
|
|
577
599
|
expected_exceptions = win_platform? ? [Gem::Package::SymlinkError, Errno::EACCES] : [Gem::Package::SymlinkError]
|
@@ -595,18 +617,18 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
595
617
|
# Extract into a subdirectory of @destination; if this test fails it writes
|
596
618
|
# a file outside destination_subdir, but we want the file to remain inside
|
597
619
|
# @destination so it will be cleaned up.
|
598
|
-
destination_subdir = File.join @destination,
|
620
|
+
destination_subdir = File.join @destination, "subdir"
|
599
621
|
FileUtils.mkdir_p destination_subdir
|
600
622
|
|
601
|
-
destination_user_dir = File.join @destination,
|
602
|
-
destination_user_subdir = File.join destination_user_dir,
|
623
|
+
destination_user_dir = File.join @destination, "user"
|
624
|
+
destination_user_subdir = File.join destination_user_dir, "dir"
|
603
625
|
FileUtils.mkdir_p destination_user_subdir
|
604
626
|
|
605
627
|
pend "TMPDIR seems too long to add it as symlink into tar" if destination_user_dir.size > 90
|
606
628
|
|
607
629
|
tgz_io = util_tar_gz do |tar|
|
608
|
-
tar.add_symlink
|
609
|
-
tar.add_symlink
|
630
|
+
tar.add_symlink "link", destination_user_dir, 16877
|
631
|
+
tar.add_symlink "link/dir", ".", 16877
|
610
632
|
end
|
611
633
|
|
612
634
|
expected_exceptions = win_platform? ? [Gem::Package::SymlinkError, Errno::EACCES] : [Gem::Package::SymlinkError]
|
@@ -629,19 +651,19 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
629
651
|
package = Gem::Package.new @gem
|
630
652
|
|
631
653
|
tgz_io = util_tar_gz do |tar|
|
632
|
-
tar.mkdir
|
633
|
-
tar.add_file
|
634
|
-
io.write
|
654
|
+
tar.mkdir "lib", 0755
|
655
|
+
tar.add_file "lib/foo.rb", 0644 do |io|
|
656
|
+
io.write "hi"
|
635
657
|
end
|
636
|
-
tar.mkdir
|
658
|
+
tar.mkdir "lib/foo", 0755
|
637
659
|
end
|
638
660
|
|
639
661
|
package.extract_tar_gz tgz_io, @destination
|
640
662
|
|
641
|
-
extracted = File.join @destination,
|
663
|
+
extracted = File.join @destination, "lib/foo.rb"
|
642
664
|
assert_path_exist extracted
|
643
665
|
|
644
|
-
extracted = File.join @destination,
|
666
|
+
extracted = File.join @destination, "lib/foo"
|
645
667
|
assert_path_exist extracted
|
646
668
|
end
|
647
669
|
|
@@ -649,14 +671,14 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
649
671
|
package = Gem::Package.new @gem
|
650
672
|
|
651
673
|
tgz_io = util_tar_gz do |tar|
|
652
|
-
tar.add_file
|
653
|
-
io.write
|
674
|
+
tar.add_file "./dot_slash.rb", 0644 do |io|
|
675
|
+
io.write "hi"
|
654
676
|
end
|
655
677
|
end
|
656
678
|
|
657
679
|
package.extract_tar_gz tgz_io, @destination
|
658
680
|
|
659
|
-
extracted = File.join @destination,
|
681
|
+
extracted = File.join @destination, "dot_slash.rb"
|
660
682
|
assert_path_exist extracted
|
661
683
|
end
|
662
684
|
|
@@ -664,14 +686,14 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
664
686
|
package = Gem::Package.new @gem
|
665
687
|
|
666
688
|
tgz_io = util_tar_gz do |tar|
|
667
|
-
tar.add_file
|
668
|
-
io.write
|
689
|
+
tar.add_file ".dot_file.rb", 0644 do |io|
|
690
|
+
io.write "hi"
|
669
691
|
end
|
670
692
|
end
|
671
693
|
|
672
694
|
package.extract_tar_gz tgz_io, @destination
|
673
695
|
|
674
|
-
extracted = File.join @destination,
|
696
|
+
extracted = File.join @destination, ".dot_file.rb"
|
675
697
|
assert_path_exist extracted
|
676
698
|
end
|
677
699
|
|
@@ -680,14 +702,14 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
680
702
|
package = Gem::Package.new @gem
|
681
703
|
|
682
704
|
tgz_io = util_tar_gz do |tar|
|
683
|
-
tar.add_file
|
684
|
-
io.write
|
705
|
+
tar.add_file "foo/file.rb", 0644 do |io|
|
706
|
+
io.write "hi"
|
685
707
|
end
|
686
708
|
end
|
687
709
|
|
688
710
|
package.extract_tar_gz tgz_io, @destination.upcase
|
689
711
|
|
690
|
-
extracted = File.join @destination,
|
712
|
+
extracted = File.join @destination, "foo/file.rb"
|
691
713
|
assert_path_exist extracted
|
692
714
|
end
|
693
715
|
end
|
@@ -695,20 +717,20 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
695
717
|
def test_install_location
|
696
718
|
package = Gem::Package.new @gem
|
697
719
|
|
698
|
-
file =
|
699
|
-
file.taint if RUBY_VERSION <
|
720
|
+
file = "file.rb".dup
|
721
|
+
file.taint if RUBY_VERSION < "2.7"
|
700
722
|
|
701
723
|
destination = package.install_location file, @destination
|
702
724
|
|
703
|
-
assert_equal File.join(@destination,
|
704
|
-
refute destination.tainted? if RUBY_VERSION <
|
725
|
+
assert_equal File.join(@destination, "file.rb"), destination
|
726
|
+
refute destination.tainted? if RUBY_VERSION < "2.7"
|
705
727
|
end
|
706
728
|
|
707
729
|
def test_install_location_absolute
|
708
730
|
package = Gem::Package.new @gem
|
709
731
|
|
710
732
|
e = assert_raise Gem::Package::PathError do
|
711
|
-
package.install_location
|
733
|
+
package.install_location "/absolute.rb", @destination
|
712
734
|
end
|
713
735
|
|
714
736
|
assert_equal("installing into parent path /absolute.rb of " +
|
@@ -718,36 +740,36 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
718
740
|
def test_install_location_dots
|
719
741
|
package = Gem::Package.new @gem
|
720
742
|
|
721
|
-
file =
|
743
|
+
file = "file.rb"
|
722
744
|
|
723
|
-
destination = File.join @destination,
|
745
|
+
destination = File.join @destination, "foo", "..", "bar"
|
724
746
|
|
725
|
-
FileUtils.mkdir_p File.join @destination,
|
747
|
+
FileUtils.mkdir_p File.join @destination, "foo"
|
726
748
|
FileUtils.mkdir_p File.expand_path destination
|
727
749
|
|
728
750
|
destination = package.install_location file, destination
|
729
751
|
|
730
752
|
# this test only fails on ruby missing File.realpath
|
731
|
-
assert_equal File.join(@destination,
|
753
|
+
assert_equal File.join(@destination, "bar", "file.rb"), destination
|
732
754
|
end
|
733
755
|
|
734
756
|
def test_install_location_extra_slash
|
735
757
|
package = Gem::Package.new @gem
|
736
758
|
|
737
|
-
file =
|
738
|
-
file.taint if RUBY_VERSION <
|
759
|
+
file = "foo//file.rb".dup
|
760
|
+
file.taint if RUBY_VERSION < "2.7"
|
739
761
|
|
740
762
|
destination = package.install_location file, @destination
|
741
763
|
|
742
|
-
assert_equal File.join(@destination,
|
743
|
-
refute destination.tainted? if RUBY_VERSION <
|
764
|
+
assert_equal File.join(@destination, "foo", "file.rb"), destination
|
765
|
+
refute destination.tainted? if RUBY_VERSION < "2.7"
|
744
766
|
end
|
745
767
|
|
746
768
|
def test_install_location_relative
|
747
769
|
package = Gem::Package.new @gem
|
748
770
|
|
749
771
|
e = assert_raise Gem::Package::PathError do
|
750
|
-
package.install_location
|
772
|
+
package.install_location "../relative.rb", @destination
|
751
773
|
end
|
752
774
|
|
753
775
|
parent = File.expand_path File.join @destination, "../relative.rb"
|
@@ -773,9 +795,9 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
773
795
|
|
774
796
|
def test_load_spec
|
775
797
|
entry = StringIO.new Gem::Util.gzip @spec.to_yaml
|
776
|
-
def entry.full_name()
|
798
|
+
def entry.full_name() "metadata.gz" end
|
777
799
|
|
778
|
-
package = Gem::Package.new
|
800
|
+
package = Gem::Package.new "nonexistent.gem"
|
779
801
|
|
780
802
|
spec = package.load_spec entry
|
781
803
|
|
@@ -794,8 +816,8 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
794
816
|
|
795
817
|
def test_verify_checksum_bad
|
796
818
|
data_tgz = util_tar_gz do |tar|
|
797
|
-
tar.add_file
|
798
|
-
io.write
|
819
|
+
tar.add_file "lib/code.rb", 0444 do |io|
|
820
|
+
io.write "# lib/code.rb"
|
799
821
|
end
|
800
822
|
end
|
801
823
|
|
@@ -804,45 +826,45 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
804
826
|
gem = util_tar do |tar|
|
805
827
|
metadata_gz = Gem::Util.gzip @spec.to_yaml
|
806
828
|
|
807
|
-
tar.add_file
|
829
|
+
tar.add_file "metadata.gz", 0444 do |io|
|
808
830
|
io.write metadata_gz
|
809
831
|
end
|
810
832
|
|
811
|
-
tar.add_file
|
833
|
+
tar.add_file "data.tar.gz", 0444 do |io|
|
812
834
|
io.write data_tgz
|
813
835
|
end
|
814
836
|
|
815
837
|
bogus_checksums = {
|
816
|
-
|
817
|
-
|
818
|
-
|
838
|
+
"SHA1" => {
|
839
|
+
"data.tar.gz" => "bogus",
|
840
|
+
"metadata.gz" => "bogus",
|
819
841
|
},
|
820
842
|
}
|
821
|
-
tar.add_file
|
843
|
+
tar.add_file "checksums.yaml.gz", 0444 do |io|
|
822
844
|
Zlib::GzipWriter.wrap io do |gz_io|
|
823
845
|
gz_io.write Psych.dump bogus_checksums
|
824
846
|
end
|
825
847
|
end
|
826
848
|
end
|
827
849
|
|
828
|
-
File.open
|
850
|
+
File.open "mismatch.gem", "wb" do |io|
|
829
851
|
io.write gem.string
|
830
852
|
end
|
831
853
|
|
832
|
-
package = Gem::Package.new
|
854
|
+
package = Gem::Package.new "mismatch.gem"
|
833
855
|
|
834
856
|
e = assert_raise Gem::Package::FormatError do
|
835
857
|
package.verify
|
836
858
|
end
|
837
859
|
|
838
|
-
assert_equal
|
860
|
+
assert_equal "SHA1 checksum mismatch for data.tar.gz in mismatch.gem",
|
839
861
|
e.message
|
840
862
|
end
|
841
863
|
|
842
864
|
def test_verify_checksum_missing
|
843
865
|
data_tgz = util_tar_gz do |tar|
|
844
|
-
tar.add_file
|
845
|
-
io.write
|
866
|
+
tar.add_file "lib/code.rb", 0444 do |io|
|
867
|
+
io.write "# lib/code.rb"
|
846
868
|
end
|
847
869
|
end
|
848
870
|
|
@@ -851,7 +873,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
851
873
|
gem = util_tar do |tar|
|
852
874
|
metadata_gz = Gem::Util.gzip @spec.to_yaml
|
853
875
|
|
854
|
-
tar.add_file
|
876
|
+
tar.add_file "metadata.gz", 0444 do |io|
|
855
877
|
io.write metadata_gz
|
856
878
|
end
|
857
879
|
|
@@ -859,37 +881,37 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
859
881
|
digest << metadata_gz
|
860
882
|
|
861
883
|
checksums = {
|
862
|
-
|
863
|
-
|
884
|
+
"SHA1" => {
|
885
|
+
"metadata.gz" => digest.hexdigest,
|
864
886
|
},
|
865
887
|
}
|
866
888
|
|
867
|
-
tar.add_file
|
889
|
+
tar.add_file "checksums.yaml.gz", 0444 do |io|
|
868
890
|
Zlib::GzipWriter.wrap io do |gz_io|
|
869
891
|
gz_io.write Psych.dump checksums
|
870
892
|
end
|
871
893
|
end
|
872
894
|
|
873
|
-
tar.add_file
|
895
|
+
tar.add_file "data.tar.gz", 0444 do |io|
|
874
896
|
io.write data_tgz
|
875
897
|
end
|
876
898
|
end
|
877
899
|
|
878
|
-
File.open
|
900
|
+
File.open "data_checksum_missing.gem", "wb" do |io|
|
879
901
|
io.write gem.string
|
880
902
|
end
|
881
903
|
|
882
|
-
package = Gem::Package.new
|
904
|
+
package = Gem::Package.new "data_checksum_missing.gem"
|
883
905
|
|
884
906
|
assert package.verify
|
885
907
|
end
|
886
908
|
|
887
909
|
def test_verify_corrupt
|
888
910
|
pend "jruby strips the null byte and does not think it's corrupt" if Gem.java_platform?
|
889
|
-
tf = Tempfile.open
|
890
|
-
data = Gem::Util.gzip
|
911
|
+
tf = Tempfile.open "corrupt" do |io|
|
912
|
+
data = Gem::Util.gzip "a" * 10
|
891
913
|
io.write \
|
892
|
-
tar_file_header(
|
914
|
+
tar_file_header("metadata.gz", "\000x", 0644, data.length, Time.now)
|
893
915
|
io.write data
|
894
916
|
io.rewind
|
895
917
|
|
@@ -907,19 +929,19 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
907
929
|
end
|
908
930
|
|
909
931
|
def test_verify_empty
|
910
|
-
FileUtils.touch
|
932
|
+
FileUtils.touch "empty.gem"
|
911
933
|
|
912
|
-
package = Gem::Package.new
|
934
|
+
package = Gem::Package.new "empty.gem"
|
913
935
|
|
914
936
|
e = assert_raise Gem::Package::FormatError do
|
915
937
|
package.verify
|
916
938
|
end
|
917
939
|
|
918
|
-
assert_equal
|
940
|
+
assert_equal "package metadata is missing in empty.gem", e.message
|
919
941
|
end
|
920
942
|
|
921
943
|
def test_verify_nonexistent
|
922
|
-
package = Gem::Package.new
|
944
|
+
package = Gem::Package.new "nonexistent.gem"
|
923
945
|
|
924
946
|
e = assert_raise Gem::Package::FormatError do
|
925
947
|
package.verify
|
@@ -930,19 +952,19 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
930
952
|
end
|
931
953
|
|
932
954
|
def test_verify_duplicate_file
|
933
|
-
FileUtils.mkdir_p
|
934
|
-
FileUtils.touch
|
955
|
+
FileUtils.mkdir_p "lib"
|
956
|
+
FileUtils.touch "lib/code.rb"
|
935
957
|
|
936
958
|
build = Gem::Package.new @gem
|
937
959
|
build.spec = @spec
|
938
960
|
build.setup_signer
|
939
|
-
File.open @gem,
|
961
|
+
File.open @gem, "wb" do |gem_io|
|
940
962
|
Gem::Package::TarWriter.new gem_io do |gem|
|
941
963
|
build.add_metadata gem
|
942
964
|
build.add_contents gem
|
943
965
|
|
944
|
-
gem.add_file_simple
|
945
|
-
gem.add_file_simple
|
966
|
+
gem.add_file_simple "a.sig", 0444, 0
|
967
|
+
gem.add_file_simple "a.sig", 0444, 0
|
946
968
|
end
|
947
969
|
end
|
948
970
|
|
@@ -956,7 +978,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
956
978
|
end
|
957
979
|
|
958
980
|
def test_verify_security_policy
|
959
|
-
pend
|
981
|
+
pend "openssl is missing" unless Gem::HAVE_OPENSSL
|
960
982
|
|
961
983
|
package = Gem::Package.new @gem
|
962
984
|
package.security_policy = Gem::Security::HighSecurity
|
@@ -965,21 +987,21 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
965
987
|
package.verify
|
966
988
|
end
|
967
989
|
|
968
|
-
assert_equal
|
990
|
+
assert_equal "unsigned gems are not allowed by the High Security policy",
|
969
991
|
e.message
|
970
992
|
|
971
|
-
refute package.instance_variable_get(:@spec),
|
972
|
-
assert_empty package.instance_variable_get(:@files),
|
993
|
+
refute package.instance_variable_get(:@spec), "@spec must not be loaded"
|
994
|
+
assert_empty package.instance_variable_get(:@files), "@files must empty"
|
973
995
|
end
|
974
996
|
|
975
997
|
def test_verify_security_policy_low_security
|
976
|
-
pend
|
998
|
+
pend "openssl is missing" unless Gem::HAVE_OPENSSL
|
977
999
|
|
978
1000
|
@spec.cert_chain = [PUBLIC_CERT.to_pem]
|
979
1001
|
@spec.signing_key = PRIVATE_KEY
|
980
1002
|
|
981
|
-
FileUtils.mkdir_p
|
982
|
-
FileUtils.touch
|
1003
|
+
FileUtils.mkdir_p "lib"
|
1004
|
+
FileUtils.touch "lib/code.rb"
|
983
1005
|
|
984
1006
|
build = Gem::Package.new @gem
|
985
1007
|
build.spec = @spec
|
@@ -993,7 +1015,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
993
1015
|
end
|
994
1016
|
|
995
1017
|
def test_verify_security_policy_checksum_missing
|
996
|
-
pend
|
1018
|
+
pend "openssl is missing" unless Gem::HAVE_OPENSSL
|
997
1019
|
|
998
1020
|
@spec.cert_chain = [PUBLIC_CERT.to_pem]
|
999
1021
|
@spec.signing_key = PRIVATE_KEY
|
@@ -1002,23 +1024,23 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
1002
1024
|
build.spec = @spec
|
1003
1025
|
build.setup_signer
|
1004
1026
|
|
1005
|
-
FileUtils.mkdir
|
1006
|
-
FileUtils.touch
|
1027
|
+
FileUtils.mkdir "lib"
|
1028
|
+
FileUtils.touch "lib/code.rb"
|
1007
1029
|
|
1008
|
-
File.open @gem,
|
1030
|
+
File.open @gem, "wb" do |gem_io|
|
1009
1031
|
Gem::Package::TarWriter.new gem_io do |gem|
|
1010
1032
|
build.add_metadata gem
|
1011
1033
|
build.add_contents gem
|
1012
1034
|
|
1013
1035
|
# write bogus data.tar.gz to foil signature
|
1014
|
-
bogus_data = Gem::Util.gzip
|
1036
|
+
bogus_data = Gem::Util.gzip "hello"
|
1015
1037
|
fake_signer = Class.new do
|
1016
|
-
def digest_name;
|
1038
|
+
def digest_name; "SHA512"; end
|
1017
1039
|
def digest_algorithm; OpenSSL::Digest(:SHA512).new; end
|
1018
|
-
def key;
|
1019
|
-
def sign(*);
|
1040
|
+
def key; "key"; end
|
1041
|
+
def sign(*); "fake_sig"; end
|
1020
1042
|
end
|
1021
|
-
gem.add_file_signed
|
1043
|
+
gem.add_file_signed "data2.tar.gz", 0444, fake_signer.new do |io|
|
1022
1044
|
io.write bogus_data
|
1023
1045
|
end
|
1024
1046
|
|
@@ -1035,24 +1057,24 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
1035
1057
|
package.verify
|
1036
1058
|
end
|
1037
1059
|
|
1038
|
-
assert_equal
|
1060
|
+
assert_equal "invalid signature", e.message
|
1039
1061
|
|
1040
|
-
refute package.instance_variable_get(:@spec),
|
1041
|
-
assert_empty package.instance_variable_get(:@files),
|
1062
|
+
refute package.instance_variable_get(:@spec), "@spec must not be loaded"
|
1063
|
+
assert_empty package.instance_variable_get(:@files), "@files must empty"
|
1042
1064
|
end
|
1043
1065
|
|
1044
1066
|
def test_verify_truncate
|
1045
|
-
File.open
|
1067
|
+
File.open "bad.gem", "wb" do |io|
|
1046
1068
|
io.write File.read(@gem, 1024) # don't care about newlines
|
1047
1069
|
end
|
1048
1070
|
|
1049
|
-
package = Gem::Package.new
|
1071
|
+
package = Gem::Package.new "bad.gem"
|
1050
1072
|
|
1051
1073
|
e = assert_raise Gem::Package::FormatError do
|
1052
1074
|
package.verify
|
1053
1075
|
end
|
1054
1076
|
|
1055
|
-
assert_equal
|
1077
|
+
assert_equal "package content (data.tar.gz) is missing in bad.gem",
|
1056
1078
|
e.message
|
1057
1079
|
end
|
1058
1080
|
|
@@ -1060,7 +1082,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
1060
1082
|
|
1061
1083
|
def test_verify_entry
|
1062
1084
|
entry = Object.new
|
1063
|
-
def entry.full_name() raise ArgumentError,
|
1085
|
+
def entry.full_name() raise ArgumentError, "whatever" end
|
1064
1086
|
|
1065
1087
|
package = Gem::Package.new @gem
|
1066
1088
|
|