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
data/test/rubygems/test_gem.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# coding: US-ASCII
|
2
|
-
require_relative
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
2
|
+
require_relative "helper"
|
3
|
+
require "rubygems"
|
4
|
+
require "rubygems/command"
|
5
|
+
require "rubygems/installer"
|
6
|
+
require "pathname"
|
7
|
+
require "tmpdir"
|
8
|
+
require "rbconfig"
|
9
9
|
|
10
10
|
class TestGem < Gem::TestCase
|
11
11
|
PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
|
12
12
|
|
13
|
-
PROJECT_DIR = File.expand_path(
|
13
|
+
PROJECT_DIR = File.expand_path("../..", __dir__).tap(&Gem::UNTAINT)
|
14
14
|
|
15
15
|
def setup
|
16
16
|
super
|
@@ -89,32 +89,32 @@ class TestGem < Gem::TestCase
|
|
89
89
|
|
90
90
|
def test_self_install
|
91
91
|
spec_fetcher do |f|
|
92
|
-
f.gem
|
93
|
-
f.spec
|
92
|
+
f.gem "a", 1
|
93
|
+
f.spec "a", 2
|
94
94
|
end
|
95
95
|
|
96
96
|
gemhome2 = "#{@gemhome}2"
|
97
97
|
|
98
|
-
installed = Gem.install
|
98
|
+
installed = Gem.install "a", "= 1", :install_dir => gemhome2
|
99
99
|
|
100
100
|
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
|
101
101
|
|
102
|
-
assert_path_exist File.join(gemhome2,
|
102
|
+
assert_path_exist File.join(gemhome2, "gems", "a-1")
|
103
103
|
end
|
104
104
|
|
105
105
|
def test_self_install_in_rescue
|
106
106
|
spec_fetcher do |f|
|
107
|
-
f.gem
|
108
|
-
f.spec
|
107
|
+
f.gem "a", 1
|
108
|
+
f.spec "a", 2
|
109
109
|
end
|
110
110
|
|
111
111
|
gemhome2 = "#{@gemhome}2"
|
112
112
|
|
113
113
|
installed =
|
114
114
|
begin
|
115
|
-
raise
|
115
|
+
raise "Error"
|
116
116
|
rescue StandardError
|
117
|
-
Gem.install
|
117
|
+
Gem.install "a", "= 1", :install_dir => gemhome2
|
118
118
|
end
|
119
119
|
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
|
120
120
|
end
|
@@ -143,7 +143,7 @@ class TestGem < Gem::TestCase
|
|
143
143
|
|
144
144
|
def test_self_install_permissions_with_format_executable_and_non_standard_ruby_install_name
|
145
145
|
Gem::Installer.exec_format = nil
|
146
|
-
ruby_install_name
|
146
|
+
ruby_install_name "ruby27" do
|
147
147
|
assert_self_install_permissions(format_executable: true)
|
148
148
|
end
|
149
149
|
ensure
|
@@ -160,35 +160,35 @@ class TestGem < Gem::TestCase
|
|
160
160
|
:format_executable => format_executable,
|
161
161
|
}
|
162
162
|
Dir.chdir @tempdir do
|
163
|
-
Dir.mkdir
|
164
|
-
Dir.mkdir
|
163
|
+
Dir.mkdir "bin"
|
164
|
+
Dir.mkdir "data"
|
165
165
|
|
166
|
-
File.write
|
167
|
-
File.chmod 0755,
|
166
|
+
File.write "bin/foo", "#!/usr/bin/env ruby\n"
|
167
|
+
File.chmod 0755, "bin/foo"
|
168
168
|
|
169
|
-
File.write
|
169
|
+
File.write "data/foo.txt", "blah\n"
|
170
170
|
|
171
171
|
spec_fetcher do |f|
|
172
|
-
f.gem
|
173
|
-
s.executables = [
|
172
|
+
f.gem "foo", 1 do |s|
|
173
|
+
s.executables = ["foo"]
|
174
174
|
s.files = %w[bin/foo data/foo.txt]
|
175
175
|
end
|
176
176
|
end
|
177
|
-
Gem.install
|
177
|
+
Gem.install "foo", Gem::Requirement.default, options
|
178
178
|
end
|
179
179
|
|
180
180
|
prog_mode = (options[:prog_mode] & mask).to_s(8)
|
181
181
|
dir_mode = (options[:dir_mode] & mask).to_s(8)
|
182
182
|
data_mode = (options[:data_mode] & mask).to_s(8)
|
183
|
-
prog_name =
|
184
|
-
prog_name = RbConfig::CONFIG[
|
183
|
+
prog_name = "foo"
|
184
|
+
prog_name = RbConfig::CONFIG["ruby_install_name"].sub("ruby", "foo") if options[:format_executable]
|
185
185
|
expected = {
|
186
186
|
"bin/#{prog_name}" => prog_mode,
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
187
|
+
"gems/foo-1" => dir_mode,
|
188
|
+
"gems/foo-1/bin" => dir_mode,
|
189
|
+
"gems/foo-1/data" => dir_mode,
|
190
|
+
"gems/foo-1/bin/foo" => prog_mode,
|
191
|
+
"gems/foo-1/data/foo.txt" => data_mode,
|
192
192
|
}
|
193
193
|
# add Windows script
|
194
194
|
expected["bin/#{prog_name}.bat"] = mask.to_s(8) if win_platform?
|
@@ -200,7 +200,7 @@ class TestGem < Gem::TestCase
|
|
200
200
|
end
|
201
201
|
assert_equal(expected, result)
|
202
202
|
ensure
|
203
|
-
File.chmod(0755, *Dir.glob(@gemhome +
|
203
|
+
File.chmod(0755, *Dir.glob(@gemhome + "/gems/**/").map {|path| path.tap(&Gem::UNTAINT) })
|
204
204
|
end
|
205
205
|
|
206
206
|
def test_require_missing
|
@@ -222,57 +222,57 @@ class TestGem < Gem::TestCase
|
|
222
222
|
end
|
223
223
|
|
224
224
|
def test_self_bin_path_active
|
225
|
-
a1 = util_spec
|
226
|
-
s.executables = [
|
225
|
+
a1 = util_spec "a", "1" do |s|
|
226
|
+
s.executables = ["exec"]
|
227
227
|
end
|
228
228
|
|
229
|
-
util_spec
|
230
|
-
s.executables = [
|
229
|
+
util_spec "a", "2" do |s|
|
230
|
+
s.executables = ["exec"]
|
231
231
|
end
|
232
232
|
|
233
233
|
a1.activate
|
234
234
|
|
235
|
-
assert_match
|
235
|
+
assert_match "a-1/bin/exec", Gem.bin_path("a", "exec", ">= 0")
|
236
236
|
end
|
237
237
|
|
238
238
|
def test_self_bin_path_picking_newest
|
239
|
-
a1 = util_spec
|
240
|
-
s.executables = [
|
239
|
+
a1 = util_spec "a", "1" do |s|
|
240
|
+
s.executables = ["exec"]
|
241
241
|
end
|
242
242
|
|
243
|
-
a2 = util_spec
|
244
|
-
s.executables = [
|
243
|
+
a2 = util_spec "a", "2" do |s|
|
244
|
+
s.executables = ["exec"]
|
245
245
|
end
|
246
246
|
|
247
247
|
install_specs a1, a2
|
248
248
|
|
249
|
-
assert_match
|
249
|
+
assert_match "a-2/bin/exec", Gem.bin_path("a", "exec", ">= 0")
|
250
250
|
end
|
251
251
|
|
252
252
|
def test_self_activate_bin_path_no_exec_name
|
253
253
|
e = assert_raise ArgumentError do
|
254
|
-
Gem.activate_bin_path
|
254
|
+
Gem.activate_bin_path "a"
|
255
255
|
end
|
256
256
|
|
257
|
-
assert_equal
|
257
|
+
assert_equal "you must supply exec_name", e.message
|
258
258
|
end
|
259
259
|
|
260
260
|
def test_activate_bin_path_resolves_eagerly
|
261
|
-
a1 = util_spec
|
262
|
-
s.executables = [
|
263
|
-
s.add_dependency
|
261
|
+
a1 = util_spec "a", "1" do |s|
|
262
|
+
s.executables = ["exec"]
|
263
|
+
s.add_dependency "b"
|
264
264
|
end
|
265
265
|
|
266
|
-
b1 = util_spec
|
267
|
-
s.add_dependency
|
266
|
+
b1 = util_spec "b", "1" do |s|
|
267
|
+
s.add_dependency "c", "2"
|
268
268
|
end
|
269
269
|
|
270
|
-
b2 = util_spec
|
271
|
-
s.add_dependency
|
270
|
+
b2 = util_spec "b", "2" do |s|
|
271
|
+
s.add_dependency "c", "1"
|
272
272
|
end
|
273
273
|
|
274
|
-
c1 = util_spec
|
275
|
-
c2 = util_spec
|
274
|
+
c1 = util_spec "c", "1"
|
275
|
+
c2 = util_spec "c", "2"
|
276
276
|
|
277
277
|
install_specs c1, c2, b1, b2, a1
|
278
278
|
|
@@ -280,27 +280,27 @@ class TestGem < Gem::TestCase
|
|
280
280
|
|
281
281
|
# If we didn't eagerly resolve, this would activate c-2 and then the
|
282
282
|
# finish_resolve would cause a conflict
|
283
|
-
gem
|
283
|
+
gem "c"
|
284
284
|
Gem.finish_resolve
|
285
285
|
|
286
286
|
assert_equal %w[a-1 b-2 c-1], loaded_spec_names
|
287
287
|
end
|
288
288
|
|
289
289
|
def test_activate_bin_path_does_not_error_if_a_gem_thats_not_finally_activated_has_orphaned_dependencies
|
290
|
-
a1 = util_spec
|
291
|
-
s.executables = [
|
292
|
-
s.add_dependency
|
290
|
+
a1 = util_spec "a", "1" do |s|
|
291
|
+
s.executables = ["exec"]
|
292
|
+
s.add_dependency "b"
|
293
293
|
end
|
294
294
|
|
295
|
-
b1 = util_spec
|
296
|
-
s.add_dependency
|
295
|
+
b1 = util_spec "b", "1" do |s|
|
296
|
+
s.add_dependency "c", "1"
|
297
297
|
end
|
298
298
|
|
299
|
-
b2 = util_spec
|
300
|
-
s.add_dependency
|
299
|
+
b2 = util_spec "b", "2" do |s|
|
300
|
+
s.add_dependency "c", "2"
|
301
301
|
end
|
302
302
|
|
303
|
-
c2 = util_spec
|
303
|
+
c2 = util_spec "c", "2"
|
304
304
|
|
305
305
|
install_specs c2, b1, b2, a1
|
306
306
|
|
@@ -312,20 +312,20 @@ class TestGem < Gem::TestCase
|
|
312
312
|
end
|
313
313
|
|
314
314
|
def test_activate_bin_path_raises_a_meaningful_error_if_a_gem_thats_finally_activated_has_orphaned_dependencies
|
315
|
-
a1 = util_spec
|
316
|
-
s.executables = [
|
317
|
-
s.add_dependency
|
315
|
+
a1 = util_spec "a", "1" do |s|
|
316
|
+
s.executables = ["exec"]
|
317
|
+
s.add_dependency "b"
|
318
318
|
end
|
319
319
|
|
320
|
-
b1 = util_spec
|
321
|
-
s.add_dependency
|
320
|
+
b1 = util_spec "b", "1" do |s|
|
321
|
+
s.add_dependency "c", "1"
|
322
322
|
end
|
323
323
|
|
324
|
-
b2 = util_spec
|
325
|
-
s.add_dependency
|
324
|
+
b2 = util_spec "b", "2" do |s|
|
325
|
+
s.add_dependency "c", "2"
|
326
326
|
end
|
327
327
|
|
328
|
-
c1 = util_spec
|
328
|
+
c1 = util_spec "c", "1"
|
329
329
|
|
330
330
|
install_specs c1, b1, b2, a1
|
331
331
|
|
@@ -339,8 +339,8 @@ class TestGem < Gem::TestCase
|
|
339
339
|
end
|
340
340
|
|
341
341
|
def test_activate_bin_path_in_debug_mode
|
342
|
-
a1 = util_spec
|
343
|
-
s.executables = [
|
342
|
+
a1 = util_spec "a", "1" do |s|
|
343
|
+
s.executables = ["exec"]
|
344
344
|
end
|
345
345
|
|
346
346
|
install_specs a1
|
@@ -355,12 +355,12 @@ class TestGem < Gem::TestCase
|
|
355
355
|
end
|
356
356
|
|
357
357
|
def test_activate_bin_path_selects_exact_bundler_version_if_present
|
358
|
-
bundler_latest = util_spec
|
359
|
-
s.executables = [
|
358
|
+
bundler_latest = util_spec "bundler", "2.0.1" do |s|
|
359
|
+
s.executables = ["bundle"]
|
360
360
|
end
|
361
361
|
|
362
|
-
bundler_previous = util_spec
|
363
|
-
s.executables = [
|
362
|
+
bundler_previous = util_spec "bundler", "2.0.0" do |s|
|
363
|
+
s.executables = ["bundle"]
|
364
364
|
end
|
365
365
|
|
366
366
|
install_specs bundler_latest, bundler_previous
|
@@ -389,12 +389,12 @@ class TestGem < Gem::TestCase
|
|
389
389
|
end
|
390
390
|
|
391
391
|
def test_activate_bin_path_respects_underscore_selection_if_given
|
392
|
-
bundler_latest = util_spec
|
393
|
-
s.executables = [
|
392
|
+
bundler_latest = util_spec "bundler", "2.0.1" do |s|
|
393
|
+
s.executables = ["bundle"]
|
394
394
|
end
|
395
395
|
|
396
|
-
bundler_previous = util_spec
|
397
|
-
s.executables = [
|
396
|
+
bundler_previous = util_spec "bundler", "1.17.3" do |s|
|
397
|
+
s.executables = ["bundle"]
|
398
398
|
end
|
399
399
|
|
400
400
|
install_specs bundler_latest, bundler_previous
|
@@ -450,57 +450,57 @@ class TestGem < Gem::TestCase
|
|
450
450
|
|
451
451
|
def test_self_bin_path_no_exec_name
|
452
452
|
e = assert_raise ArgumentError do
|
453
|
-
Gem.bin_path
|
453
|
+
Gem.bin_path "a"
|
454
454
|
end
|
455
455
|
|
456
|
-
assert_equal
|
456
|
+
assert_equal "you must supply exec_name", e.message
|
457
457
|
end
|
458
458
|
|
459
459
|
def test_self_bin_path_bin_name
|
460
460
|
install_specs util_exec_gem
|
461
|
-
assert_equal @abin_path, Gem.bin_path(
|
461
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin")
|
462
462
|
end
|
463
463
|
|
464
464
|
def test_self_bin_path_bin_name_version
|
465
465
|
install_specs util_exec_gem
|
466
|
-
assert_equal @abin_path, Gem.bin_path(
|
466
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin", "4")
|
467
467
|
end
|
468
468
|
|
469
469
|
def test_self_bin_path_nonexistent_binfile
|
470
|
-
util_spec
|
471
|
-
s.executables = [
|
470
|
+
util_spec "a", "2" do |s|
|
471
|
+
s.executables = ["exec"]
|
472
472
|
end
|
473
473
|
assert_raise(Gem::GemNotFoundException) do
|
474
|
-
Gem.bin_path(
|
474
|
+
Gem.bin_path("a", "other", "2")
|
475
475
|
end
|
476
476
|
end
|
477
477
|
|
478
478
|
def test_self_bin_path_no_bin_file
|
479
|
-
util_spec
|
479
|
+
util_spec "a", "1"
|
480
480
|
assert_raise(ArgumentError) do
|
481
|
-
Gem.bin_path(
|
481
|
+
Gem.bin_path("a", nil, "1")
|
482
482
|
end
|
483
483
|
end
|
484
484
|
|
485
485
|
def test_self_bin_path_not_found
|
486
486
|
assert_raise(Gem::GemNotFoundException) do
|
487
|
-
Gem.bin_path(
|
487
|
+
Gem.bin_path("non-existent", "blah")
|
488
488
|
end
|
489
489
|
end
|
490
490
|
|
491
491
|
def test_self_bin_path_bin_file_gone_in_latest
|
492
492
|
install_specs util_exec_gem
|
493
|
-
spec = util_spec
|
493
|
+
spec = util_spec "a", "10" do |s|
|
494
494
|
s.executables = []
|
495
495
|
end
|
496
496
|
install_specs spec
|
497
|
-
assert_equal @abin_path, Gem.bin_path(
|
497
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin")
|
498
498
|
end
|
499
499
|
|
500
500
|
def test_self_bindir
|
501
|
-
assert_equal File.join(@gemhome,
|
502
|
-
assert_equal File.join(@gemhome,
|
503
|
-
assert_equal File.join(@gemhome,
|
501
|
+
assert_equal File.join(@gemhome, "bin"), Gem.bindir
|
502
|
+
assert_equal File.join(@gemhome, "bin"), Gem.bindir(Gem.dir)
|
503
|
+
assert_equal File.join(@gemhome, "bin"), Gem.bindir(Pathname.new(Gem.dir))
|
504
504
|
end
|
505
505
|
|
506
506
|
def test_self_bindir_default_dir
|
@@ -529,21 +529,21 @@ class TestGem < Gem::TestCase
|
|
529
529
|
foo = nil
|
530
530
|
|
531
531
|
Dir.chdir @tempdir do
|
532
|
-
FileUtils.mkdir_p
|
533
|
-
File.open File.join(
|
534
|
-
fp.puts
|
532
|
+
FileUtils.mkdir_p "data"
|
533
|
+
File.open File.join("data", "foo.txt"), "w" do |fp|
|
534
|
+
fp.puts "blah"
|
535
535
|
end
|
536
536
|
|
537
|
-
foo = util_spec
|
537
|
+
foo = util_spec "foo" do |s|
|
538
538
|
s.files = %w[data/foo.txt]
|
539
539
|
end
|
540
540
|
|
541
541
|
install_gem foo
|
542
542
|
end
|
543
543
|
|
544
|
-
gem
|
544
|
+
gem "foo"
|
545
545
|
|
546
|
-
expected = File.join @gemhome,
|
546
|
+
expected = File.join @gemhome, "gems", foo.full_name, "data", "foo"
|
547
547
|
|
548
548
|
assert_equal expected, Gem::Specification.find_by_name("foo").datadir
|
549
549
|
end
|
@@ -555,25 +555,25 @@ class TestGem < Gem::TestCase
|
|
555
555
|
end
|
556
556
|
|
557
557
|
def test_self_default_exec_format
|
558
|
-
ruby_install_name
|
559
|
-
assert_equal
|
558
|
+
ruby_install_name "ruby" do
|
559
|
+
assert_equal "%s", Gem.default_exec_format
|
560
560
|
end
|
561
561
|
end
|
562
562
|
|
563
563
|
def test_self_default_exec_format_18
|
564
|
-
ruby_install_name
|
565
|
-
assert_equal
|
564
|
+
ruby_install_name "ruby18" do
|
565
|
+
assert_equal "%s18", Gem.default_exec_format
|
566
566
|
end
|
567
567
|
end
|
568
568
|
|
569
569
|
def test_self_default_exec_format_jruby
|
570
|
-
ruby_install_name
|
571
|
-
assert_equal
|
570
|
+
ruby_install_name "jruby" do
|
571
|
+
assert_equal "j%s", Gem.default_exec_format
|
572
572
|
end
|
573
573
|
end
|
574
574
|
|
575
575
|
def test_default_path
|
576
|
-
vendordir(File.join(@tempdir,
|
576
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
577
577
|
FileUtils.rm_rf Gem.user_home
|
578
578
|
|
579
579
|
expected = [Gem.default_dir]
|
@@ -593,7 +593,7 @@ class TestGem < Gem::TestCase
|
|
593
593
|
end
|
594
594
|
|
595
595
|
def test_default_path_user_home
|
596
|
-
vendordir(File.join(@tempdir,
|
596
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
597
597
|
expected = [Gem.user_dir, Gem.default_dir]
|
598
598
|
|
599
599
|
assert_equal expected, Gem.default_path
|
@@ -601,7 +601,7 @@ class TestGem < Gem::TestCase
|
|
601
601
|
end
|
602
602
|
|
603
603
|
def test_default_path_vendor_dir
|
604
|
-
vendordir(File.join(@tempdir,
|
604
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
605
605
|
FileUtils.mkdir_p Gem.vendor_dir
|
606
606
|
|
607
607
|
FileUtils.rm_rf Gem.user_home
|
@@ -617,14 +617,14 @@ class TestGem < Gem::TestCase
|
|
617
617
|
end
|
618
618
|
|
619
619
|
def test_self_use_gemdeps
|
620
|
-
with_rubygems_gemdeps(
|
621
|
-
FileUtils.mkdir_p
|
622
|
-
FileUtils.mkdir_p
|
620
|
+
with_rubygems_gemdeps("-") do
|
621
|
+
FileUtils.mkdir_p "detect/a/b"
|
622
|
+
FileUtils.mkdir_p "detect/a/Isolate"
|
623
623
|
|
624
|
-
FileUtils.touch
|
624
|
+
FileUtils.touch "detect/Isolate"
|
625
625
|
|
626
626
|
begin
|
627
|
-
Dir.chdir
|
627
|
+
Dir.chdir "detect/a/b"
|
628
628
|
|
629
629
|
Gem.use_gemdeps
|
630
630
|
|
@@ -645,12 +645,12 @@ class TestGem < Gem::TestCase
|
|
645
645
|
|
646
646
|
Gem.ensure_gem_subdirectories @gemhome
|
647
647
|
|
648
|
-
assert_path_exist File.join @gemhome,
|
649
|
-
assert_path_exist File.join @gemhome,
|
650
|
-
assert_path_exist File.join @gemhome,
|
651
|
-
assert_path_exist File.join @gemhome,
|
652
|
-
assert_path_exist File.join @gemhome,
|
653
|
-
assert_path_exist File.join @gemhome,
|
648
|
+
assert_path_exist File.join @gemhome, "build_info"
|
649
|
+
assert_path_exist File.join @gemhome, "cache"
|
650
|
+
assert_path_exist File.join @gemhome, "doc"
|
651
|
+
assert_path_exist File.join @gemhome, "extensions"
|
652
|
+
assert_path_exist File.join @gemhome, "gems"
|
653
|
+
assert_path_exist File.join @gemhome, "specifications"
|
654
654
|
end
|
655
655
|
|
656
656
|
def test_self_ensure_gem_directories_permissions
|
@@ -680,9 +680,9 @@ class TestGem < Gem::TestCase
|
|
680
680
|
end unless win_platform?
|
681
681
|
|
682
682
|
def test_self_ensure_gem_directories_missing_parents
|
683
|
-
gemdir = File.join @tempdir,
|
684
|
-
FileUtils.rm_rf File.join(@tempdir,
|
685
|
-
refute File.exist?(File.join(@tempdir,
|
683
|
+
gemdir = File.join @tempdir, "a/b/c/gemdir"
|
684
|
+
FileUtils.rm_rf File.join(@tempdir, "a") rescue nil
|
685
|
+
refute File.exist?(File.join(@tempdir, "a")),
|
686
686
|
"manually remove #{File.join @tempdir, 'a'}, tests are broken"
|
687
687
|
Gem.use_paths gemdir
|
688
688
|
|
@@ -725,19 +725,19 @@ class TestGem < Gem::TestCase
|
|
725
725
|
end
|
726
726
|
|
727
727
|
def test_self_ensure_gem_directories_non_existent_paths
|
728
|
-
Gem.ensure_gem_subdirectories
|
729
|
-
Gem.ensure_gem_subdirectories
|
728
|
+
Gem.ensure_gem_subdirectories "/proc/0123456789/bogus" # should not raise
|
729
|
+
Gem.ensure_gem_subdirectories "classpath:/bogus/x" # JRuby embed scenario
|
730
730
|
end
|
731
731
|
end
|
732
732
|
|
733
733
|
def test_self_extension_dir_shared
|
734
|
-
enable_shared
|
734
|
+
enable_shared "yes" do
|
735
735
|
assert_equal Gem.ruby_api_version, Gem.extension_api_version
|
736
736
|
end
|
737
737
|
end
|
738
738
|
|
739
739
|
def test_self_extension_dir_static
|
740
|
-
enable_shared
|
740
|
+
enable_shared "no" do
|
741
741
|
assert_equal "#{Gem.ruby_api_version}-static", Gem.extension_api_version
|
742
742
|
end
|
743
743
|
end
|
@@ -746,14 +746,14 @@ class TestGem < Gem::TestCase
|
|
746
746
|
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
747
747
|
$LOAD_PATH.unshift cwd
|
748
748
|
|
749
|
-
discover_path = File.join
|
749
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
750
750
|
|
751
751
|
foo1, foo2 = %w[1 2].map do |version|
|
752
|
-
spec = quick_gem
|
752
|
+
spec = quick_gem "sff", version do |s|
|
753
753
|
s.files << discover_path
|
754
754
|
end
|
755
755
|
|
756
|
-
write_file(File.join
|
756
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
757
757
|
fp.puts "# #{spec.full_name}"
|
758
758
|
end
|
759
759
|
|
@@ -763,13 +763,13 @@ class TestGem < Gem::TestCase
|
|
763
763
|
Gem.refresh
|
764
764
|
|
765
765
|
expected = [
|
766
|
-
File.expand_path(
|
766
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
767
767
|
File.join(foo2.full_gem_path, discover_path),
|
768
768
|
File.join(foo1.full_gem_path, discover_path),
|
769
769
|
]
|
770
770
|
|
771
|
-
assert_equal expected, Gem.find_files(
|
772
|
-
assert_equal expected, Gem.find_files(
|
771
|
+
assert_equal expected, Gem.find_files("sff/discover")
|
772
|
+
assert_equal expected, Gem.find_files("sff/**.rb"), "[ruby-core:31730]"
|
773
773
|
ensure
|
774
774
|
assert_equal cwd, $LOAD_PATH.shift
|
775
775
|
end
|
@@ -778,14 +778,14 @@ class TestGem < Gem::TestCase
|
|
778
778
|
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
779
779
|
actual_load_path = $LOAD_PATH.unshift(cwd).dup
|
780
780
|
|
781
|
-
discover_path = File.join
|
781
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
782
782
|
|
783
783
|
foo1, _ = %w[1 2].map do |version|
|
784
|
-
spec = quick_gem
|
784
|
+
spec = quick_gem "sff", version do |s|
|
785
785
|
s.files << discover_path
|
786
786
|
end
|
787
787
|
|
788
|
-
write_file(File.join
|
788
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
789
789
|
fp.puts "# #{spec.full_name}"
|
790
790
|
end
|
791
791
|
|
@@ -793,19 +793,19 @@ class TestGem < Gem::TestCase
|
|
793
793
|
end
|
794
794
|
Gem.refresh
|
795
795
|
|
796
|
-
write_file(File.join Dir.pwd,
|
796
|
+
write_file(File.join Dir.pwd, "Gemfile") do |fp|
|
797
797
|
fp.puts "source 'https://rubygems.org'"
|
798
798
|
fp.puts "gem '#{foo1.name}', '#{foo1.version}'"
|
799
799
|
end
|
800
|
-
Gem.use_gemdeps(File.join Dir.pwd,
|
800
|
+
Gem.use_gemdeps(File.join Dir.pwd, "Gemfile")
|
801
801
|
|
802
802
|
expected = [
|
803
|
-
File.expand_path(
|
803
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
804
804
|
File.join(foo1.full_gem_path, discover_path),
|
805
805
|
].sort
|
806
806
|
|
807
|
-
assert_equal expected, Gem.find_files(
|
808
|
-
assert_equal expected, Gem.find_files(
|
807
|
+
assert_equal expected, Gem.find_files("sff/discover").sort
|
808
|
+
assert_equal expected, Gem.find_files("sff/**.rb").sort, "[ruby-core:31730]"
|
809
809
|
ensure
|
810
810
|
assert_equal cwd, actual_load_path.shift unless Gem.java_platform?
|
811
811
|
end
|
@@ -814,14 +814,14 @@ class TestGem < Gem::TestCase
|
|
814
814
|
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
815
815
|
$LOAD_PATH.unshift cwd
|
816
816
|
|
817
|
-
discover_path = File.join
|
817
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
818
818
|
|
819
819
|
_, foo2 = %w[1 2].map do |version|
|
820
|
-
spec = quick_gem
|
820
|
+
spec = quick_gem "sff", version do |s|
|
821
821
|
s.files << discover_path
|
822
822
|
end
|
823
823
|
|
824
|
-
write_file(File.join
|
824
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
825
825
|
fp.puts "# #{spec.full_name}"
|
826
826
|
end
|
827
827
|
|
@@ -831,30 +831,30 @@ class TestGem < Gem::TestCase
|
|
831
831
|
Gem.refresh
|
832
832
|
|
833
833
|
expected = [
|
834
|
-
File.expand_path(
|
834
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
835
835
|
File.join(foo2.full_gem_path, discover_path),
|
836
836
|
]
|
837
837
|
|
838
|
-
assert_equal expected, Gem.find_latest_files(
|
839
|
-
assert_equal expected, Gem.find_latest_files(
|
838
|
+
assert_equal expected, Gem.find_latest_files("sff/discover")
|
839
|
+
assert_equal expected, Gem.find_latest_files("sff/**.rb"), "[ruby-core:31730]"
|
840
840
|
ensure
|
841
841
|
assert_equal cwd, $LOAD_PATH.shift
|
842
842
|
end
|
843
843
|
|
844
844
|
def test_self_latest_spec_for
|
845
845
|
gems = spec_fetcher do |fetcher|
|
846
|
-
fetcher.spec
|
847
|
-
fetcher.spec
|
848
|
-
fetcher.spec
|
846
|
+
fetcher.spec "a", 1
|
847
|
+
fetcher.spec "a", "3.a"
|
848
|
+
fetcher.spec "a", 2
|
849
849
|
end
|
850
850
|
|
851
|
-
spec = Gem.latest_spec_for
|
851
|
+
spec = Gem.latest_spec_for "a"
|
852
852
|
|
853
|
-
assert_equal gems[
|
853
|
+
assert_equal gems["a-2"], spec
|
854
854
|
end
|
855
855
|
|
856
856
|
def test_self_latest_spec_for_multiple_sources
|
857
|
-
uri =
|
857
|
+
uri = "https://example.sample.com/"
|
858
858
|
source = Gem::Source.new(uri)
|
859
859
|
source_list = Gem::SourceList.new
|
860
860
|
source_list << Gem::Source.new(@uri)
|
@@ -862,44 +862,44 @@ class TestGem < Gem::TestCase
|
|
862
862
|
Gem.sources.replace source_list
|
863
863
|
|
864
864
|
spec_fetcher(uri) do |fetcher|
|
865
|
-
fetcher.spec
|
865
|
+
fetcher.spec "a", 1.1
|
866
866
|
end
|
867
867
|
|
868
868
|
gems = spec_fetcher do |fetcher|
|
869
|
-
fetcher.spec
|
870
|
-
fetcher.spec
|
871
|
-
fetcher.spec
|
869
|
+
fetcher.spec "a", 1
|
870
|
+
fetcher.spec "a", "3.a"
|
871
|
+
fetcher.spec "a", 2
|
872
872
|
end
|
873
|
-
spec = Gem.latest_spec_for
|
874
|
-
assert_equal gems[
|
873
|
+
spec = Gem.latest_spec_for "a"
|
874
|
+
assert_equal gems["a-2"], spec
|
875
875
|
end
|
876
876
|
|
877
877
|
def test_self_latest_rubygems_version
|
878
878
|
spec_fetcher do |fetcher|
|
879
|
-
fetcher.spec
|
880
|
-
fetcher.spec
|
881
|
-
fetcher.spec
|
879
|
+
fetcher.spec "rubygems-update", "1.8.23"
|
880
|
+
fetcher.spec "rubygems-update", "1.8.24"
|
881
|
+
fetcher.spec "rubygems-update", "2.0.0.preview3"
|
882
882
|
end
|
883
883
|
|
884
884
|
version = Gem.latest_rubygems_version
|
885
885
|
|
886
|
-
assert_equal Gem::Version.new(
|
886
|
+
assert_equal Gem::Version.new("1.8.24"), version
|
887
887
|
end
|
888
888
|
|
889
889
|
def test_self_latest_version_for
|
890
890
|
spec_fetcher do |fetcher|
|
891
|
-
fetcher.spec
|
892
|
-
fetcher.spec
|
893
|
-
fetcher.spec
|
891
|
+
fetcher.spec "a", 1
|
892
|
+
fetcher.spec "a", 2
|
893
|
+
fetcher.spec "a", "3.a"
|
894
894
|
end
|
895
895
|
|
896
|
-
version = Gem.latest_version_for
|
896
|
+
version = Gem.latest_version_for "a"
|
897
897
|
|
898
898
|
assert_equal Gem::Version.new(2), version
|
899
899
|
end
|
900
900
|
|
901
901
|
def test_self_latest_version_for_multiple_sources
|
902
|
-
uri =
|
902
|
+
uri = "https://example.sample.com/"
|
903
903
|
source = Gem::Source.new(uri)
|
904
904
|
source_list = Gem::SourceList.new
|
905
905
|
source_list << Gem::Source.new(@uri)
|
@@ -907,27 +907,27 @@ class TestGem < Gem::TestCase
|
|
907
907
|
Gem.sources.replace source_list
|
908
908
|
|
909
909
|
spec_fetcher(uri) do |fetcher|
|
910
|
-
fetcher.spec
|
910
|
+
fetcher.spec "a", 1.1
|
911
911
|
end
|
912
912
|
|
913
913
|
spec_fetcher do |fetcher|
|
914
|
-
fetcher.spec
|
915
|
-
fetcher.spec
|
916
|
-
fetcher.spec
|
914
|
+
fetcher.spec "a", 1
|
915
|
+
fetcher.spec "a", 2
|
916
|
+
fetcher.spec "a", "3.a"
|
917
917
|
end
|
918
918
|
|
919
|
-
version = Gem.latest_version_for
|
919
|
+
version = Gem.latest_version_for "a"
|
920
920
|
|
921
921
|
assert_equal Gem::Version.new(2), version
|
922
922
|
end
|
923
923
|
|
924
924
|
def test_self_loaded_specs
|
925
|
-
foo = util_spec
|
925
|
+
foo = util_spec "foo"
|
926
926
|
install_gem foo
|
927
927
|
|
928
928
|
foo.activate
|
929
929
|
|
930
|
-
assert_equal true, Gem.loaded_specs.keys.include?(
|
930
|
+
assert_equal true, Gem.loaded_specs.keys.include?("foo")
|
931
931
|
end
|
932
932
|
|
933
933
|
def test_self_path
|
@@ -947,7 +947,7 @@ class TestGem < Gem::TestCase
|
|
947
947
|
path_count = Gem.path.size
|
948
948
|
Gem.clear_paths
|
949
949
|
|
950
|
-
ENV[
|
950
|
+
ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
|
951
951
|
|
952
952
|
assert_equal @additional, Gem.path[0,2]
|
953
953
|
|
@@ -959,10 +959,10 @@ class TestGem < Gem::TestCase
|
|
959
959
|
def test_self_path_duplicate
|
960
960
|
Gem.clear_paths
|
961
961
|
util_ensure_gem_dirs
|
962
|
-
dirs = @additional + [@gemhome] + [File.join(@tempdir,
|
962
|
+
dirs = @additional + [@gemhome] + [File.join(@tempdir, "a")]
|
963
963
|
|
964
|
-
ENV[
|
965
|
-
ENV[
|
964
|
+
ENV["GEM_HOME"] = @gemhome
|
965
|
+
ENV["GEM_PATH"] = dirs.join File::PATH_SEPARATOR
|
966
966
|
|
967
967
|
assert_equal @gemhome, Gem.dir
|
968
968
|
|
@@ -974,8 +974,8 @@ class TestGem < Gem::TestCase
|
|
974
974
|
Gem.clear_paths
|
975
975
|
|
976
976
|
util_ensure_gem_dirs
|
977
|
-
ENV[
|
978
|
-
ENV[
|
977
|
+
ENV["GEM_HOME"] = @gemhome
|
978
|
+
ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
|
979
979
|
|
980
980
|
assert_equal @gemhome, Gem.dir
|
981
981
|
|
@@ -992,38 +992,38 @@ class TestGem < Gem::TestCase
|
|
992
992
|
end
|
993
993
|
|
994
994
|
def test_self_prefix_libdir
|
995
|
-
orig_libdir = RbConfig::CONFIG[
|
996
|
-
RbConfig::CONFIG[
|
995
|
+
orig_libdir = RbConfig::CONFIG["libdir"]
|
996
|
+
RbConfig::CONFIG["libdir"] = PROJECT_DIR
|
997
997
|
|
998
998
|
assert_nil Gem.prefix
|
999
999
|
ensure
|
1000
|
-
RbConfig::CONFIG[
|
1000
|
+
RbConfig::CONFIG["libdir"] = orig_libdir
|
1001
1001
|
end
|
1002
1002
|
|
1003
1003
|
def test_self_prefix_sitelibdir
|
1004
|
-
orig_sitelibdir = RbConfig::CONFIG[
|
1005
|
-
RbConfig::CONFIG[
|
1004
|
+
orig_sitelibdir = RbConfig::CONFIG["sitelibdir"]
|
1005
|
+
RbConfig::CONFIG["sitelibdir"] = PROJECT_DIR
|
1006
1006
|
|
1007
1007
|
assert_nil Gem.prefix
|
1008
1008
|
ensure
|
1009
|
-
RbConfig::CONFIG[
|
1009
|
+
RbConfig::CONFIG["sitelibdir"] = orig_sitelibdir
|
1010
1010
|
end
|
1011
1011
|
|
1012
1012
|
def test_self_read_binary
|
1013
|
-
File.open
|
1013
|
+
File.open "test", "w" do |io|
|
1014
1014
|
io.write "\xCF\x80"
|
1015
1015
|
end
|
1016
1016
|
|
1017
|
-
assert_equal ["\xCF", "\x80"], Gem.read_binary(
|
1017
|
+
assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
|
1018
1018
|
|
1019
|
-
pend
|
1019
|
+
pend "chmod not supported" if Gem.win_platform?
|
1020
1020
|
|
1021
1021
|
begin
|
1022
|
-
File.chmod 0444,
|
1022
|
+
File.chmod 0444, "test"
|
1023
1023
|
|
1024
|
-
assert_equal ["\xCF", "\x80"], Gem.read_binary(
|
1024
|
+
assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
|
1025
1025
|
ensure
|
1026
|
-
File.chmod 0644,
|
1026
|
+
File.chmod 0644, "test"
|
1027
1027
|
end
|
1028
1028
|
end
|
1029
1029
|
|
@@ -1084,72 +1084,72 @@ class TestGem < Gem::TestCase
|
|
1084
1084
|
end
|
1085
1085
|
|
1086
1086
|
def test_self_ruby_api_version
|
1087
|
-
orig_ruby_version, RbConfig::CONFIG[
|
1087
|
+
orig_ruby_version, RbConfig::CONFIG["ruby_version"] = RbConfig::CONFIG["ruby_version"], "1.2.3"
|
1088
1088
|
|
1089
1089
|
Gem.instance_variable_set :@ruby_api_version, nil
|
1090
1090
|
|
1091
|
-
assert_equal
|
1091
|
+
assert_equal "1.2.3", Gem.ruby_api_version
|
1092
1092
|
ensure
|
1093
1093
|
Gem.instance_variable_set :@ruby_api_version, nil
|
1094
1094
|
|
1095
|
-
RbConfig::CONFIG[
|
1095
|
+
RbConfig::CONFIG["ruby_version"] = orig_ruby_version
|
1096
1096
|
end
|
1097
1097
|
|
1098
1098
|
def test_self_env_requirement
|
1099
|
-
ENV["GEM_REQUIREMENT_FOO"] =
|
1100
|
-
ENV["GEM_REQUIREMENT_BAR"] =
|
1101
|
-
ENV["GEM_REQUIREMENT_BAZ"] =
|
1099
|
+
ENV["GEM_REQUIREMENT_FOO"] = ">= 1.2.3"
|
1100
|
+
ENV["GEM_REQUIREMENT_BAR"] = "1.2.3"
|
1101
|
+
ENV["GEM_REQUIREMENT_BAZ"] = "abcd"
|
1102
1102
|
|
1103
|
-
assert_equal Gem::Requirement.create(
|
1104
|
-
assert_equal Gem::Requirement.create(
|
1105
|
-
assert_raise(Gem::Requirement::BadRequirementError) { Gem.env_requirement(
|
1106
|
-
assert_equal Gem::Requirement.default, Gem.env_requirement(
|
1103
|
+
assert_equal Gem::Requirement.create(">= 1.2.3"), Gem.env_requirement("foo")
|
1104
|
+
assert_equal Gem::Requirement.create("1.2.3"), Gem.env_requirement("bAr")
|
1105
|
+
assert_raise(Gem::Requirement::BadRequirementError) { Gem.env_requirement("baz") }
|
1106
|
+
assert_equal Gem::Requirement.default, Gem.env_requirement("qux")
|
1107
1107
|
end
|
1108
1108
|
|
1109
1109
|
def test_self_ruby_version_with_non_mri_implementations
|
1110
|
-
util_set_RUBY_VERSION
|
1110
|
+
util_set_RUBY_VERSION "2.5.0", 0, 60928, "jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]"
|
1111
1111
|
|
1112
|
-
assert_equal Gem::Version.new(
|
1112
|
+
assert_equal Gem::Version.new("2.5.0"), Gem.ruby_version
|
1113
1113
|
ensure
|
1114
1114
|
util_restore_RUBY_VERSION
|
1115
1115
|
end
|
1116
1116
|
|
1117
1117
|
def test_self_ruby_version_with_svn_prerelease
|
1118
|
-
util_set_RUBY_VERSION
|
1118
|
+
util_set_RUBY_VERSION "2.6.0", -1, 63539, "ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]"
|
1119
1119
|
|
1120
|
-
assert_equal Gem::Version.new(
|
1120
|
+
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
|
1121
1121
|
ensure
|
1122
1122
|
util_restore_RUBY_VERSION
|
1123
1123
|
end
|
1124
1124
|
|
1125
1125
|
def test_self_ruby_version_with_git_prerelease
|
1126
|
-
util_set_RUBY_VERSION
|
1126
|
+
util_set_RUBY_VERSION "2.7.0", -1, "b563439274a402e33541f5695b1bfd4ac1085638", "ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]"
|
1127
1127
|
|
1128
|
-
assert_equal Gem::Version.new(
|
1128
|
+
assert_equal Gem::Version.new("2.7.0.preview3"), Gem.ruby_version
|
1129
1129
|
ensure
|
1130
1130
|
util_restore_RUBY_VERSION
|
1131
1131
|
end
|
1132
1132
|
|
1133
1133
|
def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
|
1134
|
-
util_set_RUBY_VERSION
|
1134
|
+
util_set_RUBY_VERSION "2.6.0", -1, 63539, "weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]", "weirdjruby", "9.2.0.0"
|
1135
1135
|
|
1136
|
-
assert_equal Gem::Version.new(
|
1136
|
+
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
|
1137
1137
|
ensure
|
1138
1138
|
util_restore_RUBY_VERSION
|
1139
1139
|
end
|
1140
1140
|
|
1141
1141
|
def test_self_ruby_version_with_svn_trunk
|
1142
|
-
util_set_RUBY_VERSION
|
1142
|
+
util_set_RUBY_VERSION "1.9.2", -1, 23493, "ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]"
|
1143
1143
|
|
1144
|
-
assert_equal Gem::Version.new(
|
1144
|
+
assert_equal Gem::Version.new("1.9.2.dev"), Gem.ruby_version
|
1145
1145
|
ensure
|
1146
1146
|
util_restore_RUBY_VERSION
|
1147
1147
|
end
|
1148
1148
|
|
1149
1149
|
def test_self_ruby_version_with_git_master
|
1150
|
-
util_set_RUBY_VERSION
|
1150
|
+
util_set_RUBY_VERSION "2.7.0", -1, "5de284ec78220e75643f89b454ce999da0c1c195", "ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]"
|
1151
1151
|
|
1152
|
-
assert_equal Gem::Version.new(
|
1152
|
+
assert_equal Gem::Version.new("2.7.0.dev"), Gem.ruby_version
|
1153
1153
|
ensure
|
1154
1154
|
util_restore_RUBY_VERSION
|
1155
1155
|
end
|
@@ -1159,7 +1159,7 @@ class TestGem < Gem::TestCase
|
|
1159
1159
|
end
|
1160
1160
|
|
1161
1161
|
def test_self_paths_eq
|
1162
|
-
other = File.join @tempdir,
|
1162
|
+
other = File.join @tempdir, "other"
|
1163
1163
|
path = [@userhome, other].join File::PATH_SEPARATOR
|
1164
1164
|
|
1165
1165
|
#
|
@@ -1172,12 +1172,12 @@ class TestGem < Gem::TestCase
|
|
1172
1172
|
end
|
1173
1173
|
|
1174
1174
|
def test_self_paths_eq_nonexistent_home
|
1175
|
-
ENV[
|
1175
|
+
ENV["GEM_HOME"] = @gemhome
|
1176
1176
|
Gem.clear_paths
|
1177
1177
|
|
1178
|
-
other = File.join @tempdir,
|
1178
|
+
other = File.join @tempdir, "other"
|
1179
1179
|
|
1180
|
-
ENV[
|
1180
|
+
ENV["HOME"] = other
|
1181
1181
|
|
1182
1182
|
Gem.paths = { "GEM_PATH" => other }
|
1183
1183
|
|
@@ -1256,43 +1256,43 @@ class TestGem < Gem::TestCase
|
|
1256
1256
|
end
|
1257
1257
|
|
1258
1258
|
def test_try_activate_returns_true_for_activated_specs
|
1259
|
-
b = util_spec
|
1260
|
-
spec.files <<
|
1259
|
+
b = util_spec "b", "1.0" do |spec|
|
1260
|
+
spec.files << "lib/b.rb"
|
1261
1261
|
end
|
1262
1262
|
install_specs b
|
1263
1263
|
|
1264
|
-
assert Gem.try_activate(
|
1265
|
-
assert Gem.try_activate(
|
1264
|
+
assert Gem.try_activate("b"), "try_activate should return true"
|
1265
|
+
assert Gem.try_activate("b"), "try_activate should still return true"
|
1266
1266
|
end
|
1267
1267
|
|
1268
1268
|
def test_spec_order_is_consistent
|
1269
|
-
b1 = util_spec
|
1270
|
-
b2 = util_spec
|
1271
|
-
b3 = util_spec
|
1269
|
+
b1 = util_spec "b", "1.0"
|
1270
|
+
b2 = util_spec "b", "2.0"
|
1271
|
+
b3 = util_spec "b", "3.0"
|
1272
1272
|
|
1273
1273
|
install_specs b1, b2, b3
|
1274
1274
|
|
1275
|
-
specs1 = Gem::Specification.stubs.find_all {|s| s.name ==
|
1275
|
+
specs1 = Gem::Specification.stubs.find_all {|s| s.name == "b" }
|
1276
1276
|
Gem::Specification.reset
|
1277
|
-
specs2 = Gem::Specification.stubs_for(
|
1277
|
+
specs2 = Gem::Specification.stubs_for("b")
|
1278
1278
|
assert_equal specs1.map(&:version), specs2.map(&:version)
|
1279
1279
|
end
|
1280
1280
|
|
1281
1281
|
def test_self_try_activate_missing_dep
|
1282
|
-
b = util_spec
|
1283
|
-
a = util_spec
|
1282
|
+
b = util_spec "b", "1.0"
|
1283
|
+
a = util_spec "a", "1.0", "b" => ">= 1.0"
|
1284
1284
|
|
1285
1285
|
install_specs b, a
|
1286
1286
|
uninstall_gem b
|
1287
1287
|
|
1288
|
-
a_file = File.join a.gem_dir,
|
1288
|
+
a_file = File.join a.gem_dir, "lib", "a_file.rb"
|
1289
1289
|
|
1290
1290
|
write_file a_file do |io|
|
1291
|
-
io.puts
|
1291
|
+
io.puts "# a_file.rb"
|
1292
1292
|
end
|
1293
1293
|
|
1294
1294
|
e = assert_raise Gem::MissingSpecError do
|
1295
|
-
Gem.try_activate
|
1295
|
+
Gem.try_activate "a_file"
|
1296
1296
|
end
|
1297
1297
|
|
1298
1298
|
assert_match %r{Could not find 'b' }, e.message
|
@@ -1300,30 +1300,30 @@ class TestGem < Gem::TestCase
|
|
1300
1300
|
end
|
1301
1301
|
|
1302
1302
|
def test_self_try_activate_missing_prerelease
|
1303
|
-
b = util_spec
|
1304
|
-
a = util_spec
|
1303
|
+
b = util_spec "b", "1.0rc1"
|
1304
|
+
a = util_spec "a", "1.0rc1", "b" => "1.0rc1"
|
1305
1305
|
|
1306
1306
|
install_specs b, a
|
1307
1307
|
uninstall_gem b
|
1308
1308
|
|
1309
|
-
a_file = File.join a.gem_dir,
|
1309
|
+
a_file = File.join a.gem_dir, "lib", "a_file.rb"
|
1310
1310
|
|
1311
1311
|
write_file a_file do |io|
|
1312
|
-
io.puts
|
1312
|
+
io.puts "# a_file.rb"
|
1313
1313
|
end
|
1314
1314
|
|
1315
1315
|
e = assert_raise Gem::MissingSpecError do
|
1316
|
-
Gem.try_activate
|
1316
|
+
Gem.try_activate "a_file"
|
1317
1317
|
end
|
1318
1318
|
|
1319
1319
|
assert_match %r{Could not find 'b' \(= 1.0rc1\)}, e.message
|
1320
1320
|
end
|
1321
1321
|
|
1322
1322
|
def test_self_try_activate_missing_extensions
|
1323
|
-
spec = util_spec
|
1323
|
+
spec = util_spec "ext", "1" do |s|
|
1324
1324
|
s.extensions = %w[ext/extconf.rb]
|
1325
1325
|
s.mark_version
|
1326
|
-
s.installed_by_version = v(
|
1326
|
+
s.installed_by_version = v("2.2")
|
1327
1327
|
end
|
1328
1328
|
|
1329
1329
|
# write the spec without install to simulate a failed install
|
@@ -1332,7 +1332,7 @@ class TestGem < Gem::TestCase
|
|
1332
1332
|
end
|
1333
1333
|
|
1334
1334
|
_, err = capture_output do
|
1335
|
-
refute Gem.try_activate
|
1335
|
+
refute Gem.try_activate "nonexistent"
|
1336
1336
|
end
|
1337
1337
|
|
1338
1338
|
unless Gem.java_platform?
|
@@ -1344,43 +1344,43 @@ class TestGem < Gem::TestCase
|
|
1344
1344
|
end
|
1345
1345
|
|
1346
1346
|
def test_self_use_paths_with_nils
|
1347
|
-
orig_home = ENV.delete
|
1348
|
-
orig_path = ENV.delete
|
1347
|
+
orig_home = ENV.delete "GEM_HOME"
|
1348
|
+
orig_path = ENV.delete "GEM_PATH"
|
1349
1349
|
Gem.use_paths nil, nil
|
1350
1350
|
assert_equal Gem.default_dir, Gem.paths.home
|
1351
1351
|
path = (Gem.default_path + [Gem.paths.home]).uniq
|
1352
1352
|
assert_equal path, Gem.paths.path
|
1353
1353
|
ensure
|
1354
|
-
ENV[
|
1355
|
-
ENV[
|
1354
|
+
ENV["GEM_HOME"] = orig_home
|
1355
|
+
ENV["GEM_PATH"] = orig_path
|
1356
1356
|
end
|
1357
1357
|
|
1358
1358
|
def test_setting_paths_does_not_warn_about_unknown_keys
|
1359
1359
|
stdout, stderr = capture_output do
|
1360
|
-
Gem.paths = {
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1360
|
+
Gem.paths = { "foo" => [],
|
1361
|
+
"bar" => Object.new,
|
1362
|
+
"GEM_HOME" => Gem.paths.home,
|
1363
|
+
"GEM_PATH" => "foo" }
|
1364
1364
|
end
|
1365
|
-
assert_equal [
|
1366
|
-
assert_equal
|
1367
|
-
assert_equal
|
1365
|
+
assert_equal ["foo", Gem.paths.home], Gem.paths.path
|
1366
|
+
assert_equal "", stderr
|
1367
|
+
assert_equal "", stdout
|
1368
1368
|
end
|
1369
1369
|
|
1370
1370
|
def test_setting_paths_does_not_mutate_parameter_object
|
1371
|
-
Gem.paths = {
|
1372
|
-
|
1373
|
-
assert_equal [
|
1371
|
+
Gem.paths = { "GEM_HOME" => Gem.paths.home,
|
1372
|
+
"GEM_PATH" => "foo" }.freeze
|
1373
|
+
assert_equal ["foo", Gem.paths.home], Gem.paths.path
|
1374
1374
|
end
|
1375
1375
|
|
1376
1376
|
def test_deprecated_paths=
|
1377
1377
|
stdout, stderr = capture_output do
|
1378
|
-
Gem.paths = {
|
1379
|
-
|
1378
|
+
Gem.paths = { "GEM_HOME" => Gem.paths.home,
|
1379
|
+
"GEM_PATH" => [Gem.paths.home, "foo"] }
|
1380
1380
|
end
|
1381
|
-
assert_equal [Gem.paths.home,
|
1381
|
+
assert_equal [Gem.paths.home, "foo"], Gem.paths.path
|
1382
1382
|
assert_match(/Array values in the parameter to `Gem.paths=` are deprecated.\nPlease use a String or nil/m, stderr)
|
1383
|
-
assert_equal
|
1383
|
+
assert_equal "", stdout
|
1384
1384
|
end
|
1385
1385
|
|
1386
1386
|
def test_self_use_paths
|
@@ -1393,8 +1393,8 @@ class TestGem < Gem::TestCase
|
|
1393
1393
|
end
|
1394
1394
|
|
1395
1395
|
def test_self_user_dir
|
1396
|
-
parts = [@userhome,
|
1397
|
-
parts << RbConfig::CONFIG[
|
1396
|
+
parts = [@userhome, ".gem", Gem.ruby_engine]
|
1397
|
+
parts << RbConfig::CONFIG["ruby_version"] unless RbConfig::CONFIG["ruby_version"].empty?
|
1398
1398
|
|
1399
1399
|
FileUtils.mkdir_p File.join(parts)
|
1400
1400
|
|
@@ -1402,10 +1402,10 @@ class TestGem < Gem::TestCase
|
|
1402
1402
|
end
|
1403
1403
|
|
1404
1404
|
def test_self_user_home
|
1405
|
-
if ENV[
|
1406
|
-
assert_equal ENV[
|
1405
|
+
if ENV["HOME"]
|
1406
|
+
assert_equal ENV["HOME"], Gem.user_home
|
1407
1407
|
else
|
1408
|
-
assert true,
|
1408
|
+
assert true, "count this test"
|
1409
1409
|
end
|
1410
1410
|
end
|
1411
1411
|
|
@@ -1430,7 +1430,7 @@ class TestGem < Gem::TestCase
|
|
1430
1430
|
a = util_spec "a", "1"
|
1431
1431
|
b = util_spec "b", "1", "c" => nil
|
1432
1432
|
c = util_spec "c", "2"
|
1433
|
-
d = util_spec "d", "1", {
|
1433
|
+
d = util_spec "d", "1", { "e" => "= 1" }, "lib/d#{$$}.rb"
|
1434
1434
|
e = util_spec "e", "1"
|
1435
1435
|
|
1436
1436
|
install_specs a, c, b, e, d
|
@@ -1451,35 +1451,35 @@ class TestGem < Gem::TestCase
|
|
1451
1451
|
|
1452
1452
|
output = Gem::Util.gunzip input
|
1453
1453
|
|
1454
|
-
assert_equal
|
1454
|
+
assert_equal "hello", output
|
1455
1455
|
assert_equal Encoding::BINARY, output.encoding
|
1456
1456
|
end
|
1457
1457
|
|
1458
1458
|
def test_self_gzip
|
1459
|
-
input =
|
1459
|
+
input = "hello"
|
1460
1460
|
|
1461
1461
|
output = Gem::Util.gzip input
|
1462
1462
|
|
1463
1463
|
zipped = StringIO.new output
|
1464
1464
|
|
1465
|
-
assert_equal
|
1465
|
+
assert_equal "hello", Zlib::GzipReader.new(zipped).read
|
1466
1466
|
assert_equal Encoding::BINARY, output.encoding
|
1467
1467
|
end
|
1468
1468
|
|
1469
1469
|
def test_self_vendor_dir
|
1470
|
-
vendordir(File.join(@tempdir,
|
1470
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
1471
1471
|
expected =
|
1472
|
-
File.join RbConfig::CONFIG[
|
1473
|
-
RbConfig::CONFIG[
|
1472
|
+
File.join RbConfig::CONFIG["vendordir"], "gems",
|
1473
|
+
RbConfig::CONFIG["ruby_version"]
|
1474
1474
|
|
1475
1475
|
assert_equal expected, Gem.vendor_dir
|
1476
1476
|
end
|
1477
1477
|
end
|
1478
1478
|
|
1479
1479
|
def test_self_vendor_dir_ENV_GEM_VENDOR
|
1480
|
-
ENV[
|
1480
|
+
ENV["GEM_VENDOR"] = File.join @tempdir, "vendor", "gems"
|
1481
1481
|
|
1482
|
-
assert_equal ENV[
|
1482
|
+
assert_equal ENV["GEM_VENDOR"], Gem.vendor_dir
|
1483
1483
|
refute Gem.vendor_dir.frozen?
|
1484
1484
|
end
|
1485
1485
|
|
@@ -1493,18 +1493,18 @@ class TestGem < Gem::TestCase
|
|
1493
1493
|
plugin_path = File.join "lib", "rubygems_plugin.rb"
|
1494
1494
|
|
1495
1495
|
Dir.chdir @tempdir do
|
1496
|
-
FileUtils.mkdir_p
|
1496
|
+
FileUtils.mkdir_p "lib"
|
1497
1497
|
File.open plugin_path, "w" do |fp|
|
1498
1498
|
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
|
1499
1499
|
end
|
1500
1500
|
|
1501
|
-
foo1 = util_spec
|
1501
|
+
foo1 = util_spec "foo", "1" do |s|
|
1502
1502
|
s.files << plugin_path
|
1503
1503
|
end
|
1504
1504
|
|
1505
1505
|
install_gem foo1
|
1506
1506
|
|
1507
|
-
foo2 = util_spec
|
1507
|
+
foo2 = util_spec "foo", "2" do |s|
|
1508
1508
|
s.files << plugin_path
|
1509
1509
|
end
|
1510
1510
|
|
@@ -1513,7 +1513,7 @@ class TestGem < Gem::TestCase
|
|
1513
1513
|
|
1514
1514
|
Gem::Specification.reset
|
1515
1515
|
|
1516
|
-
gem
|
1516
|
+
gem "foo"
|
1517
1517
|
|
1518
1518
|
Gem.load_plugins
|
1519
1519
|
|
@@ -1524,12 +1524,12 @@ class TestGem < Gem::TestCase
|
|
1524
1524
|
plugin_path = File.join "lib", "rubygems_plugin.rb"
|
1525
1525
|
|
1526
1526
|
Dir.chdir @tempdir do
|
1527
|
-
FileUtils.mkdir_p
|
1527
|
+
FileUtils.mkdir_p "lib"
|
1528
1528
|
File.open plugin_path, "w" do |fp|
|
1529
1529
|
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
|
1530
1530
|
end
|
1531
1531
|
|
1532
|
-
foo = util_spec
|
1532
|
+
foo = util_spec "foo", "1" do |s|
|
1533
1533
|
s.files << plugin_path
|
1534
1534
|
end
|
1535
1535
|
|
@@ -1538,7 +1538,7 @@ class TestGem < Gem::TestCase
|
|
1538
1538
|
|
1539
1539
|
Gem.paths = { "GEM_PATH" => [Gem.dir, Gem.user_dir].join(File::PATH_SEPARATOR) }
|
1540
1540
|
|
1541
|
-
gem
|
1541
|
+
gem "foo"
|
1542
1542
|
|
1543
1543
|
Gem.load_plugins
|
1544
1544
|
|
@@ -1546,30 +1546,30 @@ class TestGem < Gem::TestCase
|
|
1546
1546
|
end
|
1547
1547
|
|
1548
1548
|
def test_load_env_plugins
|
1549
|
-
with_plugin(
|
1549
|
+
with_plugin("load") { Gem.load_env_plugins }
|
1550
1550
|
assert_equal :loaded, TEST_PLUGIN_LOAD rescue nil
|
1551
1551
|
|
1552
1552
|
util_remove_interrupt_command
|
1553
1553
|
|
1554
1554
|
# Should attempt to cause a StandardError
|
1555
|
-
with_plugin(
|
1555
|
+
with_plugin("standarderror") { Gem.load_env_plugins }
|
1556
1556
|
assert_equal :loaded, TEST_PLUGIN_STANDARDERROR rescue nil
|
1557
1557
|
|
1558
1558
|
util_remove_interrupt_command
|
1559
1559
|
|
1560
1560
|
# Should attempt to cause an Exception
|
1561
|
-
with_plugin(
|
1561
|
+
with_plugin("exception") { Gem.load_env_plugins }
|
1562
1562
|
assert_equal :loaded, TEST_PLUGIN_EXCEPTION rescue nil
|
1563
1563
|
end
|
1564
1564
|
|
1565
1565
|
def test_gem_path_ordering
|
1566
1566
|
refute_equal Gem.dir, Gem.user_dir
|
1567
1567
|
|
1568
|
-
write_file File.join(@tempdir,
|
1569
|
-
write_file File.join(@tempdir,
|
1568
|
+
write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
|
1569
|
+
write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
|
1570
1570
|
|
1571
|
-
g = util_spec
|
1572
|
-
m = util_spec
|
1571
|
+
g = util_spec "g", "1", nil, "lib/g.rb"
|
1572
|
+
m = util_spec "m", "1", nil, "lib/m.rb"
|
1573
1573
|
|
1574
1574
|
install_gem g, :install_dir => Gem.dir
|
1575
1575
|
m0 = install_gem m, :install_dir => Gem.dir
|
@@ -1588,15 +1588,15 @@ class TestGem < Gem::TestCase
|
|
1588
1588
|
Gem::Specification.reset
|
1589
1589
|
Gem.searcher = nil
|
1590
1590
|
|
1591
|
-
assert_equal Gem::Dependency.new(
|
1592
|
-
Gem::Dependency.new(
|
1591
|
+
assert_equal Gem::Dependency.new("m","1").to_specs,
|
1592
|
+
Gem::Dependency.new("m","1").to_specs.sort
|
1593
1593
|
|
1594
1594
|
assert_equal \
|
1595
1595
|
[expected.gem_dir],
|
1596
|
-
Gem::Dependency.new(
|
1596
|
+
Gem::Dependency.new("m","1").to_specs.map(&:gem_dir).sort,
|
1597
1597
|
"Wrong specs for #{_name}"
|
1598
1598
|
|
1599
|
-
spec = Gem::Dependency.new(
|
1599
|
+
spec = Gem::Dependency.new("m","1").to_spec
|
1600
1600
|
|
1601
1601
|
assert_equal \
|
1602
1602
|
File.join(_paths.first, "gems", "m-1"),
|
@@ -1606,7 +1606,7 @@ class TestGem < Gem::TestCase
|
|
1606
1606
|
|
1607
1607
|
gem "m"
|
1608
1608
|
|
1609
|
-
spec = Gem::Dependency.new(
|
1609
|
+
spec = Gem::Dependency.new("m","1").to_spec
|
1610
1610
|
assert spec.activated?, "dependency not activated for #{_name}"
|
1611
1611
|
|
1612
1612
|
assert_equal \
|
@@ -1621,11 +1621,11 @@ class TestGem < Gem::TestCase
|
|
1621
1621
|
end
|
1622
1622
|
|
1623
1623
|
def test_gem_path_ordering_short
|
1624
|
-
write_file File.join(@tempdir,
|
1625
|
-
write_file File.join(@tempdir,
|
1624
|
+
write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
|
1625
|
+
write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
|
1626
1626
|
|
1627
|
-
g = util_spec
|
1628
|
-
m = util_spec
|
1627
|
+
g = util_spec "g", "1", nil, "lib/g.rb"
|
1628
|
+
m = util_spec "m", "1", nil, "lib/m.rb"
|
1629
1629
|
|
1630
1630
|
install_gem g, :install_dir => Gem.dir
|
1631
1631
|
install_gem m, :install_dir => Gem.dir
|
@@ -1635,7 +1635,7 @@ class TestGem < Gem::TestCase
|
|
1635
1635
|
|
1636
1636
|
assert_equal \
|
1637
1637
|
File.join(Gem.dir, "gems", "m-1"),
|
1638
|
-
Gem::Dependency.new(
|
1638
|
+
Gem::Dependency.new("m","1").to_spec.gem_dir,
|
1639
1639
|
"Wrong spec selected"
|
1640
1640
|
end
|
1641
1641
|
|
@@ -1702,7 +1702,7 @@ class TestGem < Gem::TestCase
|
|
1702
1702
|
s.bindir = "exe"
|
1703
1703
|
end
|
1704
1704
|
|
1705
|
-
write_file File.join(@tempdir,
|
1705
|
+
write_file File.join(@tempdir, "exe", "foo") do |fp|
|
1706
1706
|
fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
|
1707
1707
|
end
|
1708
1708
|
|
@@ -1716,7 +1716,7 @@ class TestGem < Gem::TestCase
|
|
1716
1716
|
install_gem b, :install_dir => path
|
1717
1717
|
install_gem c, :install_dir => path
|
1718
1718
|
|
1719
|
-
ENV[
|
1719
|
+
ENV["GEM_PATH"] = path
|
1720
1720
|
|
1721
1721
|
with_rubygems_gemdeps("-") do
|
1722
1722
|
new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
|
@@ -1751,7 +1751,7 @@ class TestGem < Gem::TestCase
|
|
1751
1751
|
s.bindir = "exe"
|
1752
1752
|
end
|
1753
1753
|
|
1754
|
-
write_file File.join(@tempdir,
|
1754
|
+
write_file File.join(@tempdir, "exe", "foo") do |fp|
|
1755
1755
|
fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
|
1756
1756
|
end
|
1757
1757
|
|
@@ -1765,7 +1765,7 @@ class TestGem < Gem::TestCase
|
|
1765
1765
|
install_gem b, :install_dir => path
|
1766
1766
|
install_gem c, :install_dir => path
|
1767
1767
|
|
1768
|
-
ENV[
|
1768
|
+
ENV["GEM_PATH"] = path
|
1769
1769
|
|
1770
1770
|
with_rubygems_gemdeps("-") do
|
1771
1771
|
Dir.mkdir "sub1"
|
@@ -1837,14 +1837,14 @@ class TestGem < Gem::TestCase
|
|
1837
1837
|
end
|
1838
1838
|
|
1839
1839
|
def test_use_gemdeps
|
1840
|
-
gem_deps_file =
|
1841
|
-
spec = util_spec
|
1840
|
+
gem_deps_file = "gem.deps.rb".tap(&Gem::UNTAINT)
|
1841
|
+
spec = util_spec "a", 1
|
1842
1842
|
install_specs spec
|
1843
1843
|
|
1844
1844
|
spec = Gem::Specification.find {|s| s == spec }
|
1845
1845
|
refute spec.activated?
|
1846
1846
|
|
1847
|
-
File.open gem_deps_file,
|
1847
|
+
File.open gem_deps_file, "w" do |io|
|
1848
1848
|
io.write 'gem "a"'
|
1849
1849
|
end
|
1850
1850
|
|
@@ -1858,11 +1858,11 @@ class TestGem < Gem::TestCase
|
|
1858
1858
|
|
1859
1859
|
def test_use_gemdeps_ENV
|
1860
1860
|
with_rubygems_gemdeps(nil) do
|
1861
|
-
spec = util_spec
|
1861
|
+
spec = util_spec "a", 1
|
1862
1862
|
|
1863
1863
|
refute spec.activated?
|
1864
1864
|
|
1865
|
-
File.open
|
1865
|
+
File.open "gem.deps.rb", "w" do |io|
|
1866
1866
|
io.write 'gem "a"'
|
1867
1867
|
end
|
1868
1868
|
|
@@ -1874,33 +1874,33 @@ class TestGem < Gem::TestCase
|
|
1874
1874
|
|
1875
1875
|
def test_use_gemdeps_argument_missing
|
1876
1876
|
e = assert_raise ArgumentError do
|
1877
|
-
Gem.use_gemdeps
|
1877
|
+
Gem.use_gemdeps "gem.deps.rb"
|
1878
1878
|
end
|
1879
1879
|
|
1880
|
-
assert_equal
|
1880
|
+
assert_equal "Unable to find gem dependencies file at gem.deps.rb",
|
1881
1881
|
e.message
|
1882
1882
|
end
|
1883
1883
|
|
1884
1884
|
def test_use_gemdeps_argument_missing_match_ENV
|
1885
|
-
with_rubygems_gemdeps(
|
1885
|
+
with_rubygems_gemdeps("gem.deps.rb") do
|
1886
1886
|
e = assert_raise ArgumentError do
|
1887
|
-
Gem.use_gemdeps
|
1887
|
+
Gem.use_gemdeps "gem.deps.rb"
|
1888
1888
|
end
|
1889
1889
|
|
1890
|
-
assert_equal
|
1890
|
+
assert_equal "Unable to find gem dependencies file at gem.deps.rb",
|
1891
1891
|
e.message
|
1892
1892
|
end
|
1893
1893
|
end
|
1894
1894
|
|
1895
1895
|
def test_use_gemdeps_automatic
|
1896
|
-
with_rubygems_gemdeps(
|
1897
|
-
spec = util_spec
|
1896
|
+
with_rubygems_gemdeps("-") do
|
1897
|
+
spec = util_spec "a", 1
|
1898
1898
|
install_specs spec
|
1899
1899
|
spec = Gem::Specification.find {|s| s == spec }
|
1900
1900
|
|
1901
1901
|
refute spec.activated?
|
1902
1902
|
|
1903
|
-
File.open
|
1903
|
+
File.open "Gemfile", "w" do |io|
|
1904
1904
|
io.write 'gem "a"'
|
1905
1905
|
end
|
1906
1906
|
|
@@ -1911,7 +1911,7 @@ class TestGem < Gem::TestCase
|
|
1911
1911
|
end
|
1912
1912
|
|
1913
1913
|
def test_use_gemdeps_automatic_missing
|
1914
|
-
with_rubygems_gemdeps(
|
1914
|
+
with_rubygems_gemdeps("-") do
|
1915
1915
|
Gem.use_gemdeps
|
1916
1916
|
|
1917
1917
|
assert true # count
|
@@ -1919,12 +1919,12 @@ class TestGem < Gem::TestCase
|
|
1919
1919
|
end
|
1920
1920
|
|
1921
1921
|
def test_use_gemdeps_disabled
|
1922
|
-
with_rubygems_gemdeps(
|
1923
|
-
spec = util_spec
|
1922
|
+
with_rubygems_gemdeps("") do
|
1923
|
+
spec = util_spec "a", 1
|
1924
1924
|
|
1925
1925
|
refute spec.activated?
|
1926
1926
|
|
1927
|
-
File.open
|
1927
|
+
File.open "gem.deps.rb", "w" do |io|
|
1928
1928
|
io.write 'gem "a"'
|
1929
1929
|
end
|
1930
1930
|
|
@@ -1935,8 +1935,8 @@ class TestGem < Gem::TestCase
|
|
1935
1935
|
end
|
1936
1936
|
|
1937
1937
|
def test_use_gemdeps_missing_gem
|
1938
|
-
with_rubygems_gemdeps(
|
1939
|
-
File.open
|
1938
|
+
with_rubygems_gemdeps("x") do
|
1939
|
+
File.open "x", "w" do |io|
|
1940
1940
|
io.write 'gem "a"'
|
1941
1941
|
end
|
1942
1942
|
|
@@ -1957,14 +1957,14 @@ You may need to `bundle install` to install missing gems
|
|
1957
1957
|
end
|
1958
1958
|
|
1959
1959
|
def test_use_gemdeps_specific
|
1960
|
-
with_rubygems_gemdeps(
|
1961
|
-
spec = util_spec
|
1960
|
+
with_rubygems_gemdeps("x") do
|
1961
|
+
spec = util_spec "a", 1
|
1962
1962
|
install_specs spec
|
1963
1963
|
|
1964
1964
|
spec = Gem::Specification.find {|s| s == spec }
|
1965
1965
|
refute spec.activated?
|
1966
1966
|
|
1967
|
-
File.open
|
1967
|
+
File.open "x", "w" do |io|
|
1968
1968
|
io.write 'gem "a"'
|
1969
1969
|
end
|
1970
1970
|
|
@@ -1991,8 +1991,8 @@ You may need to `bundle install` to install missing gems
|
|
1991
1991
|
# Ensure that `Gem.source_date_epoch` is consistent even if
|
1992
1992
|
# $SOURCE_DATE_EPOCH has not been set.
|
1993
1993
|
def test_default_source_date_epoch_doesnt_change
|
1994
|
-
old_epoch = ENV[
|
1995
|
-
ENV[
|
1994
|
+
old_epoch = ENV["SOURCE_DATE_EPOCH"]
|
1995
|
+
ENV["SOURCE_DATE_EPOCH"] = nil
|
1996
1996
|
|
1997
1997
|
# Unfortunately, there is no real way to test this aside from waiting
|
1998
1998
|
# enough for `Time.now.to_i` to change -- which is a whole second.
|
@@ -2003,23 +2003,23 @@ You may need to `bundle install` to install missing gems
|
|
2003
2003
|
b = Gem.source_date_epoch
|
2004
2004
|
assert_equal a, b
|
2005
2005
|
ensure
|
2006
|
-
ENV[
|
2006
|
+
ENV["SOURCE_DATE_EPOCH"] = old_epoch
|
2007
2007
|
end
|
2008
2008
|
|
2009
2009
|
private
|
2010
2010
|
|
2011
2011
|
def ruby_install_name(name)
|
2012
2012
|
with_clean_path_to_ruby do
|
2013
|
-
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG[
|
2014
|
-
RbConfig::CONFIG[
|
2013
|
+
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG["ruby_install_name"]
|
2014
|
+
RbConfig::CONFIG["ruby_install_name"] = name
|
2015
2015
|
|
2016
2016
|
begin
|
2017
2017
|
yield
|
2018
2018
|
ensure
|
2019
2019
|
if orig_RUBY_INSTALL_NAME
|
2020
|
-
RbConfig::CONFIG[
|
2020
|
+
RbConfig::CONFIG["ruby_install_name"] = orig_RUBY_INSTALL_NAME
|
2021
2021
|
else
|
2022
|
-
RbConfig::CONFIG.delete
|
2022
|
+
RbConfig::CONFIG.delete "ruby_install_name"
|
2023
2023
|
end
|
2024
2024
|
end
|
2025
2025
|
end
|
@@ -2074,12 +2074,12 @@ You may need to `bundle install` to install missing gems
|
|
2074
2074
|
end
|
2075
2075
|
|
2076
2076
|
def util_exec_gem
|
2077
|
-
spec, _ = util_spec
|
2078
|
-
s.executables = [
|
2077
|
+
spec, _ = util_spec "a", "4" do |s|
|
2078
|
+
s.executables = ["exec", "abin"]
|
2079
2079
|
end
|
2080
2080
|
|
2081
|
-
@exec_path = File.join spec.full_gem_path, spec.bindir,
|
2082
|
-
@abin_path = File.join spec.full_gem_path, spec.bindir,
|
2081
|
+
@exec_path = File.join spec.full_gem_path, spec.bindir, "exec"
|
2082
|
+
@abin_path = File.join spec.full_gem_path, spec.bindir, "abin"
|
2083
2083
|
spec
|
2084
2084
|
end
|
2085
2085
|
|
@@ -2093,20 +2093,20 @@ You may need to `bundle install` to install missing gems
|
|
2093
2093
|
end
|
2094
2094
|
|
2095
2095
|
def with_path_and_rubyopt(path_value, rubyopt_value)
|
2096
|
-
path, ENV[
|
2097
|
-
rubyopt, ENV[
|
2096
|
+
path, ENV["PATH"] = ENV["PATH"], path_value
|
2097
|
+
rubyopt, ENV["RUBYOPT"] = ENV["RUBYOPT"], rubyopt_value
|
2098
2098
|
|
2099
2099
|
yield
|
2100
2100
|
ensure
|
2101
|
-
ENV[
|
2102
|
-
ENV[
|
2101
|
+
ENV["PATH"] = path
|
2102
|
+
ENV["RUBYOPT"] = rubyopt
|
2103
2103
|
end
|
2104
2104
|
|
2105
2105
|
def with_rubygems_gemdeps(value)
|
2106
|
-
rubygems_gemdeps, ENV[
|
2106
|
+
rubygems_gemdeps, ENV["RUBYGEMS_GEMDEPS"] = ENV["RUBYGEMS_GEMDEPS"], value
|
2107
2107
|
|
2108
2108
|
yield
|
2109
2109
|
ensure
|
2110
|
-
ENV[
|
2110
|
+
ENV["RUBYGEMS_GEMDEPS"] = rubygems_gemdeps
|
2111
2111
|
end
|
2112
2112
|
end
|