rubygems-update 3.3.18 → 3.4.19
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 +1429 -1064
- data/CONTRIBUTING.md +31 -8
- data/Manifest.txt +61 -36
- data/POLICIES.md +55 -20
- data/README.md +19 -6
- data/bundler/CHANGELOG.md +457 -1
- data/bundler/README.md +3 -6
- data/bundler/UPGRADING.md +11 -4
- data/bundler/bundler.gemspec +8 -10
- data/bundler/exe/bundle +5 -16
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/add.rb +1 -1
- data/bundler/lib/bundler/cli/binstubs.rb +6 -2
- data/bundler/lib/bundler/cli/check.rb +1 -1
- data/bundler/lib/bundler/cli/common.rb +2 -0
- data/bundler/lib/bundler/cli/console.rb +2 -2
- data/bundler/lib/bundler/cli/doctor.rb +4 -6
- data/bundler/lib/bundler/cli/gem.rb +62 -40
- data/bundler/lib/bundler/cli/info.rb +1 -1
- data/bundler/lib/bundler/cli/init.rb +6 -2
- data/bundler/lib/bundler/cli/install.rb +8 -6
- data/bundler/lib/bundler/cli/lock.rb +8 -5
- data/bundler/lib/bundler/cli/open.rb +6 -4
- data/bundler/lib/bundler/cli/outdated.rb +14 -7
- data/bundler/lib/bundler/cli/platform.rb +7 -5
- data/bundler/lib/bundler/cli/viz.rb +1 -1
- data/bundler/lib/bundler/cli.rb +53 -7
- data/bundler/lib/bundler/compact_index_client/cache.rb +1 -1
- data/bundler/lib/bundler/compact_index_client/updater.rb +40 -39
- data/bundler/lib/bundler/constants.rb +1 -1
- data/bundler/lib/bundler/current_ruby.rb +16 -5
- data/bundler/lib/bundler/definition.rb +262 -133
- data/bundler/lib/bundler/dependency.rb +20 -86
- data/bundler/lib/bundler/digest.rb +1 -1
- data/bundler/lib/bundler/dsl.rb +6 -7
- data/bundler/lib/bundler/endpoint_specification.rb +2 -13
- data/bundler/lib/bundler/env.rb +2 -2
- data/bundler/lib/bundler/environment_preserver.rb +3 -2
- data/bundler/lib/bundler/errors.rb +1 -11
- data/bundler/lib/bundler/feature_flag.rb +0 -2
- data/bundler/lib/bundler/fetcher/compact_index.rb +11 -13
- data/bundler/lib/bundler/fetcher/dependency.rb +2 -6
- data/bundler/lib/bundler/fetcher/downloader.rb +4 -5
- data/bundler/lib/bundler/fetcher/index.rb +1 -2
- data/bundler/lib/bundler/fetcher.rb +21 -15
- data/bundler/lib/bundler/force_platform.rb +18 -0
- data/bundler/lib/bundler/friendly_errors.rb +1 -4
- data/bundler/lib/bundler/gem_helper.rb +3 -4
- data/bundler/lib/bundler/gem_helpers.rb +7 -2
- data/bundler/lib/bundler/gem_version_promoter.rb +53 -98
- data/bundler/lib/bundler/graph.rb +3 -3
- data/bundler/lib/bundler/index.rb +13 -47
- data/bundler/lib/bundler/injector.rb +5 -4
- data/bundler/lib/bundler/inline.rb +9 -11
- data/bundler/lib/bundler/installer/parallel_installer.rb +4 -34
- data/bundler/lib/bundler/installer/standalone.rb +13 -9
- data/bundler/lib/bundler/installer.rb +17 -29
- data/bundler/lib/bundler/lazy_specification.rb +54 -53
- data/bundler/lib/bundler/lockfile_generator.rb +3 -3
- data/bundler/lib/bundler/lockfile_parser.rb +17 -16
- 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 +9 -3
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +9 -2
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +2 -2
- data/bundler/lib/bundler/man/bundle-clean.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +26 -10
- data/bundler/lib/bundler/man/bundle-config.1.ronn +17 -10
- 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 +6 -6
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +6 -6
- data/bundler/lib/bundler/man/bundle-gem.1 +27 -37
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +5 -5
- 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 +3 -3
- data/bundler/lib/bundler/man/bundle-info.1.ronn +3 -3
- data/bundler/lib/bundler/man/bundle-init.1 +5 -1
- data/bundler/lib/bundler/man/bundle-init.1.ronn +2 -0
- 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 -30
- data/bundler/lib/bundler/man/bundle-install.1.ronn +6 -29
- 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 +22 -2
- data/bundler/lib/bundler/man/bundle-open.1.ronn +9 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +13 -9
- data/bundler/lib/bundler/man/bundle-outdated.1.ronn +12 -9
- 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 +55 -55
- data/bundler/lib/bundler/man/gemfile.5.ronn +57 -53
- 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/mirror.rb +5 -7
- data/bundler/lib/bundler/plugin/index.rb +5 -5
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +0 -4
- data/bundler/lib/bundler/plugin/installer.rb +5 -2
- data/bundler/lib/bundler/plugin.rb +3 -1
- data/bundler/lib/bundler/remote_specification.rb +7 -12
- data/bundler/lib/bundler/resolver/base.rb +107 -0
- data/bundler/lib/bundler/resolver/candidate.rb +94 -0
- data/bundler/lib/bundler/resolver/incompatibility.rb +15 -0
- data/bundler/lib/bundler/resolver/package.rb +72 -0
- data/bundler/lib/bundler/resolver/root.rb +25 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +42 -71
- data/bundler/lib/bundler/resolver.rb +335 -328
- data/bundler/lib/bundler/ruby_dsl.rb +7 -1
- data/bundler/lib/bundler/ruby_version.rb +8 -8
- data/bundler/lib/bundler/rubygems_ext.rb +100 -9
- data/bundler/lib/bundler/rubygems_gem_installer.rb +23 -14
- data/bundler/lib/bundler/rubygems_integration.rb +11 -15
- data/bundler/lib/bundler/runtime.rb +2 -6
- data/bundler/lib/bundler/safe_marshal.rb +31 -0
- data/bundler/lib/bundler/settings.rb +5 -11
- data/bundler/lib/bundler/setup.rb +4 -1
- data/bundler/lib/bundler/shared_helpers.rb +3 -3
- data/bundler/lib/bundler/source/git/git_proxy.rb +237 -74
- data/bundler/lib/bundler/source/git.rb +55 -30
- data/bundler/lib/bundler/source/metadata.rb +1 -2
- data/bundler/lib/bundler/source/path/installer.rb +1 -22
- data/bundler/lib/bundler/source/path.rb +6 -6
- data/bundler/lib/bundler/source/rubygems.rb +26 -81
- data/bundler/lib/bundler/source.rb +1 -1
- data/bundler/lib/bundler/source_list.rb +8 -2
- data/bundler/lib/bundler/spec_set.rb +60 -37
- data/bundler/lib/bundler/templates/Executable +1 -1
- data/bundler/lib/bundler/templates/Executable.bundler +5 -10
- data/bundler/lib/bundler/templates/Executable.standalone +2 -0
- data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/README.md.tt +6 -4
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +12 -1
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +0 -4
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +10 -0
- data/bundler/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +13 -4
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +9 -2
- data/bundler/lib/bundler/ui/rg_proxy.rb +1 -1
- data/bundler/lib/bundler/ui/shell.rb +35 -12
- data/bundler/lib/bundler/ui/silent.rb +21 -5
- data/bundler/lib/bundler/uri_normalizer.rb +23 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +3 -3
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +0 -1
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +3 -1
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1351 -409
- data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
- data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +64 -16
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +27 -7
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +40 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +2 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +15 -9
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +11 -6
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +1 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +2 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +3 -2
- data/bundler/lib/bundler/vendored_persistent.rb +1 -33
- data/bundler/lib/bundler/{vendored_tmpdir.rb → vendored_pub_grub.rb} +1 -1
- data/bundler/lib/bundler/version.rb +5 -1
- data/bundler/lib/bundler/worker.rb +5 -7
- data/bundler/lib/bundler.rb +25 -77
- data/{bin → exe}/gem +4 -5
- data/{bin → exe}/update_rubygems +12 -10
- data/lib/rubygems/available_set.rb +4 -3
- data/lib/rubygems/basic_specification.rb +5 -4
- data/lib/rubygems/bundler_version_finder.rb +2 -2
- data/lib/rubygems/command.rb +41 -32
- data/lib/rubygems/command_manager.rb +30 -15
- data/lib/rubygems/commands/build_command.rb +12 -8
- data/lib/rubygems/commands/cert_command.rb +34 -33
- data/lib/rubygems/commands/check_command.rb +21 -20
- data/lib/rubygems/commands/cleanup_command.rb +18 -17
- data/lib/rubygems/commands/contents_command.rb +14 -13
- data/lib/rubygems/commands/dependency_command.rb +17 -16
- data/lib/rubygems/commands/environment_command.rb +6 -5
- data/lib/rubygems/commands/exec_command.rb +249 -0
- data/lib/rubygems/commands/fetch_command.rb +10 -9
- data/lib/rubygems/commands/generate_index_command.rb +18 -17
- data/lib/rubygems/commands/help_command.rb +7 -6
- data/lib/rubygems/commands/info_command.rb +3 -3
- data/lib/rubygems/commands/install_command.rb +28 -23
- data/lib/rubygems/commands/list_command.rb +4 -3
- data/lib/rubygems/commands/lock_command.rb +5 -4
- data/lib/rubygems/commands/mirror_command.rb +4 -3
- data/lib/rubygems/commands/open_command.rb +10 -9
- data/lib/rubygems/commands/outdated_command.rb +6 -5
- data/lib/rubygems/commands/owner_command.rb +17 -14
- data/lib/rubygems/commands/pristine_command.rb +46 -36
- data/lib/rubygems/commands/push_command.rb +9 -8
- data/lib/rubygems/commands/query_command.rb +9 -8
- data/lib/rubygems/commands/rdoc_command.rb +21 -19
- data/lib/rubygems/commands/search_command.rb +4 -3
- data/lib/rubygems/commands/server_command.rb +4 -3
- data/lib/rubygems/commands/setup_command.rb +97 -106
- data/lib/rubygems/commands/signin_command.rb +10 -9
- data/lib/rubygems/commands/signout_command.rb +8 -7
- data/lib/rubygems/commands/sources_command.rb +22 -21
- data/lib/rubygems/commands/specification_command.rb +14 -13
- data/lib/rubygems/commands/stale_command.rb +3 -2
- data/lib/rubygems/commands/uninstall_command.rb +44 -40
- data/lib/rubygems/commands/unpack_command.rb +14 -13
- data/lib/rubygems/commands/update_command.rb +42 -63
- data/lib/rubygems/commands/which_command.rb +8 -7
- data/lib/rubygems/commands/yank_command.rb +12 -11
- data/lib/rubygems/config_file.rb +55 -21
- data/lib/rubygems/core_ext/kernel_gem.rb +1 -6
- data/lib/rubygems/core_ext/kernel_require.rb +109 -115
- data/lib/rubygems/core_ext/kernel_warn.rb +33 -37
- data/lib/rubygems/core_ext/tcpsocket_init.rb +3 -1
- data/lib/rubygems/defaults.rb +33 -18
- data/lib/rubygems/dependency.rb +15 -11
- data/lib/rubygems/dependency_installer.rb +38 -37
- data/lib/rubygems/dependency_list.rb +7 -6
- data/lib/rubygems/deprecate.rb +3 -2
- data/lib/rubygems/doctor.rb +19 -18
- data/lib/rubygems/errors.rb +3 -2
- data/lib/rubygems/exceptions.rb +16 -8
- data/lib/rubygems/ext/build_error.rb +2 -1
- data/lib/rubygems/ext/builder.rb +37 -21
- data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +9 -5
- data/lib/rubygems/ext/cargo_builder.rb +150 -111
- data/lib/rubygems/ext/cmake_builder.rb +2 -2
- data/lib/rubygems/ext/configure_builder.rb +2 -1
- data/lib/rubygems/ext/ext_conf_builder.rb +11 -9
- data/lib/rubygems/ext/rake_builder.rb +7 -5
- data/lib/rubygems/ext.rb +8 -7
- data/lib/rubygems/gem_runner.rb +6 -5
- data/lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb +163 -0
- data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +105 -0
- data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +78 -0
- data/lib/rubygems/gemcutter_utilities.rb +90 -34
- data/lib/rubygems/indexer.rb +29 -28
- data/lib/rubygems/install_default_message.rb +3 -2
- data/lib/rubygems/install_message.rb +3 -2
- data/lib/rubygems/install_update_options.rb +56 -55
- data/lib/rubygems/installer.rb +54 -46
- data/lib/rubygems/installer_uninstaller_utils.rb +2 -2
- data/lib/rubygems/local_remote_options.rb +19 -20
- data/lib/rubygems/mock_gem_ui.rb +3 -2
- data/lib/rubygems/name_tuple.rb +5 -4
- data/lib/rubygems/optparse/lib/optparse.rb +20 -15
- data/lib/rubygems/optparse.rb +1 -1
- data/lib/rubygems/package/digest_io.rb +1 -0
- data/lib/rubygems/package/file_source.rb +3 -2
- data/lib/rubygems/package/io_source.rb +1 -0
- data/lib/rubygems/package/old.rb +9 -8
- data/lib/rubygems/package/source.rb +1 -0
- data/lib/rubygems/package/tar_header.rb +63 -62
- data/lib/rubygems/package/tar_reader/entry.rb +91 -9
- data/lib/rubygems/package/tar_reader.rb +2 -29
- data/lib/rubygems/package/tar_writer.rb +8 -7
- data/lib/rubygems/package.rb +64 -48
- data/lib/rubygems/package_task.rb +5 -4
- data/lib/rubygems/path_support.rb +1 -0
- data/lib/rubygems/platform.rb +79 -53
- data/lib/rubygems/psych_tree.rb +2 -1
- data/lib/rubygems/query_utils.rb +35 -35
- data/lib/rubygems/rdoc.rb +3 -2
- data/lib/rubygems/remote_fetcher.rb +23 -22
- data/lib/rubygems/request/connection_pools.rb +4 -4
- data/lib/rubygems/request/http_pool.rb +2 -1
- data/lib/rubygems/request/https_pool.rb +1 -0
- data/lib/rubygems/request.rb +23 -22
- data/lib/rubygems/request_set/gem_dependency_api.rb +123 -123
- data/lib/rubygems/request_set/lockfile/parser.rb +28 -27
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +5 -3
- data/lib/rubygems/request_set/lockfile.rb +6 -5
- data/lib/rubygems/request_set.rb +20 -19
- data/lib/rubygems/requirement.rb +15 -14
- data/lib/rubygems/resolver/activation_request.rb +4 -3
- data/lib/rubygems/resolver/api_set.rb +5 -4
- data/lib/rubygems/resolver/api_specification.rb +7 -6
- data/lib/rubygems/resolver/best_set.rb +6 -5
- data/lib/rubygems/resolver/composed_set.rb +1 -0
- data/lib/rubygems/resolver/conflict.rb +11 -10
- data/lib/rubygems/resolver/current_set.rb +1 -0
- data/lib/rubygems/resolver/dependency_request.rb +3 -2
- data/lib/rubygems/resolver/git_set.rb +3 -2
- data/lib/rubygems/resolver/git_specification.rb +7 -6
- data/lib/rubygems/resolver/index_set.rb +4 -3
- data/lib/rubygems/resolver/index_specification.rb +7 -5
- data/lib/rubygems/resolver/installed_specification.rb +5 -4
- data/lib/rubygems/resolver/installer_set.rb +15 -17
- data/lib/rubygems/resolver/local_specification.rb +3 -2
- data/lib/rubygems/resolver/lock_set.rb +5 -4
- data/lib/rubygems/resolver/lock_specification.rb +5 -4
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +32 -26
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/rubygems/resolver/molinillo.rb +2 -1
- data/lib/rubygems/resolver/requirement_list.rb +1 -0
- data/lib/rubygems/resolver/set.rb +1 -0
- data/lib/rubygems/resolver/source_set.rb +2 -0
- data/lib/rubygems/resolver/spec_specification.rb +1 -0
- data/lib/rubygems/resolver/specification.rb +2 -1
- data/lib/rubygems/resolver/stats.rb +2 -1
- data/lib/rubygems/resolver/vendor_set.rb +2 -1
- data/lib/rubygems/resolver/vendor_specification.rb +4 -3
- data/lib/rubygems/resolver.rb +41 -40
- data/lib/rubygems/s3_uri_signer.rb +10 -8
- data/lib/rubygems/safe_yaml.rb +4 -2
- data/lib/rubygems/security/policies.rb +48 -47
- data/lib/rubygems/security/policy.rb +19 -18
- data/lib/rubygems/security/signer.rb +6 -5
- data/lib/rubygems/security/trust_dir.rb +5 -4
- data/lib/rubygems/security.rb +30 -42
- data/lib/rubygems/security_option.rb +6 -5
- data/lib/rubygems/shellwords.rb +3 -0
- data/lib/rubygems/source/git.rb +22 -22
- data/lib/rubygems/source/installed.rb +2 -1
- data/lib/rubygems/source/local.rb +3 -2
- data/lib/rubygems/source/lock.rb +1 -0
- data/lib/rubygems/source/specific_file.rb +2 -1
- data/lib/rubygems/source/vendor.rb +1 -0
- data/lib/rubygems/source.rb +16 -16
- data/lib/rubygems/spec_fetcher.rb +10 -9
- data/lib/rubygems/specification.rb +121 -114
- data/lib/rubygems/specification_policy.rb +36 -15
- data/lib/rubygems/stub_specification.rb +11 -9
- data/lib/rubygems/text.rb +2 -2
- data/lib/rubygems/tsort/lib/tsort.rb +308 -310
- data/lib/rubygems/tsort.rb +1 -1
- data/lib/rubygems/uninstaller.rb +19 -18
- data/lib/rubygems/update_suggestion.rb +69 -0
- data/lib/rubygems/uri.rb +4 -4
- data/lib/rubygems/uri_formatter.rb +1 -1
- data/lib/rubygems/user_interaction.rb +37 -21
- data/lib/rubygems/util/licenses.rb +4 -3
- data/lib/rubygems/util/list.rb +1 -0
- data/lib/rubygems/util.rb +12 -15
- data/lib/rubygems/validator.rb +7 -6
- data/lib/rubygems/version.rb +17 -11
- data/lib/rubygems/version_option.rb +4 -3
- data/lib/rubygems.rb +89 -68
- data/rubygems-update.gemspec +10 -8
- data/setup.rb +10 -9
- data/test/rubygems/alternate_cert.pem +14 -14
- data/test/rubygems/alternate_cert_32.pem +15 -15
- data/test/rubygems/alternate_key.pem +25 -25
- data/test/rubygems/bad_rake.rb +1 -0
- data/test/rubygems/bundler_test_gem.rb +421 -0
- data/test/rubygems/child_cert.pem +15 -16
- data/test/rubygems/child_cert_32.pem +15 -16
- data/test/rubygems/child_key.pem +25 -25
- data/test/rubygems/encrypted_private_key.pem +26 -26
- data/test/rubygems/expired_cert.pem +15 -15
- data/test/rubygems/fake_certlib/openssl.rb +1 -0
- data/test/rubygems/future_cert.pem +15 -15
- data/test/rubygems/future_cert_32.pem +15 -15
- data/test/rubygems/good_rake.rb +1 -0
- data/test/rubygems/grandchild_cert.pem +15 -16
- data/test/rubygems/grandchild_cert_32.pem +15 -16
- data/test/rubygems/grandchild_key.pem +25 -25
- data/test/rubygems/helper.rb +172 -151
- data/test/rubygems/installer_test_case.rb +14 -13
- data/test/rubygems/invalid_issuer_cert.pem +16 -16
- data/test/rubygems/invalid_issuer_cert_32.pem +16 -16
- data/test/rubygems/invalid_key.pem +25 -25
- data/test/rubygems/invalid_signer_cert.pem +15 -15
- data/test/rubygems/invalid_signer_cert_32.pem +15 -15
- data/test/rubygems/invalidchild_cert.pem +15 -16
- data/test/rubygems/invalidchild_cert_32.pem +15 -16
- data/test/rubygems/invalidchild_key.pem +25 -25
- data/test/rubygems/multifactor_auth_utilities.rb +111 -0
- data/test/rubygems/package/tar_test_case.rb +53 -17
- data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +2 -1
- data/test/rubygems/plugin/load/rubygems_plugin.rb +1 -0
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +2 -1
- data/test/rubygems/private_key.pem +25 -25
- data/test/rubygems/public_cert.pem +16 -16
- data/test/rubygems/public_cert_32.pem +15 -15
- data/test/rubygems/public_key.pem +7 -7
- data/test/rubygems/rubygems/commands/crash_command.rb +1 -0
- data/test/rubygems/rubygems_plugin.rb +3 -2
- data/test/rubygems/simple_gem.rb +2 -1
- data/test/rubygems/specifications/bar-0.0.2.gemspec +2 -0
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +6 -4
- data/test/rubygems/test_bundled_ca.rb +13 -12
- data/test/rubygems/test_config.rb +5 -4
- data/test/rubygems/test_deprecate.rb +5 -4
- data/test/rubygems/test_exit.rb +9 -3
- data/test/rubygems/test_gem.rb +339 -677
- data/test/rubygems/test_gem_available_set.rb +22 -21
- data/test/rubygems/test_gem_bundler_version_finder.rb +6 -4
- data/test/rubygems/test_gem_command.rb +45 -44
- data/test/rubygems/test_gem_command_manager.rb +96 -30
- data/test/rubygems/test_gem_commands_build_command.rb +74 -63
- data/test/rubygems/test_gem_commands_cert_command.rb +98 -99
- data/test/rubygems/test_gem_commands_check_command.rb +5 -4
- data/test/rubygems/test_gem_commands_cleanup_command.rb +41 -40
- data/test/rubygems/test_gem_commands_contents_command.rb +28 -27
- data/test/rubygems/test_gem_commands_dependency_command.rb +37 -36
- data/test/rubygems/test_gem_commands_environment_command.rb +17 -16
- data/test/rubygems/test_gem_commands_exec_command.rb +853 -0
- data/test/rubygems/test_gem_commands_fetch_command.rb +38 -37
- data/test/rubygems/test_gem_commands_generate_index_command.rb +8 -7
- data/test/rubygems/test_gem_commands_help_command.rb +14 -13
- data/test/rubygems/test_gem_commands_info_command.rb +29 -2
- data/test/rubygems/test_gem_commands_install_command.rb +152 -132
- data/test/rubygems/test_gem_commands_list_command.rb +5 -4
- data/test/rubygems/test_gem_commands_lock_command.rb +11 -10
- data/test/rubygems/test_gem_commands_mirror.rb +3 -2
- data/test/rubygems/test_gem_commands_open_command.rb +5 -4
- data/test/rubygems/test_gem_commands_outdated_command.rb +10 -9
- data/test/rubygems/test_gem_commands_owner_command.rb +227 -50
- data/test/rubygems/test_gem_commands_pristine_command.rb +142 -93
- data/test/rubygems/test_gem_commands_push_command.rb +189 -64
- data/test/rubygems/test_gem_commands_query_command.rb +74 -73
- data/test/rubygems/test_gem_commands_search_command.rb +3 -2
- data/test/rubygems/test_gem_commands_server_command.rb +3 -2
- data/test/rubygems/test_gem_commands_setup_command.rb +123 -96
- data/test/rubygems/test_gem_commands_signin_command.rb +71 -31
- data/test/rubygems/test_gem_commands_signout_command.rb +3 -3
- data/test/rubygems/test_gem_commands_sources_command.rb +29 -29
- data/test/rubygems/test_gem_commands_specification_command.rb +33 -32
- data/test/rubygems/test_gem_commands_stale_command.rb +5 -4
- data/test/rubygems/test_gem_commands_uninstall_command.rb +99 -81
- data/test/rubygems/test_gem_commands_unpack_command.rb +32 -31
- data/test/rubygems/test_gem_commands_update_command.rb +96 -95
- data/test/rubygems/test_gem_commands_which_command.rb +7 -6
- data/test/rubygems/test_gem_commands_yank_command.rb +162 -43
- data/test/rubygems/test_gem_config_file.rb +94 -81
- data/test/rubygems/test_gem_dependency.rb +76 -73
- data/test/rubygems/test_gem_dependency_installer.rb +200 -165
- data/test/rubygems/test_gem_dependency_list.rb +48 -47
- data/test/rubygems/test_gem_dependency_resolution_error.rb +5 -4
- data/test/rubygems/test_gem_doctor.rb +27 -26
- data/test/rubygems/test_gem_ext_builder.rb +60 -61
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +4 -4
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{Cargo.lock → ext/custom_name_lib/Cargo.lock} +23 -33
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{Cargo.toml → ext/custom_name_lib/Cargo.toml} +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{src → ext/custom_name_lib/src}/lib.rs +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +3 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +37 -33
- 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/rust_ruby_example.gemspec +2 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +12 -0
- data/test/rubygems/test_gem_ext_cargo_builder.rb +48 -59
- data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +20 -19
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +21 -36
- data/test/rubygems/test_gem_ext_cmake_builder.rb +16 -15
- data/test/rubygems/test_gem_ext_configure_builder.rb +14 -13
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +51 -52
- data/test/rubygems/test_gem_ext_rake_builder.rb +16 -15
- data/test/rubygems/test_gem_gem_runner.rb +15 -9
- data/test/rubygems/test_gem_gemcutter_utilities.rb +170 -84
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +5 -4
- data/test/rubygems/test_gem_indexer.rb +87 -67
- data/test/rubygems/test_gem_install_update_options.rb +17 -16
- data/test/rubygems/test_gem_installer.rb +422 -304
- data/test/rubygems/test_gem_local_remote_options.rb +11 -10
- data/test/rubygems/test_gem_name_tuple.rb +5 -4
- data/test/rubygems/test_gem_package.rb +243 -231
- data/test/rubygems/test_gem_package_old.rb +14 -13
- data/test/rubygems/test_gem_package_tar_header.rb +48 -47
- data/test/rubygems/test_gem_package_tar_reader.rb +56 -8
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +162 -16
- data/test/rubygems/test_gem_package_tar_writer.rb +77 -76
- data/test/rubygems/test_gem_package_task.rb +19 -18
- data/test/rubygems/test_gem_path_support.rb +15 -14
- data/test/rubygems/test_gem_platform.rb +333 -227
- data/test/rubygems/test_gem_rdoc.rb +15 -14
- data/test/rubygems/test_gem_remote_fetcher.rb +155 -154
- data/test/rubygems/test_gem_request.rb +64 -58
- data/test/rubygems/test_gem_request_connection_pools.rb +30 -29
- data/test/rubygems/test_gem_request_set.rb +101 -100
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +210 -211
- data/test/rubygems/test_gem_request_set_lockfile.rb +87 -86
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +58 -57
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +63 -62
- data/test/rubygems/test_gem_requirement.rb +48 -41
- data/test/rubygems/test_gem_resolver.rb +167 -99
- data/test/rubygems/test_gem_resolver_activation_request.rb +7 -6
- data/test/rubygems/test_gem_resolver_api_set.rb +34 -33
- data/test/rubygems/test_gem_resolver_api_specification.rb +48 -47
- data/test/rubygems/test_gem_resolver_best_set.rb +23 -22
- data/test/rubygems/test_gem_resolver_composed_set.rb +2 -1
- data/test/rubygems/test_gem_resolver_conflict.rb +13 -12
- data/test/rubygems/test_gem_resolver_dependency_request.rb +16 -15
- data/test/rubygems/test_gem_resolver_git_set.rb +22 -21
- data/test/rubygems/test_gem_resolver_git_specification.rb +22 -21
- data/test/rubygems/test_gem_resolver_index_set.rb +13 -12
- data/test/rubygems/test_gem_resolver_index_specification.rb +17 -16
- data/test/rubygems/test_gem_resolver_installed_specification.rb +6 -5
- data/test/rubygems/test_gem_resolver_installer_set.rb +79 -34
- data/test/rubygems/test_gem_resolver_local_specification.rb +8 -7
- data/test/rubygems/test_gem_resolver_lock_set.rb +13 -12
- data/test/rubygems/test_gem_resolver_lock_specification.rb +18 -17
- data/test/rubygems/test_gem_resolver_requirement_list.rb +2 -1
- data/test/rubygems/test_gem_resolver_specification.rb +9 -8
- data/test/rubygems/test_gem_resolver_vendor_set.rb +7 -6
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +11 -10
- data/test/rubygems/test_gem_security.rb +69 -68
- data/test/rubygems/test_gem_security_policy.rb +72 -72
- data/test/rubygems/test_gem_security_signer.rb +35 -34
- data/test/rubygems/test_gem_security_trust_dir.rb +7 -6
- data/test/rubygems/test_gem_silent_ui.rb +39 -32
- data/test/rubygems/test_gem_source.rb +45 -44
- data/test/rubygems/test_gem_source_fetch_problem.rb +10 -9
- data/test/rubygems/test_gem_source_git.rb +69 -62
- data/test/rubygems/test_gem_source_installed.rb +17 -16
- data/test/rubygems/test_gem_source_list.rb +6 -5
- data/test/rubygems/test_gem_source_local.rb +15 -14
- data/test/rubygems/test_gem_source_lock.rb +32 -31
- data/test/rubygems/test_gem_source_specific_file.rb +18 -17
- data/test/rubygems/test_gem_source_subpath_problem.rb +8 -7
- data/test/rubygems/test_gem_source_vendor.rb +14 -13
- data/test/rubygems/test_gem_spec_fetcher.rb +73 -72
- data/test/rubygems/test_gem_specification.rb +533 -469
- data/test/rubygems/test_gem_stream_ui.rb +53 -22
- data/test/rubygems/test_gem_stub_specification.rb +33 -32
- data/test/rubygems/test_gem_text.rb +2 -1
- data/test/rubygems/test_gem_uninstaller.rb +118 -117
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +4 -3
- data/test/rubygems/test_gem_update_suggestion.rb +209 -0
- data/test/rubygems/test_gem_uri.rb +6 -4
- data/test/rubygems/test_gem_uri_formatter.rb +15 -14
- data/test/rubygems/test_gem_util.rb +24 -23
- data/test/rubygems/test_gem_validator.rb +8 -8
- data/test/rubygems/test_gem_version.rb +24 -16
- data/test/rubygems/test_gem_version_option.rb +16 -15
- data/test/rubygems/test_kernel.rb +43 -48
- data/test/rubygems/test_project_sanity.rb +32 -3
- data/test/rubygems/test_remote_fetch_error.rb +8 -7
- data/test/rubygems/test_require.rb +118 -103
- data/test/rubygems/test_rubygems.rb +10 -8
- data/test/rubygems/test_webauthn_listener.rb +143 -0
- data/test/rubygems/test_webauthn_listener_response.rb +93 -0
- data/test/rubygems/test_webauthn_poller.rb +124 -0
- data/test/rubygems/utilities.rb +98 -34
- data/test/rubygems/wrong_key_cert.pem +15 -15
- data/test/rubygems/wrong_key_cert_32.pem +15 -15
- data/test/test_changelog_generator.rb +1 -1
- metadata +99 -46
- data/bundler/lib/bundler/dep_proxy.rb +0 -55
- data/bundler/lib/bundler/templates/gems.rb +0 -5
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -5
- data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -6
- data/bundler/lib/bundler/vendor/molinillo/LICENSE +0 -9
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -88
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -164
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -149
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -11
- data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
- data/bundler/lib/bundler/vendored_molinillo.rb +0 -4
- data/bundler/lib/bundler/version_ranges.rb +0 -122
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +0 -21
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +0 -21
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require_relative "installer_test_case"
|
3
4
|
|
4
5
|
class TestGemInstaller < Gem::InstallerTestCase
|
5
6
|
def setup
|
@@ -21,7 +22,7 @@ class TestGemInstaller < Gem::InstallerTestCase
|
|
21
22
|
load_relative "no" do
|
22
23
|
installer = setup_base_installer
|
23
24
|
|
24
|
-
util_make_exec @spec,
|
25
|
+
util_make_exec @spec, ""
|
25
26
|
|
26
27
|
expected = <<-EOF
|
27
28
|
#!#{Gem.ruby}
|
@@ -55,7 +56,7 @@ load Gem.bin_path("a", "executable", version)
|
|
55
56
|
end
|
56
57
|
EOF
|
57
58
|
|
58
|
-
wrapper = installer.app_script_text
|
59
|
+
wrapper = installer.app_script_text "executable"
|
59
60
|
assert_equal expected, wrapper
|
60
61
|
end
|
61
62
|
end
|
@@ -66,12 +67,12 @@ end
|
|
66
67
|
installer.generate_bin
|
67
68
|
|
68
69
|
@spec = Gem::Specification.new do |s|
|
69
|
-
s.files = [
|
70
|
+
s.files = ["lib/code.rb"]
|
70
71
|
s.name = "a"
|
71
72
|
s.version = "3"
|
72
73
|
s.summary = "summary"
|
73
74
|
s.description = "desc"
|
74
|
-
s.require_path =
|
75
|
+
s.require_path = "lib"
|
75
76
|
end
|
76
77
|
|
77
78
|
util_make_exec
|
@@ -79,7 +80,7 @@ end
|
|
79
80
|
installer.wrappers = true
|
80
81
|
installer.generate_bin
|
81
82
|
|
82
|
-
installed_exec = File.join util_inst_bindir,
|
83
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
83
84
|
assert_path_exist installed_exec
|
84
85
|
|
85
86
|
wrapper = File.read installed_exec
|
@@ -98,7 +99,7 @@ end
|
|
98
99
|
installer.generate_bin
|
99
100
|
end
|
100
101
|
|
101
|
-
conflicted = File.join @gemhome,
|
102
|
+
conflicted = File.join @gemhome, "bin", "executable"
|
102
103
|
assert_match %r{\A"executable" from a conflicts with (?:#{Regexp.quote(conflicted)}|installed executable from conflict)\z},
|
103
104
|
e.message
|
104
105
|
end
|
@@ -111,15 +112,15 @@ end
|
|
111
112
|
installer.generate_bin
|
112
113
|
|
113
114
|
@spec = Gem::Specification.new do |s|
|
114
|
-
s.files = [
|
115
|
+
s.files = ["lib/code.rb"]
|
115
116
|
s.name = "a"
|
116
117
|
s.version = "3"
|
117
118
|
s.summary = "summary"
|
118
119
|
s.description = "desc"
|
119
|
-
s.require_path =
|
120
|
+
s.require_path = "lib"
|
120
121
|
end
|
121
122
|
|
122
|
-
File.open File.join(util_inst_bindir,
|
123
|
+
File.open File.join(util_inst_bindir, "executable"), "w" do |io|
|
123
124
|
io.write <<-EXEC
|
124
125
|
#!/usr/local/bin/ruby
|
125
126
|
#
|
@@ -130,14 +131,14 @@ gem 'other', version
|
|
130
131
|
end
|
131
132
|
|
132
133
|
util_make_exec
|
133
|
-
Gem::Installer.exec_format =
|
134
|
+
Gem::Installer.exec_format = "foo-%s-bar"
|
134
135
|
installer.gem_dir = @spec.gem_dir
|
135
136
|
installer.wrappers = true
|
136
137
|
installer.format_executable = true
|
137
138
|
|
138
139
|
installer.generate_bin # should not raise
|
139
140
|
|
140
|
-
installed_exec = File.join util_inst_bindir,
|
141
|
+
installed_exec = File.join util_inst_bindir, "foo-executable-bar"
|
141
142
|
assert_path_exist installed_exec
|
142
143
|
|
143
144
|
wrapper = File.read installed_exec
|
@@ -172,7 +173,7 @@ gem 'other', version
|
|
172
173
|
|
173
174
|
installer.generate_bin
|
174
175
|
|
175
|
-
installed_exec = File.join util_inst_bindir,
|
176
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
176
177
|
assert_path_exist installed_exec
|
177
178
|
|
178
179
|
wrapper = File.read installed_exec
|
@@ -187,7 +188,7 @@ gem 'other', version
|
|
187
188
|
|
188
189
|
installer.generate_bin
|
189
190
|
|
190
|
-
installed_exec = File.join util_inst_bindir,
|
191
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
191
192
|
assert_path_exist installed_exec
|
192
193
|
|
193
194
|
wrapper = File.read installed_exec
|
@@ -203,8 +204,8 @@ gem 'other', version
|
|
203
204
|
bin_dir = bin_dir.downcase
|
204
205
|
end
|
205
206
|
|
206
|
-
orig_PATH, ENV[
|
207
|
-
ENV[
|
207
|
+
orig_PATH, ENV["PATH"] =
|
208
|
+
ENV["PATH"], [ENV["PATH"], bin_dir].join(File::PATH_SEPARATOR)
|
208
209
|
|
209
210
|
use_ui @ui do
|
210
211
|
installer.check_that_user_bin_dir_is_in_path
|
@@ -214,7 +215,7 @@ gem 'other', version
|
|
214
215
|
|
215
216
|
return unless win_platform?
|
216
217
|
|
217
|
-
ENV[
|
218
|
+
ENV["PATH"] = [orig_PATH, bin_dir.tr(File::SEPARATOR, File::ALT_SEPARATOR)].join(File::PATH_SEPARATOR)
|
218
219
|
|
219
220
|
use_ui @ui do
|
220
221
|
installer.check_that_user_bin_dir_is_in_path
|
@@ -222,17 +223,17 @@ gem 'other', version
|
|
222
223
|
|
223
224
|
assert_empty @ui.error
|
224
225
|
ensure
|
225
|
-
ENV[
|
226
|
+
ENV["PATH"] = orig_PATH
|
226
227
|
end
|
227
228
|
|
228
229
|
def test_check_that_user_bin_dir_is_in_path_tilde
|
229
230
|
pend "Tilde is PATH is not supported under MS Windows" if win_platform?
|
230
231
|
|
231
|
-
orig_PATH, ENV[
|
232
|
-
ENV[
|
232
|
+
orig_PATH, ENV["PATH"] =
|
233
|
+
ENV["PATH"], [ENV["PATH"], "~/bin"].join(File::PATH_SEPARATOR)
|
233
234
|
|
234
235
|
installer = setup_base_installer
|
235
|
-
installer.bin_dir.replace File.join @userhome,
|
236
|
+
installer.bin_dir.replace File.join @userhome, "bin"
|
236
237
|
|
237
238
|
use_ui @ui do
|
238
239
|
installer.check_that_user_bin_dir_is_in_path
|
@@ -240,7 +241,7 @@ gem 'other', version
|
|
240
241
|
|
241
242
|
assert_empty @ui.error
|
242
243
|
ensure
|
243
|
-
ENV[
|
244
|
+
ENV["PATH"] = orig_PATH unless win_platform?
|
244
245
|
end
|
245
246
|
|
246
247
|
def test_check_that_user_bin_dir_is_in_path_not_in_path
|
@@ -262,22 +263,22 @@ gem 'other', version
|
|
262
263
|
def test_ensure_dependency
|
263
264
|
installer = setup_base_installer
|
264
265
|
|
265
|
-
util_spec
|
266
|
+
util_spec "a"
|
266
267
|
|
267
|
-
dep = Gem::Dependency.new
|
268
|
+
dep = Gem::Dependency.new "a", ">= 2"
|
268
269
|
assert installer.ensure_dependency(@spec, dep)
|
269
270
|
|
270
|
-
dep = Gem::Dependency.new
|
271
|
+
dep = Gem::Dependency.new "b", "> 2"
|
271
272
|
e = assert_raise Gem::InstallError do
|
272
273
|
installer.ensure_dependency @spec, dep
|
273
274
|
end
|
274
275
|
|
275
|
-
assert_equal
|
276
|
+
assert_equal "a requires b (> 2)", e.message
|
276
277
|
end
|
277
278
|
|
278
279
|
def test_ensure_loadable_spec
|
279
|
-
a, a_gem = util_gem
|
280
|
-
s.add_dependency
|
280
|
+
a, a_gem = util_gem "a", 2 do |s|
|
281
|
+
s.add_dependency "garbage ~> 5"
|
281
282
|
end
|
282
283
|
|
283
284
|
installer = Gem::Installer.at a_gem
|
@@ -291,10 +292,10 @@ gem 'other', version
|
|
291
292
|
end
|
292
293
|
|
293
294
|
def test_ensure_loadable_spec_security_policy
|
294
|
-
pend
|
295
|
+
pend "openssl is missing" unless Gem::HAVE_OPENSSL
|
295
296
|
|
296
|
-
_, a_gem = util_gem
|
297
|
-
s.add_dependency
|
297
|
+
_, a_gem = util_gem "a", 2 do |s|
|
298
|
+
s.add_dependency "garbage ~> 5"
|
298
299
|
end
|
299
300
|
|
300
301
|
policy = Gem::Security::HighSecurity
|
@@ -310,7 +311,7 @@ gem 'other', version
|
|
310
311
|
|
311
312
|
installer.extract_files
|
312
313
|
|
313
|
-
assert_path_exist File.join @spec.gem_dir,
|
314
|
+
assert_path_exist File.join @spec.gem_dir, "bin/executable"
|
314
315
|
end
|
315
316
|
|
316
317
|
def test_generate_bin_bindir
|
@@ -319,12 +320,12 @@ gem 'other', version
|
|
319
320
|
installer.wrappers = true
|
320
321
|
|
321
322
|
@spec.executables = %w[executable]
|
322
|
-
@spec.bindir =
|
323
|
+
@spec.bindir = "bin"
|
323
324
|
|
324
|
-
exec_file = installer.formatted_program_filename
|
325
|
+
exec_file = installer.formatted_program_filename "executable"
|
325
326
|
exec_path = File.join @spec.gem_dir, exec_file
|
326
|
-
File.open exec_path,
|
327
|
-
f.puts
|
327
|
+
File.open exec_path, "w" do |f|
|
328
|
+
f.puts "#!/usr/bin/ruby"
|
328
329
|
end
|
329
330
|
|
330
331
|
installer.gem_dir = @spec.gem_dir
|
@@ -332,7 +333,7 @@ gem 'other', version
|
|
332
333
|
installer.generate_bin
|
333
334
|
|
334
335
|
assert_directory_exists util_inst_bindir
|
335
|
-
installed_exec = File.join(util_inst_bindir,
|
336
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
336
337
|
assert_path_exist installed_exec
|
337
338
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
338
339
|
|
@@ -352,7 +353,7 @@ gem 'other', version
|
|
352
353
|
:install_dir => "/non/existent",
|
353
354
|
}
|
354
355
|
|
355
|
-
inst = Gem::Installer.at
|
356
|
+
inst = Gem::Installer.at "", options
|
356
357
|
|
357
358
|
Gem::Installer.path_warning = false
|
358
359
|
|
@@ -375,7 +376,7 @@ gem 'other', version
|
|
375
376
|
|
376
377
|
installer.generate_bin
|
377
378
|
assert_directory_exists util_inst_bindir
|
378
|
-
installed_exec = File.join util_inst_bindir,
|
379
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
379
380
|
assert_path_exist installed_exec
|
380
381
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
381
382
|
|
@@ -391,10 +392,10 @@ gem 'other', version
|
|
391
392
|
util_make_exec
|
392
393
|
installer.gem_dir = @spec.gem_dir
|
393
394
|
|
394
|
-
Gem::Installer.exec_format =
|
395
|
+
Gem::Installer.exec_format = "foo-%s-bar"
|
395
396
|
installer.generate_bin
|
396
397
|
assert_directory_exists util_inst_bindir
|
397
|
-
installed_exec = File.join util_inst_bindir,
|
398
|
+
installed_exec = File.join util_inst_bindir, "foo-executable-bar"
|
398
399
|
assert_path_exist installed_exec
|
399
400
|
ensure
|
400
401
|
Gem::Installer.exec_format = nil
|
@@ -407,10 +408,10 @@ gem 'other', version
|
|
407
408
|
util_make_exec
|
408
409
|
installer.gem_dir = @spec.gem_dir
|
409
410
|
|
410
|
-
Gem::Installer.exec_format =
|
411
|
+
Gem::Installer.exec_format = "foo-%s-bar"
|
411
412
|
installer.generate_bin
|
412
413
|
assert_directory_exists util_inst_bindir
|
413
|
-
installed_exec = File.join util_inst_bindir,
|
414
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
414
415
|
assert_path_exist installed_exec
|
415
416
|
ensure
|
416
417
|
Gem::Installer.exec_format = nil
|
@@ -422,19 +423,19 @@ gem 'other', version
|
|
422
423
|
installer.wrappers = true
|
423
424
|
|
424
425
|
gem_dir = File.join("#{@gemhome}2", "gems", @spec.full_name)
|
425
|
-
gem_bindir = File.join gem_dir,
|
426
|
+
gem_bindir = File.join gem_dir, "bin"
|
426
427
|
FileUtils.mkdir_p gem_bindir
|
427
|
-
File.open File.join(gem_bindir,
|
428
|
+
File.open File.join(gem_bindir, "executable"), "w" do |f|
|
428
429
|
f.puts "#!/bin/ruby"
|
429
430
|
end
|
430
431
|
|
431
432
|
installer.gem_home = "#{@gemhome}2"
|
432
433
|
installer.gem_dir = gem_dir
|
433
|
-
installer.bin_dir = File.join "#{@gemhome}2",
|
434
|
+
installer.bin_dir = File.join "#{@gemhome}2", "bin"
|
434
435
|
|
435
436
|
installer.generate_bin
|
436
437
|
|
437
|
-
installed_exec = File.join("#{@gemhome}2", "bin",
|
438
|
+
installed_exec = File.join("#{@gemhome}2", "bin", "executable")
|
438
439
|
assert_path_exist installed_exec
|
439
440
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
440
441
|
|
@@ -450,7 +451,7 @@ gem 'other', version
|
|
450
451
|
installer.wrappers = true
|
451
452
|
installer.generate_bin
|
452
453
|
|
453
|
-
assert_path_not_exist util_inst_bindir,
|
454
|
+
assert_path_not_exist util_inst_bindir, "bin dir was created when not needed"
|
454
455
|
end
|
455
456
|
|
456
457
|
def test_generate_bin_script_no_perms
|
@@ -462,9 +463,9 @@ gem 'other', version
|
|
462
463
|
Dir.mkdir util_inst_bindir
|
463
464
|
|
464
465
|
if win_platform?
|
465
|
-
pend(
|
466
|
+
pend("test_generate_bin_script_no_perms skipped on MS Windows")
|
466
467
|
elsif Process.uid.zero?
|
467
|
-
pend(
|
468
|
+
pend("test_generate_bin_script_no_perms skipped in root privilege")
|
468
469
|
else
|
469
470
|
FileUtils.chmod 0000, util_inst_bindir
|
470
471
|
|
@@ -473,7 +474,7 @@ gem 'other', version
|
|
473
474
|
end
|
474
475
|
end
|
475
476
|
ensure
|
476
|
-
FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG
|
477
|
+
FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG || win_platform?)
|
477
478
|
end
|
478
479
|
|
479
480
|
def test_generate_bin_script_no_shebang
|
@@ -482,16 +483,16 @@ gem 'other', version
|
|
482
483
|
installer.wrappers = true
|
483
484
|
@spec.executables = %w[executable]
|
484
485
|
|
485
|
-
gem_dir = File.join @gemhome,
|
486
|
-
gem_bindir = File.join gem_dir,
|
486
|
+
gem_dir = File.join @gemhome, "gems", @spec.full_name
|
487
|
+
gem_bindir = File.join gem_dir, "bin"
|
487
488
|
FileUtils.mkdir_p gem_bindir
|
488
|
-
File.open File.join(gem_bindir,
|
489
|
+
File.open File.join(gem_bindir, "executable"), "w" do |f|
|
489
490
|
f.puts "blah blah blah"
|
490
491
|
end
|
491
492
|
|
492
493
|
installer.generate_bin
|
493
494
|
|
494
|
-
installed_exec = File.join @gemhome,
|
495
|
+
installed_exec = File.join @gemhome, "bin", "executable"
|
495
496
|
assert_path_exist installed_exec
|
496
497
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
497
498
|
|
@@ -507,9 +508,9 @@ gem 'other', version
|
|
507
508
|
installer.wrappers = true
|
508
509
|
util_make_exec
|
509
510
|
installer.gem_dir = @spec.gem_dir
|
510
|
-
installed_exec = File.join(util_inst_bindir,
|
511
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
511
512
|
|
512
|
-
real_exec = File.join @spec.gem_dir,
|
513
|
+
real_exec = File.join @spec.gem_dir, "bin", "executable"
|
513
514
|
|
514
515
|
# fake --no-wrappers for previous install
|
515
516
|
unless Gem.win_platform?
|
@@ -525,7 +526,7 @@ gem 'other', version
|
|
525
526
|
assert_match %r{generated by RubyGems}, File.read(installed_exec)
|
526
527
|
|
527
528
|
refute_match %r{generated by RubyGems}, File.read(real_exec),
|
528
|
-
|
529
|
+
"real executable overwritten"
|
529
530
|
end
|
530
531
|
|
531
532
|
def test_generate_bin_symlink
|
@@ -539,9 +540,9 @@ gem 'other', version
|
|
539
540
|
|
540
541
|
installer.generate_bin
|
541
542
|
assert_directory_exists util_inst_bindir
|
542
|
-
installed_exec = File.join util_inst_bindir,
|
543
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
543
544
|
assert_equal true, File.symlink?(installed_exec)
|
544
|
-
assert_equal(File.join(@spec.gem_dir,
|
545
|
+
assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
|
545
546
|
File.readlink(installed_exec))
|
546
547
|
end
|
547
548
|
|
@@ -566,9 +567,9 @@ gem 'other', version
|
|
566
567
|
Dir.mkdir util_inst_bindir
|
567
568
|
|
568
569
|
if win_platform?
|
569
|
-
pend(
|
570
|
+
pend("test_generate_bin_symlink_no_perms skipped on MS Windows")
|
570
571
|
elsif Process.uid.zero?
|
571
|
-
pend(
|
572
|
+
pend("test_user_install_disabled_read_only test skipped in root privilege")
|
572
573
|
else
|
573
574
|
FileUtils.chmod 0000, util_inst_bindir
|
574
575
|
|
@@ -577,7 +578,7 @@ gem 'other', version
|
|
577
578
|
end
|
578
579
|
end
|
579
580
|
ensure
|
580
|
-
FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG
|
581
|
+
FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG || win_platform?)
|
581
582
|
end
|
582
583
|
|
583
584
|
def test_generate_bin_symlink_update_newer
|
@@ -590,24 +591,24 @@ gem 'other', version
|
|
590
591
|
installer.gem_dir = @spec.gem_dir
|
591
592
|
|
592
593
|
installer.generate_bin
|
593
|
-
installed_exec = File.join(util_inst_bindir,
|
594
|
-
assert_equal(File.join(@spec.gem_dir,
|
594
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
595
|
+
assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
|
595
596
|
File.readlink(installed_exec))
|
596
597
|
|
597
598
|
@spec = Gem::Specification.new do |s|
|
598
|
-
s.files = [
|
599
|
+
s.files = ["lib/code.rb"]
|
599
600
|
s.name = "a"
|
600
601
|
s.version = "3"
|
601
602
|
s.summary = "summary"
|
602
603
|
s.description = "desc"
|
603
|
-
s.require_path =
|
604
|
+
s.require_path = "lib"
|
604
605
|
end
|
605
606
|
|
606
607
|
util_make_exec
|
607
608
|
installer.gem_dir = @spec.gem_dir
|
608
609
|
installer.generate_bin
|
609
|
-
installed_exec = File.join(util_inst_bindir,
|
610
|
-
assert_equal(@spec.bin_file(
|
610
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
611
|
+
assert_equal(@spec.bin_file("executable"),
|
611
612
|
File.readlink(installed_exec),
|
612
613
|
"Ensure symlink moved to latest version")
|
613
614
|
end
|
@@ -622,17 +623,17 @@ gem 'other', version
|
|
622
623
|
installer.gem_dir = @spec.gem_dir
|
623
624
|
|
624
625
|
installer.generate_bin
|
625
|
-
installed_exec = File.join(util_inst_bindir,
|
626
|
-
assert_equal(File.join(@spec.gem_dir,
|
626
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
627
|
+
assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
|
627
628
|
File.readlink(installed_exec))
|
628
629
|
|
629
630
|
spec = Gem::Specification.new do |s|
|
630
|
-
s.files = [
|
631
|
+
s.files = ["lib/code.rb"]
|
631
632
|
s.name = "a"
|
632
633
|
s.version = "1"
|
633
634
|
s.summary = "summary"
|
634
635
|
s.description = "desc"
|
635
|
-
s.require_path =
|
636
|
+
s.require_path = "lib"
|
636
637
|
end
|
637
638
|
|
638
639
|
util_make_exec
|
@@ -643,8 +644,8 @@ gem 'other', version
|
|
643
644
|
|
644
645
|
installer.generate_bin
|
645
646
|
|
646
|
-
installed_exec = File.join util_inst_bindir,
|
647
|
-
expected = File.join @spec.gem_dir,
|
647
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
648
|
+
expected = File.join @spec.gem_dir, "bin", "executable"
|
648
649
|
assert_equal(expected,
|
649
650
|
File.readlink(installed_exec),
|
650
651
|
"Ensure symlink not moved")
|
@@ -661,16 +662,16 @@ gem 'other', version
|
|
661
662
|
|
662
663
|
installer.generate_bin
|
663
664
|
|
664
|
-
installed_exec = File.join util_inst_bindir,
|
665
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
665
666
|
assert_path_exist installed_exec
|
666
667
|
|
667
668
|
@spec = Gem::Specification.new do |s|
|
668
|
-
s.files = [
|
669
|
+
s.files = ["lib/code.rb"]
|
669
670
|
s.name = "a"
|
670
671
|
s.version = "3"
|
671
672
|
s.summary = "summary"
|
672
673
|
s.description = "desc"
|
673
|
-
s.require_path =
|
674
|
+
s.require_path = "lib"
|
674
675
|
end
|
675
676
|
util_make_exec
|
676
677
|
|
@@ -680,8 +681,8 @@ gem 'other', version
|
|
680
681
|
|
681
682
|
installer.generate_bin
|
682
683
|
|
683
|
-
installed_exec = File.join util_inst_bindir,
|
684
|
-
assert_equal(@spec.bin_file(
|
684
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
685
|
+
assert_equal(@spec.bin_file("executable"),
|
685
686
|
File.readlink(installed_exec),
|
686
687
|
"Ensure symlink moved to latest version")
|
687
688
|
end
|
@@ -691,7 +692,7 @@ gem 'other', version
|
|
691
692
|
Gem.win_platform = true
|
692
693
|
old_alt_separator = File::ALT_SEPARATOR
|
693
694
|
File.__send__(:remove_const, :ALT_SEPARATOR)
|
694
|
-
File.const_set(:ALT_SEPARATOR,
|
695
|
+
File.const_set(:ALT_SEPARATOR, "\\")
|
695
696
|
|
696
697
|
installer = setup_base_installer
|
697
698
|
|
@@ -704,7 +705,7 @@ gem 'other', version
|
|
704
705
|
end
|
705
706
|
|
706
707
|
assert_directory_exists util_inst_bindir
|
707
|
-
installed_exec = File.join(util_inst_bindir,
|
708
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
708
709
|
assert_path_exist installed_exec
|
709
710
|
|
710
711
|
if symlink_supported?
|
@@ -726,7 +727,7 @@ gem 'other', version
|
|
726
727
|
def test_generate_bin_uses_default_shebang
|
727
728
|
pend "Symlinks not supported or not enabled" unless symlink_supported?
|
728
729
|
|
729
|
-
load_relative
|
730
|
+
load_relative "no" do
|
730
731
|
installer = setup_base_installer
|
731
732
|
|
732
733
|
installer.wrappers = true
|
@@ -756,14 +757,17 @@ gem 'other', version
|
|
756
757
|
end
|
757
758
|
end
|
758
759
|
|
759
|
-
|
760
|
+
errors = @ui.error.split("\n")
|
761
|
+
assert_equal "WARNING: ascii_binder-0.1.10.1 ships with a dangling symlink named bin/ascii_binder pointing to missing bin/asciibinder file. Ignoring", errors.shift
|
762
|
+
assert_empty errors
|
763
|
+
|
760
764
|
assert_empty @ui.output
|
761
765
|
end
|
762
766
|
|
763
767
|
def test_generate_plugins
|
764
768
|
installer = util_setup_installer do |spec|
|
765
|
-
write_file File.join(@tempdir,
|
766
|
-
io.write "
|
769
|
+
write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
|
770
|
+
io.write "# do nothing"
|
767
771
|
end
|
768
772
|
|
769
773
|
spec.files += %w[lib/rubygems_plugin.rb]
|
@@ -773,18 +777,18 @@ gem 'other', version
|
|
773
777
|
installer.install
|
774
778
|
end
|
775
779
|
|
776
|
-
plugin_path = File.join Gem.plugindir,
|
780
|
+
plugin_path = File.join Gem.plugindir, "a_plugin.rb"
|
777
781
|
|
778
782
|
FileUtils.rm plugin_path
|
779
783
|
|
780
784
|
installer.generate_plugins
|
781
785
|
|
782
|
-
assert File.exist?(plugin_path),
|
786
|
+
assert File.exist?(plugin_path), "plugin not written"
|
783
787
|
end
|
784
788
|
|
785
789
|
def test_generate_plugins_with_install_dir
|
786
|
-
spec = quick_gem
|
787
|
-
write_file File.join(@tempdir,
|
790
|
+
spec = quick_gem "a" do |s|
|
791
|
+
write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
|
788
792
|
io.write "puts __FILE__"
|
789
793
|
end
|
790
794
|
|
@@ -793,17 +797,17 @@ gem 'other', version
|
|
793
797
|
|
794
798
|
util_build_gem spec
|
795
799
|
|
796
|
-
plugin_path = File.join "#{@gemhome}2",
|
800
|
+
plugin_path = File.join "#{@gemhome}2", "plugins", "a_plugin.rb"
|
797
801
|
installer = util_installer spec, "#{@gemhome}2"
|
798
802
|
|
799
803
|
assert_equal spec, installer.install
|
800
804
|
|
801
|
-
assert File.exist?(plugin_path),
|
805
|
+
assert File.exist?(plugin_path), "plugin not written to install_dir"
|
802
806
|
end
|
803
807
|
|
804
808
|
def test_generate_plugins_with_user_install
|
805
|
-
spec = quick_gem
|
806
|
-
write_file File.join(@tempdir,
|
809
|
+
spec = quick_gem "a" do |s|
|
810
|
+
write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
|
807
811
|
io.write "puts __FILE__"
|
808
812
|
end
|
809
813
|
|
@@ -813,19 +817,19 @@ gem 'other', version
|
|
813
817
|
util_build_gem spec
|
814
818
|
|
815
819
|
File.chmod(0555, Gem.plugindir)
|
816
|
-
system_path = File.join(Gem.plugindir,
|
817
|
-
user_path = File.join(Gem.plugindir(Gem.user_dir),
|
820
|
+
system_path = File.join(Gem.plugindir, "a_plugin.rb")
|
821
|
+
user_path = File.join(Gem.plugindir(Gem.user_dir), "a_plugin.rb")
|
818
822
|
installer = util_installer spec, Gem.dir, :user
|
819
823
|
|
820
824
|
assert_equal spec, installer.install
|
821
825
|
|
822
|
-
assert !File.exist?(system_path),
|
823
|
-
assert File.exist?(user_path),
|
826
|
+
assert !File.exist?(system_path), "plugin incorrectly written to system plugins_dir"
|
827
|
+
assert File.exist?(user_path), "plugin not written to user plugins_dir"
|
824
828
|
end
|
825
829
|
|
826
830
|
def test_generate_plugins_with_build_root
|
827
|
-
spec = quick_gem
|
828
|
-
write_file File.join(@tempdir,
|
831
|
+
spec = quick_gem "a" do |s|
|
832
|
+
write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
|
829
833
|
io.write "puts __FILE__"
|
830
834
|
end
|
831
835
|
|
@@ -835,67 +839,115 @@ gem 'other', version
|
|
835
839
|
util_build_gem spec
|
836
840
|
|
837
841
|
File.chmod(0555, Gem.plugindir)
|
838
|
-
system_path = File.join(Gem.plugindir,
|
842
|
+
system_path = File.join(Gem.plugindir, "a_plugin.rb")
|
839
843
|
|
840
|
-
build_root = File.join(@tempdir,
|
841
|
-
build_root_path = File.join(build_root, Gem.plugindir.gsub(/^[a-zA-Z]:/,
|
844
|
+
build_root = File.join(@tempdir, "build_root")
|
845
|
+
build_root_path = File.join(build_root, Gem.plugindir.gsub(/^[a-zA-Z]:/, ""), "a_plugin.rb")
|
842
846
|
|
843
847
|
installer = Gem::Installer.at spec.cache_file, :build_root => build_root
|
844
848
|
|
845
849
|
assert_equal spec, installer.install
|
846
850
|
|
847
|
-
assert !File.exist?(system_path),
|
848
|
-
assert File.exist?(build_root_path),
|
851
|
+
assert !File.exist?(system_path), "plugin written incorrect written to system plugins_dir"
|
852
|
+
assert File.exist?(build_root_path), "plugin not written to build_root"
|
849
853
|
|
850
854
|
refute_includes File.read(build_root_path), build_root
|
851
855
|
end
|
852
856
|
|
857
|
+
class << self
|
858
|
+
attr_accessor :plugin_loaded
|
859
|
+
attr_accessor :post_install_is_called
|
860
|
+
end
|
861
|
+
|
862
|
+
def test_use_plugin_immediately
|
863
|
+
self.class.plugin_loaded = false
|
864
|
+
self.class.post_install_is_called = false
|
865
|
+
spec_version = nil
|
866
|
+
plugin_path = nil
|
867
|
+
installer = util_setup_installer do |spec|
|
868
|
+
spec_version = spec.version
|
869
|
+
plugin_path = File.join("lib", "rubygems_plugin.rb")
|
870
|
+
write_file File.join(@tempdir, plugin_path) do |io|
|
871
|
+
io.write <<-PLUGIN
|
872
|
+
#{self.class}.plugin_loaded = true
|
873
|
+
Gem.post_install do
|
874
|
+
#{self.class}.post_install_is_called = true
|
875
|
+
end
|
876
|
+
PLUGIN
|
877
|
+
end
|
878
|
+
spec.files += [plugin_path]
|
879
|
+
plugin_path = File.join(spec.gem_dir, plugin_path)
|
880
|
+
end
|
881
|
+
build_rake_in do
|
882
|
+
installer.install
|
883
|
+
end
|
884
|
+
assert self.class.plugin_loaded, "plugin is not loaded"
|
885
|
+
assert self.class.post_install_is_called,
|
886
|
+
"post install hook registered by plugin is not called"
|
887
|
+
|
888
|
+
self.class.plugin_loaded = false
|
889
|
+
$LOADED_FEATURES.delete(plugin_path)
|
890
|
+
installer_new = util_setup_installer do |spec_new|
|
891
|
+
spec_new.version = spec_version.version.succ
|
892
|
+
plugin_path = File.join("lib", "rubygems_plugin.rb")
|
893
|
+
write_file File.join(@tempdir, plugin_path) do |io|
|
894
|
+
io.write "#{self.class}.plugin_loaded = true"
|
895
|
+
end
|
896
|
+
spec_new.files += [plugin_path]
|
897
|
+
end
|
898
|
+
build_rake_in do
|
899
|
+
installer_new.install
|
900
|
+
end
|
901
|
+
assert !self.class.plugin_loaded,
|
902
|
+
"plugin is loaded even when old version is already loaded"
|
903
|
+
end
|
904
|
+
|
853
905
|
def test_keeps_plugins_up_to_date
|
854
906
|
# NOTE: version a-2 is already installed by setup hooks
|
855
907
|
|
856
|
-
write_file File.join(@tempdir,
|
857
|
-
io.write "
|
908
|
+
write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
|
909
|
+
io.write "# do nothing"
|
858
910
|
end
|
859
911
|
|
860
912
|
build_rake_in do
|
861
913
|
util_setup_installer do |spec|
|
862
|
-
spec.version =
|
914
|
+
spec.version = "1"
|
863
915
|
spec.files += %w[lib/rubygems_plugin.rb]
|
864
916
|
end.install
|
865
917
|
|
866
|
-
plugin_path = File.join Gem.plugindir,
|
867
|
-
refute File.exist?(plugin_path),
|
918
|
+
plugin_path = File.join Gem.plugindir, "a_plugin.rb"
|
919
|
+
refute File.exist?(plugin_path), "old version installed while newer version without plugin also installed, but plugin written"
|
868
920
|
|
869
921
|
util_setup_installer do |spec|
|
870
|
-
spec.version =
|
922
|
+
spec.version = "2"
|
871
923
|
spec.files += %w[lib/rubygems_plugin.rb]
|
872
924
|
end.install
|
873
925
|
|
874
|
-
plugin_path = File.join Gem.plugindir,
|
875
|
-
assert File.exist?(plugin_path),
|
876
|
-
assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path),
|
926
|
+
plugin_path = File.join Gem.plugindir, "a_plugin.rb"
|
927
|
+
assert File.exist?(plugin_path), "latest version reinstalled, but plugin not written"
|
928
|
+
assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), "written plugin has incorrect content"
|
877
929
|
|
878
930
|
util_setup_installer do |spec|
|
879
|
-
spec.version =
|
931
|
+
spec.version = "3"
|
880
932
|
spec.files += %w[lib/rubygems_plugin.rb]
|
881
933
|
end.install
|
882
934
|
|
883
|
-
plugin_path = File.join Gem.plugindir,
|
884
|
-
assert File.exist?(plugin_path),
|
885
|
-
assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path),
|
935
|
+
plugin_path = File.join Gem.plugindir, "a_plugin.rb"
|
936
|
+
assert File.exist?(plugin_path), "latest version installed, but plugin removed"
|
937
|
+
assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), "written plugin has incorrect content"
|
886
938
|
|
887
939
|
util_setup_installer do |spec|
|
888
|
-
spec.version =
|
940
|
+
spec.version = "4"
|
889
941
|
end.install
|
890
942
|
|
891
|
-
refute File.exist?(plugin_path),
|
943
|
+
refute File.exist?(plugin_path), "new version installed without a plugin while older version with a plugin installed, but plugin not removed"
|
892
944
|
end
|
893
945
|
end
|
894
946
|
|
895
947
|
def test_generates_plugins_dir_under_install_dir_if_not_there
|
896
948
|
Gem.use_paths "#{@gemhome}2" # Set GEM_HOME to an uninitialized repo
|
897
949
|
|
898
|
-
@spec = util_spec
|
950
|
+
@spec = util_spec "a"
|
899
951
|
|
900
952
|
path = Gem::Package.build @spec
|
901
953
|
|
@@ -904,8 +956,8 @@ gem 'other', version
|
|
904
956
|
end
|
905
957
|
|
906
958
|
def test_initialize
|
907
|
-
spec = util_spec
|
908
|
-
s.platform = Gem::Platform.new
|
959
|
+
spec = util_spec "a" do |s|
|
960
|
+
s.platform = Gem::Platform.new "mswin32"
|
909
961
|
end
|
910
962
|
|
911
963
|
gem = File.join @tempdir, spec.file_name
|
@@ -916,8 +968,8 @@ gem 'other', version
|
|
916
968
|
|
917
969
|
installer = Gem::Installer.at gem
|
918
970
|
|
919
|
-
assert_equal File.join(@gemhome,
|
920
|
-
assert_equal File.join(@gemhome,
|
971
|
+
assert_equal File.join(@gemhome, "gems", spec.full_name), installer.gem_dir
|
972
|
+
assert_equal File.join(@gemhome, "bin"), installer.bin_dir
|
921
973
|
end
|
922
974
|
|
923
975
|
def test_initialize_user_install
|
@@ -925,7 +977,7 @@ gem 'other', version
|
|
925
977
|
|
926
978
|
installer = Gem::Installer.at @gem, :user_install => true
|
927
979
|
|
928
|
-
assert_equal File.join(Gem.user_dir,
|
980
|
+
assert_equal File.join(Gem.user_dir, "gems", @spec.full_name),
|
929
981
|
installer.gem_dir
|
930
982
|
assert_equal Gem.bindir(Gem.user_dir), installer.bin_dir
|
931
983
|
end
|
@@ -936,7 +988,7 @@ gem 'other', version
|
|
936
988
|
installer =
|
937
989
|
Gem::Installer.at @gem, :user_install => true, :bin_dir => @tempdir
|
938
990
|
|
939
|
-
assert_equal File.join(Gem.user_dir,
|
991
|
+
assert_equal File.join(Gem.user_dir, "gems", @spec.full_name),
|
940
992
|
installer.gem_dir
|
941
993
|
assert_equal @tempdir, installer.bin_dir
|
942
994
|
end
|
@@ -944,26 +996,26 @@ gem 'other', version
|
|
944
996
|
def test_install
|
945
997
|
installer = util_setup_installer
|
946
998
|
|
947
|
-
gemdir = File.join @gemhome,
|
948
|
-
cache_file = File.join @gemhome,
|
949
|
-
stub_exe = File.join @gemhome,
|
950
|
-
rakefile = File.join gemdir,
|
951
|
-
spec_file = File.join @gemhome,
|
999
|
+
gemdir = File.join @gemhome, "gems", @spec.full_name
|
1000
|
+
cache_file = File.join @gemhome, "cache", @spec.file_name
|
1001
|
+
stub_exe = File.join @gemhome, "bin", "executable"
|
1002
|
+
rakefile = File.join gemdir, "ext", "a", "Rakefile"
|
1003
|
+
spec_file = File.join @gemhome, "specifications", @spec.spec_name
|
952
1004
|
|
953
1005
|
Gem.pre_install do
|
954
|
-
assert_path_not_exist cache_file,
|
1006
|
+
assert_path_not_exist cache_file, "cache file must not exist yet"
|
955
1007
|
true
|
956
1008
|
end
|
957
1009
|
|
958
1010
|
Gem.post_build do
|
959
|
-
assert_path_exist gemdir,
|
960
|
-
assert_path_exist rakefile,
|
961
|
-
assert_path_not_exist stub_exe,
|
1011
|
+
assert_path_exist gemdir, "gem install dir must exist"
|
1012
|
+
assert_path_exist rakefile, "gem executable must exist"
|
1013
|
+
assert_path_not_exist stub_exe, "gem executable must not exist"
|
962
1014
|
true
|
963
1015
|
end
|
964
1016
|
|
965
1017
|
Gem.post_install do
|
966
|
-
assert_path_exist cache_file,
|
1018
|
+
assert_path_exist cache_file, "cache file must exist"
|
967
1019
|
end
|
968
1020
|
|
969
1021
|
@newspec = nil
|
@@ -975,15 +1027,15 @@ gem 'other', version
|
|
975
1027
|
|
976
1028
|
assert_equal @spec, @newspec
|
977
1029
|
assert_path_exist gemdir
|
978
|
-
assert_path_exist stub_exe,
|
1030
|
+
assert_path_exist stub_exe, "gem executable must exist"
|
979
1031
|
|
980
|
-
exe = File.join gemdir,
|
1032
|
+
exe = File.join gemdir, "bin", "executable"
|
981
1033
|
assert_path_exist exe
|
982
1034
|
|
983
1035
|
exe_mode = File.stat(exe).mode & 0111
|
984
1036
|
assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform?
|
985
1037
|
|
986
|
-
assert_path_exist File.join gemdir,
|
1038
|
+
assert_path_exist File.join gemdir, "lib", "code.rb"
|
987
1039
|
|
988
1040
|
assert_path_exist rakefile
|
989
1041
|
|
@@ -1000,7 +1052,7 @@ gem 'other', version
|
|
1000
1052
|
|
1001
1053
|
installer.wrappers = true
|
1002
1054
|
|
1003
|
-
gemdir = File.join @gemhome,
|
1055
|
+
gemdir = File.join @gemhome, "gems", @spec.full_name
|
1004
1056
|
|
1005
1057
|
@newspec = nil
|
1006
1058
|
build_rake_in do
|
@@ -1009,7 +1061,7 @@ gem 'other', version
|
|
1009
1061
|
end
|
1010
1062
|
end
|
1011
1063
|
|
1012
|
-
exe = File.join gemdir,
|
1064
|
+
exe = File.join gemdir, "bin", "executable"
|
1013
1065
|
|
1014
1066
|
e = assert_raise RuntimeError do
|
1015
1067
|
instance_eval File.read(exe)
|
@@ -1023,10 +1075,10 @@ gem 'other', version
|
|
1023
1075
|
|
1024
1076
|
# build old version that has a bin file
|
1025
1077
|
installer = util_setup_gem do |spec|
|
1026
|
-
File.open File.join(
|
1078
|
+
File.open File.join("bin", "executable"), "w" do |f|
|
1027
1079
|
f.puts "require 'code'"
|
1028
1080
|
end
|
1029
|
-
File.open File.join(
|
1081
|
+
File.open File.join("lib", "code.rb"), "w" do |f|
|
1030
1082
|
f.puts 'raise "I have an executable"'
|
1031
1083
|
end
|
1032
1084
|
end
|
@@ -1038,15 +1090,15 @@ gem 'other', version
|
|
1038
1090
|
end
|
1039
1091
|
end
|
1040
1092
|
|
1041
|
-
old_bin_file = File.join installer.bin_dir,
|
1093
|
+
old_bin_file = File.join installer.bin_dir, "executable"
|
1042
1094
|
|
1043
1095
|
# build new version that doesn't have a bin file
|
1044
1096
|
installer = util_setup_gem do |spec|
|
1045
|
-
FileUtils.rm File.join(
|
1046
|
-
spec.files.delete File.join(
|
1047
|
-
spec.executables.delete
|
1097
|
+
FileUtils.rm File.join("bin", "executable")
|
1098
|
+
spec.files.delete File.join("bin", "executable")
|
1099
|
+
spec.executables.delete "executable"
|
1048
1100
|
spec.version = @spec.version.bump
|
1049
|
-
File.open File.join(
|
1101
|
+
File.open File.join("lib", "code.rb"), "w" do |f|
|
1050
1102
|
f.puts 'raise "I do not have an executable"'
|
1051
1103
|
end
|
1052
1104
|
end
|
@@ -1063,7 +1115,7 @@ gem 'other', version
|
|
1063
1115
|
|
1064
1116
|
# We expect the bin stub to activate the version that actually contains
|
1065
1117
|
# the binstub.
|
1066
|
-
assert_match(
|
1118
|
+
assert_match("I have an executable", e.message)
|
1067
1119
|
end
|
1068
1120
|
|
1069
1121
|
def test_install_creates_binstub_that_understand_version
|
@@ -1078,7 +1130,7 @@ gem 'other', version
|
|
1078
1130
|
end
|
1079
1131
|
end
|
1080
1132
|
|
1081
|
-
exe = File.join @gemhome,
|
1133
|
+
exe = File.join @gemhome, "bin", "executable"
|
1082
1134
|
|
1083
1135
|
ARGV.unshift "_3.0_"
|
1084
1136
|
|
@@ -1096,17 +1148,17 @@ gem 'other', version
|
|
1096
1148
|
end
|
1097
1149
|
|
1098
1150
|
def test_install_creates_binstub_that_prefers_user_installed_gem_to_default
|
1099
|
-
default_spec = new_default_spec(
|
1100
|
-
default_spec.executables =
|
1151
|
+
default_spec = new_default_spec("default", "2", nil, "exe/executable")
|
1152
|
+
default_spec.executables = "executable"
|
1101
1153
|
install_default_gems default_spec
|
1102
1154
|
|
1103
|
-
exe = File.join @gemhome,
|
1155
|
+
exe = File.join @gemhome, "bin", "executable"
|
1104
1156
|
|
1105
1157
|
assert_path_exist exe, "default gem's executable not installed"
|
1106
1158
|
|
1107
1159
|
installer = util_setup_installer do |spec|
|
1108
|
-
spec.name =
|
1109
|
-
spec.version =
|
1160
|
+
spec.name = "default"
|
1161
|
+
spec.version = "2"
|
1110
1162
|
end
|
1111
1163
|
|
1112
1164
|
util_clear_gems
|
@@ -1139,7 +1191,7 @@ gem 'other', version
|
|
1139
1191
|
end
|
1140
1192
|
end
|
1141
1193
|
|
1142
|
-
exe = File.join @gemhome,
|
1194
|
+
exe = File.join @gemhome, "bin", "executable"
|
1143
1195
|
|
1144
1196
|
extra_arg = "\xE4pfel".dup.force_encoding("UTF-8")
|
1145
1197
|
ARGV.unshift extra_arg
|
@@ -1166,16 +1218,16 @@ gem 'other', version
|
|
1166
1218
|
end
|
1167
1219
|
end
|
1168
1220
|
|
1169
|
-
gemdir = File.join(@gemhome,
|
1170
|
-
assert_path_exist File.join gemdir,
|
1221
|
+
gemdir = File.join(@gemhome, "gems", @spec.full_name)
|
1222
|
+
assert_path_exist File.join gemdir, "lib", "code.rb"
|
1171
1223
|
|
1172
1224
|
installer = util_setup_installer
|
1173
1225
|
|
1174
1226
|
# Morph spec to have lib/other.rb instead of code.rb and recreate
|
1175
|
-
@spec.files = File.join(
|
1227
|
+
@spec.files = File.join("lib", "other.rb")
|
1176
1228
|
Dir.chdir @tempdir do
|
1177
|
-
File.open File.join(
|
1178
|
-
f.puts
|
1229
|
+
File.open File.join("lib", "other.rb"), "w" do |f|
|
1230
|
+
f.puts "1"
|
1179
1231
|
end
|
1180
1232
|
|
1181
1233
|
use_ui ui do
|
@@ -1190,14 +1242,14 @@ gem 'other', version
|
|
1190
1242
|
end
|
1191
1243
|
end
|
1192
1244
|
|
1193
|
-
assert_path_exist File.join gemdir,
|
1194
|
-
assert_path_not_exist File.join gemdir,
|
1245
|
+
assert_path_exist File.join gemdir, "lib", "other.rb"
|
1246
|
+
assert_path_not_exist File.join gemdir, "lib", "code.rb",
|
1195
1247
|
"code.rb from prior install of same gem shouldn't remain here"
|
1196
1248
|
end
|
1197
1249
|
|
1198
1250
|
def test_install_force
|
1199
|
-
_, missing_dep_gem = util_gem
|
1200
|
-
s.add_dependency
|
1251
|
+
_, missing_dep_gem = util_gem "missing_dep", "1" do |s|
|
1252
|
+
s.add_dependency "doesnt_exist", "1"
|
1201
1253
|
end
|
1202
1254
|
|
1203
1255
|
use_ui @ui do
|
@@ -1205,12 +1257,12 @@ gem 'other', version
|
|
1205
1257
|
installer.install
|
1206
1258
|
end
|
1207
1259
|
|
1208
|
-
gem_dir = File.join(@gemhome,
|
1260
|
+
gem_dir = File.join(@gemhome, "gems", "missing_dep-1")
|
1209
1261
|
assert_path_exist gem_dir
|
1210
1262
|
end
|
1211
1263
|
|
1212
1264
|
def test_install_build_root
|
1213
|
-
build_root = File.join(@tempdir,
|
1265
|
+
build_root = File.join(@tempdir, "build_root")
|
1214
1266
|
|
1215
1267
|
@gem = setup_base_gem
|
1216
1268
|
installer = Gem::Installer.at @gem, :build_root => build_root
|
@@ -1221,22 +1273,22 @@ gem 'other', version
|
|
1221
1273
|
def test_install_missing_dirs
|
1222
1274
|
installer = setup_base_installer
|
1223
1275
|
|
1224
|
-
FileUtils.rm_rf File.join(Gem.dir,
|
1225
|
-
FileUtils.rm_rf File.join(Gem.dir,
|
1276
|
+
FileUtils.rm_rf File.join(Gem.dir, "doc")
|
1277
|
+
FileUtils.rm_rf File.join(Gem.dir, "specifications")
|
1226
1278
|
|
1227
1279
|
use_ui @ui do
|
1228
1280
|
installer.install
|
1229
1281
|
end
|
1230
1282
|
|
1231
|
-
assert_directory_exists File.join(Gem.dir,
|
1232
|
-
assert_directory_exists File.join(Gem.dir,
|
1283
|
+
assert_directory_exists File.join(Gem.dir, "doc")
|
1284
|
+
assert_directory_exists File.join(Gem.dir, "specifications")
|
1233
1285
|
|
1234
|
-
assert_path_exist File.join @gemhome,
|
1235
|
-
assert_path_exist File.join @gemhome,
|
1286
|
+
assert_path_exist File.join @gemhome, "cache", @spec.file_name
|
1287
|
+
assert_path_exist File.join @gemhome, "specifications", @spec.spec_name
|
1236
1288
|
end
|
1237
1289
|
|
1238
1290
|
def test_install_post_build_false
|
1239
|
-
@spec = util_spec
|
1291
|
+
@spec = util_spec "a"
|
1240
1292
|
|
1241
1293
|
util_build_gem @spec
|
1242
1294
|
|
@@ -1256,10 +1308,10 @@ gem 'other', version
|
|
1256
1308
|
assert_equal "post-build hook at #{location} failed for a-2", e.message
|
1257
1309
|
end
|
1258
1310
|
|
1259
|
-
spec_file = File.join @gemhome,
|
1311
|
+
spec_file = File.join @gemhome, "specifications", @spec.spec_name
|
1260
1312
|
assert_path_not_exist spec_file
|
1261
1313
|
|
1262
|
-
gem_dir = File.join @gemhome,
|
1314
|
+
gem_dir = File.join @gemhome, "gems", @spec.full_name
|
1263
1315
|
assert_path_not_exist gem_dir
|
1264
1316
|
end
|
1265
1317
|
|
@@ -1274,15 +1326,15 @@ gem 'other', version
|
|
1274
1326
|
installer.install
|
1275
1327
|
end
|
1276
1328
|
|
1277
|
-
spec_file = File.join @gemhome,
|
1329
|
+
spec_file = File.join @gemhome, "specifications", @spec.spec_name
|
1278
1330
|
assert_path_exist spec_file
|
1279
1331
|
|
1280
|
-
gem_dir = File.join @gemhome,
|
1332
|
+
gem_dir = File.join @gemhome, "gems", @spec.full_name
|
1281
1333
|
assert_path_exist gem_dir
|
1282
1334
|
end
|
1283
1335
|
|
1284
1336
|
def test_install_pre_install_false
|
1285
|
-
@spec = util_spec
|
1337
|
+
@spec = util_spec "a"
|
1286
1338
|
|
1287
1339
|
util_build_gem @spec
|
1288
1340
|
|
@@ -1302,7 +1354,7 @@ gem 'other', version
|
|
1302
1354
|
assert_equal "pre-install hook at #{location} failed for a-2", e.message
|
1303
1355
|
end
|
1304
1356
|
|
1305
|
-
spec_file = File.join @gemhome,
|
1357
|
+
spec_file = File.join @gemhome, "specifications", @spec.spec_name
|
1306
1358
|
assert_path_not_exist spec_file
|
1307
1359
|
end
|
1308
1360
|
|
@@ -1317,13 +1369,13 @@ gem 'other', version
|
|
1317
1369
|
installer.install
|
1318
1370
|
end
|
1319
1371
|
|
1320
|
-
spec_file = File.join @gemhome,
|
1372
|
+
spec_file = File.join @gemhome, "specifications", @spec.spec_name
|
1321
1373
|
assert_path_exist spec_file
|
1322
1374
|
end
|
1323
1375
|
|
1324
1376
|
def test_install_with_message
|
1325
1377
|
@spec = setup_base_spec
|
1326
|
-
@spec.post_install_message =
|
1378
|
+
@spec.post_install_message = "I am a shiny gem!"
|
1327
1379
|
|
1328
1380
|
use_ui @ui do
|
1329
1381
|
path = Gem::Package.build @spec
|
@@ -1337,7 +1389,7 @@ gem 'other', version
|
|
1337
1389
|
|
1338
1390
|
def test_install_with_skipped_message
|
1339
1391
|
@spec = setup_base_spec
|
1340
|
-
@spec.post_install_message =
|
1392
|
+
@spec.post_install_message = "I am a shiny gem!"
|
1341
1393
|
|
1342
1394
|
use_ui @ui do
|
1343
1395
|
path = Gem::Package.build @spec
|
@@ -1370,7 +1422,7 @@ gem 'other', version
|
|
1370
1422
|
installer.install
|
1371
1423
|
end
|
1372
1424
|
|
1373
|
-
expected_makefile = File.join gemhome2,
|
1425
|
+
expected_makefile = File.join gemhome2, "gems", @spec.full_name, "Makefile"
|
1374
1426
|
|
1375
1427
|
assert_path_exist expected_makefile
|
1376
1428
|
end
|
@@ -1435,11 +1487,11 @@ gem 'other', version
|
|
1435
1487
|
installer.install
|
1436
1488
|
end
|
1437
1489
|
|
1438
|
-
expected_makefile = File.join Gem.user_dir,
|
1490
|
+
expected_makefile = File.join Gem.user_dir, "gems", @spec.full_name, "Makefile"
|
1439
1491
|
|
1440
1492
|
assert_path_exist expected_makefile
|
1441
1493
|
assert_path_exist expected_extension_dir
|
1442
|
-
assert_path_not_exist File.join expected_extension_dir,
|
1494
|
+
assert_path_not_exist File.join expected_extension_dir, "gem_make.out"
|
1443
1495
|
end
|
1444
1496
|
|
1445
1497
|
def test_find_lib_file_after_install
|
@@ -1469,7 +1521,7 @@ gem 'other', version
|
|
1469
1521
|
end
|
1470
1522
|
|
1471
1523
|
Dir.mkdir File.join(@tempdir, "lib")
|
1472
|
-
write_file File.join(@tempdir,
|
1524
|
+
write_file File.join(@tempdir, "lib", "b.rb") do |io|
|
1473
1525
|
io.write "# b.rb"
|
1474
1526
|
end
|
1475
1527
|
|
@@ -1483,14 +1535,14 @@ gem 'other', version
|
|
1483
1535
|
end
|
1484
1536
|
|
1485
1537
|
expected = File.join @spec.full_require_paths.find {|path|
|
1486
|
-
File.exist? File.join path,
|
1487
|
-
},
|
1488
|
-
assert_equal expected, @spec.matches_for_glob(
|
1538
|
+
File.exist? File.join path, "b.rb"
|
1539
|
+
}, "b.rb"
|
1540
|
+
assert_equal expected, @spec.matches_for_glob("b.rb").first
|
1489
1541
|
end
|
1490
1542
|
|
1491
1543
|
def test_install_extension_and_script
|
1492
1544
|
pend "Makefile creation crashes on jruby" if Gem.java_platform?
|
1493
|
-
pend
|
1545
|
+
pend "terminates on mswin" if vc_windows? && ruby_repo?
|
1494
1546
|
|
1495
1547
|
@spec = setup_base_spec
|
1496
1548
|
@spec.extensions << "extconf.rb"
|
@@ -1556,7 +1608,7 @@ gem 'other', version
|
|
1556
1608
|
write_file File.join(@tempdir, file)
|
1557
1609
|
end
|
1558
1610
|
|
1559
|
-
so = File.join(@spec.
|
1611
|
+
so = File.join(@spec.extension_dir, "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}")
|
1560
1612
|
assert_path_not_exist so
|
1561
1613
|
use_ui @ui do
|
1562
1614
|
path = Gem::Package.build @spec
|
@@ -1566,30 +1618,65 @@ gem 'other', version
|
|
1566
1618
|
end
|
1567
1619
|
assert_path_exist so
|
1568
1620
|
rescue
|
1569
|
-
puts
|
1570
|
-
puts File.read File.join(@gemhome,
|
1571
|
-
puts
|
1621
|
+
puts "-" * 78
|
1622
|
+
puts File.read File.join(@gemhome, "gems", "a-2", "Makefile")
|
1623
|
+
puts "-" * 78
|
1572
1624
|
|
1573
|
-
path = File.join(@gemhome,
|
1625
|
+
path = File.join(@gemhome, "gems", "a-2", "gem_make.out")
|
1574
1626
|
|
1575
1627
|
if File.exist?(path)
|
1576
1628
|
puts File.read(path)
|
1577
|
-
puts
|
1629
|
+
puts "-" * 78
|
1578
1630
|
end
|
1579
1631
|
|
1580
1632
|
raise
|
1581
1633
|
end
|
1582
1634
|
end
|
1583
1635
|
|
1636
|
+
def test_install_extension_clean_intermediate_files
|
1637
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1638
|
+
@spec = setup_base_spec
|
1639
|
+
@spec.require_paths = ["."]
|
1640
|
+
@spec.extensions << "extconf.rb"
|
1641
|
+
|
1642
|
+
File.write File.join(@tempdir, "extconf.rb"), <<-RUBY
|
1643
|
+
require "mkmf"
|
1644
|
+
CONFIG['CC'] = '$(TOUCH) $@ ||'
|
1645
|
+
CONFIG['LDSHARED'] = '$(TOUCH) $@ ||'
|
1646
|
+
$ruby = '#{Gem.ruby}'
|
1647
|
+
create_makefile("#{@spec.name}")
|
1648
|
+
RUBY
|
1649
|
+
|
1650
|
+
# empty depend file for no auto dependencies
|
1651
|
+
@spec.files += %W[depend #{@spec.name}.c].each do |file|
|
1652
|
+
write_file File.join(@tempdir, file)
|
1653
|
+
end
|
1654
|
+
|
1655
|
+
shared_object = "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}"
|
1656
|
+
extension_file = File.join @spec.extension_dir, shared_object
|
1657
|
+
intermediate_file = File.join @spec.gem_dir, shared_object
|
1658
|
+
|
1659
|
+
assert_path_not_exist extension_file, "no before installing"
|
1660
|
+
use_ui @ui do
|
1661
|
+
path = Gem::Package.build @spec
|
1662
|
+
|
1663
|
+
installer = Gem::Installer.at path
|
1664
|
+
installer.install
|
1665
|
+
end
|
1666
|
+
|
1667
|
+
assert_path_exist extension_file, "installed"
|
1668
|
+
assert_path_not_exist intermediate_file
|
1669
|
+
end
|
1670
|
+
|
1584
1671
|
def test_installation_satisfies_dependency_eh
|
1585
1672
|
installer = setup_base_installer
|
1586
1673
|
|
1587
|
-
util_spec
|
1674
|
+
util_spec "a"
|
1588
1675
|
|
1589
|
-
dep = Gem::Dependency.new
|
1676
|
+
dep = Gem::Dependency.new "a", ">= 2"
|
1590
1677
|
assert installer.installation_satisfies_dependency?(dep)
|
1591
1678
|
|
1592
|
-
dep = Gem::Dependency.new
|
1679
|
+
dep = Gem::Dependency.new "a", "> 2"
|
1593
1680
|
refute installer.installation_satisfies_dependency?(dep)
|
1594
1681
|
end
|
1595
1682
|
|
@@ -1598,15 +1685,15 @@ gem 'other', version
|
|
1598
1685
|
installer.options[:development] = true
|
1599
1686
|
installer.options[:dev_shallow] = true
|
1600
1687
|
|
1601
|
-
util_spec
|
1688
|
+
util_spec "a"
|
1602
1689
|
|
1603
|
-
dep = Gem::Dependency.new
|
1690
|
+
dep = Gem::Dependency.new "a", :development
|
1604
1691
|
assert installer.installation_satisfies_dependency?(dep)
|
1605
1692
|
end
|
1606
1693
|
|
1607
1694
|
def test_pre_install_checks_dependencies
|
1608
1695
|
installer = setup_base_installer
|
1609
|
-
@spec.add_dependency
|
1696
|
+
@spec.add_dependency "b", "> 5"
|
1610
1697
|
installer = util_setup_gem
|
1611
1698
|
installer.force = false
|
1612
1699
|
|
@@ -1619,7 +1706,7 @@ gem 'other', version
|
|
1619
1706
|
|
1620
1707
|
def test_pre_install_checks_dependencies_ignore
|
1621
1708
|
installer = util_setup_installer
|
1622
|
-
@spec.add_dependency
|
1709
|
+
@spec.add_dependency "b", "> 5"
|
1623
1710
|
installer.ignore_dependencies = true
|
1624
1711
|
|
1625
1712
|
build_rake_in do
|
@@ -1633,16 +1720,16 @@ gem 'other', version
|
|
1633
1720
|
gemhome2 = "#{@gemhome}2"
|
1634
1721
|
|
1635
1722
|
@gem = setup_base_gem
|
1636
|
-
@spec.add_dependency
|
1723
|
+
@spec.add_dependency "d"
|
1637
1724
|
|
1638
|
-
quick_gem
|
1725
|
+
quick_gem "d", 2
|
1639
1726
|
|
1640
1727
|
gem = File.join @gemhome, @spec.file_name
|
1641
1728
|
|
1642
1729
|
FileUtils.mv @gemhome, gemhome2
|
1643
1730
|
FileUtils.mkdir @gemhome
|
1644
1731
|
|
1645
|
-
FileUtils.mv File.join(gemhome2,
|
1732
|
+
FileUtils.mv File.join(gemhome2, "cache", @spec.file_name), gem
|
1646
1733
|
|
1647
1734
|
# Don't leak any already activated gems into the installer, require
|
1648
1735
|
# that it work everything out on it's own.
|
@@ -1658,7 +1745,7 @@ gem 'other', version
|
|
1658
1745
|
end
|
1659
1746
|
|
1660
1747
|
def test_pre_install_checks_malicious_name
|
1661
|
-
spec = util_spec
|
1748
|
+
spec = util_spec "../malicious", "1"
|
1662
1749
|
def spec.full_name # so the spec is buildable
|
1663
1750
|
"malicious-1"
|
1664
1751
|
end
|
@@ -1666,19 +1753,19 @@ gem 'other', version
|
|
1666
1753
|
|
1667
1754
|
util_build_gem spec
|
1668
1755
|
|
1669
|
-
gem = File.join(@gemhome,
|
1756
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1670
1757
|
|
1671
1758
|
use_ui @ui do
|
1672
1759
|
installer = Gem::Installer.at gem
|
1673
1760
|
e = assert_raise Gem::InstallError do
|
1674
1761
|
installer.pre_install_checks
|
1675
1762
|
end
|
1676
|
-
assert_equal
|
1763
|
+
assert_equal "#<Gem::Specification name=../malicious version=1> has an invalid name", e.message
|
1677
1764
|
end
|
1678
1765
|
end
|
1679
1766
|
|
1680
1767
|
def test_pre_install_checks_malicious_name_before_eval
|
1681
|
-
spec = util_spec "malicious\n::Object.const_set(:FROM_EVAL, true)#",
|
1768
|
+
spec = util_spec "malicious\n::Object.const_set(:FROM_EVAL, true)#", "1"
|
1682
1769
|
def spec.full_name # so the spec is buildable
|
1683
1770
|
"malicious-1"
|
1684
1771
|
end
|
@@ -1686,7 +1773,7 @@ gem 'other', version
|
|
1686
1773
|
|
1687
1774
|
util_build_gem spec
|
1688
1775
|
|
1689
|
-
gem = File.join(@gemhome,
|
1776
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1690
1777
|
|
1691
1778
|
use_ui @ui do
|
1692
1779
|
installer = Gem::Installer.at gem
|
@@ -1699,7 +1786,7 @@ gem 'other', version
|
|
1699
1786
|
end
|
1700
1787
|
|
1701
1788
|
def test_pre_install_checks_malicious_require_paths_before_eval
|
1702
|
-
spec = util_spec "malicious",
|
1789
|
+
spec = util_spec "malicious", "1"
|
1703
1790
|
def spec.full_name # so the spec is buildable
|
1704
1791
|
"malicious-1"
|
1705
1792
|
end
|
@@ -1708,7 +1795,7 @@ gem 'other', version
|
|
1708
1795
|
|
1709
1796
|
util_build_gem spec
|
1710
1797
|
|
1711
|
-
gem = File.join(@gemhome,
|
1798
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1712
1799
|
|
1713
1800
|
use_ui @ui do
|
1714
1801
|
installer = Gem::Installer.at gem
|
@@ -1722,7 +1809,7 @@ gem 'other', version
|
|
1722
1809
|
def test_pre_install_checks_malicious_extensions_before_eval
|
1723
1810
|
pend "mswin environment disallow to create file contained the carriage return code." if Gem.win_platform?
|
1724
1811
|
|
1725
|
-
spec = util_spec "malicious",
|
1812
|
+
spec = util_spec "malicious", "1"
|
1726
1813
|
def spec.full_name # so the spec is buildable
|
1727
1814
|
"malicious-1"
|
1728
1815
|
end
|
@@ -1731,7 +1818,7 @@ gem 'other', version
|
|
1731
1818
|
|
1732
1819
|
util_build_gem spec
|
1733
1820
|
|
1734
|
-
gem = File.join(@gemhome,
|
1821
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1735
1822
|
|
1736
1823
|
use_ui @ui do
|
1737
1824
|
installer = Gem::Installer.at gem
|
@@ -1743,7 +1830,7 @@ gem 'other', version
|
|
1743
1830
|
end
|
1744
1831
|
|
1745
1832
|
def test_pre_install_checks_malicious_specification_version_before_eval
|
1746
|
-
spec = util_spec "malicious",
|
1833
|
+
spec = util_spec "malicious", "1"
|
1747
1834
|
def spec.full_name # so the spec is buildable
|
1748
1835
|
"malicious-1"
|
1749
1836
|
end
|
@@ -1752,7 +1839,7 @@ gem 'other', version
|
|
1752
1839
|
|
1753
1840
|
util_build_gem spec
|
1754
1841
|
|
1755
|
-
gem = File.join(@gemhome,
|
1842
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1756
1843
|
|
1757
1844
|
use_ui @ui do
|
1758
1845
|
installer = Gem::Installer.at gem
|
@@ -1764,16 +1851,16 @@ gem 'other', version
|
|
1764
1851
|
end
|
1765
1852
|
|
1766
1853
|
def test_pre_install_checks_malicious_dependencies_before_eval
|
1767
|
-
spec = util_spec "malicious",
|
1854
|
+
spec = util_spec "malicious", "1"
|
1768
1855
|
def spec.full_name # so the spec is buildable
|
1769
1856
|
"malicious-1"
|
1770
1857
|
end
|
1771
1858
|
def spec.validate(*args); end
|
1772
|
-
spec.add_dependency "b\nfoo",
|
1859
|
+
spec.add_dependency "b\nfoo", "> 5"
|
1773
1860
|
|
1774
1861
|
util_build_gem spec
|
1775
1862
|
|
1776
|
-
gem = File.join(@gemhome,
|
1863
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1777
1864
|
|
1778
1865
|
use_ui @ui do
|
1779
1866
|
installer = Gem::Installer.at gem
|
@@ -1790,7 +1877,7 @@ gem 'other', version
|
|
1790
1877
|
|
1791
1878
|
installer = Gem::Installer.at(
|
1792
1879
|
gem_with_ill_formated_platform,
|
1793
|
-
:install_dir => @
|
1880
|
+
:install_dir => @gemhome,
|
1794
1881
|
:user_install => false,
|
1795
1882
|
:force => true
|
1796
1883
|
)
|
@@ -1811,7 +1898,7 @@ gem 'other', version
|
|
1811
1898
|
|
1812
1899
|
util_make_exec @spec, "#!/usr/bin/ruby"
|
1813
1900
|
|
1814
|
-
shebang = installer.shebang
|
1901
|
+
shebang = installer.shebang "executable"
|
1815
1902
|
|
1816
1903
|
assert_equal "#!#{Gem.ruby}", shebang
|
1817
1904
|
end
|
@@ -1821,15 +1908,15 @@ gem 'other', version
|
|
1821
1908
|
installer = setup_base_installer
|
1822
1909
|
|
1823
1910
|
assert_nil installer.build_root
|
1824
|
-
assert_equal File.join(@gemhome,
|
1911
|
+
assert_equal File.join(@gemhome, "bin"), installer.bin_dir
|
1825
1912
|
assert_equal @gemhome, installer.gem_home
|
1826
1913
|
end
|
1827
1914
|
|
1828
1915
|
def test_process_options_build_root
|
1829
|
-
build_root = File.join @tempdir,
|
1830
|
-
bin_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/,
|
1831
|
-
gem_home = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/,
|
1832
|
-
plugins_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/,
|
1916
|
+
build_root = File.join @tempdir, "build_root"
|
1917
|
+
bin_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""), "bin")
|
1918
|
+
gem_home = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""))
|
1919
|
+
plugins_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""), "plugins")
|
1833
1920
|
|
1834
1921
|
@gem = setup_base_gem
|
1835
1922
|
installer = use_ui(@ui) { Gem::Installer.at @gem, :build_root => build_root }
|
@@ -1848,24 +1935,24 @@ gem 'other', version
|
|
1848
1935
|
end
|
1849
1936
|
|
1850
1937
|
def test_shebang_arguments
|
1851
|
-
load_relative
|
1938
|
+
load_relative "no" do
|
1852
1939
|
installer = setup_base_installer
|
1853
1940
|
|
1854
1941
|
util_make_exec @spec, "#!/usr/bin/ruby -ws"
|
1855
1942
|
|
1856
|
-
shebang = installer.shebang
|
1943
|
+
shebang = installer.shebang "executable"
|
1857
1944
|
|
1858
1945
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
1859
1946
|
end
|
1860
1947
|
end
|
1861
1948
|
|
1862
1949
|
def test_shebang_arguments_with_load_relative
|
1863
|
-
load_relative
|
1950
|
+
load_relative "yes" do
|
1864
1951
|
installer = setup_base_installer
|
1865
1952
|
|
1866
1953
|
util_make_exec @spec, "#!/usr/bin/ruby -ws"
|
1867
1954
|
|
1868
|
-
shebang = installer.shebang
|
1955
|
+
shebang = installer.shebang "executable"
|
1869
1956
|
|
1870
1957
|
shebang_lines = shebang.split "\n"
|
1871
1958
|
|
@@ -1875,47 +1962,47 @@ gem 'other', version
|
|
1875
1962
|
end
|
1876
1963
|
|
1877
1964
|
def test_shebang_empty
|
1878
|
-
load_relative
|
1965
|
+
load_relative "no" do
|
1879
1966
|
installer = setup_base_installer
|
1880
1967
|
|
1881
|
-
util_make_exec @spec,
|
1968
|
+
util_make_exec @spec, ""
|
1882
1969
|
|
1883
|
-
shebang = installer.shebang
|
1970
|
+
shebang = installer.shebang "executable"
|
1884
1971
|
assert_equal "#!#{Gem.ruby}", shebang
|
1885
1972
|
end
|
1886
1973
|
end
|
1887
1974
|
|
1888
1975
|
def test_shebang_env
|
1889
|
-
load_relative
|
1976
|
+
load_relative "no" do
|
1890
1977
|
installer = setup_base_installer
|
1891
1978
|
|
1892
1979
|
util_make_exec @spec, "#!/usr/bin/env ruby"
|
1893
1980
|
|
1894
|
-
shebang = installer.shebang
|
1981
|
+
shebang = installer.shebang "executable"
|
1895
1982
|
|
1896
1983
|
assert_equal "#!#{Gem.ruby}", shebang
|
1897
1984
|
end
|
1898
1985
|
end
|
1899
1986
|
|
1900
1987
|
def test_shebang_env_arguments
|
1901
|
-
load_relative
|
1988
|
+
load_relative "no" do
|
1902
1989
|
installer = setup_base_installer
|
1903
1990
|
|
1904
1991
|
util_make_exec @spec, "#!/usr/bin/env ruby -ws"
|
1905
1992
|
|
1906
|
-
shebang = installer.shebang
|
1993
|
+
shebang = installer.shebang "executable"
|
1907
1994
|
|
1908
1995
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
1909
1996
|
end
|
1910
1997
|
end
|
1911
1998
|
|
1912
1999
|
def test_shebang_env_arguments_with_load_relative
|
1913
|
-
load_relative
|
2000
|
+
load_relative "yes" do
|
1914
2001
|
installer = setup_base_installer
|
1915
2002
|
|
1916
2003
|
util_make_exec @spec, "#!/usr/bin/env ruby -ws"
|
1917
2004
|
|
1918
|
-
shebang = installer.shebang
|
2005
|
+
shebang = installer.shebang "executable"
|
1919
2006
|
|
1920
2007
|
shebang_lines = shebang.split "\n"
|
1921
2008
|
|
@@ -1927,10 +2014,10 @@ gem 'other', version
|
|
1927
2014
|
def test_shebang_env_shebang
|
1928
2015
|
installer = setup_base_installer
|
1929
2016
|
|
1930
|
-
util_make_exec @spec,
|
2017
|
+
util_make_exec @spec, ""
|
1931
2018
|
installer.env_shebang = true
|
1932
2019
|
|
1933
|
-
shebang = installer.shebang
|
2020
|
+
shebang = installer.shebang "executable"
|
1934
2021
|
|
1935
2022
|
bin_env = get_bin_env
|
1936
2023
|
|
@@ -1939,36 +2026,36 @@ gem 'other', version
|
|
1939
2026
|
end
|
1940
2027
|
|
1941
2028
|
def test_shebang_nested
|
1942
|
-
load_relative
|
2029
|
+
load_relative "no" do
|
1943
2030
|
installer = setup_base_installer
|
1944
2031
|
|
1945
2032
|
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby"
|
1946
2033
|
|
1947
|
-
shebang = installer.shebang
|
2034
|
+
shebang = installer.shebang "executable"
|
1948
2035
|
|
1949
2036
|
assert_equal "#!#{Gem.ruby}", shebang
|
1950
2037
|
end
|
1951
2038
|
end
|
1952
2039
|
|
1953
2040
|
def test_shebang_nested_arguments
|
1954
|
-
load_relative
|
2041
|
+
load_relative "no" do
|
1955
2042
|
installer = setup_base_installer
|
1956
2043
|
|
1957
2044
|
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby -ws"
|
1958
2045
|
|
1959
|
-
shebang = installer.shebang
|
2046
|
+
shebang = installer.shebang "executable"
|
1960
2047
|
|
1961
2048
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
1962
2049
|
end
|
1963
2050
|
end
|
1964
2051
|
|
1965
2052
|
def test_shebang_nested_arguments_with_load_relative
|
1966
|
-
load_relative
|
2053
|
+
load_relative "yes" do
|
1967
2054
|
installer = setup_base_installer
|
1968
2055
|
|
1969
2056
|
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby -ws"
|
1970
2057
|
|
1971
|
-
shebang = installer.shebang
|
2058
|
+
shebang = installer.shebang "executable"
|
1972
2059
|
|
1973
2060
|
shebang_lines = shebang.split "\n"
|
1974
2061
|
|
@@ -1978,36 +2065,36 @@ gem 'other', version
|
|
1978
2065
|
end
|
1979
2066
|
|
1980
2067
|
def test_shebang_version
|
1981
|
-
load_relative
|
2068
|
+
load_relative "no" do
|
1982
2069
|
installer = setup_base_installer
|
1983
2070
|
|
1984
2071
|
util_make_exec @spec, "#!/usr/bin/ruby18"
|
1985
2072
|
|
1986
|
-
shebang = installer.shebang
|
2073
|
+
shebang = installer.shebang "executable"
|
1987
2074
|
|
1988
2075
|
assert_equal "#!#{Gem.ruby}", shebang
|
1989
2076
|
end
|
1990
2077
|
end
|
1991
2078
|
|
1992
2079
|
def test_shebang_version_arguments
|
1993
|
-
load_relative
|
2080
|
+
load_relative "no" do
|
1994
2081
|
installer = setup_base_installer
|
1995
2082
|
|
1996
2083
|
util_make_exec @spec, "#!/usr/bin/ruby18 -ws"
|
1997
2084
|
|
1998
|
-
shebang = installer.shebang
|
2085
|
+
shebang = installer.shebang "executable"
|
1999
2086
|
|
2000
2087
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
2001
2088
|
end
|
2002
2089
|
end
|
2003
2090
|
|
2004
2091
|
def test_shebang_version_arguments_with_load_relative
|
2005
|
-
load_relative
|
2092
|
+
load_relative "yes" do
|
2006
2093
|
installer = setup_base_installer
|
2007
2094
|
|
2008
2095
|
util_make_exec @spec, "#!/usr/bin/ruby18 -ws"
|
2009
2096
|
|
2010
|
-
shebang = installer.shebang
|
2097
|
+
shebang = installer.shebang "executable"
|
2011
2098
|
|
2012
2099
|
shebang_lines = shebang.split "\n"
|
2013
2100
|
|
@@ -2017,36 +2104,36 @@ gem 'other', version
|
|
2017
2104
|
end
|
2018
2105
|
|
2019
2106
|
def test_shebang_version_env
|
2020
|
-
load_relative
|
2107
|
+
load_relative "no" do
|
2021
2108
|
installer = setup_base_installer
|
2022
2109
|
|
2023
2110
|
util_make_exec @spec, "#!/usr/bin/env ruby18"
|
2024
2111
|
|
2025
|
-
shebang = installer.shebang
|
2112
|
+
shebang = installer.shebang "executable"
|
2026
2113
|
|
2027
2114
|
assert_equal "#!#{Gem.ruby}", shebang
|
2028
2115
|
end
|
2029
2116
|
end
|
2030
2117
|
|
2031
2118
|
def test_shebang_version_env_arguments
|
2032
|
-
load_relative
|
2119
|
+
load_relative "no" do
|
2033
2120
|
installer = setup_base_installer
|
2034
2121
|
|
2035
2122
|
util_make_exec @spec, "#!/usr/bin/env ruby18 -ws"
|
2036
2123
|
|
2037
|
-
shebang = installer.shebang
|
2124
|
+
shebang = installer.shebang "executable"
|
2038
2125
|
|
2039
2126
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
2040
2127
|
end
|
2041
2128
|
end
|
2042
2129
|
|
2043
2130
|
def test_shebang_version_env_arguments_with_load_relative
|
2044
|
-
load_relative
|
2131
|
+
load_relative "yes" do
|
2045
2132
|
installer = setup_base_installer
|
2046
2133
|
|
2047
2134
|
util_make_exec @spec, "#!/usr/bin/env ruby18 -ws"
|
2048
2135
|
|
2049
|
-
shebang = installer.shebang
|
2136
|
+
shebang = installer.shebang "executable"
|
2050
2137
|
|
2051
2138
|
shebang_lines = shebang.split "\n"
|
2052
2139
|
|
@@ -2059,13 +2146,13 @@ gem 'other', version
|
|
2059
2146
|
installer = setup_base_installer
|
2060
2147
|
|
2061
2148
|
conf = Gem::ConfigFile.new []
|
2062
|
-
conf[:custom_shebang] =
|
2149
|
+
conf[:custom_shebang] = "test"
|
2063
2150
|
|
2064
2151
|
Gem.configuration = conf
|
2065
2152
|
|
2066
2153
|
util_make_exec @spec, "#!/usr/bin/ruby"
|
2067
2154
|
|
2068
|
-
shebang = installer.shebang
|
2155
|
+
shebang = installer.shebang "executable"
|
2069
2156
|
|
2070
2157
|
assert_equal "#!test", shebang
|
2071
2158
|
end
|
@@ -2083,13 +2170,13 @@ gem 'other', version
|
|
2083
2170
|
|
2084
2171
|
bin_env = get_bin_env
|
2085
2172
|
conf = Gem::ConfigFile.new []
|
2086
|
-
conf[:custom_shebang] =
|
2173
|
+
conf[:custom_shebang] = "1 $env 2 $ruby 3 $exec 4 $name"
|
2087
2174
|
|
2088
2175
|
Gem.configuration = conf
|
2089
2176
|
|
2090
2177
|
util_make_exec @spec, "#!/usr/bin/ruby"
|
2091
2178
|
|
2092
|
-
shebang = installer.shebang
|
2179
|
+
shebang = installer.shebang "executable"
|
2093
2180
|
|
2094
2181
|
assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} 3 executable 4 a", shebang
|
2095
2182
|
end
|
@@ -2099,13 +2186,13 @@ gem 'other', version
|
|
2099
2186
|
|
2100
2187
|
bin_env = get_bin_env
|
2101
2188
|
conf = Gem::ConfigFile.new []
|
2102
|
-
conf[:custom_shebang] =
|
2189
|
+
conf[:custom_shebang] = "1 $env 2 $ruby 3 $exec"
|
2103
2190
|
|
2104
2191
|
Gem.configuration = conf
|
2105
2192
|
|
2106
2193
|
util_make_exec @spec, "#!/usr/bin/ruby -ws"
|
2107
2194
|
|
2108
|
-
shebang = installer.shebang
|
2195
|
+
shebang = installer.shebang "executable"
|
2109
2196
|
|
2110
2197
|
assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} -ws 3 executable", shebang
|
2111
2198
|
end
|
@@ -2113,14 +2200,14 @@ gem 'other', version
|
|
2113
2200
|
def test_unpack
|
2114
2201
|
installer = util_setup_installer
|
2115
2202
|
|
2116
|
-
dest = File.join @gemhome,
|
2203
|
+
dest = File.join @gemhome, "gems", @spec.full_name
|
2117
2204
|
|
2118
2205
|
Gem::Deprecate.skip_during do
|
2119
2206
|
installer.unpack dest
|
2120
2207
|
end
|
2121
2208
|
|
2122
|
-
assert_path_exist File.join dest,
|
2123
|
-
assert_path_exist File.join dest,
|
2209
|
+
assert_path_exist File.join dest, "lib", "code.rb"
|
2210
|
+
assert_path_exist File.join dest, "bin", "executable"
|
2124
2211
|
end
|
2125
2212
|
|
2126
2213
|
def test_write_build_info_file
|
@@ -2163,12 +2250,12 @@ gem 'other', version
|
|
2163
2250
|
|
2164
2251
|
assert_path_not_exist @spec.build_info_file
|
2165
2252
|
assert_path_exist \
|
2166
|
-
File.join("#{@gemhome}2",
|
2253
|
+
File.join("#{@gemhome}2", "build_info", "#{@spec.full_name}.info")
|
2167
2254
|
end
|
2168
2255
|
|
2169
2256
|
def test_write_cache_file
|
2170
2257
|
@gem = setup_base_gem
|
2171
|
-
cache_file = File.join @gemhome,
|
2258
|
+
cache_file = File.join @gemhome, "cache", @spec.file_name
|
2172
2259
|
gem = File.join @gemhome, @spec.file_name
|
2173
2260
|
|
2174
2261
|
FileUtils.mv cache_file, gem
|
@@ -2219,6 +2306,37 @@ gem 'other', version
|
|
2219
2306
|
assert_equal @spec, eval(File.read(@spec.spec_file))
|
2220
2307
|
end
|
2221
2308
|
|
2309
|
+
def test_leaves_no_empty_cached_spec_when_no_more_disk_space
|
2310
|
+
@spec = setup_base_spec
|
2311
|
+
FileUtils.rm @spec.spec_file
|
2312
|
+
assert_path_not_exist @spec.spec_file
|
2313
|
+
|
2314
|
+
@spec.files = %w[a.rb b.rb c.rb]
|
2315
|
+
|
2316
|
+
installer = Gem::Installer.for_spec @spec
|
2317
|
+
installer.gem_home = @gemhome
|
2318
|
+
|
2319
|
+
File.class_eval do
|
2320
|
+
alias_method :original_write, :write
|
2321
|
+
|
2322
|
+
def write(data)
|
2323
|
+
raise Errno::ENOSPC
|
2324
|
+
end
|
2325
|
+
end
|
2326
|
+
|
2327
|
+
assert_raise Errno::ENOSPC do
|
2328
|
+
installer.write_spec
|
2329
|
+
end
|
2330
|
+
|
2331
|
+
assert_path_not_exist @spec.spec_file
|
2332
|
+
ensure
|
2333
|
+
File.class_eval do
|
2334
|
+
remove_method :write
|
2335
|
+
alias_method :write, :original_write # rubocop:disable Lint/DuplicateMethods
|
2336
|
+
remove_method :original_write
|
2337
|
+
end
|
2338
|
+
end
|
2339
|
+
|
2222
2340
|
def test_dir
|
2223
2341
|
installer = setup_base_installer
|
2224
2342
|
|
@@ -2226,7 +2344,7 @@ gem 'other', version
|
|
2226
2344
|
end
|
2227
2345
|
|
2228
2346
|
def test_default_gem_loaded_from
|
2229
|
-
spec = util_spec
|
2347
|
+
spec = util_spec "a"
|
2230
2348
|
installer = Gem::Installer.for_spec spec, :install_as_default => true
|
2231
2349
|
installer.install
|
2232
2350
|
assert_predicate spec, :default_gem?
|
@@ -2235,7 +2353,7 @@ gem 'other', version
|
|
2235
2353
|
def test_default_gem_without_wrappers
|
2236
2354
|
installer = setup_base_installer
|
2237
2355
|
|
2238
|
-
FileUtils.rm_rf File.join(Gem.default_dir,
|
2356
|
+
FileUtils.rm_rf File.join(Gem.default_dir, "specifications")
|
2239
2357
|
|
2240
2358
|
installer.wrappers = false
|
2241
2359
|
installer.options[:install_as_default] = true
|
@@ -2245,20 +2363,20 @@ gem 'other', version
|
|
2245
2363
|
installer.install
|
2246
2364
|
end
|
2247
2365
|
|
2248
|
-
assert_directory_exists File.join(@spec.gem_dir,
|
2249
|
-
installed_exec = File.join @spec.gem_dir,
|
2366
|
+
assert_directory_exists File.join(@spec.gem_dir, "bin")
|
2367
|
+
installed_exec = File.join @spec.gem_dir, "bin", "executable"
|
2250
2368
|
assert_path_exist installed_exec
|
2251
2369
|
|
2252
|
-
assert_directory_exists File.join(Gem.default_dir,
|
2253
|
-
assert_directory_exists File.join(Gem.default_dir,
|
2370
|
+
assert_directory_exists File.join(Gem.default_dir, "specifications")
|
2371
|
+
assert_directory_exists File.join(Gem.default_dir, "specifications", "default")
|
2254
2372
|
|
2255
|
-
default_spec = eval File.read File.join(Gem.default_dir,
|
2373
|
+
default_spec = eval File.read File.join(Gem.default_dir, "specifications", "default", "a-2.gemspec")
|
2256
2374
|
assert_equal Gem::Version.new("2"), default_spec.version
|
2257
|
-
assert_equal [
|
2375
|
+
assert_equal ["bin/executable"], default_spec.files
|
2258
2376
|
|
2259
2377
|
assert_directory_exists util_inst_bindir
|
2260
2378
|
|
2261
|
-
installed_exec = File.join util_inst_bindir,
|
2379
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
2262
2380
|
assert_path_exist installed_exec
|
2263
2381
|
|
2264
2382
|
wrapper = File.read installed_exec
|
@@ -2284,7 +2402,7 @@ gem 'other', version
|
|
2284
2402
|
|
2285
2403
|
assert_directory_exists util_inst_bindir
|
2286
2404
|
|
2287
|
-
installed_exec = File.join util_inst_bindir,
|
2405
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
2288
2406
|
assert_path_exist installed_exec
|
2289
2407
|
|
2290
2408
|
wrapper = File.read installed_exec
|
@@ -2292,8 +2410,8 @@ gem 'other', version
|
|
2292
2410
|
end
|
2293
2411
|
|
2294
2412
|
def test_default_gem_with_exe_as_bindir
|
2295
|
-
@spec = quick_gem
|
2296
|
-
util_make_exec spec,
|
2413
|
+
@spec = quick_gem "c" do |spec|
|
2414
|
+
util_make_exec spec, "#!/usr/bin/ruby", "exe"
|
2297
2415
|
end
|
2298
2416
|
|
2299
2417
|
util_build_gem @spec
|
@@ -2309,16 +2427,16 @@ gem 'other', version
|
|
2309
2427
|
installer.install
|
2310
2428
|
end
|
2311
2429
|
|
2312
|
-
assert_directory_exists File.join(@spec.gem_dir,
|
2313
|
-
installed_exec = File.join @spec.gem_dir,
|
2430
|
+
assert_directory_exists File.join(@spec.gem_dir, "exe")
|
2431
|
+
installed_exec = File.join @spec.gem_dir, "exe", "executable"
|
2314
2432
|
assert_path_exist installed_exec
|
2315
2433
|
|
2316
|
-
assert_directory_exists File.join(Gem.default_dir,
|
2317
|
-
assert_directory_exists File.join(Gem.default_dir,
|
2434
|
+
assert_directory_exists File.join(Gem.default_dir, "specifications")
|
2435
|
+
assert_directory_exists File.join(Gem.default_dir, "specifications", "default")
|
2318
2436
|
|
2319
|
-
default_spec = eval File.read File.join(Gem.default_dir,
|
2437
|
+
default_spec = eval File.read File.join(Gem.default_dir, "specifications", "default", "c-2.gemspec")
|
2320
2438
|
assert_equal Gem::Version.new("2"), default_spec.version
|
2321
|
-
assert_equal [
|
2439
|
+
assert_equal ["exe/executable"], default_spec.files
|
2322
2440
|
end
|
2323
2441
|
|
2324
2442
|
def test_default_gem_to_specific_install_dir
|
@@ -2330,17 +2448,17 @@ gem 'other', version
|
|
2330
2448
|
installer.install
|
2331
2449
|
end
|
2332
2450
|
|
2333
|
-
assert_directory_exists File.join("#{@gemhome}2",
|
2334
|
-
assert_directory_exists File.join("#{@gemhome}2",
|
2451
|
+
assert_directory_exists File.join("#{@gemhome}2", "specifications")
|
2452
|
+
assert_directory_exists File.join("#{@gemhome}2", "specifications", "default")
|
2335
2453
|
|
2336
|
-
default_spec = eval File.read File.join("#{@gemhome}2",
|
2454
|
+
default_spec = eval File.read File.join("#{@gemhome}2", "specifications", "default", "a-2.gemspec")
|
2337
2455
|
assert_equal Gem::Version.new("2"), default_spec.version
|
2338
|
-
assert_equal [
|
2456
|
+
assert_equal ["bin/executable"], default_spec.files
|
2339
2457
|
end
|
2340
2458
|
|
2341
2459
|
def test_package_attribute
|
2342
|
-
gem = quick_gem
|
2343
|
-
util_make_exec spec,
|
2460
|
+
gem = quick_gem "c" do |spec|
|
2461
|
+
util_make_exec spec, "#!/usr/bin/ruby", "exe"
|
2344
2462
|
end
|
2345
2463
|
|
2346
2464
|
installer = util_installer(gem, @gemhome)
|
@@ -2349,8 +2467,8 @@ gem 'other', version
|
|
2349
2467
|
end
|
2350
2468
|
|
2351
2469
|
def test_gem_attribute
|
2352
|
-
gem = quick_gem
|
2353
|
-
util_make_exec spec,
|
2470
|
+
gem = quick_gem "c" do |spec|
|
2471
|
+
util_make_exec spec, "#!/usr/bin/ruby", "exe"
|
2354
2472
|
end
|
2355
2473
|
|
2356
2474
|
installer = util_installer(gem, @gemhome)
|
@@ -2361,14 +2479,14 @@ gem 'other', version
|
|
2361
2479
|
private
|
2362
2480
|
|
2363
2481
|
def util_execless
|
2364
|
-
@spec = util_spec
|
2482
|
+
@spec = util_spec "z"
|
2365
2483
|
util_build_gem @spec
|
2366
2484
|
|
2367
2485
|
util_installer @spec, @gemhome
|
2368
2486
|
end
|
2369
2487
|
|
2370
2488
|
def util_conflict_executable(wrappers)
|
2371
|
-
conflict = quick_gem
|
2489
|
+
conflict = quick_gem "conflict" do |spec|
|
2372
2490
|
util_make_exec spec
|
2373
2491
|
end
|
2374
2492
|
|
@@ -2384,11 +2502,11 @@ gem 'other', version
|
|
2384
2502
|
end
|
2385
2503
|
|
2386
2504
|
def load_relative(value)
|
2387
|
-
orig_LIBRUBY_RELATIVE = RbConfig::CONFIG[
|
2388
|
-
RbConfig::CONFIG[
|
2505
|
+
orig_LIBRUBY_RELATIVE = RbConfig::CONFIG["LIBRUBY_RELATIVE"]
|
2506
|
+
RbConfig::CONFIG["LIBRUBY_RELATIVE"] = value
|
2389
2507
|
|
2390
2508
|
yield
|
2391
2509
|
ensure
|
2392
|
-
RbConfig::CONFIG[
|
2510
|
+
RbConfig::CONFIG["LIBRUBY_RELATIVE"] = orig_LIBRUBY_RELATIVE
|
2393
2511
|
end
|
2394
2512
|
end
|