rubygems-update 3.0.3 → 3.4.7
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 +5556 -0
- data/CODE_OF_CONDUCT.md +62 -24
- data/CONTRIBUTING.md +111 -21
- data/MAINTAINERS.txt +1 -6
- data/Manifest.txt +209 -101
- data/POLICIES.md +65 -22
- data/README.md +23 -15
- data/UPGRADING.md +5 -81
- data/bin/gem +2 -16
- data/bin/update_rubygems +5 -5
- data/bundler/CHANGELOG.md +2619 -1256
- data/bundler/LICENSE.md +18 -19
- data/bundler/README.md +11 -12
- data/bundler/UPGRADING.md +222 -0
- data/bundler/bundler.gemspec +13 -33
- data/bundler/exe/bundle +26 -11
- data/bundler/exe/bundler +1 -1
- data/bundler/lib/bundler/.document +1 -0
- data/bundler/lib/bundler/build_metadata.rb +5 -13
- data/bundler/lib/bundler/capistrano.rb +4 -4
- data/bundler/lib/bundler/cli/add.rb +28 -16
- data/bundler/lib/bundler/cli/binstubs.rb +11 -3
- data/bundler/lib/bundler/cli/cache.rb +24 -17
- data/bundler/lib/bundler/cli/check.rb +5 -3
- data/bundler/lib/bundler/cli/clean.rb +1 -1
- data/bundler/lib/bundler/cli/common.rb +41 -13
- data/bundler/lib/bundler/cli/config.rb +170 -86
- data/bundler/lib/bundler/cli/console.rb +3 -3
- data/bundler/lib/bundler/cli/doctor.rb +27 -10
- data/bundler/lib/bundler/cli/exec.rb +8 -25
- data/bundler/lib/bundler/cli/fund.rb +36 -0
- data/bundler/lib/bundler/cli/gem.rb +261 -48
- data/bundler/lib/bundler/cli/info.rb +52 -8
- data/bundler/lib/bundler/cli/init.rb +7 -3
- data/bundler/lib/bundler/cli/inject.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +38 -66
- data/bundler/lib/bundler/cli/issue.rb +8 -7
- data/bundler/lib/bundler/cli/list.rb +19 -11
- data/bundler/lib/bundler/cli/lock.rb +11 -4
- data/bundler/lib/bundler/cli/open.rb +14 -9
- data/bundler/lib/bundler/cli/outdated.rb +152 -121
- data/bundler/lib/bundler/cli/platform.rb +2 -2
- data/bundler/lib/bundler/cli/plugin.rb +19 -2
- data/bundler/lib/bundler/cli/pristine.rb +6 -1
- data/bundler/lib/bundler/cli/remove.rb +1 -2
- data/bundler/lib/bundler/cli/show.rb +3 -3
- data/bundler/lib/bundler/cli/update.rb +49 -18
- data/bundler/lib/bundler/cli/viz.rb +1 -1
- data/bundler/lib/bundler/cli.rb +269 -165
- data/bundler/lib/bundler/compact_index_client/cache.rb +7 -24
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +58 -57
- data/bundler/lib/bundler/compact_index_client.rb +28 -18
- data/bundler/lib/bundler/constants.rb +1 -1
- data/bundler/lib/bundler/current_ruby.rb +26 -11
- data/bundler/lib/bundler/definition.rb +359 -441
- data/bundler/lib/bundler/dependency.rb +29 -71
- data/bundler/lib/bundler/deployment.rb +1 -1
- data/bundler/lib/bundler/digest.rb +71 -0
- data/bundler/lib/bundler/dsl.rb +84 -116
- data/bundler/lib/bundler/endpoint_specification.rb +20 -14
- data/bundler/lib/bundler/env.rb +10 -15
- data/bundler/lib/bundler/environment_preserver.rb +30 -3
- data/bundler/lib/bundler/errors.rb +31 -14
- data/bundler/lib/bundler/feature_flag.rb +13 -33
- data/bundler/lib/bundler/fetcher/base.rb +7 -9
- data/bundler/lib/bundler/fetcher/compact_index.rb +46 -39
- data/bundler/lib/bundler/fetcher/dependency.rb +2 -2
- data/bundler/lib/bundler/fetcher/downloader.rb +15 -12
- data/bundler/lib/bundler/fetcher/index.rb +4 -30
- data/bundler/lib/bundler/fetcher.rb +39 -41
- data/bundler/lib/bundler/force_platform.rb +18 -0
- data/bundler/lib/bundler/friendly_errors.rb +49 -54
- data/bundler/lib/bundler/gem_helper.rb +79 -43
- data/bundler/lib/bundler/gem_helpers.rb +44 -28
- data/bundler/lib/bundler/gem_tasks.rb +1 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +54 -99
- data/bundler/lib/bundler/graph.rb +5 -5
- data/bundler/lib/bundler/index.rb +14 -52
- data/bundler/lib/bundler/injector.rb +50 -16
- data/bundler/lib/bundler/inline.rb +28 -29
- data/bundler/lib/bundler/installer/gem_installer.rb +22 -23
- data/bundler/lib/bundler/installer/parallel_installer.rb +51 -51
- data/bundler/lib/bundler/installer/standalone.rb +62 -12
- data/bundler/lib/bundler/installer.rb +46 -97
- data/bundler/lib/bundler/lazy_specification.rb +88 -48
- data/bundler/lib/bundler/lockfile_generator.rb +3 -3
- data/bundler/lib/bundler/lockfile_parser.rb +30 -62
- data/bundler/{man → lib/bundler/man}/bundle-add.1 +29 -5
- data/bundler/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +22 -4
- data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +6 -4
- data/bundler/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
- data/bundler/lib/bundler/man/bundle-cache.1 +61 -0
- data/bundler/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +22 -15
- data/bundler/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-clean.1 +2 -2
- data/bundler/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-config.1 +78 -60
- data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +96 -85
- data/bundler/lib/bundler/man/bundle-console.1 +53 -0
- data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-exec.1 +6 -6
- data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +6 -6
- data/bundler/lib/bundler/man/bundle-gem.1 +105 -0
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +117 -0
- data/bundler/lib/bundler/man/bundle-help.1 +13 -0
- data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/bundler/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-init.1 +6 -2
- data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +3 -1
- data/bundler/{man → lib/bundler/man}/bundle-inject.1 +5 -2
- data/bundler/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
- data/bundler/{man → lib/bundler/man}/bundle-install.1 +42 -37
- data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +42 -38
- data/bundler/{man → lib/bundler/man}/bundle-list.1 +7 -7
- data/bundler/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
- data/bundler/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-open.1 +22 -2
- data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +9 -1
- data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +3 -10
- data/bundler/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +1 -10
- data/bundler/{man → lib/bundler/man}/bundle-platform.1 +16 -6
- data/bundler/{man/bundle-platform.ronn → 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/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-update.1 +8 -8
- data/bundler/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +8 -7
- data/bundler/lib/bundler/man/bundle-version.1 +35 -0
- data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/bundler/{man → lib/bundler/man}/bundle-viz.1 +4 -1
- data/bundler/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +2 -0
- data/bundler/{man → lib/bundler/man}/bundle.1 +17 -12
- data/bundler/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +14 -9
- data/bundler/lib/bundler/man/gemfile.5 +723 -0
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +112 -95
- data/bundler/lib/bundler/man/index.txt +29 -0
- data/bundler/lib/bundler/match_metadata.rb +13 -0
- data/bundler/lib/bundler/match_platform.rb +1 -2
- data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
- data/bundler/lib/bundler/mirror.rb +10 -12
- data/bundler/lib/bundler/plugin/api/source.rb +29 -15
- data/bundler/lib/bundler/plugin/api.rb +1 -1
- data/bundler/lib/bundler/plugin/dsl.rb +1 -1
- data/bundler/lib/bundler/plugin/index.rb +31 -8
- data/bundler/lib/bundler/plugin/installer/git.rb +0 -4
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -9
- data/bundler/lib/bundler/plugin/installer.rb +35 -22
- data/bundler/lib/bundler/plugin/source_list.rb +5 -1
- data/bundler/lib/bundler/plugin.rb +102 -42
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/remote_specification.rb +15 -8
- data/bundler/lib/bundler/resolver/base.rb +77 -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 +49 -73
- data/bundler/lib/bundler/resolver.rb +343 -300
- data/bundler/lib/bundler/retry.rb +4 -4
- data/bundler/lib/bundler/ruby_dsl.rb +1 -1
- data/bundler/lib/bundler/ruby_version.rb +9 -37
- data/bundler/lib/bundler/rubygems_ext.rb +235 -92
- data/bundler/lib/bundler/rubygems_gem_installer.rb +87 -21
- data/bundler/lib/bundler/rubygems_integration.rb +179 -515
- data/bundler/lib/bundler/runtime.rb +25 -40
- data/bundler/lib/bundler/self_manager.rb +168 -0
- data/bundler/lib/bundler/settings.rb +162 -118
- data/bundler/lib/bundler/setup.rb +11 -12
- data/bundler/lib/bundler/shared_helpers.rb +61 -102
- data/bundler/lib/bundler/similarity_detector.rb +3 -3
- data/bundler/lib/bundler/source/git/git_proxy.rb +257 -128
- data/bundler/lib/bundler/source/git.rb +84 -61
- data/bundler/lib/bundler/source/metadata.rb +9 -9
- data/bundler/lib/bundler/source/path/installer.rb +11 -32
- data/bundler/lib/bundler/source/path.rb +28 -17
- data/bundler/lib/bundler/source/rubygems/remote.rb +3 -4
- data/bundler/lib/bundler/source/rubygems.rb +171 -197
- data/bundler/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/bundler/lib/bundler/source.rb +30 -10
- data/bundler/lib/bundler/source_list.rb +112 -67
- data/bundler/lib/bundler/source_map.rb +71 -0
- data/bundler/lib/bundler/spec_set.rb +86 -72
- data/bundler/lib/bundler/stub_specification.rb +45 -37
- data/bundler/lib/bundler/templates/Executable +3 -5
- data/bundler/lib/bundler/templates/Executable.bundler +21 -17
- data/bundler/lib/bundler/templates/Executable.standalone +4 -4
- data/bundler/lib/bundler/templates/Gemfile +0 -2
- data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
- data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +22 -2
- data/bundler/lib/bundler/templates/newgem/README.md.tt +13 -15
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +33 -5
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +2 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- 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 +37 -0
- data/bundler/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +36 -41
- data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
- data/bundler/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
- data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/ui/rg_proxy.rb +1 -1
- data/bundler/lib/bundler/ui/shell.rb +39 -20
- data/bundler/lib/bundler/ui/silent.rb +21 -5
- data/bundler/lib/bundler/ui.rb +3 -3
- data/bundler/lib/bundler/uri_credentials_filter.rb +10 -4
- data/bundler/lib/bundler/vendor/.document +1 -0
- data/bundler/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +128 -0
- data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1493 -425
- data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
- 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 +155 -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 +243 -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/LICENSE.md +20 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +25 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +20 -10
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +34 -15
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +83 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +40 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +88 -13
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +5 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +16 -9
- data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
- data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +729 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +100 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1587 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +125 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +293 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +539 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +119 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/bundler/lib/bundler/vendored_fileutils.rb +1 -6
- data/bundler/lib/bundler/vendored_persistent.rb +2 -39
- data/bundler/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
- data/bundler/lib/bundler/vendored_thor.rb +2 -2
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/vendored_uri.rb +4 -0
- data/bundler/lib/bundler/version.rb +5 -20
- data/bundler/lib/bundler/vlad.rb +2 -2
- data/bundler/lib/bundler/worker.rb +26 -15
- data/bundler/lib/bundler/yaml_serializer.rb +3 -4
- data/bundler/lib/bundler.rb +285 -183
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/available_set.rb +7 -8
- data/lib/rubygems/basic_specification.rb +44 -31
- data/lib/rubygems/bundler_version_finder.rb +28 -50
- data/lib/rubygems/command.rb +104 -46
- data/lib/rubygems/command_manager.rb +35 -16
- data/lib/rubygems/commands/build_command.rb +77 -26
- data/lib/rubygems/commands/cert_command.rb +78 -76
- data/lib/rubygems/commands/check_command.rb +20 -22
- data/lib/rubygems/commands/cleanup_command.rb +36 -32
- data/lib/rubygems/commands/contents_command.rb +16 -18
- data/lib/rubygems/commands/dependency_command.rb +39 -50
- data/lib/rubygems/commands/environment_command.rb +11 -13
- data/lib/rubygems/commands/fetch_command.rb +33 -16
- data/lib/rubygems/commands/generate_index_command.rb +18 -17
- data/lib/rubygems/commands/help_command.rb +7 -7
- data/lib/rubygems/commands/info_command.rb +11 -6
- data/lib/rubygems/commands/install_command.rb +45 -79
- data/lib/rubygems/commands/list_command.rb +9 -8
- data/lib/rubygems/commands/lock_command.rb +7 -9
- data/lib/rubygems/commands/mirror_command.rb +3 -4
- data/lib/rubygems/commands/open_command.rb +11 -14
- data/lib/rubygems/commands/outdated_command.rb +5 -6
- data/lib/rubygems/commands/owner_command.rb +29 -22
- data/lib/rubygems/commands/pristine_command.rb +61 -51
- data/lib/rubygems/commands/push_command.rb +26 -63
- data/lib/rubygems/commands/query_command.rb +21 -337
- data/lib/rubygems/commands/rdoc_command.rb +26 -26
- data/lib/rubygems/commands/search_command.rb +8 -8
- data/lib/rubygems/commands/server_command.rb +16 -77
- data/lib/rubygems/commands/setup_command.rb +282 -241
- data/lib/rubygems/commands/signin_command.rb +9 -10
- data/lib/rubygems/commands/signout_command.rb +7 -9
- data/lib/rubygems/commands/sources_command.rb +42 -26
- data/lib/rubygems/commands/specification_command.rb +25 -20
- data/lib/rubygems/commands/stale_command.rb +3 -3
- data/lib/rubygems/commands/uninstall_command.rb +58 -49
- data/lib/rubygems/commands/unpack_command.rb +15 -44
- data/lib/rubygems/commands/update_command.rb +133 -81
- data/lib/rubygems/commands/which_command.rb +8 -11
- data/lib/rubygems/commands/yank_command.rb +22 -19
- data/lib/rubygems/compatibility.rb +7 -5
- data/lib/rubygems/config_file.rb +101 -47
- data/lib/rubygems/core_ext/kernel_gem.rb +8 -12
- data/lib/rubygems/core_ext/kernel_require.rb +124 -83
- data/lib/rubygems/core_ext/kernel_warn.rb +35 -30
- data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
- data/lib/rubygems/defaults.rb +131 -55
- data/lib/rubygems/dependency.rb +44 -27
- data/lib/rubygems/dependency_installer.rb +49 -205
- data/lib/rubygems/dependency_list.rb +24 -25
- data/lib/rubygems/deprecate.rb +106 -12
- data/lib/rubygems/doctor.rb +22 -22
- data/lib/rubygems/errors.rb +8 -14
- data/lib/rubygems/exceptions.rb +35 -33
- data/lib/rubygems/ext/build_error.rb +2 -0
- data/lib/rubygems/ext/builder.rb +71 -95
- data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +27 -0
- data/lib/rubygems/ext/cargo_builder.rb +360 -0
- data/lib/rubygems/ext/cmake_builder.rb +6 -7
- data/lib/rubygems/ext/configure_builder.rb +5 -8
- data/lib/rubygems/ext/ext_conf_builder.rb +45 -65
- data/lib/rubygems/ext/rake_builder.rb +7 -10
- data/lib/rubygems/ext.rb +7 -6
- data/lib/rubygems/gem_runner.rb +15 -26
- data/lib/rubygems/gemcutter_utilities.rb +179 -54
- data/lib/rubygems/indexer.rb +38 -53
- data/lib/rubygems/install_default_message.rb +2 -2
- data/lib/rubygems/install_message.rb +2 -2
- data/lib/rubygems/install_update_options.rb +73 -64
- data/lib/rubygems/installer.rb +230 -173
- data/lib/rubygems/installer_uninstaller_utils.rb +29 -0
- data/lib/rubygems/local_remote_options.rb +22 -24
- data/lib/rubygems/mock_gem_ui.rb +2 -5
- data/lib/rubygems/name_tuple.rb +10 -14
- data/lib/rubygems/openssl.rb +7 -0
- data/lib/rubygems/optparse/.document +1 -0
- data/lib/rubygems/optparse/COPYING +56 -0
- data/lib/rubygems/optparse/lib/optionparser.rb +2 -0
- data/lib/rubygems/optparse/lib/optparse/ac.rb +54 -0
- data/lib/rubygems/optparse/lib/optparse/date.rb +18 -0
- data/lib/rubygems/optparse/lib/optparse/kwargs.rb +22 -0
- data/lib/rubygems/optparse/lib/optparse/shellwords.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/time.rb +11 -0
- data/lib/rubygems/optparse/lib/optparse/uri.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/version.rb +71 -0
- data/lib/rubygems/optparse/lib/optparse.rb +2308 -0
- data/lib/rubygems/optparse.rb +3 -0
- data/lib/rubygems/package/digest_io.rb +0 -2
- data/lib/rubygems/package/file_source.rb +2 -4
- data/lib/rubygems/package/io_source.rb +4 -2
- data/lib/rubygems/package/old.rb +9 -11
- data/lib/rubygems/package/tar_header.rb +73 -66
- data/lib/rubygems/package/tar_reader/entry.rb +8 -9
- data/lib/rubygems/package/tar_reader.rb +16 -13
- data/lib/rubygems/package/tar_writer.rb +12 -22
- data/lib/rubygems/package.rb +142 -125
- data/lib/rubygems/package_task.rb +5 -11
- data/lib/rubygems/path_support.rb +3 -8
- data/lib/rubygems/platform.rb +113 -73
- data/lib/rubygems/psych_tree.rb +1 -1
- data/lib/rubygems/query_utils.rb +351 -0
- data/lib/rubygems/rdoc.rb +4 -16
- data/lib/rubygems/remote_fetcher.rb +64 -136
- data/lib/rubygems/request/connection_pools.rb +7 -11
- data/lib/rubygems/request/http_pool.rb +2 -3
- data/lib/rubygems/request.rb +31 -32
- data/lib/rubygems/request_set/gem_dependency_api.rb +135 -136
- data/lib/rubygems/request_set/lockfile/parser.rb +28 -28
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +5 -5
- data/lib/rubygems/request_set/lockfile.rb +21 -20
- data/lib/rubygems/request_set.rb +30 -43
- data/lib/rubygems/requirement.rb +42 -64
- data/lib/rubygems/resolver/activation_request.rb +29 -53
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_set.rb +33 -26
- data/lib/rubygems/resolver/api_specification.rb +30 -16
- data/lib/rubygems/resolver/best_set.rb +9 -11
- data/lib/rubygems/resolver/composed_set.rb +3 -5
- data/lib/rubygems/resolver/conflict.rb +12 -19
- data/lib/rubygems/resolver/current_set.rb +0 -2
- data/lib/rubygems/resolver/dependency_request.rb +3 -5
- data/lib/rubygems/resolver/git_set.rb +2 -4
- data/lib/rubygems/resolver/git_specification.rb +6 -8
- data/lib/rubygems/resolver/index_set.rb +4 -6
- data/lib/rubygems/resolver/index_specification.rb +38 -7
- data/lib/rubygems/resolver/installed_specification.rb +4 -6
- data/lib/rubygems/resolver/installer_set.rb +69 -27
- data/lib/rubygems/resolver/local_specification.rb +2 -4
- data/lib/rubygems/resolver/lock_set.rb +7 -9
- data/lib/rubygems/resolver/lock_specification.rb +6 -8
- data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +8 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +51 -12
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +42 -9
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +82 -8
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +13 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +510 -165
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- data/lib/rubygems/resolver/molinillo.rb +1 -1
- data/lib/rubygems/resolver/requirement_list.rb +0 -1
- data/lib/rubygems/resolver/set.rb +0 -3
- data/lib/rubygems/resolver/source_set.rb +0 -2
- data/lib/rubygems/resolver/spec_specification.rb +14 -2
- data/lib/rubygems/resolver/specification.rb +14 -3
- data/lib/rubygems/resolver/vendor_set.rb +1 -3
- data/lib/rubygems/resolver/vendor_specification.rb +3 -5
- data/lib/rubygems/resolver.rb +58 -54
- data/lib/rubygems/s3_uri_signer.rb +175 -0
- data/lib/rubygems/safe_yaml.rb +14 -16
- data/lib/rubygems/security/policies.rb +47 -47
- data/lib/rubygems/security/policy.rb +25 -29
- data/lib/rubygems/security/signer.rb +16 -18
- data/lib/rubygems/security/trust_dir.rb +5 -6
- data/lib/rubygems/security.rb +90 -69
- data/lib/rubygems/security_option.rb +7 -8
- data/lib/rubygems/source/git.rb +30 -30
- data/lib/rubygems/source/installed.rb +1 -3
- data/lib/rubygems/source/local.rb +4 -6
- data/lib/rubygems/source/lock.rb +0 -2
- data/lib/rubygems/source/specific_file.rb +1 -3
- data/lib/rubygems/source/vendor.rb +0 -2
- data/lib/rubygems/source.rb +50 -38
- data/lib/rubygems/source_list.rb +9 -13
- data/lib/rubygems/spec_fetcher.rb +52 -64
- data/lib/rubygems/specification.rb +432 -463
- data/lib/rubygems/specification_policy.rb +185 -87
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +24 -29
- data/lib/rubygems/text.rb +21 -21
- data/lib/rubygems/tsort/.document +1 -0
- data/lib/rubygems/tsort/LICENSE.txt +22 -0
- data/lib/rubygems/tsort/lib/tsort.rb +452 -0
- data/lib/rubygems/tsort.rb +3 -0
- data/lib/rubygems/uninstaller.rb +110 -57
- data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
- data/lib/rubygems/update_suggestion.rb +69 -0
- data/lib/rubygems/uri.rb +126 -0
- data/lib/rubygems/uri_formatter.rb +2 -4
- data/lib/rubygems/user_interaction.rb +46 -49
- data/lib/rubygems/util/licenses.rb +511 -404
- data/lib/rubygems/util.rb +40 -56
- data/lib/rubygems/validator.rb +15 -37
- data/lib/rubygems/version.rb +48 -29
- data/lib/rubygems/version_option.rb +11 -5
- data/lib/rubygems.rb +305 -332
- data/rubygems-update.gemspec +6 -13
- data/setup.rb +11 -22
- 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/bundler_test_gem.rb +419 -0
- data/test/rubygems/ca_cert.pem +74 -65
- 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/client.pem +103 -45
- data/test/rubygems/data/excon-0.7.7.gemspec.rz +0 -0
- data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
- data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
- data/test/rubygems/data/pry-0.4.7.gemspec.rz +0 -0
- data/test/rubygems/encrypted_private_key.pem +26 -26
- data/test/rubygems/expired_cert.pem +15 -15
- data/test/rubygems/future_cert.pem +15 -15
- data/test/rubygems/future_cert_32.pem +15 -15
- 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/{lib/rubygems/test_case.rb → test/rubygems/helper.rb} +505 -507
- data/{lib → test}/rubygems/installer_test_case.rb +115 -53
- 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/{lib → test}/rubygems/package/tar_test_case.rb +4 -6
- data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
- data/test/rubygems/packages/ascii_binder-0.1.10.1.gem +0 -0
- data/test/rubygems/packages/ill-formatted-platform-1.0.0.10.gem +0 -0
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
- data/test/rubygems/private_ec_key.pem +9 -0
- 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 +0 -2
- data/test/rubygems/rubygems_plugin.rb +2 -4
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +12 -0
- data/test/rubygems/ssl_cert.pem +78 -17
- data/test/rubygems/ssl_key.pem +25 -13
- data/test/rubygems/test_bundled_ca.rb +44 -47
- data/test/rubygems/test_config.rb +5 -7
- data/test/rubygems/test_deprecate.rb +90 -10
- data/test/rubygems/test_exit.rb +17 -0
- data/test/rubygems/test_gem.rb +679 -885
- data/test/rubygems/test_gem_available_set.rb +24 -25
- data/test/rubygems/test_gem_bundler_version_finder.rb +42 -42
- data/test/rubygems/test_gem_command.rb +186 -39
- data/test/rubygems/test_gem_command_manager.rb +166 -36
- data/test/rubygems/test_gem_commands_build_command.rb +436 -52
- data/test/rubygems/test_gem_commands_cert_command.rb +193 -124
- data/test/rubygems/test_gem_commands_check_command.rb +9 -11
- data/test/rubygems/test_gem_commands_cleanup_command.rb +87 -62
- data/test/rubygems/test_gem_commands_contents_command.rb +73 -42
- data/test/rubygems/test_gem_commands_dependency_command.rb +39 -41
- data/test/rubygems/test_gem_commands_environment_command.rb +60 -48
- data/test/rubygems/test_gem_commands_fetch_command.rb +163 -32
- data/test/rubygems/test_gem_commands_generate_index_command.rb +39 -9
- data/test/rubygems/test_gem_commands_help_command.rb +34 -19
- data/test/rubygems/test_gem_commands_info_command.rb +34 -9
- data/test/rubygems/test_gem_commands_install_command.rb +600 -173
- data/test/rubygems/test_gem_commands_list_command.rb +5 -7
- data/test/rubygems/test_gem_commands_lock_command.rb +11 -13
- data/test/rubygems/test_gem_commands_mirror.rb +3 -4
- data/test/rubygems/test_gem_commands_open_command.rb +16 -19
- data/test/rubygems/test_gem_commands_outdated_command.rb +24 -7
- data/test/rubygems/test_gem_commands_owner_command.rb +183 -49
- data/test/rubygems/test_gem_commands_pristine_command.rb +222 -89
- data/test/rubygems/test_gem_commands_push_command.rb +178 -69
- data/test/rubygems/test_gem_commands_query_command.rb +114 -89
- data/test/rubygems/test_gem_commands_search_command.rb +2 -4
- data/test/rubygems/test_gem_commands_server_command.rb +6 -46
- data/test/rubygems/test_gem_commands_setup_command.rb +334 -157
- data/test/rubygems/test_gem_commands_signin_command.rb +187 -27
- data/test/rubygems/test_gem_commands_signout_command.rb +3 -10
- data/test/rubygems/test_gem_commands_sources_command.rb +266 -33
- data/test/rubygems/test_gem_commands_specification_command.rb +81 -55
- data/test/rubygems/test_gem_commands_stale_command.rb +4 -6
- data/test/rubygems/test_gem_commands_uninstall_command.rb +230 -95
- data/test/rubygems/test_gem_commands_unpack_command.rb +32 -34
- data/test/rubygems/test_gem_commands_update_command.rb +412 -102
- data/test/rubygems/test_gem_commands_which_command.rb +12 -14
- data/test/rubygems/test_gem_commands_yank_command.rb +107 -26
- data/test/rubygems/test_gem_config_file.rb +120 -96
- data/test/rubygems/test_gem_dependency.rb +94 -86
- data/test/rubygems/test_gem_dependency_installer.rb +305 -388
- data/test/rubygems/test_gem_dependency_list.rb +66 -61
- data/test/rubygems/test_gem_dependency_resolution_error.rb +5 -7
- data/test/rubygems/test_gem_doctor.rb +73 -47
- data/test/rubygems/test_gem_ext_builder.rb +116 -106
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +8 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock +233 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/src/lib.rs +27 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +233 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec +8 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +51 -0
- data/test/rubygems/test_gem_ext_cargo_builder.rb +166 -0
- data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +33 -0
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +60 -0
- data/test/rubygems/test_gem_ext_cmake_builder.rb +32 -37
- data/test/rubygems/test_gem_ext_configure_builder.rb +23 -31
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +75 -79
- data/test/rubygems/test_gem_ext_rake_builder.rb +49 -30
- data/test/rubygems/test_gem_gem_runner.rb +52 -7
- data/test/rubygems/test_gem_gemcutter_utilities.rb +91 -76
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -6
- data/test/rubygems/test_gem_indexer.rb +120 -105
- data/test/rubygems/test_gem_install_update_options.rb +57 -33
- data/test/rubygems/test_gem_installer.rb +1230 -644
- data/test/rubygems/test_gem_local_remote_options.rb +11 -13
- data/test/rubygems/test_gem_name_tuple.rb +4 -6
- data/test/rubygems/test_gem_package.rb +396 -266
- data/test/rubygems/test_gem_package_old.rb +57 -56
- data/test/rubygems/test_gem_package_tar_header.rb +108 -50
- data/test/rubygems/test_gem_package_tar_reader.rb +8 -10
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +77 -20
- data/test/rubygems/test_gem_package_tar_writer.rb +107 -101
- data/test/rubygems/test_gem_package_task.rb +58 -25
- data/test/rubygems/test_gem_path_support.rb +29 -29
- data/test/rubygems/test_gem_platform.rb +388 -199
- data/test/rubygems/test_gem_rdoc.rb +20 -155
- data/test/rubygems/test_gem_remote_fetcher.rb +474 -303
- data/test/rubygems/test_gem_request.rb +128 -85
- data/test/rubygems/test_gem_request_connection_pools.rb +32 -32
- data/test/rubygems/test_gem_request_set.rb +186 -110
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +280 -261
- data/test/rubygems/test_gem_request_set_lockfile.rb +93 -94
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +68 -69
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +136 -136
- data/test/rubygems/test_gem_requirement.rb +140 -55
- data/test/rubygems/test_gem_resolver.rb +224 -115
- data/test/rubygems/test_gem_resolver_activation_request.rb +9 -40
- data/test/rubygems/test_gem_resolver_api_set.rb +79 -78
- data/test/rubygems/test_gem_resolver_api_specification.rb +47 -49
- data/test/rubygems/test_gem_resolver_best_set.rb +43 -22
- data/test/rubygems/test_gem_resolver_composed_set.rb +1 -3
- data/test/rubygems/test_gem_resolver_conflict.rb +12 -18
- data/test/rubygems/test_gem_resolver_dependency_request.rb +15 -17
- data/test/rubygems/test_gem_resolver_git_set.rb +22 -24
- data/test/rubygems/test_gem_resolver_git_specification.rb +22 -22
- data/test/rubygems/test_gem_resolver_index_set.rb +14 -16
- data/test/rubygems/test_gem_resolver_index_specification.rb +21 -18
- data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -8
- data/test/rubygems/test_gem_resolver_installer_set.rb +106 -44
- data/test/rubygems/test_gem_resolver_local_specification.rb +7 -9
- data/test/rubygems/test_gem_resolver_lock_set.rb +15 -17
- data/test/rubygems/test_gem_resolver_lock_specification.rb +17 -19
- data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -3
- data/test/rubygems/test_gem_resolver_specification.rb +8 -10
- data/test/rubygems/test_gem_resolver_vendor_set.rb +9 -11
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +10 -12
- data/test/rubygems/test_gem_security.rb +109 -79
- data/test/rubygems/test_gem_security_policy.rb +102 -107
- data/test/rubygems/test_gem_security_signer.rb +51 -52
- data/test/rubygems/test_gem_security_trust_dir.rb +14 -16
- data/test/rubygems/test_gem_silent_ui.rb +47 -42
- data/test/rubygems/test_gem_source.rb +66 -51
- data/test/rubygems/test_gem_source_fetch_problem.rb +17 -8
- data/test/rubygems/test_gem_source_git.rb +74 -74
- data/test/rubygems/test_gem_source_installed.rb +16 -18
- data/test/rubygems/test_gem_source_list.rb +5 -5
- data/test/rubygems/test_gem_source_local.rb +15 -16
- data/test/rubygems/test_gem_source_lock.rb +31 -33
- data/test/rubygems/test_gem_source_specific_file.rb +18 -19
- data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
- data/test/rubygems/test_gem_source_vendor.rb +13 -15
- data/test/rubygems/test_gem_spec_fetcher.rb +74 -67
- data/test/rubygems/test_gem_specification.rb +1051 -1071
- data/test/rubygems/test_gem_stream_ui.rb +25 -23
- data/test/rubygems/test_gem_stub_specification.rb +39 -56
- data/test/rubygems/test_gem_text.rb +8 -3
- data/test/rubygems/test_gem_uninstaller.rb +269 -100
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -5
- data/test/rubygems/test_gem_update_suggestion.rb +208 -0
- data/test/rubygems/test_gem_uri.rb +39 -0
- data/test/rubygems/test_gem_uri_formatter.rb +14 -16
- data/test/rubygems/test_gem_util.rb +46 -34
- data/test/rubygems/test_gem_validator.rb +12 -15
- data/test/rubygems/test_gem_version.rb +49 -34
- data/test/rubygems/test_gem_version_option.rb +16 -18
- data/test/rubygems/test_kernel.rb +61 -53
- data/test/rubygems/test_project_sanity.rb +20 -0
- data/test/rubygems/test_remote_fetch_error.rb +7 -8
- data/test/rubygems/test_require.rb +415 -121
- data/test/rubygems/test_rubygems.rb +74 -0
- data/{lib/rubygems/test_utilities.rb → test/rubygems/utilities.rb} +74 -50
- 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 +17 -0
- metadata +218 -244
- data/.rubocop.yml +0 -66
- data/.travis.yml +0 -38
- data/History.txt +0 -3965
- data/Rakefile +0 -372
- data/appveyor.yml +0 -43
- data/bundler/CODE_OF_CONDUCT.md +0 -42
- data/bundler/CONTRIBUTING.md +0 -17
- data/bundler/exe/bundle_ruby +0 -60
- data/bundler/lib/bundler/cli/package.rb +0 -49
- data/bundler/lib/bundler/compatibility_guard.rb +0 -14
- data/bundler/lib/bundler/dep_proxy.rb +0 -48
- data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/bundler/lib/bundler/gemdeps.rb +0 -29
- data/bundler/lib/bundler/psyched_yaml.rb +0 -37
- data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/bundler/lib/bundler/templates/gems.rb +0 -8
- data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -7
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- 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 -81
- 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 -136
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
- 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 -101
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
- 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 -12
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/bundler/lib/bundler/version_ranges.rb +0 -76
- data/bundler/man/bundle-gem.1 +0 -80
- data/bundler/man/bundle-gem.ronn +0 -78
- data/bundler/man/bundle-package.1 +0 -55
- data/lib/rubygems/psych_additions.rb +0 -10
- data/lib/rubygems/server.rb +0 -878
- data/lib/rubygems/source_local.rb +0 -7
- data/lib/rubygems/source_specific_file.rb +0 -6
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/rubygems/syck_hack.rb +0 -77
- data/lib/ubygems.rb +0 -14
- data/test/rubygems/bogussources.rb +0 -9
- data/test/rubygems/data/null-type.gemspec.rz +0 -0
- data/test/rubygems/test_gem_server.rb +0 -607
- data/util/CL2notes +0 -55
- data/util/ci +0 -77
- data/util/create_certs.rb +0 -171
- data/util/create_encrypted_key.rb +0 -16
- data/util/generate_spdx_license_list.rb +0 -61
- data/util/patch_with_prs.rb +0 -77
- data/util/rubocop +0 -8
- data/util/update_bundled_ca_certificates.rb +0 -139
- data/util/update_changelog.rb +0 -67
- /data/bundler/lib/bundler/{ssl_certs → man}/.document +0 -0
- /data/bundler/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- /data/bundler/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- /data/bundler/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- /data/bundler/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- /data/bundler/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- /data/bundler/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- /data/bundler/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
- /data/{bundler/lib/bundler/ssl_certs/index.rubygems.org → lib/rubygems/ssl_certs/rubygems.org}/GlobalSignRootCA.pem +0 -0
@@ -1,31 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
require_relative "installer_test_case"
|
3
3
|
|
4
4
|
class TestGemInstaller < Gem::InstallerTestCase
|
5
|
-
@@symlink_supported = nil
|
6
|
-
|
7
|
-
def symlink_supported?
|
8
|
-
if @@symlink_supported.nil?
|
9
|
-
begin
|
10
|
-
File.symlink("", "")
|
11
|
-
rescue Errno::ENOENT, Errno::EEXIST
|
12
|
-
@@symlink_supported = true
|
13
|
-
rescue NotImplementedError, SystemCallError
|
14
|
-
@@symlink_supported = false
|
15
|
-
end
|
16
|
-
end
|
17
|
-
@@symlink_supported
|
18
|
-
end
|
19
|
-
|
20
5
|
def setup
|
21
6
|
super
|
22
7
|
common_installer_setup
|
23
8
|
|
24
|
-
if (self.class.method_defined?(:__name__) ? __name__ : name) =~ /\Atest_install(_|\Z)/
|
25
|
-
FileUtils.rm_r @spec.gem_dir
|
26
|
-
FileUtils.rm_r @user_spec.gem_dir
|
27
|
-
end
|
28
|
-
|
29
9
|
@config = Gem.configuration
|
30
10
|
end
|
31
11
|
|
@@ -38,9 +18,12 @@ class TestGemInstaller < Gem::InstallerTestCase
|
|
38
18
|
end
|
39
19
|
|
40
20
|
def test_app_script_text
|
41
|
-
|
21
|
+
load_relative "no" do
|
22
|
+
installer = setup_base_installer
|
42
23
|
|
43
|
-
|
24
|
+
util_make_exec @spec, ""
|
25
|
+
|
26
|
+
expected = <<-EOF
|
44
27
|
#!#{Gem.ruby}
|
45
28
|
#
|
46
29
|
# This file was generated by RubyGems.
|
@@ -51,6 +34,8 @@ class TestGemInstaller < Gem::InstallerTestCase
|
|
51
34
|
|
52
35
|
require 'rubygems'
|
53
36
|
|
37
|
+
Gem.use_gemdeps
|
38
|
+
|
54
39
|
version = \">= 0.a\"
|
55
40
|
|
56
41
|
str = ARGV.first
|
@@ -68,79 +53,73 @@ else
|
|
68
53
|
gem "a", version
|
69
54
|
load Gem.bin_path("a", "executable", version)
|
70
55
|
end
|
71
|
-
|
56
|
+
EOF
|
72
57
|
|
73
|
-
|
74
|
-
|
58
|
+
wrapper = installer.app_script_text "executable"
|
59
|
+
assert_equal expected, wrapper
|
60
|
+
end
|
75
61
|
end
|
76
62
|
|
77
63
|
def test_check_executable_overwrite
|
78
|
-
|
64
|
+
installer = setup_base_installer
|
65
|
+
|
66
|
+
installer.generate_bin
|
79
67
|
|
80
68
|
@spec = Gem::Specification.new do |s|
|
81
|
-
s.files = [
|
69
|
+
s.files = ["lib/code.rb"]
|
82
70
|
s.name = "a"
|
83
71
|
s.version = "3"
|
84
72
|
s.summary = "summary"
|
85
73
|
s.description = "desc"
|
86
|
-
s.require_path =
|
74
|
+
s.require_path = "lib"
|
87
75
|
end
|
88
76
|
|
89
77
|
util_make_exec
|
90
|
-
|
91
|
-
|
92
|
-
|
78
|
+
installer.gem_dir = @spec.gem_dir
|
79
|
+
installer.wrappers = true
|
80
|
+
installer.generate_bin
|
93
81
|
|
94
|
-
installed_exec = File.join util_inst_bindir,
|
95
|
-
|
82
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
83
|
+
assert_path_exist installed_exec
|
96
84
|
|
97
85
|
wrapper = File.read installed_exec
|
98
|
-
assert_match %r
|
86
|
+
assert_match %r{generated by RubyGems}, wrapper
|
99
87
|
end
|
100
88
|
|
101
89
|
def test_check_executable_overwrite_default_bin_dir
|
102
|
-
|
103
|
-
orig_RUBY_FRAMEWORK_VERSION = RUBY_FRAMEWORK_VERSION
|
104
|
-
Object.send :remove_const, :RUBY_FRAMEWORK_VERSION
|
105
|
-
end
|
106
|
-
orig_bindir = RbConfig::CONFIG['bindir']
|
107
|
-
RbConfig::CONFIG['bindir'] = Gem.bindir
|
90
|
+
installer = setup_base_installer(false)
|
108
91
|
|
109
|
-
|
92
|
+
bindir(Gem.bindir) do
|
93
|
+
util_conflict_executable false
|
110
94
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
95
|
+
ui = Gem::MockGemUi.new "n\n"
|
96
|
+
use_ui ui do
|
97
|
+
e = assert_raise Gem::InstallError do
|
98
|
+
installer.generate_bin
|
99
|
+
end
|
116
100
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
ensure
|
122
|
-
Object.const_set :RUBY_FRAMEWORK_VERSION, orig_RUBY_FRAMEWORK_VERSION if
|
123
|
-
orig_RUBY_FRAMEWORK_VERSION
|
124
|
-
if orig_bindir
|
125
|
-
RbConfig::CONFIG['bindir'] = orig_bindir
|
126
|
-
else
|
127
|
-
RbConfig::CONFIG.delete 'bindir'
|
101
|
+
conflicted = File.join @gemhome, "bin", "executable"
|
102
|
+
assert_match %r{\A"executable" from a conflicts with (?:#{Regexp.quote(conflicted)}|installed executable from conflict)\z},
|
103
|
+
e.message
|
104
|
+
end
|
128
105
|
end
|
129
106
|
end
|
130
107
|
|
131
108
|
def test_check_executable_overwrite_format_executable
|
132
|
-
|
109
|
+
installer = setup_base_installer
|
110
|
+
|
111
|
+
installer.generate_bin
|
133
112
|
|
134
113
|
@spec = Gem::Specification.new do |s|
|
135
|
-
s.files = [
|
114
|
+
s.files = ["lib/code.rb"]
|
136
115
|
s.name = "a"
|
137
116
|
s.version = "3"
|
138
117
|
s.summary = "summary"
|
139
118
|
s.description = "desc"
|
140
|
-
s.require_path =
|
119
|
+
s.require_path = "lib"
|
141
120
|
end
|
142
121
|
|
143
|
-
File.open File.join(util_inst_bindir,
|
122
|
+
File.open File.join(util_inst_bindir, "executable"), "w" do |io|
|
144
123
|
io.write <<-EXEC
|
145
124
|
#!/usr/local/bin/ruby
|
146
125
|
#
|
@@ -151,28 +130,32 @@ gem 'other', version
|
|
151
130
|
end
|
152
131
|
|
153
132
|
util_make_exec
|
154
|
-
Gem::Installer.exec_format =
|
155
|
-
|
156
|
-
|
157
|
-
|
133
|
+
Gem::Installer.exec_format = "foo-%s-bar"
|
134
|
+
installer.gem_dir = @spec.gem_dir
|
135
|
+
installer.wrappers = true
|
136
|
+
installer.format_executable = true
|
158
137
|
|
159
|
-
|
138
|
+
installer.generate_bin # should not raise
|
160
139
|
|
161
|
-
installed_exec = File.join util_inst_bindir,
|
162
|
-
|
140
|
+
installed_exec = File.join util_inst_bindir, "foo-executable-bar"
|
141
|
+
assert_path_exist installed_exec
|
163
142
|
|
164
143
|
wrapper = File.read installed_exec
|
165
|
-
assert_match %r
|
144
|
+
assert_match %r{generated by RubyGems}, wrapper
|
145
|
+
ensure
|
146
|
+
Gem::Installer.exec_format = nil
|
166
147
|
end
|
167
148
|
|
168
149
|
def test_check_executable_overwrite_other_gem
|
150
|
+
installer = setup_base_installer(false)
|
151
|
+
|
169
152
|
util_conflict_executable true
|
170
153
|
|
171
154
|
ui = Gem::MockGemUi.new "n\n"
|
172
155
|
|
173
156
|
use_ui ui do
|
174
|
-
e =
|
175
|
-
|
157
|
+
e = assert_raise Gem::InstallError do
|
158
|
+
installer.generate_bin
|
176
159
|
end
|
177
160
|
|
178
161
|
assert_equal '"executable" from a conflicts with installed executable from conflict',
|
@@ -181,104 +164,125 @@ gem 'other', version
|
|
181
164
|
end
|
182
165
|
|
183
166
|
def test_check_executable_overwrite_other_gem_force
|
167
|
+
installer = setup_base_installer
|
168
|
+
|
184
169
|
util_conflict_executable true
|
185
|
-
|
186
|
-
|
170
|
+
installer.wrappers = true
|
171
|
+
installer.force = true
|
187
172
|
|
188
|
-
|
173
|
+
installer.generate_bin
|
189
174
|
|
190
|
-
installed_exec = File.join util_inst_bindir,
|
191
|
-
|
175
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
176
|
+
assert_path_exist installed_exec
|
192
177
|
|
193
178
|
wrapper = File.read installed_exec
|
194
|
-
assert_match %r
|
179
|
+
assert_match %r{generated by RubyGems}, wrapper
|
195
180
|
end
|
196
181
|
|
197
182
|
def test_check_executable_overwrite_other_non_gem
|
183
|
+
installer = setup_base_installer
|
184
|
+
|
198
185
|
util_conflict_executable false
|
199
|
-
|
186
|
+
installer.wrappers = true
|
200
187
|
|
201
|
-
|
188
|
+
installer.generate_bin
|
202
189
|
|
203
|
-
installed_exec = File.join util_inst_bindir,
|
204
|
-
|
190
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
191
|
+
assert_path_exist installed_exec
|
205
192
|
|
206
193
|
wrapper = File.read installed_exec
|
207
|
-
assert_match %r
|
194
|
+
assert_match %r{generated by RubyGems}, wrapper
|
208
195
|
end unless Gem.win_platform?
|
209
196
|
|
210
197
|
def test_check_that_user_bin_dir_is_in_path
|
211
|
-
|
198
|
+
installer = setup_base_installer
|
199
|
+
|
200
|
+
bin_dir = installer.bin_dir
|
212
201
|
|
213
202
|
if Gem.win_platform?
|
214
|
-
bin_dir = bin_dir.downcase
|
203
|
+
bin_dir = bin_dir.downcase
|
204
|
+
end
|
205
|
+
|
206
|
+
orig_PATH, ENV["PATH"] =
|
207
|
+
ENV["PATH"], [ENV["PATH"], bin_dir].join(File::PATH_SEPARATOR)
|
208
|
+
|
209
|
+
use_ui @ui do
|
210
|
+
installer.check_that_user_bin_dir_is_in_path
|
215
211
|
end
|
216
212
|
|
217
|
-
|
218
|
-
|
213
|
+
assert_empty @ui.error
|
214
|
+
|
215
|
+
return unless win_platform?
|
216
|
+
|
217
|
+
ENV["PATH"] = [orig_PATH, bin_dir.tr(File::SEPARATOR, File::ALT_SEPARATOR)].join(File::PATH_SEPARATOR)
|
219
218
|
|
220
219
|
use_ui @ui do
|
221
|
-
|
220
|
+
installer.check_that_user_bin_dir_is_in_path
|
222
221
|
end
|
223
222
|
|
224
223
|
assert_empty @ui.error
|
225
224
|
ensure
|
226
|
-
ENV[
|
225
|
+
ENV["PATH"] = orig_PATH
|
227
226
|
end
|
228
227
|
|
229
228
|
def test_check_that_user_bin_dir_is_in_path_tilde
|
230
|
-
|
229
|
+
pend "Tilde is PATH is not supported under MS Windows" if win_platform?
|
231
230
|
|
232
|
-
orig_PATH, ENV[
|
233
|
-
ENV[
|
231
|
+
orig_PATH, ENV["PATH"] =
|
232
|
+
ENV["PATH"], [ENV["PATH"], "~/bin"].join(File::PATH_SEPARATOR)
|
234
233
|
|
235
|
-
|
234
|
+
installer = setup_base_installer
|
235
|
+
installer.bin_dir.replace File.join @userhome, "bin"
|
236
236
|
|
237
237
|
use_ui @ui do
|
238
|
-
|
238
|
+
installer.check_that_user_bin_dir_is_in_path
|
239
239
|
end
|
240
240
|
|
241
241
|
assert_empty @ui.error
|
242
242
|
ensure
|
243
|
-
ENV[
|
243
|
+
ENV["PATH"] = orig_PATH unless win_platform?
|
244
244
|
end
|
245
245
|
|
246
246
|
def test_check_that_user_bin_dir_is_in_path_not_in_path
|
247
|
+
installer = setup_base_installer
|
248
|
+
|
247
249
|
use_ui @ui do
|
248
|
-
|
250
|
+
installer.check_that_user_bin_dir_is_in_path
|
249
251
|
end
|
250
252
|
|
251
|
-
expected =
|
253
|
+
expected = installer.bin_dir
|
252
254
|
|
253
255
|
if Gem.win_platform?
|
254
|
-
expected = expected.downcase
|
256
|
+
expected = expected.downcase
|
255
257
|
end
|
256
258
|
|
257
259
|
assert_match expected, @ui.error
|
258
260
|
end
|
259
261
|
|
260
262
|
def test_ensure_dependency
|
261
|
-
|
263
|
+
installer = setup_base_installer
|
264
|
+
|
265
|
+
util_spec "a"
|
262
266
|
|
263
|
-
dep = Gem::Dependency.new
|
264
|
-
assert
|
267
|
+
dep = Gem::Dependency.new "a", ">= 2"
|
268
|
+
assert installer.ensure_dependency(@spec, dep)
|
265
269
|
|
266
|
-
dep = Gem::Dependency.new
|
267
|
-
e =
|
268
|
-
|
270
|
+
dep = Gem::Dependency.new "b", "> 2"
|
271
|
+
e = assert_raise Gem::InstallError do
|
272
|
+
installer.ensure_dependency @spec, dep
|
269
273
|
end
|
270
274
|
|
271
|
-
assert_equal
|
275
|
+
assert_equal "a requires b (> 2)", e.message
|
272
276
|
end
|
273
277
|
|
274
278
|
def test_ensure_loadable_spec
|
275
|
-
a, a_gem = util_gem
|
276
|
-
s.add_dependency
|
279
|
+
a, a_gem = util_gem "a", 2 do |s|
|
280
|
+
s.add_dependency "garbage ~> 5"
|
277
281
|
end
|
278
282
|
|
279
283
|
installer = Gem::Installer.at a_gem
|
280
284
|
|
281
|
-
e =
|
285
|
+
e = assert_raise Gem::InstallError do
|
282
286
|
installer.ensure_loadable_spec
|
283
287
|
end
|
284
288
|
|
@@ -287,49 +291,53 @@ gem 'other', version
|
|
287
291
|
end
|
288
292
|
|
289
293
|
def test_ensure_loadable_spec_security_policy
|
290
|
-
|
294
|
+
pend "openssl is missing" unless Gem::HAVE_OPENSSL
|
291
295
|
|
292
|
-
_, a_gem = util_gem
|
293
|
-
s.add_dependency
|
296
|
+
_, a_gem = util_gem "a", 2 do |s|
|
297
|
+
s.add_dependency "garbage ~> 5"
|
294
298
|
end
|
295
299
|
|
296
300
|
policy = Gem::Security::HighSecurity
|
297
301
|
installer = Gem::Installer.at a_gem, :security_policy => policy
|
298
302
|
|
299
|
-
|
303
|
+
assert_raise Gem::Security::Exception do
|
300
304
|
installer.ensure_loadable_spec
|
301
305
|
end
|
302
306
|
end
|
303
307
|
|
304
308
|
def test_extract_files
|
305
|
-
|
309
|
+
installer = setup_base_installer
|
310
|
+
|
311
|
+
installer.extract_files
|
306
312
|
|
307
|
-
|
313
|
+
assert_path_exist File.join @spec.gem_dir, "bin/executable"
|
308
314
|
end
|
309
315
|
|
310
316
|
def test_generate_bin_bindir
|
311
|
-
|
317
|
+
installer = setup_base_installer
|
318
|
+
|
319
|
+
installer.wrappers = true
|
312
320
|
|
313
321
|
@spec.executables = %w[executable]
|
314
|
-
@spec.bindir =
|
322
|
+
@spec.bindir = "bin"
|
315
323
|
|
316
|
-
exec_file =
|
324
|
+
exec_file = installer.formatted_program_filename "executable"
|
317
325
|
exec_path = File.join @spec.gem_dir, exec_file
|
318
|
-
File.open exec_path,
|
319
|
-
f.puts
|
326
|
+
File.open exec_path, "w" do |f|
|
327
|
+
f.puts "#!/usr/bin/ruby"
|
320
328
|
end
|
321
329
|
|
322
|
-
|
330
|
+
installer.gem_dir = @spec.gem_dir
|
323
331
|
|
324
|
-
|
332
|
+
installer.generate_bin
|
325
333
|
|
326
|
-
|
327
|
-
installed_exec = File.join(util_inst_bindir,
|
328
|
-
|
334
|
+
assert_directory_exists util_inst_bindir
|
335
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
336
|
+
assert_path_exist installed_exec
|
329
337
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
330
338
|
|
331
339
|
wrapper = File.read installed_exec
|
332
|
-
assert_match %r
|
340
|
+
assert_match %r{generated by RubyGems}, wrapper
|
333
341
|
end
|
334
342
|
|
335
343
|
def test_generate_bin_bindir_with_user_install_warning
|
@@ -341,10 +349,10 @@ gem 'other', version
|
|
341
349
|
|
342
350
|
options = {
|
343
351
|
:bin_dir => bin_dir,
|
344
|
-
:install_dir => "/non/existent"
|
352
|
+
:install_dir => "/non/existent",
|
345
353
|
}
|
346
354
|
|
347
|
-
inst = Gem::Installer.at
|
355
|
+
inst = Gem::Installer.at "", options
|
348
356
|
|
349
357
|
Gem::Installer.path_warning = false
|
350
358
|
|
@@ -359,133 +367,149 @@ gem 'other', version
|
|
359
367
|
end
|
360
368
|
|
361
369
|
def test_generate_bin_script
|
362
|
-
|
370
|
+
installer = setup_base_installer
|
371
|
+
|
372
|
+
installer.wrappers = true
|
363
373
|
util_make_exec
|
364
|
-
|
374
|
+
installer.gem_dir = @spec.gem_dir
|
365
375
|
|
366
|
-
|
367
|
-
|
368
|
-
installed_exec = File.join util_inst_bindir,
|
369
|
-
|
376
|
+
installer.generate_bin
|
377
|
+
assert_directory_exists util_inst_bindir
|
378
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
379
|
+
assert_path_exist installed_exec
|
370
380
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
371
381
|
|
372
382
|
wrapper = File.read installed_exec
|
373
|
-
assert_match %r
|
383
|
+
assert_match %r{generated by RubyGems}, wrapper
|
374
384
|
end
|
375
385
|
|
376
386
|
def test_generate_bin_script_format
|
377
|
-
|
378
|
-
|
387
|
+
installer = setup_base_installer
|
388
|
+
|
389
|
+
installer.format_executable = true
|
390
|
+
installer.wrappers = true
|
379
391
|
util_make_exec
|
380
|
-
|
392
|
+
installer.gem_dir = @spec.gem_dir
|
381
393
|
|
382
|
-
Gem::Installer.exec_format =
|
383
|
-
|
384
|
-
|
385
|
-
installed_exec = File.join util_inst_bindir,
|
386
|
-
|
394
|
+
Gem::Installer.exec_format = "foo-%s-bar"
|
395
|
+
installer.generate_bin
|
396
|
+
assert_directory_exists util_inst_bindir
|
397
|
+
installed_exec = File.join util_inst_bindir, "foo-executable-bar"
|
398
|
+
assert_path_exist installed_exec
|
387
399
|
ensure
|
388
400
|
Gem::Installer.exec_format = nil
|
389
401
|
end
|
390
402
|
|
391
403
|
def test_generate_bin_script_format_disabled
|
392
|
-
|
404
|
+
installer = setup_base_installer
|
405
|
+
|
406
|
+
installer.wrappers = true
|
393
407
|
util_make_exec
|
394
|
-
|
408
|
+
installer.gem_dir = @spec.gem_dir
|
395
409
|
|
396
|
-
Gem::Installer.exec_format =
|
397
|
-
|
398
|
-
|
399
|
-
installed_exec = File.join util_inst_bindir,
|
400
|
-
|
410
|
+
Gem::Installer.exec_format = "foo-%s-bar"
|
411
|
+
installer.generate_bin
|
412
|
+
assert_directory_exists util_inst_bindir
|
413
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
414
|
+
assert_path_exist installed_exec
|
401
415
|
ensure
|
402
416
|
Gem::Installer.exec_format = nil
|
403
417
|
end
|
404
418
|
|
405
419
|
def test_generate_bin_script_install_dir
|
406
|
-
|
420
|
+
installer = setup_base_installer
|
421
|
+
|
422
|
+
installer.wrappers = true
|
407
423
|
|
408
424
|
gem_dir = File.join("#{@gemhome}2", "gems", @spec.full_name)
|
409
|
-
gem_bindir = File.join gem_dir,
|
425
|
+
gem_bindir = File.join gem_dir, "bin"
|
410
426
|
FileUtils.mkdir_p gem_bindir
|
411
|
-
File.open File.join(gem_bindir,
|
427
|
+
File.open File.join(gem_bindir, "executable"), "w" do |f|
|
412
428
|
f.puts "#!/bin/ruby"
|
413
429
|
end
|
414
430
|
|
415
|
-
|
416
|
-
|
417
|
-
|
431
|
+
installer.gem_home = "#{@gemhome}2"
|
432
|
+
installer.gem_dir = gem_dir
|
433
|
+
installer.bin_dir = File.join "#{@gemhome}2", "bin"
|
418
434
|
|
419
|
-
|
435
|
+
installer.generate_bin
|
420
436
|
|
421
|
-
installed_exec = File.join("#{@gemhome}2", "bin",
|
422
|
-
|
437
|
+
installed_exec = File.join("#{@gemhome}2", "bin", "executable")
|
438
|
+
assert_path_exist installed_exec
|
423
439
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
424
440
|
|
425
441
|
wrapper = File.read installed_exec
|
426
|
-
assert_match %r
|
442
|
+
assert_match %r{generated by RubyGems}, wrapper
|
427
443
|
end
|
428
444
|
|
429
445
|
def test_generate_bin_script_no_execs
|
430
|
-
|
446
|
+
installer = setup_base_installer
|
431
447
|
|
432
|
-
|
433
|
-
@installer.generate_bin
|
448
|
+
installer = util_execless
|
434
449
|
|
435
|
-
|
450
|
+
installer.wrappers = true
|
451
|
+
installer.generate_bin
|
452
|
+
|
453
|
+
assert_path_not_exist util_inst_bindir, "bin dir was created when not needed"
|
436
454
|
end
|
437
455
|
|
438
456
|
def test_generate_bin_script_no_perms
|
439
|
-
|
457
|
+
installer = setup_base_installer
|
458
|
+
|
459
|
+
installer.wrappers = true
|
440
460
|
util_make_exec
|
441
461
|
|
442
462
|
Dir.mkdir util_inst_bindir
|
443
463
|
|
444
464
|
if win_platform?
|
445
|
-
|
465
|
+
pend("test_generate_bin_script_no_perms skipped on MS Windows")
|
446
466
|
elsif Process.uid.zero?
|
447
|
-
|
467
|
+
pend("test_generate_bin_script_no_perms skipped in root privilege")
|
448
468
|
else
|
449
469
|
FileUtils.chmod 0000, util_inst_bindir
|
450
470
|
|
451
|
-
|
452
|
-
|
471
|
+
assert_raise Gem::FilePermissionError do
|
472
|
+
installer.generate_bin
|
453
473
|
end
|
454
474
|
end
|
455
475
|
ensure
|
456
|
-
FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG
|
476
|
+
FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG || win_platform?)
|
457
477
|
end
|
458
478
|
|
459
479
|
def test_generate_bin_script_no_shebang
|
460
|
-
|
480
|
+
installer = setup_base_installer
|
481
|
+
|
482
|
+
installer.wrappers = true
|
461
483
|
@spec.executables = %w[executable]
|
462
484
|
|
463
|
-
gem_dir = File.join @gemhome,
|
464
|
-
gem_bindir = File.join gem_dir,
|
485
|
+
gem_dir = File.join @gemhome, "gems", @spec.full_name
|
486
|
+
gem_bindir = File.join gem_dir, "bin"
|
465
487
|
FileUtils.mkdir_p gem_bindir
|
466
|
-
File.open File.join(gem_bindir,
|
488
|
+
File.open File.join(gem_bindir, "executable"), "w" do |f|
|
467
489
|
f.puts "blah blah blah"
|
468
490
|
end
|
469
491
|
|
470
|
-
|
492
|
+
installer.generate_bin
|
471
493
|
|
472
|
-
installed_exec = File.join @gemhome,
|
473
|
-
|
494
|
+
installed_exec = File.join @gemhome, "bin", "executable"
|
495
|
+
assert_path_exist installed_exec
|
474
496
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
475
497
|
|
476
498
|
wrapper = File.read installed_exec
|
477
|
-
assert_match %r
|
499
|
+
assert_match %r{generated by RubyGems}, wrapper
|
478
500
|
# HACK some gems don't have #! in their executables, restore 2008/06
|
479
501
|
#assert_no_match %r|generated by RubyGems|, wrapper
|
480
502
|
end
|
481
503
|
|
482
504
|
def test_generate_bin_script_wrappers
|
483
|
-
|
505
|
+
installer = setup_base_installer
|
506
|
+
|
507
|
+
installer.wrappers = true
|
484
508
|
util_make_exec
|
485
|
-
|
486
|
-
installed_exec = File.join(util_inst_bindir,
|
509
|
+
installer.gem_dir = @spec.gem_dir
|
510
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
487
511
|
|
488
|
-
real_exec = File.join @spec.gem_dir,
|
512
|
+
real_exec = File.join @spec.gem_dir, "bin", "executable"
|
489
513
|
|
490
514
|
# fake --no-wrappers for previous install
|
491
515
|
unless Gem.win_platform?
|
@@ -493,159 +517,171 @@ gem 'other', version
|
|
493
517
|
FileUtils.ln_s real_exec, installed_exec
|
494
518
|
end
|
495
519
|
|
496
|
-
|
497
|
-
|
498
|
-
|
520
|
+
installer.generate_bin
|
521
|
+
assert_directory_exists util_inst_bindir
|
522
|
+
assert_path_exist installed_exec
|
499
523
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
500
524
|
|
501
|
-
assert_match %r
|
525
|
+
assert_match %r{generated by RubyGems}, File.read(installed_exec)
|
502
526
|
|
503
|
-
refute_match %r
|
504
|
-
|
527
|
+
refute_match %r{generated by RubyGems}, File.read(real_exec),
|
528
|
+
"real executable overwritten"
|
505
529
|
end
|
506
530
|
|
507
531
|
def test_generate_bin_symlink
|
508
|
-
|
532
|
+
pend "Symlinks not supported or not enabled" unless symlink_supported?
|
533
|
+
|
534
|
+
installer = setup_base_installer
|
509
535
|
|
510
|
-
|
536
|
+
installer.wrappers = false
|
511
537
|
util_make_exec
|
512
|
-
|
538
|
+
installer.gem_dir = @spec.gem_dir
|
513
539
|
|
514
|
-
|
515
|
-
|
516
|
-
installed_exec = File.join util_inst_bindir,
|
540
|
+
installer.generate_bin
|
541
|
+
assert_directory_exists util_inst_bindir
|
542
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
517
543
|
assert_equal true, File.symlink?(installed_exec)
|
518
|
-
assert_equal(File.join(@spec.gem_dir,
|
544
|
+
assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
|
519
545
|
File.readlink(installed_exec))
|
520
546
|
end
|
521
547
|
|
522
548
|
def test_generate_bin_symlink_no_execs
|
523
|
-
|
549
|
+
installer = setup_base_installer
|
550
|
+
|
551
|
+
installer = util_execless
|
524
552
|
|
525
|
-
|
526
|
-
|
553
|
+
installer.wrappers = false
|
554
|
+
installer.generate_bin
|
527
555
|
|
528
|
-
|
556
|
+
assert_path_not_exist util_inst_bindir
|
529
557
|
end
|
530
558
|
|
531
559
|
def test_generate_bin_symlink_no_perms
|
532
|
-
|
560
|
+
installer = setup_base_installer
|
561
|
+
|
562
|
+
installer.wrappers = false
|
533
563
|
util_make_exec
|
534
|
-
|
564
|
+
installer.gem_dir = @spec.gem_dir
|
535
565
|
|
536
566
|
Dir.mkdir util_inst_bindir
|
537
567
|
|
538
568
|
if win_platform?
|
539
|
-
|
569
|
+
pend("test_generate_bin_symlink_no_perms skipped on MS Windows")
|
540
570
|
elsif Process.uid.zero?
|
541
|
-
|
571
|
+
pend("test_user_install_disabled_read_only test skipped in root privilege")
|
542
572
|
else
|
543
573
|
FileUtils.chmod 0000, util_inst_bindir
|
544
574
|
|
545
|
-
|
546
|
-
|
575
|
+
assert_raise Gem::FilePermissionError do
|
576
|
+
installer.generate_bin
|
547
577
|
end
|
548
578
|
end
|
549
579
|
ensure
|
550
|
-
FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG
|
580
|
+
FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG || win_platform?)
|
551
581
|
end
|
552
582
|
|
553
583
|
def test_generate_bin_symlink_update_newer
|
554
|
-
|
584
|
+
pend "Symlinks not supported or not enabled" unless symlink_supported?
|
555
585
|
|
556
|
-
|
586
|
+
installer = setup_base_installer
|
587
|
+
|
588
|
+
installer.wrappers = false
|
557
589
|
util_make_exec
|
558
|
-
|
590
|
+
installer.gem_dir = @spec.gem_dir
|
559
591
|
|
560
|
-
|
561
|
-
installed_exec = File.join(util_inst_bindir,
|
562
|
-
assert_equal(File.join(@spec.gem_dir,
|
592
|
+
installer.generate_bin
|
593
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
594
|
+
assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
|
563
595
|
File.readlink(installed_exec))
|
564
596
|
|
565
597
|
@spec = Gem::Specification.new do |s|
|
566
|
-
s.files = [
|
598
|
+
s.files = ["lib/code.rb"]
|
567
599
|
s.name = "a"
|
568
600
|
s.version = "3"
|
569
601
|
s.summary = "summary"
|
570
602
|
s.description = "desc"
|
571
|
-
s.require_path =
|
603
|
+
s.require_path = "lib"
|
572
604
|
end
|
573
605
|
|
574
606
|
util_make_exec
|
575
|
-
|
576
|
-
|
577
|
-
installed_exec = File.join(util_inst_bindir,
|
578
|
-
assert_equal(@spec.bin_file(
|
607
|
+
installer.gem_dir = @spec.gem_dir
|
608
|
+
installer.generate_bin
|
609
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
610
|
+
assert_equal(@spec.bin_file("executable"),
|
579
611
|
File.readlink(installed_exec),
|
580
612
|
"Ensure symlink moved to latest version")
|
581
613
|
end
|
582
614
|
|
583
615
|
def test_generate_bin_symlink_update_older
|
584
|
-
|
616
|
+
pend "Symlinks not supported or not enabled" unless symlink_supported?
|
617
|
+
|
618
|
+
installer = setup_base_installer
|
585
619
|
|
586
|
-
|
620
|
+
installer.wrappers = false
|
587
621
|
util_make_exec
|
588
|
-
|
622
|
+
installer.gem_dir = @spec.gem_dir
|
589
623
|
|
590
|
-
|
591
|
-
installed_exec = File.join(util_inst_bindir,
|
592
|
-
assert_equal(File.join(@spec.gem_dir,
|
624
|
+
installer.generate_bin
|
625
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
626
|
+
assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
|
593
627
|
File.readlink(installed_exec))
|
594
628
|
|
595
629
|
spec = Gem::Specification.new do |s|
|
596
|
-
s.files = [
|
630
|
+
s.files = ["lib/code.rb"]
|
597
631
|
s.name = "a"
|
598
632
|
s.version = "1"
|
599
633
|
s.summary = "summary"
|
600
634
|
s.description = "desc"
|
601
|
-
s.require_path =
|
635
|
+
s.require_path = "lib"
|
602
636
|
end
|
603
637
|
|
604
638
|
util_make_exec
|
605
639
|
one = @spec.dup
|
606
640
|
one.version = 1
|
607
|
-
|
608
|
-
|
641
|
+
installer = Gem::Installer.for_spec spec
|
642
|
+
installer.gem_dir = one.gem_dir
|
609
643
|
|
610
|
-
|
644
|
+
installer.generate_bin
|
611
645
|
|
612
|
-
installed_exec = File.join util_inst_bindir,
|
613
|
-
expected = File.join @spec.gem_dir,
|
646
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
647
|
+
expected = File.join @spec.gem_dir, "bin", "executable"
|
614
648
|
assert_equal(expected,
|
615
649
|
File.readlink(installed_exec),
|
616
650
|
"Ensure symlink not moved")
|
617
651
|
end
|
618
652
|
|
619
653
|
def test_generate_bin_symlink_update_remove_wrapper
|
620
|
-
|
654
|
+
pend "Symlinks not supported or not enabled" unless symlink_supported?
|
655
|
+
|
656
|
+
installer = setup_base_installer
|
621
657
|
|
622
|
-
|
658
|
+
installer.wrappers = true
|
623
659
|
util_make_exec
|
624
|
-
|
660
|
+
installer.gem_dir = @spec.gem_dir
|
625
661
|
|
626
|
-
|
662
|
+
installer.generate_bin
|
627
663
|
|
628
|
-
installed_exec = File.join util_inst_bindir,
|
629
|
-
|
664
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
665
|
+
assert_path_exist installed_exec
|
630
666
|
|
631
667
|
@spec = Gem::Specification.new do |s|
|
632
|
-
s.files = [
|
668
|
+
s.files = ["lib/code.rb"]
|
633
669
|
s.name = "a"
|
634
670
|
s.version = "3"
|
635
671
|
s.summary = "summary"
|
636
672
|
s.description = "desc"
|
637
|
-
s.require_path =
|
673
|
+
s.require_path = "lib"
|
638
674
|
end
|
639
675
|
util_make_exec
|
640
676
|
|
641
677
|
util_installer @spec, @gemhome
|
642
|
-
|
643
|
-
|
678
|
+
installer.wrappers = false
|
679
|
+
installer.gem_dir = @spec.gem_dir
|
644
680
|
|
645
|
-
|
681
|
+
installer.generate_bin
|
646
682
|
|
647
|
-
installed_exec = File.join util_inst_bindir,
|
648
|
-
assert_equal(@spec.bin_file(
|
683
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
684
|
+
assert_equal(@spec.bin_file("executable"),
|
649
685
|
File.readlink(installed_exec),
|
650
686
|
"Ensure symlink moved to latest version")
|
651
687
|
end
|
@@ -655,18 +691,21 @@ gem 'other', version
|
|
655
691
|
Gem.win_platform = true
|
656
692
|
old_alt_separator = File::ALT_SEPARATOR
|
657
693
|
File.__send__(:remove_const, :ALT_SEPARATOR)
|
658
|
-
File.const_set(:ALT_SEPARATOR,
|
659
|
-
|
694
|
+
File.const_set(:ALT_SEPARATOR, "\\")
|
695
|
+
|
696
|
+
installer = setup_base_installer
|
697
|
+
|
698
|
+
installer.wrappers = false
|
660
699
|
util_make_exec
|
661
|
-
|
700
|
+
installer.gem_dir = @spec.gem_dir
|
662
701
|
|
663
702
|
use_ui @ui do
|
664
|
-
|
703
|
+
installer.generate_bin
|
665
704
|
end
|
666
705
|
|
667
|
-
|
668
|
-
installed_exec = File.join(util_inst_bindir,
|
669
|
-
|
706
|
+
assert_directory_exists util_inst_bindir
|
707
|
+
installed_exec = File.join(util_inst_bindir, "executable")
|
708
|
+
assert_path_exist installed_exec
|
670
709
|
|
671
710
|
if symlink_supported?
|
672
711
|
assert File.symlink?(installed_exec)
|
@@ -685,21 +724,193 @@ gem 'other', version
|
|
685
724
|
end
|
686
725
|
|
687
726
|
def test_generate_bin_uses_default_shebang
|
688
|
-
|
727
|
+
pend "Symlinks not supported or not enabled" unless symlink_supported?
|
689
728
|
|
690
|
-
|
691
|
-
|
729
|
+
load_relative "no" do
|
730
|
+
installer = setup_base_installer
|
731
|
+
|
732
|
+
installer.wrappers = true
|
733
|
+
util_make_exec
|
692
734
|
|
693
|
-
|
735
|
+
installer.generate_bin
|
694
736
|
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
737
|
+
default_shebang = Gem.ruby
|
738
|
+
shebang_line = File.open("#{@gemhome}/bin/executable") {|f| f.readlines.first }
|
739
|
+
assert_match(/\A#!/, shebang_line)
|
740
|
+
assert_match(/#{default_shebang}/, shebang_line)
|
741
|
+
end
|
742
|
+
end
|
743
|
+
|
744
|
+
def test_generate_bin_with_dangling_symlink
|
745
|
+
gem_with_dangling_symlink = File.expand_path("packages/ascii_binder-0.1.10.1.gem", __dir__)
|
746
|
+
|
747
|
+
installer = Gem::Installer.at(
|
748
|
+
gem_with_dangling_symlink,
|
749
|
+
:user_install => false,
|
750
|
+
:force => true
|
751
|
+
)
|
752
|
+
|
753
|
+
build_rake_in do
|
754
|
+
use_ui @ui do
|
755
|
+
installer.install
|
756
|
+
end
|
757
|
+
end
|
758
|
+
|
759
|
+
errors = @ui.error.split("\n")
|
760
|
+
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
|
761
|
+
assert_empty errors
|
762
|
+
|
763
|
+
assert_empty @ui.output
|
764
|
+
end
|
765
|
+
|
766
|
+
def test_generate_plugins
|
767
|
+
installer = util_setup_installer do |spec|
|
768
|
+
write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
|
769
|
+
io.write "puts __FILE__"
|
770
|
+
end
|
771
|
+
|
772
|
+
spec.files += %w[lib/rubygems_plugin.rb]
|
773
|
+
end
|
774
|
+
|
775
|
+
build_rake_in do
|
776
|
+
installer.install
|
777
|
+
end
|
778
|
+
|
779
|
+
plugin_path = File.join Gem.plugindir, "a_plugin.rb"
|
780
|
+
|
781
|
+
FileUtils.rm plugin_path
|
782
|
+
|
783
|
+
installer.generate_plugins
|
784
|
+
|
785
|
+
assert File.exist?(plugin_path), "plugin not written"
|
786
|
+
end
|
787
|
+
|
788
|
+
def test_generate_plugins_with_install_dir
|
789
|
+
spec = quick_gem "a" do |s|
|
790
|
+
write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
|
791
|
+
io.write "puts __FILE__"
|
792
|
+
end
|
793
|
+
|
794
|
+
s.files += %w[lib/rubygems_plugin.rb]
|
795
|
+
end
|
796
|
+
|
797
|
+
util_build_gem spec
|
798
|
+
|
799
|
+
plugin_path = File.join "#{@gemhome}2", "plugins", "a_plugin.rb"
|
800
|
+
installer = util_installer spec, "#{@gemhome}2"
|
801
|
+
|
802
|
+
assert_equal spec, installer.install
|
803
|
+
|
804
|
+
assert File.exist?(plugin_path), "plugin not written to install_dir"
|
805
|
+
end
|
806
|
+
|
807
|
+
def test_generate_plugins_with_user_install
|
808
|
+
spec = quick_gem "a" do |s|
|
809
|
+
write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
|
810
|
+
io.write "puts __FILE__"
|
811
|
+
end
|
812
|
+
|
813
|
+
s.files += %w[lib/rubygems_plugin.rb]
|
814
|
+
end
|
815
|
+
|
816
|
+
util_build_gem spec
|
817
|
+
|
818
|
+
File.chmod(0555, Gem.plugindir)
|
819
|
+
system_path = File.join(Gem.plugindir, "a_plugin.rb")
|
820
|
+
user_path = File.join(Gem.plugindir(Gem.user_dir), "a_plugin.rb")
|
821
|
+
installer = util_installer spec, Gem.dir, :user
|
822
|
+
|
823
|
+
assert_equal spec, installer.install
|
824
|
+
|
825
|
+
assert !File.exist?(system_path), "plugin incorrectly written to system plugins_dir"
|
826
|
+
assert File.exist?(user_path), "plugin not written to user plugins_dir"
|
827
|
+
end
|
828
|
+
|
829
|
+
def test_generate_plugins_with_build_root
|
830
|
+
spec = quick_gem "a" do |s|
|
831
|
+
write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
|
832
|
+
io.write "puts __FILE__"
|
833
|
+
end
|
834
|
+
|
835
|
+
s.files += %w[lib/rubygems_plugin.rb]
|
836
|
+
end
|
837
|
+
|
838
|
+
util_build_gem spec
|
839
|
+
|
840
|
+
File.chmod(0555, Gem.plugindir)
|
841
|
+
system_path = File.join(Gem.plugindir, "a_plugin.rb")
|
842
|
+
|
843
|
+
build_root = File.join(@tempdir, "build_root")
|
844
|
+
build_root_path = File.join(build_root, Gem.plugindir.gsub(/^[a-zA-Z]:/, ""), "a_plugin.rb")
|
845
|
+
|
846
|
+
installer = Gem::Installer.at spec.cache_file, :build_root => build_root
|
847
|
+
|
848
|
+
assert_equal spec, installer.install
|
849
|
+
|
850
|
+
assert !File.exist?(system_path), "plugin written incorrect written to system plugins_dir"
|
851
|
+
assert File.exist?(build_root_path), "plugin not written to build_root"
|
852
|
+
|
853
|
+
refute_includes File.read(build_root_path), build_root
|
854
|
+
end
|
855
|
+
|
856
|
+
def test_keeps_plugins_up_to_date
|
857
|
+
# NOTE: version a-2 is already installed by setup hooks
|
858
|
+
|
859
|
+
write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
|
860
|
+
io.write "puts __FILE__"
|
861
|
+
end
|
862
|
+
|
863
|
+
build_rake_in do
|
864
|
+
util_setup_installer do |spec|
|
865
|
+
spec.version = "1"
|
866
|
+
spec.files += %w[lib/rubygems_plugin.rb]
|
867
|
+
end.install
|
868
|
+
|
869
|
+
plugin_path = File.join Gem.plugindir, "a_plugin.rb"
|
870
|
+
refute File.exist?(plugin_path), "old version installed while newer version without plugin also installed, but plugin written"
|
871
|
+
|
872
|
+
util_setup_installer do |spec|
|
873
|
+
spec.version = "2"
|
874
|
+
spec.files += %w[lib/rubygems_plugin.rb]
|
875
|
+
end.install
|
876
|
+
|
877
|
+
plugin_path = File.join Gem.plugindir, "a_plugin.rb"
|
878
|
+
assert File.exist?(plugin_path), "latest version reinstalled, but plugin not written"
|
879
|
+
assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), "written plugin has incorrect content"
|
880
|
+
|
881
|
+
util_setup_installer do |spec|
|
882
|
+
spec.version = "3"
|
883
|
+
spec.files += %w[lib/rubygems_plugin.rb]
|
884
|
+
end.install
|
885
|
+
|
886
|
+
plugin_path = File.join Gem.plugindir, "a_plugin.rb"
|
887
|
+
assert File.exist?(plugin_path), "latest version installed, but plugin removed"
|
888
|
+
assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), "written plugin has incorrect content"
|
889
|
+
|
890
|
+
util_setup_installer do |spec|
|
891
|
+
spec.version = "4"
|
892
|
+
end.install
|
893
|
+
|
894
|
+
refute File.exist?(plugin_path), "new version installed without a plugin while older version with a plugin installed, but plugin not removed"
|
895
|
+
end
|
896
|
+
end
|
897
|
+
|
898
|
+
def test_generates_plugins_dir_under_install_dir_if_not_there
|
899
|
+
Gem.use_paths "#{@gemhome}2" # Set GEM_HOME to an uninitialized repo
|
900
|
+
|
901
|
+
@spec = util_spec "a"
|
902
|
+
|
903
|
+
path = Gem::Package.build @spec
|
904
|
+
|
905
|
+
installer = Gem::Installer.at path, :install_dir => "#{@gemhome}3"
|
906
|
+
assert_equal @spec, installer.install
|
699
907
|
end
|
700
908
|
|
701
909
|
def test_initialize
|
702
|
-
spec = util_spec
|
910
|
+
spec = util_spec "a" do |s|
|
911
|
+
s.platform = Gem::Platform.new "mswin32"
|
912
|
+
end
|
913
|
+
|
703
914
|
gem = File.join @tempdir, spec.file_name
|
704
915
|
|
705
916
|
Dir.mkdir util_inst_bindir
|
@@ -708,107 +919,102 @@ gem 'other', version
|
|
708
919
|
|
709
920
|
installer = Gem::Installer.at gem
|
710
921
|
|
711
|
-
assert_equal File.join(@gemhome,
|
712
|
-
assert_equal File.join(@gemhome,
|
922
|
+
assert_equal File.join(@gemhome, "gems", spec.full_name), installer.gem_dir
|
923
|
+
assert_equal File.join(@gemhome, "bin"), installer.bin_dir
|
713
924
|
end
|
714
925
|
|
715
926
|
def test_initialize_user_install
|
927
|
+
@gem = setup_base_gem
|
928
|
+
|
716
929
|
installer = Gem::Installer.at @gem, :user_install => true
|
717
930
|
|
718
|
-
assert_equal File.join(Gem.user_dir,
|
931
|
+
assert_equal File.join(Gem.user_dir, "gems", @spec.full_name),
|
719
932
|
installer.gem_dir
|
720
933
|
assert_equal Gem.bindir(Gem.user_dir), installer.bin_dir
|
721
934
|
end
|
722
935
|
|
723
936
|
def test_initialize_user_install_bin_dir
|
937
|
+
@gem = setup_base_gem
|
938
|
+
|
724
939
|
installer =
|
725
940
|
Gem::Installer.at @gem, :user_install => true, :bin_dir => @tempdir
|
726
941
|
|
727
|
-
assert_equal File.join(Gem.user_dir,
|
942
|
+
assert_equal File.join(Gem.user_dir, "gems", @spec.full_name),
|
728
943
|
installer.gem_dir
|
729
944
|
assert_equal @tempdir, installer.bin_dir
|
730
945
|
end
|
731
946
|
|
732
947
|
def test_install
|
733
|
-
|
734
|
-
util_setup_gem
|
735
|
-
util_clear_gems
|
948
|
+
installer = util_setup_installer
|
736
949
|
|
737
|
-
gemdir = File.join @gemhome,
|
738
|
-
cache_file = File.join @gemhome,
|
739
|
-
stub_exe = File.join @gemhome,
|
740
|
-
rakefile = File.join gemdir,
|
741
|
-
spec_file = File.join @gemhome,
|
950
|
+
gemdir = File.join @gemhome, "gems", @spec.full_name
|
951
|
+
cache_file = File.join @gemhome, "cache", @spec.file_name
|
952
|
+
stub_exe = File.join @gemhome, "bin", "executable"
|
953
|
+
rakefile = File.join gemdir, "ext", "a", "Rakefile"
|
954
|
+
spec_file = File.join @gemhome, "specifications", @spec.spec_name
|
742
955
|
|
743
|
-
Gem.pre_install do
|
744
|
-
|
745
|
-
refute_path_exists spec_file, 'spec file must not exist yet'
|
956
|
+
Gem.pre_install do
|
957
|
+
assert_path_not_exist cache_file, "cache file must not exist yet"
|
746
958
|
true
|
747
959
|
end
|
748
960
|
|
749
|
-
Gem.post_build do
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
refute_path_exists spec_file, 'spec file must not exist yet'
|
961
|
+
Gem.post_build do
|
962
|
+
assert_path_exist gemdir, "gem install dir must exist"
|
963
|
+
assert_path_exist rakefile, "gem executable must exist"
|
964
|
+
assert_path_not_exist stub_exe, "gem executable must not exist"
|
754
965
|
true
|
755
966
|
end
|
756
967
|
|
757
|
-
Gem.post_install do
|
758
|
-
|
759
|
-
assert_path_exists spec_file, 'spec file must exist'
|
968
|
+
Gem.post_install do
|
969
|
+
assert_path_exist cache_file, "cache file must exist"
|
760
970
|
end
|
761
971
|
|
762
972
|
@newspec = nil
|
763
973
|
build_rake_in do
|
764
974
|
use_ui @ui do
|
765
|
-
@newspec =
|
975
|
+
@newspec = installer.install
|
766
976
|
end
|
767
977
|
end
|
768
978
|
|
769
979
|
assert_equal @spec, @newspec
|
770
|
-
|
771
|
-
|
980
|
+
assert_path_exist gemdir
|
981
|
+
assert_path_exist stub_exe, "gem executable must exist"
|
772
982
|
|
773
|
-
exe = File.join gemdir,
|
774
|
-
|
983
|
+
exe = File.join gemdir, "bin", "executable"
|
984
|
+
assert_path_exist exe
|
775
985
|
|
776
986
|
exe_mode = File.stat(exe).mode & 0111
|
777
987
|
assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform?
|
778
988
|
|
779
|
-
|
780
|
-
|
781
|
-
assert_path_exists rakefile
|
989
|
+
assert_path_exist File.join gemdir, "lib", "code.rb"
|
782
990
|
|
783
|
-
|
991
|
+
assert_path_exist rakefile
|
784
992
|
|
785
993
|
assert_equal spec_file, @newspec.loaded_from
|
786
|
-
|
994
|
+
assert_path_exist spec_file
|
787
995
|
|
788
|
-
assert_same
|
789
|
-
assert_same
|
790
|
-
assert_same
|
996
|
+
assert_same installer, @post_build_hook_arg
|
997
|
+
assert_same installer, @post_install_hook_arg
|
998
|
+
assert_same installer, @pre_install_hook_arg
|
791
999
|
end
|
792
1000
|
|
793
1001
|
def test_install_creates_working_binstub
|
794
|
-
|
795
|
-
util_setup_gem
|
796
|
-
util_clear_gems
|
1002
|
+
installer = util_setup_installer
|
797
1003
|
|
798
|
-
|
1004
|
+
installer.wrappers = true
|
799
1005
|
|
800
|
-
gemdir = File.join @gemhome,
|
1006
|
+
gemdir = File.join @gemhome, "gems", @spec.full_name
|
801
1007
|
|
802
1008
|
@newspec = nil
|
803
1009
|
build_rake_in do
|
804
1010
|
use_ui @ui do
|
805
|
-
@newspec =
|
1011
|
+
@newspec = installer.install
|
806
1012
|
end
|
807
1013
|
end
|
808
1014
|
|
809
|
-
exe = File.join gemdir,
|
1015
|
+
exe = File.join gemdir, "bin", "executable"
|
810
1016
|
|
811
|
-
e =
|
1017
|
+
e = assert_raise RuntimeError do
|
812
1018
|
instance_eval File.read(exe)
|
813
1019
|
end
|
814
1020
|
|
@@ -816,76 +1022,73 @@ gem 'other', version
|
|
816
1022
|
end
|
817
1023
|
|
818
1024
|
def test_conflicting_binstubs
|
819
|
-
|
820
|
-
util_clear_gems
|
1025
|
+
@gem = setup_base_gem
|
821
1026
|
|
822
1027
|
# build old version that has a bin file
|
823
|
-
util_setup_gem do |spec|
|
824
|
-
File.open File.join(
|
1028
|
+
installer = util_setup_gem do |spec|
|
1029
|
+
File.open File.join("bin", "executable"), "w" do |f|
|
825
1030
|
f.puts "require 'code'"
|
826
1031
|
end
|
827
|
-
File.open File.join(
|
1032
|
+
File.open File.join("lib", "code.rb"), "w" do |f|
|
828
1033
|
f.puts 'raise "I have an executable"'
|
829
1034
|
end
|
830
1035
|
end
|
831
1036
|
|
832
|
-
|
1037
|
+
installer.wrappers = true
|
833
1038
|
build_rake_in do
|
834
1039
|
use_ui @ui do
|
835
|
-
@newspec =
|
1040
|
+
@newspec = installer.install
|
836
1041
|
end
|
837
1042
|
end
|
838
1043
|
|
839
|
-
old_bin_file = File.join
|
1044
|
+
old_bin_file = File.join installer.bin_dir, "executable"
|
840
1045
|
|
841
1046
|
# build new version that doesn't have a bin file
|
842
|
-
util_setup_gem do |spec|
|
843
|
-
FileUtils.rm File.join(
|
844
|
-
spec.files.delete File.join(
|
845
|
-
spec.executables.delete
|
1047
|
+
installer = util_setup_gem do |spec|
|
1048
|
+
FileUtils.rm File.join("bin", "executable")
|
1049
|
+
spec.files.delete File.join("bin", "executable")
|
1050
|
+
spec.executables.delete "executable"
|
846
1051
|
spec.version = @spec.version.bump
|
847
|
-
File.open File.join(
|
1052
|
+
File.open File.join("lib", "code.rb"), "w" do |f|
|
848
1053
|
f.puts 'raise "I do not have an executable"'
|
849
1054
|
end
|
850
1055
|
end
|
851
1056
|
|
852
1057
|
build_rake_in do
|
853
1058
|
use_ui @ui do
|
854
|
-
@newspec =
|
1059
|
+
@newspec = installer.install
|
855
1060
|
end
|
856
1061
|
end
|
857
1062
|
|
858
|
-
e =
|
1063
|
+
e = assert_raise RuntimeError do
|
859
1064
|
instance_eval File.read(old_bin_file)
|
860
1065
|
end
|
861
1066
|
|
862
1067
|
# We expect the bin stub to activate the version that actually contains
|
863
1068
|
# the binstub.
|
864
|
-
assert_match(
|
1069
|
+
assert_match("I have an executable", e.message)
|
865
1070
|
end
|
866
1071
|
|
867
1072
|
def test_install_creates_binstub_that_understand_version
|
868
|
-
|
869
|
-
util_setup_gem
|
870
|
-
util_clear_gems
|
1073
|
+
installer = util_setup_installer
|
871
1074
|
|
872
|
-
|
1075
|
+
installer.wrappers = true
|
873
1076
|
|
874
1077
|
@newspec = nil
|
875
1078
|
build_rake_in do
|
876
1079
|
use_ui @ui do
|
877
|
-
@newspec =
|
1080
|
+
@newspec = installer.install
|
878
1081
|
end
|
879
1082
|
end
|
880
1083
|
|
881
|
-
exe = File.join @gemhome,
|
1084
|
+
exe = File.join @gemhome, "bin", "executable"
|
882
1085
|
|
883
1086
|
ARGV.unshift "_3.0_"
|
884
1087
|
|
885
1088
|
begin
|
886
1089
|
Gem::Specification.reset
|
887
1090
|
|
888
|
-
e =
|
1091
|
+
e = assert_raise Gem::GemNotFoundException do
|
889
1092
|
instance_eval File.read(exe)
|
890
1093
|
end
|
891
1094
|
ensure
|
@@ -895,21 +1098,51 @@ gem 'other', version
|
|
895
1098
|
assert_includes(e.message, "can't find gem a (= 3.0)")
|
896
1099
|
end
|
897
1100
|
|
898
|
-
def
|
899
|
-
|
900
|
-
|
1101
|
+
def test_install_creates_binstub_that_prefers_user_installed_gem_to_default
|
1102
|
+
default_spec = new_default_spec("default", "2", nil, "exe/executable")
|
1103
|
+
default_spec.executables = "executable"
|
1104
|
+
install_default_gems default_spec
|
1105
|
+
|
1106
|
+
exe = File.join @gemhome, "bin", "executable"
|
1107
|
+
|
1108
|
+
assert_path_exist exe, "default gem's executable not installed"
|
1109
|
+
|
1110
|
+
installer = util_setup_installer do |spec|
|
1111
|
+
spec.name = "default"
|
1112
|
+
spec.version = "2"
|
1113
|
+
end
|
1114
|
+
|
901
1115
|
util_clear_gems
|
902
1116
|
|
903
|
-
|
1117
|
+
installer.wrappers = true
|
1118
|
+
|
1119
|
+
@newspec = nil
|
1120
|
+
build_rake_in do
|
1121
|
+
use_ui @ui do
|
1122
|
+
@newspec = installer.install
|
1123
|
+
end
|
1124
|
+
end
|
1125
|
+
|
1126
|
+
e = assert_raise RuntimeError do
|
1127
|
+
instance_eval File.read(exe)
|
1128
|
+
end
|
1129
|
+
|
1130
|
+
assert_equal(e.message, "ran executable")
|
1131
|
+
end
|
1132
|
+
|
1133
|
+
def test_install_creates_binstub_that_dont_trust_encoding
|
1134
|
+
installer = util_setup_installer
|
1135
|
+
|
1136
|
+
installer.wrappers = true
|
904
1137
|
|
905
1138
|
@newspec = nil
|
906
1139
|
build_rake_in do
|
907
1140
|
use_ui @ui do
|
908
|
-
@newspec =
|
1141
|
+
@newspec = installer.install
|
909
1142
|
end
|
910
1143
|
end
|
911
1144
|
|
912
|
-
exe = File.join @gemhome,
|
1145
|
+
exe = File.join @gemhome, "bin", "executable"
|
913
1146
|
|
914
1147
|
extra_arg = "\xE4pfel".dup.force_encoding("UTF-8")
|
915
1148
|
ARGV.unshift extra_arg
|
@@ -917,7 +1150,7 @@ gem 'other', version
|
|
917
1150
|
begin
|
918
1151
|
Gem::Specification.reset
|
919
1152
|
|
920
|
-
e =
|
1153
|
+
e = assert_raise RuntimeError do
|
921
1154
|
instance_eval File.read(exe)
|
922
1155
|
end
|
923
1156
|
ensure
|
@@ -928,78 +1161,97 @@ gem 'other', version
|
|
928
1161
|
end
|
929
1162
|
|
930
1163
|
def test_install_with_no_prior_files
|
931
|
-
|
932
|
-
util_clear_gems
|
1164
|
+
installer = util_setup_installer
|
933
1165
|
|
934
|
-
util_setup_gem
|
935
1166
|
build_rake_in do
|
936
1167
|
use_ui @ui do
|
937
|
-
assert_equal @spec,
|
1168
|
+
assert_equal @spec, installer.install
|
938
1169
|
end
|
939
1170
|
end
|
940
1171
|
|
941
|
-
gemdir = File.join(@gemhome,
|
942
|
-
|
1172
|
+
gemdir = File.join(@gemhome, "gems", @spec.full_name)
|
1173
|
+
assert_path_exist File.join gemdir, "lib", "code.rb"
|
1174
|
+
|
1175
|
+
installer = util_setup_installer
|
943
1176
|
|
944
|
-
util_setup_gem
|
945
1177
|
# Morph spec to have lib/other.rb instead of code.rb and recreate
|
946
|
-
@spec.files = File.join(
|
1178
|
+
@spec.files = File.join("lib", "other.rb")
|
947
1179
|
Dir.chdir @tempdir do
|
948
|
-
File.open File.join(
|
1180
|
+
File.open File.join("lib", "other.rb"), "w" do |f|
|
1181
|
+
f.puts "1"
|
1182
|
+
end
|
1183
|
+
|
949
1184
|
use_ui ui do
|
950
1185
|
FileUtils.rm @gem
|
951
1186
|
Gem::Package.build @spec
|
952
1187
|
end
|
953
1188
|
end
|
954
|
-
|
1189
|
+
installer = Gem::Installer.at @gem, :force => true
|
955
1190
|
build_rake_in do
|
956
1191
|
use_ui @ui do
|
957
|
-
assert_equal @spec,
|
1192
|
+
assert_equal @spec, installer.install
|
958
1193
|
end
|
959
1194
|
end
|
960
1195
|
|
961
|
-
|
962
|
-
|
1196
|
+
assert_path_exist File.join gemdir, "lib", "other.rb"
|
1197
|
+
assert_path_not_exist File.join gemdir, "lib", "code.rb",
|
963
1198
|
"code.rb from prior install of same gem shouldn't remain here"
|
964
1199
|
end
|
965
1200
|
|
966
1201
|
def test_install_force
|
1202
|
+
_, missing_dep_gem = util_gem "missing_dep", "1" do |s|
|
1203
|
+
s.add_dependency "doesnt_exist", "1"
|
1204
|
+
end
|
1205
|
+
|
967
1206
|
use_ui @ui do
|
968
|
-
installer = Gem::Installer.at
|
1207
|
+
installer = Gem::Installer.at missing_dep_gem, :force => true
|
969
1208
|
installer.install
|
970
1209
|
end
|
971
1210
|
|
972
|
-
gem_dir = File.join(@gemhome,
|
973
|
-
|
1211
|
+
gem_dir = File.join(@gemhome, "gems", "missing_dep-1")
|
1212
|
+
assert_path_exist gem_dir
|
1213
|
+
end
|
1214
|
+
|
1215
|
+
def test_install_build_root
|
1216
|
+
build_root = File.join(@tempdir, "build_root")
|
1217
|
+
|
1218
|
+
@gem = setup_base_gem
|
1219
|
+
installer = Gem::Installer.at @gem, :build_root => build_root
|
1220
|
+
|
1221
|
+
assert_equal @spec, installer.install
|
974
1222
|
end
|
975
1223
|
|
976
1224
|
def test_install_missing_dirs
|
977
|
-
|
978
|
-
|
979
|
-
FileUtils.
|
1225
|
+
installer = setup_base_installer
|
1226
|
+
|
1227
|
+
FileUtils.rm_rf File.join(Gem.dir, "doc")
|
1228
|
+
FileUtils.rm_rf File.join(Gem.dir, "specifications")
|
980
1229
|
|
981
1230
|
use_ui @ui do
|
982
|
-
|
1231
|
+
installer.install
|
983
1232
|
end
|
984
1233
|
|
985
|
-
|
986
|
-
|
987
|
-
File.directory? File.join(Gem.dir, 'specifications')
|
1234
|
+
assert_directory_exists File.join(Gem.dir, "doc")
|
1235
|
+
assert_directory_exists File.join(Gem.dir, "specifications")
|
988
1236
|
|
989
|
-
|
990
|
-
|
1237
|
+
assert_path_exist File.join @gemhome, "cache", @spec.file_name
|
1238
|
+
assert_path_exist File.join @gemhome, "specifications", @spec.spec_name
|
991
1239
|
end
|
992
1240
|
|
993
1241
|
def test_install_post_build_false
|
994
|
-
|
1242
|
+
@spec = util_spec "a"
|
1243
|
+
|
1244
|
+
util_build_gem @spec
|
1245
|
+
|
1246
|
+
installer = util_installer @spec, @gemhome
|
995
1247
|
|
996
1248
|
Gem.post_build do
|
997
1249
|
false
|
998
1250
|
end
|
999
1251
|
|
1000
1252
|
use_ui @ui do
|
1001
|
-
e =
|
1002
|
-
|
1253
|
+
e = assert_raise Gem::InstallError do
|
1254
|
+
installer.install
|
1003
1255
|
end
|
1004
1256
|
|
1005
1257
|
location = "#{__FILE__}:#{__LINE__ - 9}"
|
@@ -1007,41 +1259,45 @@ gem 'other', version
|
|
1007
1259
|
assert_equal "post-build hook at #{location} failed for a-2", e.message
|
1008
1260
|
end
|
1009
1261
|
|
1010
|
-
spec_file = File.join @gemhome,
|
1011
|
-
|
1262
|
+
spec_file = File.join @gemhome, "specifications", @spec.spec_name
|
1263
|
+
assert_path_not_exist spec_file
|
1012
1264
|
|
1013
|
-
gem_dir = File.join @gemhome,
|
1014
|
-
|
1265
|
+
gem_dir = File.join @gemhome, "gems", @spec.full_name
|
1266
|
+
assert_path_not_exist gem_dir
|
1015
1267
|
end
|
1016
1268
|
|
1017
1269
|
def test_install_post_build_nil
|
1018
|
-
|
1270
|
+
installer = setup_base_installer
|
1019
1271
|
|
1020
1272
|
Gem.post_build do
|
1021
1273
|
nil
|
1022
1274
|
end
|
1023
1275
|
|
1024
1276
|
use_ui @ui do
|
1025
|
-
|
1277
|
+
installer.install
|
1026
1278
|
end
|
1027
1279
|
|
1028
|
-
spec_file = File.join @gemhome,
|
1029
|
-
|
1280
|
+
spec_file = File.join @gemhome, "specifications", @spec.spec_name
|
1281
|
+
assert_path_exist spec_file
|
1030
1282
|
|
1031
|
-
gem_dir = File.join @gemhome,
|
1032
|
-
|
1283
|
+
gem_dir = File.join @gemhome, "gems", @spec.full_name
|
1284
|
+
assert_path_exist gem_dir
|
1033
1285
|
end
|
1034
1286
|
|
1035
1287
|
def test_install_pre_install_false
|
1036
|
-
|
1288
|
+
@spec = util_spec "a"
|
1289
|
+
|
1290
|
+
util_build_gem @spec
|
1291
|
+
|
1292
|
+
installer = util_installer @spec, @gemhome
|
1037
1293
|
|
1038
1294
|
Gem.pre_install do
|
1039
1295
|
false
|
1040
1296
|
end
|
1041
1297
|
|
1042
1298
|
use_ui @ui do
|
1043
|
-
e =
|
1044
|
-
|
1299
|
+
e = assert_raise Gem::InstallError do
|
1300
|
+
installer.install
|
1045
1301
|
end
|
1046
1302
|
|
1047
1303
|
location = "#{__FILE__}:#{__LINE__ - 9}"
|
@@ -1049,54 +1305,57 @@ gem 'other', version
|
|
1049
1305
|
assert_equal "pre-install hook at #{location} failed for a-2", e.message
|
1050
1306
|
end
|
1051
1307
|
|
1052
|
-
spec_file = File.join @gemhome,
|
1053
|
-
|
1308
|
+
spec_file = File.join @gemhome, "specifications", @spec.spec_name
|
1309
|
+
assert_path_not_exist spec_file
|
1054
1310
|
end
|
1055
1311
|
|
1056
1312
|
def test_install_pre_install_nil
|
1057
|
-
|
1313
|
+
installer = setup_base_installer
|
1058
1314
|
|
1059
1315
|
Gem.pre_install do
|
1060
1316
|
nil
|
1061
1317
|
end
|
1062
1318
|
|
1063
1319
|
use_ui @ui do
|
1064
|
-
|
1320
|
+
installer.install
|
1065
1321
|
end
|
1066
1322
|
|
1067
|
-
spec_file = File.join @gemhome,
|
1068
|
-
|
1323
|
+
spec_file = File.join @gemhome, "specifications", @spec.spec_name
|
1324
|
+
assert_path_exist spec_file
|
1069
1325
|
end
|
1070
1326
|
|
1071
1327
|
def test_install_with_message
|
1072
|
-
@spec
|
1328
|
+
@spec = setup_base_spec
|
1329
|
+
@spec.post_install_message = "I am a shiny gem!"
|
1073
1330
|
|
1074
1331
|
use_ui @ui do
|
1075
1332
|
path = Gem::Package.build @spec
|
1076
1333
|
|
1077
|
-
|
1078
|
-
|
1334
|
+
installer = Gem::Installer.at path
|
1335
|
+
installer.install
|
1079
1336
|
end
|
1080
1337
|
|
1081
|
-
assert_match %r
|
1338
|
+
assert_match %r{I am a shiny gem!}, @ui.output
|
1082
1339
|
end
|
1083
1340
|
|
1084
1341
|
def test_install_with_skipped_message
|
1085
|
-
@spec
|
1342
|
+
@spec = setup_base_spec
|
1343
|
+
@spec.post_install_message = "I am a shiny gem!"
|
1086
1344
|
|
1087
1345
|
use_ui @ui do
|
1088
1346
|
path = Gem::Package.build @spec
|
1089
1347
|
|
1090
|
-
|
1091
|
-
|
1348
|
+
installer = Gem::Installer.at path, :post_install_message => false
|
1349
|
+
installer.install
|
1092
1350
|
end
|
1093
1351
|
|
1094
|
-
refute_match %r
|
1352
|
+
refute_match %r{I am a shiny gem!}, @ui.output
|
1095
1353
|
end
|
1096
1354
|
|
1097
1355
|
def test_install_extension_dir
|
1098
1356
|
gemhome2 = "#{@gemhome}2"
|
1099
1357
|
|
1358
|
+
@spec = setup_base_spec
|
1100
1359
|
@spec.extensions << "extconf.rb"
|
1101
1360
|
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1102
1361
|
io.write <<-RUBY
|
@@ -1114,12 +1373,14 @@ gem 'other', version
|
|
1114
1373
|
installer.install
|
1115
1374
|
end
|
1116
1375
|
|
1117
|
-
expected_makefile = File.join gemhome2,
|
1376
|
+
expected_makefile = File.join gemhome2, "gems", @spec.full_name, "Makefile"
|
1118
1377
|
|
1119
|
-
|
1378
|
+
assert_path_exist expected_makefile
|
1120
1379
|
end
|
1121
1380
|
|
1122
1381
|
def test_install_extension_dir_is_removed_on_reinstall
|
1382
|
+
@spec = setup_base_spec
|
1383
|
+
|
1123
1384
|
@spec.extensions << "extconf.rb"
|
1124
1385
|
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1125
1386
|
io.write <<-RUBY
|
@@ -1143,18 +1404,19 @@ gem 'other', version
|
|
1143
1404
|
write_file should_be_removed do |io|
|
1144
1405
|
io.write "DELETE ME ON REINSTALL"
|
1145
1406
|
end
|
1146
|
-
|
1407
|
+
assert_path_exist should_be_removed
|
1147
1408
|
|
1148
1409
|
# reinstall the gem, this is also the same as pristine
|
1149
1410
|
use_ui @ui do
|
1150
|
-
installer = Gem::Installer.at path
|
1411
|
+
installer = Gem::Installer.at path, :force => true
|
1151
1412
|
installer.install
|
1152
1413
|
end
|
1153
1414
|
|
1154
|
-
|
1415
|
+
assert_path_not_exist should_be_removed
|
1155
1416
|
end
|
1156
1417
|
|
1157
1418
|
def test_install_user_extension_dir
|
1419
|
+
@spec = setup_base_spec
|
1158
1420
|
@spec.extensions << "extconf.rb"
|
1159
1421
|
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1160
1422
|
io.write <<-RUBY
|
@@ -1176,14 +1438,17 @@ gem 'other', version
|
|
1176
1438
|
installer.install
|
1177
1439
|
end
|
1178
1440
|
|
1179
|
-
expected_makefile = File.join Gem.user_dir,
|
1441
|
+
expected_makefile = File.join Gem.user_dir, "gems", @spec.full_name, "Makefile"
|
1180
1442
|
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1443
|
+
assert_path_exist expected_makefile
|
1444
|
+
assert_path_exist expected_extension_dir
|
1445
|
+
assert_path_not_exist File.join expected_extension_dir, "gem_make.out"
|
1184
1446
|
end
|
1185
1447
|
|
1186
1448
|
def test_find_lib_file_after_install
|
1449
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1450
|
+
|
1451
|
+
@spec = setup_base_spec
|
1187
1452
|
@spec.extensions << "extconf.rb"
|
1188
1453
|
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1189
1454
|
io.write <<-RUBY
|
@@ -1207,7 +1472,7 @@ gem 'other', version
|
|
1207
1472
|
end
|
1208
1473
|
|
1209
1474
|
Dir.mkdir File.join(@tempdir, "lib")
|
1210
|
-
write_file File.join(@tempdir,
|
1475
|
+
write_file File.join(@tempdir, "lib", "b.rb") do |io|
|
1211
1476
|
io.write "# b.rb"
|
1212
1477
|
end
|
1213
1478
|
|
@@ -1220,13 +1485,17 @@ gem 'other', version
|
|
1220
1485
|
installer.install
|
1221
1486
|
end
|
1222
1487
|
|
1223
|
-
expected = File.join @spec.full_require_paths.find {
|
1224
|
-
File.exist? File.join path,
|
1225
|
-
},
|
1226
|
-
assert_equal expected, @spec.matches_for_glob(
|
1488
|
+
expected = File.join @spec.full_require_paths.find {|path|
|
1489
|
+
File.exist? File.join path, "b.rb"
|
1490
|
+
}, "b.rb"
|
1491
|
+
assert_equal expected, @spec.matches_for_glob("b.rb").first
|
1227
1492
|
end
|
1228
1493
|
|
1229
1494
|
def test_install_extension_and_script
|
1495
|
+
pend "Makefile creation crashes on jruby" if Gem.java_platform?
|
1496
|
+
pend if RUBY_PLATFORM.include?("mswin") && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
|
1497
|
+
|
1498
|
+
@spec = setup_base_spec
|
1230
1499
|
@spec.extensions << "extconf.rb"
|
1231
1500
|
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1232
1501
|
io.write <<-RUBY
|
@@ -1252,118 +1521,166 @@ gem 'other', version
|
|
1252
1521
|
RUBY
|
1253
1522
|
end
|
1254
1523
|
|
1255
|
-
|
1256
|
-
|
1524
|
+
assert_path_not_exist File.join @spec.gem_dir, rb
|
1525
|
+
assert_path_not_exist File.join @spec.gem_dir, rb2
|
1257
1526
|
use_ui @ui do
|
1258
1527
|
path = Gem::Package.build @spec
|
1259
1528
|
|
1260
|
-
|
1261
|
-
|
1529
|
+
installer = Gem::Installer.at path
|
1530
|
+
installer.install
|
1262
1531
|
end
|
1263
|
-
|
1264
|
-
|
1532
|
+
assert_path_exist File.join @spec.gem_dir, rb
|
1533
|
+
assert_path_exist File.join @spec.gem_dir, rb2
|
1265
1534
|
end
|
1266
1535
|
|
1267
1536
|
def test_install_extension_flat
|
1268
|
-
|
1537
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1269
1538
|
|
1270
|
-
|
1539
|
+
begin
|
1540
|
+
@spec = setup_base_spec
|
1541
|
+
@spec.require_paths = ["."]
|
1271
1542
|
|
1272
|
-
|
1273
|
-
io.write <<-RUBY
|
1274
|
-
require "mkmf"
|
1543
|
+
@spec.extensions << "extconf.rb"
|
1275
1544
|
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1545
|
+
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1546
|
+
io.write <<-RUBY
|
1547
|
+
require "mkmf"
|
1279
1548
|
|
1280
|
-
|
1281
|
-
|
1549
|
+
CONFIG['CC'] = '$(TOUCH) $@ ||'
|
1550
|
+
CONFIG['LDSHARED'] = '$(TOUCH) $@ ||'
|
1551
|
+
$ruby = '#{Gem.ruby}'
|
1552
|
+
|
1553
|
+
create_makefile("#{@spec.name}")
|
1554
|
+
RUBY
|
1555
|
+
end
|
1556
|
+
|
1557
|
+
# empty depend file for no auto dependencies
|
1558
|
+
@spec.files += %W[depend #{@spec.name}.c].each do |file|
|
1559
|
+
write_file File.join(@tempdir, file)
|
1560
|
+
end
|
1561
|
+
|
1562
|
+
so = File.join(@spec.extension_dir, "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}")
|
1563
|
+
assert_path_not_exist so
|
1564
|
+
use_ui @ui do
|
1565
|
+
path = Gem::Package.build @spec
|
1566
|
+
|
1567
|
+
installer = Gem::Installer.at path
|
1568
|
+
installer.install
|
1569
|
+
end
|
1570
|
+
assert_path_exist so
|
1571
|
+
rescue
|
1572
|
+
puts "-" * 78
|
1573
|
+
puts File.read File.join(@gemhome, "gems", "a-2", "Makefile")
|
1574
|
+
puts "-" * 78
|
1575
|
+
|
1576
|
+
path = File.join(@gemhome, "gems", "a-2", "gem_make.out")
|
1577
|
+
|
1578
|
+
if File.exist?(path)
|
1579
|
+
puts File.read(path)
|
1580
|
+
puts "-" * 78
|
1581
|
+
end
|
1582
|
+
|
1583
|
+
raise
|
1282
1584
|
end
|
1585
|
+
end
|
1586
|
+
|
1587
|
+
def test_install_extension_clean_intermediate_files
|
1588
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1589
|
+
@spec = setup_base_spec
|
1590
|
+
@spec.require_paths = ["."]
|
1591
|
+
@spec.extensions << "extconf.rb"
|
1592
|
+
|
1593
|
+
File.write File.join(@tempdir, "extconf.rb"), <<-RUBY
|
1594
|
+
require "mkmf"
|
1595
|
+
CONFIG['CC'] = '$(TOUCH) $@ ||'
|
1596
|
+
CONFIG['LDSHARED'] = '$(TOUCH) $@ ||'
|
1597
|
+
$ruby = '#{Gem.ruby}'
|
1598
|
+
create_makefile("#{@spec.name}")
|
1599
|
+
RUBY
|
1283
1600
|
|
1284
1601
|
# empty depend file for no auto dependencies
|
1285
|
-
@spec.files += %W
|
1602
|
+
@spec.files += %W[depend #{@spec.name}.c].each do |file|
|
1286
1603
|
write_file File.join(@tempdir, file)
|
1287
|
-
|
1604
|
+
end
|
1605
|
+
|
1606
|
+
shared_object = "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}"
|
1607
|
+
extension_file = File.join @spec.extension_dir, shared_object
|
1608
|
+
intermediate_file = File.join @spec.gem_dir, shared_object
|
1288
1609
|
|
1289
|
-
|
1290
|
-
refute_path_exists so
|
1610
|
+
assert_path_not_exist extension_file, "no before installing"
|
1291
1611
|
use_ui @ui do
|
1292
1612
|
path = Gem::Package.build @spec
|
1293
1613
|
|
1294
|
-
|
1295
|
-
|
1296
|
-
end
|
1297
|
-
assert_path_exists so
|
1298
|
-
rescue
|
1299
|
-
puts '-' * 78
|
1300
|
-
puts File.read File.join(@gemhome, 'gems', 'a-2', 'Makefile')
|
1301
|
-
puts '-' * 78
|
1302
|
-
|
1303
|
-
path = File.join(@gemhome, 'gems', 'a-2', 'gem_make.out')
|
1304
|
-
|
1305
|
-
if File.exist?(path)
|
1306
|
-
puts File.read(path)
|
1307
|
-
puts '-' * 78
|
1614
|
+
installer = Gem::Installer.at path
|
1615
|
+
installer.install
|
1308
1616
|
end
|
1309
1617
|
|
1310
|
-
|
1618
|
+
assert_path_exist extension_file, "installed"
|
1619
|
+
assert_path_not_exist intermediate_file
|
1311
1620
|
end
|
1312
1621
|
|
1313
1622
|
def test_installation_satisfies_dependency_eh
|
1314
|
-
|
1623
|
+
installer = setup_base_installer
|
1624
|
+
|
1625
|
+
util_spec "a"
|
1315
1626
|
|
1316
|
-
dep = Gem::Dependency.new
|
1317
|
-
assert
|
1627
|
+
dep = Gem::Dependency.new "a", ">= 2"
|
1628
|
+
assert installer.installation_satisfies_dependency?(dep)
|
1318
1629
|
|
1319
|
-
dep = Gem::Dependency.new
|
1320
|
-
refute
|
1630
|
+
dep = Gem::Dependency.new "a", "> 2"
|
1631
|
+
refute installer.installation_satisfies_dependency?(dep)
|
1321
1632
|
end
|
1322
1633
|
|
1323
1634
|
def test_installation_satisfies_dependency_eh_development
|
1324
|
-
|
1325
|
-
|
1635
|
+
installer = setup_base_installer
|
1636
|
+
installer.options[:development] = true
|
1637
|
+
installer.options[:dev_shallow] = true
|
1326
1638
|
|
1327
|
-
util_spec
|
1639
|
+
util_spec "a"
|
1328
1640
|
|
1329
|
-
dep = Gem::Dependency.new
|
1330
|
-
assert
|
1641
|
+
dep = Gem::Dependency.new "a", :development
|
1642
|
+
assert installer.installation_satisfies_dependency?(dep)
|
1331
1643
|
end
|
1332
1644
|
|
1333
1645
|
def test_pre_install_checks_dependencies
|
1334
|
-
|
1335
|
-
|
1646
|
+
installer = setup_base_installer
|
1647
|
+
@spec.add_dependency "b", "> 5"
|
1648
|
+
installer = util_setup_gem
|
1649
|
+
installer.force = false
|
1336
1650
|
|
1337
1651
|
use_ui @ui do
|
1338
|
-
|
1339
|
-
|
1652
|
+
assert_raise Gem::InstallError do
|
1653
|
+
installer.install
|
1340
1654
|
end
|
1341
1655
|
end
|
1342
1656
|
end
|
1343
1657
|
|
1344
1658
|
def test_pre_install_checks_dependencies_ignore
|
1345
|
-
|
1346
|
-
@
|
1659
|
+
installer = util_setup_installer
|
1660
|
+
@spec.add_dependency "b", "> 5"
|
1661
|
+
installer.ignore_dependencies = true
|
1347
1662
|
|
1348
1663
|
build_rake_in do
|
1349
1664
|
use_ui @ui do
|
1350
|
-
assert
|
1665
|
+
assert installer.pre_install_checks
|
1351
1666
|
end
|
1352
1667
|
end
|
1353
1668
|
end
|
1354
1669
|
|
1355
1670
|
def test_pre_install_checks_dependencies_install_dir
|
1356
1671
|
gemhome2 = "#{@gemhome}2"
|
1357
|
-
@spec.add_dependency 'd'
|
1358
1672
|
|
1359
|
-
|
1673
|
+
@gem = setup_base_gem
|
1674
|
+
@spec.add_dependency "d"
|
1675
|
+
|
1676
|
+
quick_gem "d", 2
|
1360
1677
|
|
1361
1678
|
gem = File.join @gemhome, @spec.file_name
|
1362
1679
|
|
1363
1680
|
FileUtils.mv @gemhome, gemhome2
|
1364
1681
|
FileUtils.mkdir @gemhome
|
1365
1682
|
|
1366
|
-
FileUtils.mv File.join(gemhome2,
|
1683
|
+
FileUtils.mv File.join(gemhome2, "cache", @spec.file_name), gem
|
1367
1684
|
|
1368
1685
|
# Don't leak any already activated gems into the installer, require
|
1369
1686
|
# that it work everything out on it's own.
|
@@ -1378,56 +1695,8 @@ gem 'other', version
|
|
1378
1695
|
end
|
1379
1696
|
end
|
1380
1697
|
|
1381
|
-
def test_pre_install_checks_ruby_version
|
1382
|
-
use_ui @ui do
|
1383
|
-
installer = Gem::Installer.at old_ruby_required('= 1.4.6')
|
1384
|
-
e = assert_raises Gem::RuntimeRequirementNotMetError do
|
1385
|
-
installer.pre_install_checks
|
1386
|
-
end
|
1387
|
-
rv = Gem.ruby_version
|
1388
|
-
assert_equal "old_ruby_required requires Ruby version = 1.4.6. The current ruby version is #{rv}.",
|
1389
|
-
e.message
|
1390
|
-
end
|
1391
|
-
end
|
1392
|
-
|
1393
|
-
def test_pre_install_checks_ruby_version_with_prereleases
|
1394
|
-
util_set_RUBY_VERSION '2.6.0', -1, '63539', 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]'
|
1395
|
-
|
1396
|
-
installer = Gem::Installer.at old_ruby_required('>= 2.6.0.preview2')
|
1397
|
-
assert installer.pre_install_checks
|
1398
|
-
|
1399
|
-
installer = Gem::Installer.at old_ruby_required('> 2.6.0.preview2')
|
1400
|
-
e = assert_raises Gem::RuntimeRequirementNotMetError do
|
1401
|
-
assert installer.pre_install_checks
|
1402
|
-
end
|
1403
|
-
assert_equal "old_ruby_required requires Ruby version > 2.6.0.preview2. The current ruby version is 2.6.0.preview2.",
|
1404
|
-
e.message
|
1405
|
-
ensure
|
1406
|
-
util_restore_RUBY_VERSION
|
1407
|
-
end
|
1408
|
-
|
1409
|
-
def test_pre_install_checks_wrong_rubygems_version
|
1410
|
-
spec = util_spec 'old_rubygems_required', '1' do |s|
|
1411
|
-
s.required_rubygems_version = '< 0'
|
1412
|
-
end
|
1413
|
-
|
1414
|
-
util_build_gem spec
|
1415
|
-
|
1416
|
-
gem = File.join(@gemhome, 'cache', spec.file_name)
|
1417
|
-
|
1418
|
-
use_ui @ui do
|
1419
|
-
@installer = Gem::Installer.at gem
|
1420
|
-
e = assert_raises Gem::RuntimeRequirementNotMetError do
|
1421
|
-
@installer.pre_install_checks
|
1422
|
-
end
|
1423
|
-
rgv = Gem::VERSION
|
1424
|
-
assert_equal "old_rubygems_required requires RubyGems version < 0. The current RubyGems version is #{rgv}. " +
|
1425
|
-
"Try 'gem update --system' to update RubyGems itself.", e.message
|
1426
|
-
end
|
1427
|
-
end
|
1428
|
-
|
1429
1698
|
def test_pre_install_checks_malicious_name
|
1430
|
-
spec = util_spec
|
1699
|
+
spec = util_spec "../malicious", "1"
|
1431
1700
|
def spec.full_name # so the spec is buildable
|
1432
1701
|
"malicious-1"
|
1433
1702
|
end
|
@@ -1435,19 +1704,19 @@ gem 'other', version
|
|
1435
1704
|
|
1436
1705
|
util_build_gem spec
|
1437
1706
|
|
1438
|
-
gem = File.join(@gemhome,
|
1707
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1439
1708
|
|
1440
1709
|
use_ui @ui do
|
1441
|
-
|
1442
|
-
e =
|
1443
|
-
|
1710
|
+
installer = Gem::Installer.at gem
|
1711
|
+
e = assert_raise Gem::InstallError do
|
1712
|
+
installer.pre_install_checks
|
1444
1713
|
end
|
1445
|
-
assert_equal
|
1714
|
+
assert_equal "#<Gem::Specification name=../malicious version=1> has an invalid name", e.message
|
1446
1715
|
end
|
1447
1716
|
end
|
1448
1717
|
|
1449
1718
|
def test_pre_install_checks_malicious_name_before_eval
|
1450
|
-
spec = util_spec "malicious\n::Object.const_set(:FROM_EVAL, true)#",
|
1719
|
+
spec = util_spec "malicious\n::Object.const_set(:FROM_EVAL, true)#", "1"
|
1451
1720
|
def spec.full_name # so the spec is buildable
|
1452
1721
|
"malicious-1"
|
1453
1722
|
end
|
@@ -1455,12 +1724,12 @@ gem 'other', version
|
|
1455
1724
|
|
1456
1725
|
util_build_gem spec
|
1457
1726
|
|
1458
|
-
gem = File.join(@gemhome,
|
1727
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1459
1728
|
|
1460
1729
|
use_ui @ui do
|
1461
|
-
|
1462
|
-
e =
|
1463
|
-
|
1730
|
+
installer = Gem::Installer.at gem
|
1731
|
+
e = assert_raise Gem::InstallError do
|
1732
|
+
installer.pre_install_checks
|
1464
1733
|
end
|
1465
1734
|
assert_equal "#<Gem::Specification name=malicious\n::Object.const_set(:FROM_EVAL, true)# version=1> has an invalid name", e.message
|
1466
1735
|
end
|
@@ -1468,7 +1737,7 @@ gem 'other', version
|
|
1468
1737
|
end
|
1469
1738
|
|
1470
1739
|
def test_pre_install_checks_malicious_require_paths_before_eval
|
1471
|
-
spec = util_spec "malicious",
|
1740
|
+
spec = util_spec "malicious", "1"
|
1472
1741
|
def spec.full_name # so the spec is buildable
|
1473
1742
|
"malicious-1"
|
1474
1743
|
end
|
@@ -1477,19 +1746,21 @@ gem 'other', version
|
|
1477
1746
|
|
1478
1747
|
util_build_gem spec
|
1479
1748
|
|
1480
|
-
gem = File.join(@gemhome,
|
1749
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1481
1750
|
|
1482
1751
|
use_ui @ui do
|
1483
|
-
|
1484
|
-
e =
|
1485
|
-
|
1752
|
+
installer = Gem::Installer.at gem
|
1753
|
+
e = assert_raise Gem::InstallError do
|
1754
|
+
installer.pre_install_checks
|
1486
1755
|
end
|
1487
1756
|
assert_equal "#<Gem::Specification name=malicious version=1> has an invalid require_paths", e.message
|
1488
1757
|
end
|
1489
1758
|
end
|
1490
1759
|
|
1491
1760
|
def test_pre_install_checks_malicious_extensions_before_eval
|
1492
|
-
|
1761
|
+
pend "mswin environment disallow to create file contained the carriage return code." if Gem.win_platform?
|
1762
|
+
|
1763
|
+
spec = util_spec "malicious", "1"
|
1493
1764
|
def spec.full_name # so the spec is buildable
|
1494
1765
|
"malicious-1"
|
1495
1766
|
end
|
@@ -1498,19 +1769,19 @@ gem 'other', version
|
|
1498
1769
|
|
1499
1770
|
util_build_gem spec
|
1500
1771
|
|
1501
|
-
gem = File.join(@gemhome,
|
1772
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1502
1773
|
|
1503
1774
|
use_ui @ui do
|
1504
|
-
|
1505
|
-
e =
|
1506
|
-
|
1775
|
+
installer = Gem::Installer.at gem
|
1776
|
+
e = assert_raise Gem::InstallError do
|
1777
|
+
installer.pre_install_checks
|
1507
1778
|
end
|
1508
1779
|
assert_equal "#<Gem::Specification name=malicious version=1> has an invalid extensions", e.message
|
1509
1780
|
end
|
1510
1781
|
end
|
1511
1782
|
|
1512
1783
|
def test_pre_install_checks_malicious_specification_version_before_eval
|
1513
|
-
spec = util_spec "malicious",
|
1784
|
+
spec = util_spec "malicious", "1"
|
1514
1785
|
def spec.full_name # so the spec is buildable
|
1515
1786
|
"malicious-1"
|
1516
1787
|
end
|
@@ -1519,216 +1790,389 @@ gem 'other', version
|
|
1519
1790
|
|
1520
1791
|
util_build_gem spec
|
1521
1792
|
|
1522
|
-
gem = File.join(@gemhome,
|
1793
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1523
1794
|
|
1524
1795
|
use_ui @ui do
|
1525
|
-
|
1526
|
-
e =
|
1527
|
-
|
1796
|
+
installer = Gem::Installer.at gem
|
1797
|
+
e = assert_raise Gem::InstallError do
|
1798
|
+
installer.pre_install_checks
|
1528
1799
|
end
|
1529
1800
|
assert_equal "#<Gem::Specification name=malicious version=1> has an invalid specification_version", e.message
|
1530
1801
|
end
|
1531
1802
|
end
|
1532
1803
|
|
1533
1804
|
def test_pre_install_checks_malicious_dependencies_before_eval
|
1534
|
-
spec = util_spec "malicious",
|
1805
|
+
spec = util_spec "malicious", "1"
|
1535
1806
|
def spec.full_name # so the spec is buildable
|
1536
1807
|
"malicious-1"
|
1537
1808
|
end
|
1538
1809
|
def spec.validate(*args); end
|
1539
|
-
spec.add_dependency "b\nfoo",
|
1810
|
+
spec.add_dependency "b\nfoo", "> 5"
|
1540
1811
|
|
1541
1812
|
util_build_gem spec
|
1542
1813
|
|
1543
|
-
gem = File.join(@gemhome,
|
1814
|
+
gem = File.join(@gemhome, "cache", spec.file_name)
|
1544
1815
|
|
1545
1816
|
use_ui @ui do
|
1546
|
-
|
1547
|
-
|
1548
|
-
e =
|
1549
|
-
|
1817
|
+
installer = Gem::Installer.at gem
|
1818
|
+
installer.ignore_dependencies = true
|
1819
|
+
e = assert_raise Gem::InstallError do
|
1820
|
+
installer.pre_install_checks
|
1550
1821
|
end
|
1551
1822
|
assert_equal "#<Gem::Specification name=malicious version=1> has an invalid dependencies", e.message
|
1552
1823
|
end
|
1553
1824
|
end
|
1554
1825
|
|
1826
|
+
def test_pre_install_checks_malicious_platform_before_eval
|
1827
|
+
gem_with_ill_formated_platform = File.expand_path("packages/ill-formatted-platform-1.0.0.10.gem", __dir__)
|
1828
|
+
|
1829
|
+
installer = Gem::Installer.at(
|
1830
|
+
gem_with_ill_formated_platform,
|
1831
|
+
:install_dir => @gemhome,
|
1832
|
+
:user_install => false,
|
1833
|
+
:force => true
|
1834
|
+
)
|
1835
|
+
|
1836
|
+
use_ui @ui do
|
1837
|
+
e = assert_raise Gem::InstallError do
|
1838
|
+
installer.pre_install_checks
|
1839
|
+
end
|
1840
|
+
|
1841
|
+
assert_equal "x86-mswin32\n system('id > /tmp/nyangawa')# is an invalid platform", e.message
|
1842
|
+
assert_empty @ui.output
|
1843
|
+
end
|
1844
|
+
end
|
1845
|
+
|
1555
1846
|
def test_shebang
|
1556
|
-
|
1847
|
+
load_relative "no" do
|
1848
|
+
installer = setup_base_installer
|
1849
|
+
|
1850
|
+
util_make_exec @spec, "#!/usr/bin/ruby"
|
1557
1851
|
|
1558
|
-
|
1852
|
+
shebang = installer.shebang "executable"
|
1559
1853
|
|
1560
|
-
|
1854
|
+
assert_equal "#!#{Gem.ruby}", shebang
|
1855
|
+
end
|
1561
1856
|
end
|
1562
1857
|
|
1563
1858
|
def test_process_options
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1859
|
+
installer = setup_base_installer
|
1860
|
+
|
1861
|
+
assert_nil installer.build_root
|
1862
|
+
assert_equal File.join(@gemhome, "bin"), installer.bin_dir
|
1863
|
+
assert_equal @gemhome, installer.gem_home
|
1567
1864
|
end
|
1568
1865
|
|
1569
1866
|
def test_process_options_build_root
|
1570
|
-
build_root = File.join @tempdir,
|
1867
|
+
build_root = File.join @tempdir, "build_root"
|
1868
|
+
bin_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""), "bin")
|
1869
|
+
gem_home = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""))
|
1870
|
+
plugins_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""), "plugins")
|
1871
|
+
|
1872
|
+
@gem = setup_base_gem
|
1873
|
+
installer = use_ui(@ui) { Gem::Installer.at @gem, :build_root => build_root }
|
1571
1874
|
|
1572
|
-
|
1875
|
+
assert_equal build_root, installer.build_root
|
1876
|
+
assert_equal bin_dir, installer.bin_dir
|
1877
|
+
assert_equal gem_home, installer.gem_home
|
1573
1878
|
|
1574
|
-
|
1575
|
-
|
1576
|
-
assert_equal
|
1879
|
+
errors = @ui.error.split("\n")
|
1880
|
+
|
1881
|
+
assert_equal "WARNING: You build with buildroot.", errors.shift
|
1882
|
+
assert_equal " Build root: #{build_root}", errors.shift
|
1883
|
+
assert_equal " Bin dir: #{bin_dir}", errors.shift
|
1884
|
+
assert_equal " Gem home: #{gem_home}", errors.shift
|
1885
|
+
assert_equal " Plugins dir: #{plugins_dir}", errors.shift
|
1577
1886
|
end
|
1578
1887
|
|
1579
1888
|
def test_shebang_arguments
|
1580
|
-
|
1889
|
+
load_relative "no" do
|
1890
|
+
installer = setup_base_installer
|
1581
1891
|
|
1582
|
-
|
1892
|
+
util_make_exec @spec, "#!/usr/bin/ruby -ws"
|
1583
1893
|
|
1584
|
-
|
1894
|
+
shebang = installer.shebang "executable"
|
1895
|
+
|
1896
|
+
assert_equal "#!#{Gem.ruby} -ws", shebang
|
1897
|
+
end
|
1898
|
+
end
|
1899
|
+
|
1900
|
+
def test_shebang_arguments_with_load_relative
|
1901
|
+
load_relative "yes" do
|
1902
|
+
installer = setup_base_installer
|
1903
|
+
|
1904
|
+
util_make_exec @spec, "#!/usr/bin/ruby -ws"
|
1905
|
+
|
1906
|
+
shebang = installer.shebang "executable"
|
1907
|
+
|
1908
|
+
shebang_lines = shebang.split "\n"
|
1909
|
+
|
1910
|
+
assert_equal "#!/bin/sh", shebang_lines.shift
|
1911
|
+
assert_includes shebang_lines, "#!#{Gem.ruby} -ws"
|
1912
|
+
end
|
1585
1913
|
end
|
1586
1914
|
|
1587
1915
|
def test_shebang_empty
|
1588
|
-
|
1916
|
+
load_relative "no" do
|
1917
|
+
installer = setup_base_installer
|
1918
|
+
|
1919
|
+
util_make_exec @spec, ""
|
1589
1920
|
|
1590
|
-
|
1591
|
-
|
1921
|
+
shebang = installer.shebang "executable"
|
1922
|
+
assert_equal "#!#{Gem.ruby}", shebang
|
1923
|
+
end
|
1592
1924
|
end
|
1593
1925
|
|
1594
1926
|
def test_shebang_env
|
1595
|
-
|
1927
|
+
load_relative "no" do
|
1928
|
+
installer = setup_base_installer
|
1929
|
+
|
1930
|
+
util_make_exec @spec, "#!/usr/bin/env ruby"
|
1596
1931
|
|
1597
|
-
|
1932
|
+
shebang = installer.shebang "executable"
|
1598
1933
|
|
1599
|
-
|
1934
|
+
assert_equal "#!#{Gem.ruby}", shebang
|
1935
|
+
end
|
1600
1936
|
end
|
1601
1937
|
|
1602
1938
|
def test_shebang_env_arguments
|
1603
|
-
|
1939
|
+
load_relative "no" do
|
1940
|
+
installer = setup_base_installer
|
1941
|
+
|
1942
|
+
util_make_exec @spec, "#!/usr/bin/env ruby -ws"
|
1943
|
+
|
1944
|
+
shebang = installer.shebang "executable"
|
1945
|
+
|
1946
|
+
assert_equal "#!#{Gem.ruby} -ws", shebang
|
1947
|
+
end
|
1948
|
+
end
|
1949
|
+
|
1950
|
+
def test_shebang_env_arguments_with_load_relative
|
1951
|
+
load_relative "yes" do
|
1952
|
+
installer = setup_base_installer
|
1953
|
+
|
1954
|
+
util_make_exec @spec, "#!/usr/bin/env ruby -ws"
|
1955
|
+
|
1956
|
+
shebang = installer.shebang "executable"
|
1604
1957
|
|
1605
|
-
|
1958
|
+
shebang_lines = shebang.split "\n"
|
1606
1959
|
|
1607
|
-
|
1960
|
+
assert_equal "#!/bin/sh", shebang_lines.shift
|
1961
|
+
assert_includes shebang_lines, "#!#{Gem.ruby} -ws"
|
1962
|
+
end
|
1608
1963
|
end
|
1609
1964
|
|
1610
1965
|
def test_shebang_env_shebang
|
1611
|
-
|
1612
|
-
|
1966
|
+
installer = setup_base_installer
|
1967
|
+
|
1968
|
+
util_make_exec @spec, ""
|
1969
|
+
installer.env_shebang = true
|
1613
1970
|
|
1614
|
-
shebang =
|
1971
|
+
shebang = installer.shebang "executable"
|
1615
1972
|
|
1616
|
-
|
1973
|
+
bin_env = get_bin_env
|
1617
1974
|
|
1618
|
-
assert_equal("#!#{
|
1975
|
+
assert_equal("#!#{bin_env} #{RbConfig::CONFIG['ruby_install_name']}",
|
1619
1976
|
shebang)
|
1620
1977
|
end
|
1621
1978
|
|
1622
1979
|
def test_shebang_nested
|
1623
|
-
|
1980
|
+
load_relative "no" do
|
1981
|
+
installer = setup_base_installer
|
1982
|
+
|
1983
|
+
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby"
|
1624
1984
|
|
1625
|
-
|
1985
|
+
shebang = installer.shebang "executable"
|
1626
1986
|
|
1627
|
-
|
1987
|
+
assert_equal "#!#{Gem.ruby}", shebang
|
1988
|
+
end
|
1628
1989
|
end
|
1629
1990
|
|
1630
1991
|
def test_shebang_nested_arguments
|
1631
|
-
|
1992
|
+
load_relative "no" do
|
1993
|
+
installer = setup_base_installer
|
1994
|
+
|
1995
|
+
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby -ws"
|
1632
1996
|
|
1633
|
-
|
1997
|
+
shebang = installer.shebang "executable"
|
1634
1998
|
|
1635
|
-
|
1999
|
+
assert_equal "#!#{Gem.ruby} -ws", shebang
|
2000
|
+
end
|
2001
|
+
end
|
2002
|
+
|
2003
|
+
def test_shebang_nested_arguments_with_load_relative
|
2004
|
+
load_relative "yes" do
|
2005
|
+
installer = setup_base_installer
|
2006
|
+
|
2007
|
+
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby -ws"
|
2008
|
+
|
2009
|
+
shebang = installer.shebang "executable"
|
2010
|
+
|
2011
|
+
shebang_lines = shebang.split "\n"
|
2012
|
+
|
2013
|
+
assert_equal "#!/bin/sh", shebang_lines.shift
|
2014
|
+
assert_includes shebang_lines, "#!#{Gem.ruby} -ws"
|
2015
|
+
end
|
1636
2016
|
end
|
1637
2017
|
|
1638
2018
|
def test_shebang_version
|
1639
|
-
|
2019
|
+
load_relative "no" do
|
2020
|
+
installer = setup_base_installer
|
2021
|
+
|
2022
|
+
util_make_exec @spec, "#!/usr/bin/ruby18"
|
1640
2023
|
|
1641
|
-
|
2024
|
+
shebang = installer.shebang "executable"
|
1642
2025
|
|
1643
|
-
|
2026
|
+
assert_equal "#!#{Gem.ruby}", shebang
|
2027
|
+
end
|
1644
2028
|
end
|
1645
2029
|
|
1646
2030
|
def test_shebang_version_arguments
|
1647
|
-
|
2031
|
+
load_relative "no" do
|
2032
|
+
installer = setup_base_installer
|
2033
|
+
|
2034
|
+
util_make_exec @spec, "#!/usr/bin/ruby18 -ws"
|
1648
2035
|
|
1649
|
-
|
2036
|
+
shebang = installer.shebang "executable"
|
1650
2037
|
|
1651
|
-
|
2038
|
+
assert_equal "#!#{Gem.ruby} -ws", shebang
|
2039
|
+
end
|
2040
|
+
end
|
2041
|
+
|
2042
|
+
def test_shebang_version_arguments_with_load_relative
|
2043
|
+
load_relative "yes" do
|
2044
|
+
installer = setup_base_installer
|
2045
|
+
|
2046
|
+
util_make_exec @spec, "#!/usr/bin/ruby18 -ws"
|
2047
|
+
|
2048
|
+
shebang = installer.shebang "executable"
|
2049
|
+
|
2050
|
+
shebang_lines = shebang.split "\n"
|
2051
|
+
|
2052
|
+
assert_equal "#!/bin/sh", shebang_lines.shift
|
2053
|
+
assert_includes shebang_lines, "#!#{Gem.ruby} -ws"
|
2054
|
+
end
|
1652
2055
|
end
|
1653
2056
|
|
1654
2057
|
def test_shebang_version_env
|
1655
|
-
|
2058
|
+
load_relative "no" do
|
2059
|
+
installer = setup_base_installer
|
2060
|
+
|
2061
|
+
util_make_exec @spec, "#!/usr/bin/env ruby18"
|
1656
2062
|
|
1657
|
-
|
2063
|
+
shebang = installer.shebang "executable"
|
1658
2064
|
|
1659
|
-
|
2065
|
+
assert_equal "#!#{Gem.ruby}", shebang
|
2066
|
+
end
|
1660
2067
|
end
|
1661
2068
|
|
1662
2069
|
def test_shebang_version_env_arguments
|
1663
|
-
|
2070
|
+
load_relative "no" do
|
2071
|
+
installer = setup_base_installer
|
2072
|
+
|
2073
|
+
util_make_exec @spec, "#!/usr/bin/env ruby18 -ws"
|
2074
|
+
|
2075
|
+
shebang = installer.shebang "executable"
|
2076
|
+
|
2077
|
+
assert_equal "#!#{Gem.ruby} -ws", shebang
|
2078
|
+
end
|
2079
|
+
end
|
2080
|
+
|
2081
|
+
def test_shebang_version_env_arguments_with_load_relative
|
2082
|
+
load_relative "yes" do
|
2083
|
+
installer = setup_base_installer
|
1664
2084
|
|
1665
|
-
|
2085
|
+
util_make_exec @spec, "#!/usr/bin/env ruby18 -ws"
|
1666
2086
|
|
1667
|
-
|
2087
|
+
shebang = installer.shebang "executable"
|
2088
|
+
|
2089
|
+
shebang_lines = shebang.split "\n"
|
2090
|
+
|
2091
|
+
assert_equal "#!/bin/sh", shebang_lines.shift
|
2092
|
+
assert_includes shebang_lines, "#!#{Gem.ruby} -ws"
|
2093
|
+
end
|
1668
2094
|
end
|
1669
2095
|
|
1670
2096
|
def test_shebang_custom
|
2097
|
+
installer = setup_base_installer
|
2098
|
+
|
1671
2099
|
conf = Gem::ConfigFile.new []
|
1672
|
-
conf[:custom_shebang] =
|
2100
|
+
conf[:custom_shebang] = "test"
|
1673
2101
|
|
1674
2102
|
Gem.configuration = conf
|
1675
2103
|
|
1676
2104
|
util_make_exec @spec, "#!/usr/bin/ruby"
|
1677
2105
|
|
1678
|
-
shebang =
|
2106
|
+
shebang = installer.shebang "executable"
|
1679
2107
|
|
1680
2108
|
assert_equal "#!test", shebang
|
1681
2109
|
end
|
1682
2110
|
|
2111
|
+
def get_bin_env
|
2112
|
+
if win_platform?
|
2113
|
+
""
|
2114
|
+
else
|
2115
|
+
%w[/usr/bin/env /bin/env].find {|f| File.executable?(f) }
|
2116
|
+
end
|
2117
|
+
end
|
2118
|
+
|
1683
2119
|
def test_shebang_custom_with_expands
|
1684
|
-
|
2120
|
+
installer = setup_base_installer
|
2121
|
+
|
2122
|
+
bin_env = get_bin_env
|
1685
2123
|
conf = Gem::ConfigFile.new []
|
1686
|
-
conf[:custom_shebang] =
|
2124
|
+
conf[:custom_shebang] = "1 $env 2 $ruby 3 $exec 4 $name"
|
1687
2125
|
|
1688
2126
|
Gem.configuration = conf
|
1689
2127
|
|
1690
2128
|
util_make_exec @spec, "#!/usr/bin/ruby"
|
1691
2129
|
|
1692
|
-
shebang =
|
2130
|
+
shebang = installer.shebang "executable"
|
1693
2131
|
|
1694
2132
|
assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} 3 executable 4 a", shebang
|
1695
2133
|
end
|
1696
2134
|
|
1697
2135
|
def test_shebang_custom_with_expands_and_arguments
|
1698
|
-
|
2136
|
+
installer = setup_base_installer
|
2137
|
+
|
2138
|
+
bin_env = get_bin_env
|
1699
2139
|
conf = Gem::ConfigFile.new []
|
1700
|
-
conf[:custom_shebang] =
|
2140
|
+
conf[:custom_shebang] = "1 $env 2 $ruby 3 $exec"
|
1701
2141
|
|
1702
2142
|
Gem.configuration = conf
|
1703
2143
|
|
1704
2144
|
util_make_exec @spec, "#!/usr/bin/ruby -ws"
|
1705
2145
|
|
1706
|
-
shebang =
|
2146
|
+
shebang = installer.shebang "executable"
|
1707
2147
|
|
1708
2148
|
assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} -ws 3 executable", shebang
|
1709
2149
|
end
|
1710
2150
|
|
1711
2151
|
def test_unpack
|
1712
|
-
|
2152
|
+
installer = util_setup_installer
|
1713
2153
|
|
1714
|
-
dest = File.join @gemhome,
|
2154
|
+
dest = File.join @gemhome, "gems", @spec.full_name
|
1715
2155
|
|
1716
|
-
|
2156
|
+
Gem::Deprecate.skip_during do
|
2157
|
+
installer.unpack dest
|
2158
|
+
end
|
1717
2159
|
|
1718
|
-
|
1719
|
-
|
2160
|
+
assert_path_exist File.join dest, "lib", "code.rb"
|
2161
|
+
assert_path_exist File.join dest, "bin", "executable"
|
1720
2162
|
end
|
1721
2163
|
|
1722
2164
|
def test_write_build_info_file
|
1723
|
-
|
2165
|
+
installer = setup_base_installer
|
2166
|
+
|
2167
|
+
assert_path_not_exist @spec.build_info_file
|
1724
2168
|
|
1725
|
-
|
2169
|
+
installer.build_args = %w[
|
1726
2170
|
--with-libyaml-dir /usr/local/Cellar/libyaml/0.1.4
|
1727
2171
|
]
|
1728
2172
|
|
1729
|
-
|
2173
|
+
installer.write_build_info_file
|
1730
2174
|
|
1731
|
-
|
2175
|
+
assert_path_exist @spec.build_info_file
|
1732
2176
|
|
1733
2177
|
expected = "--with-libyaml-dir\n/usr/local/Cellar/libyaml/0.1.4\n"
|
1734
2178
|
|
@@ -1736,14 +2180,17 @@ gem 'other', version
|
|
1736
2180
|
end
|
1737
2181
|
|
1738
2182
|
def test_write_build_info_file_empty
|
1739
|
-
|
2183
|
+
installer = setup_base_installer
|
2184
|
+
|
2185
|
+
assert_path_not_exist @spec.build_info_file
|
1740
2186
|
|
1741
|
-
|
2187
|
+
installer.write_build_info_file
|
1742
2188
|
|
1743
|
-
|
2189
|
+
assert_path_not_exist @spec.build_info_file
|
1744
2190
|
end
|
1745
2191
|
|
1746
2192
|
def test_write_build_info_file_install_dir
|
2193
|
+
@gem = setup_base_gem
|
1747
2194
|
installer = Gem::Installer.at @gem, :install_dir => "#{@gemhome}2"
|
1748
2195
|
|
1749
2196
|
installer.build_args = %w[
|
@@ -1752,36 +2199,38 @@ gem 'other', version
|
|
1752
2199
|
|
1753
2200
|
installer.write_build_info_file
|
1754
2201
|
|
1755
|
-
|
1756
|
-
|
1757
|
-
File.join("#{@gemhome}2",
|
2202
|
+
assert_path_not_exist @spec.build_info_file
|
2203
|
+
assert_path_exist \
|
2204
|
+
File.join("#{@gemhome}2", "build_info", "#{@spec.full_name}.info")
|
1758
2205
|
end
|
1759
2206
|
|
1760
2207
|
def test_write_cache_file
|
1761
|
-
|
2208
|
+
@gem = setup_base_gem
|
2209
|
+
cache_file = File.join @gemhome, "cache", @spec.file_name
|
1762
2210
|
gem = File.join @gemhome, @spec.file_name
|
1763
2211
|
|
1764
2212
|
FileUtils.mv cache_file, gem
|
1765
|
-
|
2213
|
+
assert_path_not_exist cache_file
|
1766
2214
|
|
1767
2215
|
installer = Gem::Installer.at gem
|
1768
2216
|
installer.gem_home = @gemhome
|
1769
2217
|
|
1770
2218
|
installer.write_cache_file
|
1771
2219
|
|
1772
|
-
|
2220
|
+
assert_path_exist cache_file
|
1773
2221
|
end
|
1774
2222
|
|
1775
2223
|
def test_write_spec
|
2224
|
+
@spec = setup_base_spec
|
1776
2225
|
FileUtils.rm @spec.spec_file
|
1777
|
-
|
2226
|
+
assert_path_not_exist @spec.spec_file
|
1778
2227
|
|
1779
|
-
|
1780
|
-
|
2228
|
+
installer = Gem::Installer.for_spec @spec
|
2229
|
+
installer.gem_home = @gemhome
|
1781
2230
|
|
1782
|
-
|
2231
|
+
installer.write_spec
|
1783
2232
|
|
1784
|
-
|
2233
|
+
assert_path_exist @spec.spec_file
|
1785
2234
|
|
1786
2235
|
loaded = Gem::Specification.load @spec.spec_file
|
1787
2236
|
|
@@ -1791,15 +2240,16 @@ gem 'other', version
|
|
1791
2240
|
end
|
1792
2241
|
|
1793
2242
|
def test_write_spec_writes_cached_spec
|
2243
|
+
@spec = setup_base_spec
|
1794
2244
|
FileUtils.rm @spec.spec_file
|
1795
|
-
|
2245
|
+
assert_path_not_exist @spec.spec_file
|
1796
2246
|
|
1797
2247
|
@spec.files = %w[a.rb b.rb c.rb]
|
1798
2248
|
|
1799
|
-
|
1800
|
-
|
2249
|
+
installer = Gem::Installer.for_spec @spec
|
2250
|
+
installer.gem_home = @gemhome
|
1801
2251
|
|
1802
|
-
|
2252
|
+
installer.write_spec
|
1803
2253
|
|
1804
2254
|
# cached specs have no file manifest:
|
1805
2255
|
@spec.files = []
|
@@ -1807,60 +2257,187 @@ gem 'other', version
|
|
1807
2257
|
assert_equal @spec, eval(File.read(@spec.spec_file))
|
1808
2258
|
end
|
1809
2259
|
|
2260
|
+
def test_leaves_no_empty_cached_spec_when_no_more_disk_space
|
2261
|
+
@spec = setup_base_spec
|
2262
|
+
FileUtils.rm @spec.spec_file
|
2263
|
+
assert_path_not_exist @spec.spec_file
|
2264
|
+
|
2265
|
+
@spec.files = %w[a.rb b.rb c.rb]
|
2266
|
+
|
2267
|
+
installer = Gem::Installer.for_spec @spec
|
2268
|
+
installer.gem_home = @gemhome
|
2269
|
+
|
2270
|
+
File.class_eval do
|
2271
|
+
alias_method :original_write, :write
|
2272
|
+
|
2273
|
+
def write(data)
|
2274
|
+
raise Errno::ENOSPC
|
2275
|
+
end
|
2276
|
+
end
|
2277
|
+
|
2278
|
+
assert_raise Errno::ENOSPC do
|
2279
|
+
installer.write_spec
|
2280
|
+
end
|
2281
|
+
|
2282
|
+
assert_path_not_exist @spec.spec_file
|
2283
|
+
ensure
|
2284
|
+
File.class_eval do
|
2285
|
+
remove_method :write
|
2286
|
+
alias_method :write, :original_write # rubocop:disable Lint/DuplicateMethods
|
2287
|
+
remove_method :original_write
|
2288
|
+
end
|
2289
|
+
end
|
2290
|
+
|
1810
2291
|
def test_dir
|
1811
|
-
|
2292
|
+
installer = setup_base_installer
|
2293
|
+
|
2294
|
+
assert_match %r{/gemhome/gems/a-2$}, installer.dir
|
1812
2295
|
end
|
1813
2296
|
|
1814
2297
|
def test_default_gem_loaded_from
|
1815
|
-
spec = util_spec
|
2298
|
+
spec = util_spec "a"
|
1816
2299
|
installer = Gem::Installer.for_spec spec, :install_as_default => true
|
1817
2300
|
installer.install
|
1818
2301
|
assert_predicate spec, :default_gem?
|
1819
2302
|
end
|
1820
2303
|
|
1821
|
-
def
|
1822
|
-
|
2304
|
+
def test_default_gem_without_wrappers
|
2305
|
+
installer = setup_base_installer
|
2306
|
+
|
2307
|
+
FileUtils.rm_rf File.join(Gem.default_dir, "specifications")
|
1823
2308
|
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
@installer.generate_bin
|
2309
|
+
installer.wrappers = false
|
2310
|
+
installer.options[:install_as_default] = true
|
2311
|
+
installer.gem_dir = @spec.gem_dir
|
1828
2312
|
|
1829
2313
|
use_ui @ui do
|
1830
|
-
|
2314
|
+
installer.install
|
1831
2315
|
end
|
1832
2316
|
|
1833
|
-
|
1834
|
-
installed_exec = File.join
|
1835
|
-
|
2317
|
+
assert_directory_exists File.join(@spec.gem_dir, "bin")
|
2318
|
+
installed_exec = File.join @spec.gem_dir, "bin", "executable"
|
2319
|
+
assert_path_exist installed_exec
|
1836
2320
|
|
1837
|
-
|
1838
|
-
|
2321
|
+
assert_directory_exists File.join(Gem.default_dir, "specifications")
|
2322
|
+
assert_directory_exists File.join(Gem.default_dir, "specifications", "default")
|
1839
2323
|
|
1840
|
-
default_spec = eval File.read File.join(Gem.default_dir,
|
2324
|
+
default_spec = eval File.read File.join(Gem.default_dir, "specifications", "default", "a-2.gemspec")
|
1841
2325
|
assert_equal Gem::Version.new("2"), default_spec.version
|
1842
|
-
assert_equal [
|
2326
|
+
assert_equal ["bin/executable"], default_spec.files
|
2327
|
+
|
2328
|
+
assert_directory_exists util_inst_bindir
|
2329
|
+
|
2330
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
2331
|
+
assert_path_exist installed_exec
|
2332
|
+
|
2333
|
+
wrapper = File.read installed_exec
|
2334
|
+
|
2335
|
+
if symlink_supported?
|
2336
|
+
refute_match %r{generated by RubyGems}, wrapper
|
2337
|
+
else # when symlink not supported, it warns and fallbacks back to installing wrapper
|
2338
|
+
assert_match %r{Unable to use symlinks, installing wrapper}, @ui.error
|
2339
|
+
assert_match %r{generated by RubyGems}, wrapper
|
2340
|
+
end
|
2341
|
+
end
|
2342
|
+
|
2343
|
+
def test_default_gem_with_wrappers
|
2344
|
+
installer = setup_base_installer
|
2345
|
+
|
2346
|
+
installer.wrappers = true
|
2347
|
+
installer.options[:install_as_default] = true
|
2348
|
+
installer.gem_dir = @spec.gem_dir
|
2349
|
+
|
2350
|
+
use_ui @ui do
|
2351
|
+
installer.install
|
2352
|
+
end
|
2353
|
+
|
2354
|
+
assert_directory_exists util_inst_bindir
|
2355
|
+
|
2356
|
+
installed_exec = File.join util_inst_bindir, "executable"
|
2357
|
+
assert_path_exist installed_exec
|
2358
|
+
|
2359
|
+
wrapper = File.read installed_exec
|
2360
|
+
assert_match %r{generated by RubyGems}, wrapper
|
1843
2361
|
end
|
1844
2362
|
|
1845
|
-
def
|
1846
|
-
spec =
|
1847
|
-
|
2363
|
+
def test_default_gem_with_exe_as_bindir
|
2364
|
+
@spec = quick_gem "c" do |spec|
|
2365
|
+
util_make_exec spec, "#!/usr/bin/ruby", "exe"
|
1848
2366
|
end
|
1849
2367
|
|
1850
|
-
util_build_gem spec
|
2368
|
+
util_build_gem @spec
|
2369
|
+
|
2370
|
+
@spec.cache_file
|
2371
|
+
|
2372
|
+
installer = util_installer @spec, @gemhome
|
2373
|
+
|
2374
|
+
installer.options[:install_as_default] = true
|
2375
|
+
installer.gem_dir = @spec.gem_dir
|
2376
|
+
|
2377
|
+
use_ui @ui do
|
2378
|
+
installer.install
|
2379
|
+
end
|
2380
|
+
|
2381
|
+
assert_directory_exists File.join(@spec.gem_dir, "exe")
|
2382
|
+
installed_exec = File.join @spec.gem_dir, "exe", "executable"
|
2383
|
+
assert_path_exist installed_exec
|
2384
|
+
|
2385
|
+
assert_directory_exists File.join(Gem.default_dir, "specifications")
|
2386
|
+
assert_directory_exists File.join(Gem.default_dir, "specifications", "default")
|
2387
|
+
|
2388
|
+
default_spec = eval File.read File.join(Gem.default_dir, "specifications", "default", "c-2.gemspec")
|
2389
|
+
assert_equal Gem::Version.new("2"), default_spec.version
|
2390
|
+
assert_equal ["exe/executable"], default_spec.files
|
2391
|
+
end
|
2392
|
+
|
2393
|
+
def test_default_gem_to_specific_install_dir
|
2394
|
+
@gem = setup_base_gem
|
2395
|
+
installer = util_installer @spec, "#{@gemhome}2"
|
2396
|
+
installer.options[:install_as_default] = true
|
2397
|
+
|
2398
|
+
use_ui @ui do
|
2399
|
+
installer.install
|
2400
|
+
end
|
2401
|
+
|
2402
|
+
assert_directory_exists File.join("#{@gemhome}2", "specifications")
|
2403
|
+
assert_directory_exists File.join("#{@gemhome}2", "specifications", "default")
|
2404
|
+
|
2405
|
+
default_spec = eval File.read File.join("#{@gemhome}2", "specifications", "default", "a-2.gemspec")
|
2406
|
+
assert_equal Gem::Version.new("2"), default_spec.version
|
2407
|
+
assert_equal ["bin/executable"], default_spec.files
|
2408
|
+
end
|
2409
|
+
|
2410
|
+
def test_package_attribute
|
2411
|
+
gem = quick_gem "c" do |spec|
|
2412
|
+
util_make_exec spec, "#!/usr/bin/ruby", "exe"
|
2413
|
+
end
|
2414
|
+
|
2415
|
+
installer = util_installer(gem, @gemhome)
|
2416
|
+
assert_respond_to(installer, :package)
|
2417
|
+
assert_kind_of(Gem::Package, installer.package)
|
2418
|
+
end
|
2419
|
+
|
2420
|
+
def test_gem_attribute
|
2421
|
+
gem = quick_gem "c" do |spec|
|
2422
|
+
util_make_exec spec, "#!/usr/bin/ruby", "exe"
|
2423
|
+
end
|
1851
2424
|
|
1852
|
-
|
2425
|
+
installer = util_installer(gem, @gemhome)
|
2426
|
+
assert_respond_to(installer, :gem)
|
2427
|
+
assert_kind_of(String, installer.gem)
|
1853
2428
|
end
|
1854
2429
|
|
2430
|
+
private
|
2431
|
+
|
1855
2432
|
def util_execless
|
1856
|
-
@spec = util_spec
|
2433
|
+
@spec = util_spec "z"
|
1857
2434
|
util_build_gem @spec
|
1858
2435
|
|
1859
|
-
|
2436
|
+
util_installer @spec, @gemhome
|
1860
2437
|
end
|
1861
2438
|
|
1862
2439
|
def util_conflict_executable(wrappers)
|
1863
|
-
conflict = quick_gem
|
2440
|
+
conflict = quick_gem "conflict" do |spec|
|
1864
2441
|
util_make_exec spec
|
1865
2442
|
end
|
1866
2443
|
|
@@ -1872,6 +2449,15 @@ gem 'other', version
|
|
1872
2449
|
end
|
1873
2450
|
|
1874
2451
|
def mask
|
1875
|
-
0100755
|
2452
|
+
0100755
|
2453
|
+
end
|
2454
|
+
|
2455
|
+
def load_relative(value)
|
2456
|
+
orig_LIBRUBY_RELATIVE = RbConfig::CONFIG["LIBRUBY_RELATIVE"]
|
2457
|
+
RbConfig::CONFIG["LIBRUBY_RELATIVE"] = value
|
2458
|
+
|
2459
|
+
yield
|
2460
|
+
ensure
|
2461
|
+
RbConfig::CONFIG["LIBRUBY_RELATIVE"] = orig_LIBRUBY_RELATIVE
|
1876
2462
|
end
|
1877
2463
|
end
|