rubygems-update 2.6.0 → 3.4.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5802 -0
- data/CODE_OF_CONDUCT.md +76 -35
- data/CONTRIBUTING.md +231 -0
- data/MAINTAINERS.txt +8 -0
- data/Manifest.txt +441 -42
- data/POLICIES.md +135 -0
- data/README.md +114 -0
- data/UPGRADING.md +15 -0
- data/bundler/CHANGELOG.md +4666 -0
- data/bundler/LICENSE.md +22 -0
- data/bundler/README.md +58 -0
- data/bundler/UPGRADING.md +222 -0
- data/bundler/bundler.gemspec +44 -0
- data/bundler/exe/bundle +38 -0
- data/bundler/exe/bundler +4 -0
- data/bundler/lib/bundler/.document +1 -0
- data/bundler/lib/bundler/build_metadata.rb +45 -0
- data/bundler/lib/bundler/capistrano.rb +22 -0
- data/bundler/lib/bundler/cli/add.rb +47 -0
- data/bundler/lib/bundler/cli/binstubs.rb +57 -0
- data/bundler/lib/bundler/cli/cache.rb +43 -0
- data/bundler/lib/bundler/cli/check.rb +40 -0
- data/bundler/lib/bundler/cli/clean.rb +25 -0
- data/bundler/lib/bundler/cli/common.rb +130 -0
- data/bundler/lib/bundler/cli/config.rb +203 -0
- data/bundler/lib/bundler/cli/console.rb +43 -0
- data/bundler/lib/bundler/cli/doctor.rb +157 -0
- data/bundler/lib/bundler/cli/exec.rb +88 -0
- data/bundler/lib/bundler/cli/fund.rb +36 -0
- data/bundler/lib/bundler/cli/gem.rb +466 -0
- data/bundler/lib/bundler/cli/info.rb +94 -0
- data/bundler/lib/bundler/cli/init.rb +51 -0
- data/bundler/lib/bundler/cli/inject.rb +60 -0
- data/bundler/lib/bundler/cli/install.rb +189 -0
- data/bundler/lib/bundler/cli/issue.rb +41 -0
- data/bundler/lib/bundler/cli/list.rb +66 -0
- data/bundler/lib/bundler/cli/lock.rb +73 -0
- data/bundler/lib/bundler/cli/open.rb +29 -0
- data/bundler/lib/bundler/cli/outdated.rb +297 -0
- data/bundler/lib/bundler/cli/platform.rb +48 -0
- data/bundler/lib/bundler/cli/plugin.rb +41 -0
- data/bundler/lib/bundler/cli/pristine.rb +52 -0
- data/bundler/lib/bundler/cli/remove.rb +17 -0
- data/bundler/lib/bundler/cli/show.rb +75 -0
- data/bundler/lib/bundler/cli/update.rb +123 -0
- data/bundler/lib/bundler/cli/viz.rb +31 -0
- data/bundler/lib/bundler/cli.rb +894 -0
- data/bundler/lib/bundler/compact_index_client/cache.rb +101 -0
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +117 -0
- data/bundler/lib/bundler/compact_index_client.rb +119 -0
- data/bundler/lib/bundler/constants.rb +7 -0
- data/bundler/lib/bundler/current_ruby.rb +108 -0
- data/bundler/lib/bundler/definition.rb +978 -0
- data/bundler/lib/bundler/dependency.rb +97 -0
- data/bundler/lib/bundler/deployment.rb +69 -0
- data/bundler/lib/bundler/deprecate.rb +44 -0
- data/bundler/lib/bundler/digest.rb +71 -0
- data/bundler/lib/bundler/dsl.rb +583 -0
- data/bundler/lib/bundler/endpoint_specification.rb +143 -0
- data/bundler/lib/bundler/env.rb +150 -0
- data/bundler/lib/bundler/environment_preserver.rb +86 -0
- data/bundler/lib/bundler/errors.rb +190 -0
- data/bundler/lib/bundler/feature_flag.rb +53 -0
- data/bundler/lib/bundler/fetcher/base.rb +50 -0
- data/bundler/lib/bundler/fetcher/compact_index.rb +129 -0
- data/bundler/lib/bundler/fetcher/dependency.rb +78 -0
- data/bundler/lib/bundler/fetcher/downloader.rb +89 -0
- data/bundler/lib/bundler/fetcher/index.rb +25 -0
- data/bundler/lib/bundler/fetcher.rb +321 -0
- data/bundler/lib/bundler/force_platform.rb +18 -0
- data/bundler/lib/bundler/friendly_errors.rb +126 -0
- data/bundler/lib/bundler/gem_helper.rb +237 -0
- data/bundler/lib/bundler/gem_helpers.rb +124 -0
- data/bundler/lib/bundler/gem_tasks.rb +7 -0
- data/bundler/lib/bundler/gem_version_promoter.rb +145 -0
- data/bundler/lib/bundler/graph.rb +152 -0
- data/bundler/lib/bundler/index.rb +206 -0
- data/bundler/lib/bundler/injector.rb +287 -0
- data/bundler/lib/bundler/inline.rb +73 -0
- data/bundler/lib/bundler/installer/gem_installer.rb +84 -0
- data/bundler/lib/bundler/installer/parallel_installer.rb +194 -0
- data/bundler/lib/bundler/installer/standalone.rb +117 -0
- data/bundler/lib/bundler/installer.rb +267 -0
- data/bundler/lib/bundler/lazy_specification.rb +163 -0
- data/bundler/lib/bundler/lockfile_generator.rb +95 -0
- data/bundler/lib/bundler/lockfile_parser.rb +218 -0
- data/bundler/lib/bundler/man/.document +1 -0
- data/bundler/lib/bundler/man/bundle-add.1 +82 -0
- data/bundler/lib/bundler/man/bundle-add.1.ronn +58 -0
- data/bundler/lib/bundler/man/bundle-binstubs.1 +42 -0
- data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +41 -0
- data/bundler/lib/bundler/man/bundle-cache.1 +61 -0
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +79 -0
- data/bundler/lib/bundler/man/bundle-check.1 +31 -0
- data/bundler/lib/bundler/man/bundle-check.1.ronn +26 -0
- data/bundler/lib/bundler/man/bundle-clean.1 +24 -0
- data/bundler/lib/bundler/man/bundle-clean.1.ronn +18 -0
- data/bundler/lib/bundler/man/bundle-config.1 +512 -0
- data/bundler/lib/bundler/man/bundle-config.1.ronn +405 -0
- data/bundler/lib/bundler/man/bundle-console.1 +53 -0
- data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/bundler/lib/bundler/man/bundle-doctor.1 +44 -0
- data/bundler/lib/bundler/man/bundle-doctor.1.ronn +33 -0
- data/bundler/lib/bundler/man/bundle-exec.1 +165 -0
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +151 -0
- 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/lib/bundler/man/bundle-info.1 +20 -0
- data/bundler/lib/bundler/man/bundle-info.1.ronn +17 -0
- data/bundler/lib/bundler/man/bundle-init.1 +29 -0
- data/bundler/lib/bundler/man/bundle-init.1.ronn +31 -0
- data/bundler/lib/bundler/man/bundle-inject.1 +36 -0
- data/bundler/lib/bundler/man/bundle-inject.1.ronn +24 -0
- data/bundler/lib/bundler/man/bundle-install.1 +313 -0
- data/bundler/lib/bundler/man/bundle-install.1.ronn +382 -0
- data/bundler/lib/bundler/man/bundle-list.1 +50 -0
- data/bundler/lib/bundler/man/bundle-list.1.ronn +33 -0
- data/bundler/lib/bundler/man/bundle-lock.1 +84 -0
- data/bundler/lib/bundler/man/bundle-lock.1.ronn +94 -0
- data/bundler/lib/bundler/man/bundle-open.1 +52 -0
- data/bundler/lib/bundler/man/bundle-open.1.ronn +27 -0
- data/bundler/lib/bundler/man/bundle-outdated.1 +152 -0
- data/bundler/lib/bundler/man/bundle-outdated.1.ronn +105 -0
- data/bundler/lib/bundler/man/bundle-platform.1 +71 -0
- data/bundler/lib/bundler/man/bundle-platform.1.ronn +49 -0
- data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/bundler/lib/bundler/man/bundle-pristine.1 +34 -0
- data/bundler/lib/bundler/man/bundle-pristine.1.ronn +34 -0
- data/bundler/lib/bundler/man/bundle-remove.1 +31 -0
- data/bundler/lib/bundler/man/bundle-remove.1.ronn +23 -0
- data/bundler/lib/bundler/man/bundle-show.1 +23 -0
- data/bundler/lib/bundler/man/bundle-show.1.ronn +21 -0
- data/bundler/lib/bundler/man/bundle-update.1 +394 -0
- data/bundler/lib/bundler/man/bundle-update.1.ronn +351 -0
- data/bundler/lib/bundler/man/bundle-version.1 +35 -0
- data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/bundler/lib/bundler/man/bundle-viz.1 +42 -0
- data/bundler/lib/bundler/man/bundle-viz.1.ronn +32 -0
- data/bundler/lib/bundler/man/bundle.1 +141 -0
- data/bundler/lib/bundler/man/bundle.1.ronn +116 -0
- data/bundler/lib/bundler/man/gemfile.5 +747 -0
- data/bundler/lib/bundler/man/gemfile.5.ronn +548 -0
- 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 +23 -0
- data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
- data/bundler/lib/bundler/mirror.rb +221 -0
- data/bundler/lib/bundler/plugin/api/source.rb +320 -0
- data/bundler/lib/bundler/plugin/api.rb +81 -0
- data/bundler/lib/bundler/plugin/dsl.rb +53 -0
- data/bundler/lib/bundler/plugin/events.rb +61 -0
- data/bundler/lib/bundler/plugin/index.rb +193 -0
- data/bundler/lib/bundler/plugin/installer/git.rb +34 -0
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +19 -0
- data/bundler/lib/bundler/plugin/installer.rb +112 -0
- data/bundler/lib/bundler/plugin/source_list.rb +31 -0
- data/bundler/lib/bundler/plugin.rb +359 -0
- data/bundler/lib/bundler/process_lock.rb +24 -0
- data/bundler/lib/bundler/remote_specification.rb +117 -0
- data/bundler/lib/bundler/resolver/base.rb +107 -0
- data/bundler/lib/bundler/resolver/candidate.rb +94 -0
- data/bundler/lib/bundler/resolver/incompatibility.rb +15 -0
- data/bundler/lib/bundler/resolver/package.rb +77 -0
- data/bundler/lib/bundler/resolver/root.rb +25 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +82 -0
- data/bundler/lib/bundler/resolver.rb +462 -0
- data/bundler/lib/bundler/retry.rb +66 -0
- data/bundler/lib/bundler/ruby_dsl.rb +45 -0
- data/bundler/lib/bundler/ruby_version.rb +131 -0
- data/bundler/lib/bundler/rubygems_ext.rb +354 -0
- data/bundler/lib/bundler/rubygems_gem_installer.rb +187 -0
- data/bundler/lib/bundler/rubygems_integration.rb +562 -0
- data/bundler/lib/bundler/runtime.rb +307 -0
- data/bundler/lib/bundler/safe_marshal.rb +31 -0
- data/bundler/lib/bundler/self_manager.rb +170 -0
- data/bundler/lib/bundler/settings/validator.rb +102 -0
- data/bundler/lib/bundler/settings.rb +568 -0
- data/bundler/lib/bundler/setup.rb +30 -0
- data/bundler/lib/bundler/shared_helpers.rb +358 -0
- data/bundler/lib/bundler/similarity_detector.rb +63 -0
- data/bundler/lib/bundler/source/gemspec.rb +18 -0
- data/bundler/lib/bundler/source/git/git_proxy.rb +455 -0
- data/bundler/lib/bundler/source/git.rb +379 -0
- data/bundler/lib/bundler/source/metadata.rb +62 -0
- data/bundler/lib/bundler/source/path/installer.rb +53 -0
- data/bundler/lib/bundler/source/path.rb +260 -0
- data/bundler/lib/bundler/source/rubygems/remote.rb +68 -0
- data/bundler/lib/bundler/source/rubygems.rb +509 -0
- data/bundler/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/bundler/lib/bundler/source.rb +114 -0
- data/bundler/lib/bundler/source_list.rb +227 -0
- data/bundler/lib/bundler/source_map.rb +71 -0
- data/bundler/lib/bundler/spec_set.rb +219 -0
- data/bundler/lib/bundler/stub_specification.rb +118 -0
- data/bundler/lib/bundler/templates/.document +1 -0
- data/bundler/lib/bundler/templates/Executable +27 -0
- data/bundler/lib/bundler/templates/Executable.bundler +109 -0
- data/bundler/lib/bundler/templates/Executable.standalone +14 -0
- data/bundler/lib/bundler/templates/Gemfile +5 -0
- data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +84 -0
- data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +26 -0
- data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
- data/bundler/lib/bundler/templates/newgem/README.md.tt +45 -0
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +71 -0
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +11 -0
- data/bundler/lib/bundler/templates/newgem/bin/setup.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
- data/bundler/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.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 +23 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +51 -0
- data/bundler/lib/bundler/templates/newgem/rspec.tt +3 -0
- 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 +11 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +15 -0
- 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/minitest/test_newgem.rb.tt +13 -0
- 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 +19 -0
- data/bundler/lib/bundler/ui/shell.rb +165 -0
- data/bundler/lib/bundler/ui/silent.rb +85 -0
- data/bundler/lib/bundler/ui.rb +9 -0
- data/bundler/lib/bundler/uri_credentials_filter.rb +43 -0
- data/bundler/lib/bundler/uri_normalizer.rb +23 -0
- 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 +2706 -0
- 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 +41 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +65 -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 +1073 -0
- data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/bundler/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +105 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +61 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +108 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +143 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +373 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +130 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +340 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +825 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +151 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +107 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +106 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +37 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +89 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +195 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +178 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +293 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +72 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +335 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +388 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +115 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +84 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb +49 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +134 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +285 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +663 -0
- 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 +4 -0
- data/bundler/lib/bundler/vendored_persistent.rb +15 -0
- data/bundler/lib/bundler/vendored_pub_grub.rb +4 -0
- data/bundler/lib/bundler/vendored_thor.rb +8 -0
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/vendored_uri.rb +4 -0
- data/bundler/lib/bundler/version.rb +13 -0
- data/bundler/lib/bundler/vlad.rb +17 -0
- data/bundler/lib/bundler/worker.rb +117 -0
- data/bundler/lib/bundler/yaml_serializer.rb +93 -0
- data/bundler/lib/bundler.rb +654 -0
- data/{test/rubygems/bogussources.rb → exe/gem} +5 -2
- data/exe/update_rubygems +38 -0
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/available_set.rb +9 -9
- data/lib/rubygems/basic_specification.rb +56 -37
- data/lib/rubygems/bundler_version_finder.rb +77 -0
- data/lib/rubygems/command.rb +142 -67
- data/lib/rubygems/command_manager.rb +61 -25
- data/lib/rubygems/commands/build_command.rb +88 -17
- data/lib/rubygems/commands/cert_command.rb +131 -82
- data/lib/rubygems/commands/check_command.rb +27 -24
- data/lib/rubygems/commands/cleanup_command.rb +56 -37
- data/lib/rubygems/commands/contents_command.rb +33 -35
- data/lib/rubygems/commands/dependency_command.rb +52 -63
- data/lib/rubygems/commands/environment_command.rb +31 -13
- data/lib/rubygems/commands/exec_command.rb +249 -0
- data/lib/rubygems/commands/fetch_command.rb +36 -19
- data/lib/rubygems/commands/generate_index_command.rb +21 -20
- data/lib/rubygems/commands/help_command.rb +21 -21
- data/lib/rubygems/commands/info_command.rb +38 -0
- data/lib/rubygems/commands/install_command.rb +65 -133
- data/lib/rubygems/commands/list_command.rb +10 -9
- data/lib/rubygems/commands/lock_command.rb +11 -13
- data/lib/rubygems/commands/mirror_command.rb +4 -4
- data/lib/rubygems/commands/open_command.rb +28 -26
- data/lib/rubygems/commands/outdated_command.rb +6 -6
- data/lib/rubygems/commands/owner_command.rb +50 -26
- data/lib/rubygems/commands/pristine_command.rb +96 -66
- data/lib/rubygems/commands/push_command.rb +52 -45
- data/lib/rubygems/commands/query_command.rb +22 -328
- data/lib/rubygems/commands/rdoc_command.rb +31 -31
- data/lib/rubygems/commands/search_command.rb +9 -9
- data/lib/rubygems/commands/server_command.rb +15 -76
- data/lib/rubygems/commands/setup_command.rb +375 -188
- data/lib/rubygems/commands/signin_command.rb +34 -0
- data/lib/rubygems/commands/signout_command.rb +32 -0
- data/lib/rubygems/commands/sources_command.rb +51 -35
- data/lib/rubygems/commands/specification_command.rb +39 -29
- data/lib/rubygems/commands/stale_command.rb +5 -4
- data/lib/rubygems/commands/uninstall_command.rb +94 -59
- data/lib/rubygems/commands/unpack_command.rb +43 -52
- data/lib/rubygems/commands/update_command.rb +154 -96
- data/lib/rubygems/commands/which_command.rb +13 -16
- data/lib/rubygems/commands/yank_command.rb +27 -31
- data/lib/rubygems/compatibility.rb +8 -26
- data/lib/rubygems/config_file.rb +214 -119
- data/lib/rubygems/core_ext/kernel_gem.rb +10 -14
- data/lib/rubygems/core_ext/kernel_require.rb +119 -88
- data/lib/rubygems/core_ext/kernel_warn.rb +49 -0
- data/lib/rubygems/core_ext/tcpsocket_init.rb +54 -0
- data/lib/rubygems/defaults.rb +174 -56
- data/lib/rubygems/dependency.rb +66 -51
- data/lib/rubygems/dependency_installer.rb +70 -225
- data/lib/rubygems/dependency_list.rb +32 -33
- data/lib/rubygems/deprecate.rb +112 -17
- data/lib/rubygems/doctor.rb +30 -30
- data/lib/rubygems/errors.rb +51 -9
- data/lib/rubygems/exceptions.rb +64 -35
- data/lib/rubygems/ext/build_error.rb +3 -1
- data/lib/rubygems/ext/builder.rb +96 -75
- 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 +6 -9
- data/lib/rubygems/ext/ext_conf_builder.rb +41 -60
- data/lib/rubygems/ext/rake_builder.rb +18 -21
- data/lib/rubygems/ext.rb +8 -7
- data/lib/rubygems/gem_runner.rb +22 -24
- data/lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb +163 -0
- data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +105 -0
- data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +78 -0
- data/lib/rubygems/gemcutter_utilities.rb +244 -40
- data/lib/rubygems/indexer.rb +49 -55
- data/lib/rubygems/install_default_message.rb +3 -3
- data/lib/rubygems/install_message.rb +3 -3
- data/lib/rubygems/install_update_options.rb +103 -96
- data/lib/rubygems/installer.rb +370 -214
- data/lib/rubygems/installer_uninstaller_utils.rb +29 -0
- data/lib/rubygems/local_remote_options.rb +27 -27
- data/lib/rubygems/mock_gem_ui.rb +6 -9
- data/lib/rubygems/name_tuple.rb +16 -19
- 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 +5 -7
- data/lib/rubygems/package/file_source.rb +6 -8
- data/lib/rubygems/package/io_source.rb +6 -4
- data/lib/rubygems/package/old.rb +18 -27
- data/lib/rubygems/package/source.rb +1 -1
- data/lib/rubygems/package/tar_header.rb +86 -71
- data/lib/rubygems/package/tar_reader/entry.rb +113 -20
- data/lib/rubygems/package/tar_reader.rb +13 -37
- data/lib/rubygems/package/tar_writer.rb +28 -44
- data/lib/rubygems/package.rb +234 -135
- data/lib/rubygems/package_task.rb +6 -12
- data/lib/rubygems/path_support.rb +18 -12
- data/lib/rubygems/platform.rb +123 -77
- data/lib/rubygems/psych_tree.rb +3 -2
- data/lib/rubygems/query_utils.rb +351 -0
- data/lib/rubygems/rdoc.rb +4 -326
- data/lib/rubygems/remote_fetcher.rb +89 -171
- data/lib/rubygems/request/connection_pools.rb +30 -23
- data/lib/rubygems/request/http_pool.rb +6 -7
- data/lib/rubygems/request/https_pool.rb +2 -3
- data/lib/rubygems/request.rb +88 -41
- data/lib/rubygems/request_set/gem_dependency_api.rb +171 -176
- data/lib/rubygems/request_set/lockfile/parser.rb +39 -49
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +15 -13
- data/lib/rubygems/request_set/lockfile.rb +34 -32
- data/lib/rubygems/request_set.rb +115 -71
- data/lib/rubygems/requirement.rb +72 -63
- data/lib/rubygems/resolver/activation_request.rb +35 -60
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_set.rb +40 -32
- data/lib/rubygems/resolver/api_specification.rb +37 -18
- data/lib/rubygems/resolver/best_set.rb +15 -17
- data/lib/rubygems/resolver/composed_set.rb +9 -11
- data/lib/rubygems/resolver/conflict.rb +18 -24
- data/lib/rubygems/resolver/current_set.rb +2 -4
- data/lib/rubygems/resolver/dependency_request.rb +8 -9
- data/lib/rubygems/resolver/git_set.rb +8 -10
- data/lib/rubygems/resolver/git_specification.rb +11 -13
- data/lib/rubygems/resolver/index_set.rb +10 -12
- data/lib/rubygems/resolver/index_specification.rb +42 -11
- data/lib/rubygems/resolver/installed_specification.rb +9 -11
- data/lib/rubygems/resolver/installer_set.rb +93 -46
- data/lib/rubygems/resolver/local_specification.rb +5 -7
- data/lib/rubygems/resolver/lock_set.rb +13 -15
- data/lib/rubygems/resolver/lock_specification.rb +13 -15
- data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +88 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +36 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +66 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +62 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +63 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +61 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +126 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +46 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +36 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +164 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +110 -146
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +83 -9
- 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 +552 -172
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +12 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- data/lib/rubygems/resolver/molinillo.rb +2 -1
- data/lib/rubygems/resolver/requirement_list.rb +2 -2
- data/lib/rubygems/resolver/set.rb +3 -5
- data/lib/rubygems/resolver/source_set.rb +6 -7
- data/lib/rubygems/resolver/spec_specification.rb +16 -4
- data/lib/rubygems/resolver/specification.rb +25 -10
- data/lib/rubygems/resolver/stats.rb +1 -0
- data/lib/rubygems/resolver/vendor_set.rb +6 -8
- data/lib/rubygems/resolver/vendor_specification.rb +6 -8
- data/lib/rubygems/resolver.rb +120 -64
- data/lib/rubygems/s3_uri_signer.rb +177 -0
- data/lib/rubygems/safe_yaml.rb +59 -0
- data/lib/rubygems/security/policies.rb +49 -49
- data/lib/rubygems/security/policy.rb +44 -47
- data/lib/rubygems/security/signer.rb +86 -29
- data/lib/rubygems/security/trust_dir.rb +21 -23
- data/lib/rubygems/security.rb +111 -78
- data/lib/rubygems/security_option.rb +43 -0
- data/lib/rubygems/shellwords.rb +3 -0
- data/lib/rubygems/source/git.rb +40 -40
- data/lib/rubygems/source/installed.rb +5 -7
- data/lib/rubygems/source/local.rb +30 -30
- data/lib/rubygems/source/lock.rb +9 -7
- data/lib/rubygems/source/specific_file.rb +7 -8
- data/lib/rubygems/source/vendor.rb +3 -5
- data/lib/rubygems/source.rb +73 -63
- data/lib/rubygems/source_list.rb +14 -18
- data/lib/rubygems/spec_fetcher.rb +66 -78
- data/lib/rubygems/specification.rb +823 -1092
- data/lib/rubygems/specification_policy.rb +508 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem +21 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +52 -53
- data/lib/rubygems/text.rb +40 -27
- 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 +149 -84
- 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 +3 -6
- data/lib/rubygems/user_interaction.rb +95 -143
- data/lib/rubygems/util/licenses.rb +679 -314
- data/lib/rubygems/util/list.rb +2 -1
- data/lib/rubygems/util.rb +58 -73
- data/lib/rubygems/validator.rb +23 -47
- data/lib/rubygems/version.rb +92 -48
- data/lib/rubygems/version_option.rb +20 -9
- data/lib/rubygems/yaml_serializer.rb +93 -0
- data/lib/rubygems.rb +434 -346
- data/rubygems-update.gemspec +38 -0
- data/setup.rb +13 -27
- data/test/rubygems/alternate_cert.pem +15 -14
- data/test/rubygems/alternate_cert_32.pem +16 -15
- data/test/rubygems/alternate_key.pem +25 -25
- data/test/rubygems/bad_rake.rb +1 -0
- data/test/rubygems/bundler_test_gem.rb +424 -0
- data/test/rubygems/ca_cert.pem +74 -65
- data/test/rubygems/child_cert.pem +16 -15
- data/test/rubygems/child_cert_32.pem +16 -15
- 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 -14
- data/test/rubygems/fake_certlib/openssl.rb +1 -0
- data/test/rubygems/future_cert.pem +15 -14
- data/test/rubygems/future_cert_32.pem +15 -14
- data/test/rubygems/good_rake.rb +1 -0
- data/test/rubygems/grandchild_cert.pem +16 -15
- data/test/rubygems/grandchild_cert_32.pem +16 -15
- data/test/rubygems/grandchild_key.pem +25 -25
- data/{lib/rubygems/test_case.rb → test/rubygems/helper.rb} +643 -490
- data/{lib → test}/rubygems/installer_test_case.rb +118 -64
- data/test/rubygems/invalid_issuer_cert.pem +17 -15
- data/test/rubygems/invalid_issuer_cert_32.pem +17 -15
- data/test/rubygems/invalid_key.pem +25 -25
- data/test/rubygems/invalid_signer_cert.pem +16 -15
- data/test/rubygems/invalid_signer_cert_32.pem +16 -15
- data/test/rubygems/invalidchild_cert.pem +16 -15
- data/test/rubygems/invalidchild_cert_32.pem +16 -15
- data/test/rubygems/invalidchild_key.pem +25 -25
- data/test/rubygems/multifactor_auth_utilities.rb +111 -0
- data/{lib → test}/rubygems/package/tar_test_case.rb +54 -26
- 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 +2 -1
- data/test/rubygems/plugin/load/rubygems_plugin.rb +1 -0
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +2 -1
- data/test/rubygems/private3072_key.pem +40 -0
- data/test/rubygems/private_ec_key.pem +9 -0
- data/test/rubygems/private_key.pem +25 -25
- data/test/rubygems/public3072_cert.pem +25 -0
- data/test/rubygems/public_cert.pem +17 -15
- data/test/rubygems/public_cert_32.pem +16 -15
- data/test/rubygems/public_key.pem +7 -7
- data/test/rubygems/rubygems/commands/crash_command.rb +1 -2
- data/test/rubygems/rubygems_plugin.rb +7 -5
- data/test/rubygems/simple_gem.rb +1 -0
- data/test/rubygems/specifications/bar-0.0.2.gemspec +1 -1
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +14 -0
- data/test/rubygems/ssl_cert.pem +78 -17
- data/test/rubygems/ssl_key.pem +25 -13
- data/test/rubygems/test_bundled_ca.rb +45 -43
- data/test/rubygems/test_config.rb +13 -9
- data/test/rubygems/test_deprecate.rb +91 -10
- data/test/rubygems/test_exit.rb +17 -0
- data/test/rubygems/test_gem.rb +917 -797
- data/test/rubygems/test_gem_available_set.rb +25 -25
- data/test/rubygems/test_gem_bundler_version_finder.rb +127 -0
- data/test/rubygems/test_gem_command.rb +195 -40
- data/test/rubygems/test_gem_command_manager.rb +182 -46
- data/test/rubygems/test_gem_commands_build_command.rb +646 -28
- data/test/rubygems/test_gem_commands_cert_command.rb +321 -126
- data/test/rubygems/test_gem_commands_check_command.rb +11 -12
- data/test/rubygems/test_gem_commands_cleanup_command.rb +147 -52
- data/test/rubygems/test_gem_commands_contents_command.rb +75 -44
- data/test/rubygems/test_gem_commands_dependency_command.rb +61 -63
- data/test/rubygems/test_gem_commands_environment_command.rb +62 -47
- data/test/rubygems/test_gem_commands_exec_command.rb +857 -0
- data/test/rubygems/test_gem_commands_fetch_command.rb +164 -33
- data/test/rubygems/test_gem_commands_generate_index_command.rb +39 -9
- data/test/rubygems/test_gem_commands_help_command.rb +36 -17
- data/test/rubygems/test_gem_commands_info_command.rb +70 -0
- data/test/rubygems/test_gem_commands_install_command.rb +736 -150
- data/test/rubygems/test_gem_commands_list_command.rb +6 -7
- data/test/rubygems/test_gem_commands_lock_command.rb +12 -14
- data/test/rubygems/test_gem_commands_mirror.rb +4 -4
- data/test/rubygems/test_gem_commands_open_command.rb +47 -16
- data/test/rubygems/test_gem_commands_outdated_command.rb +25 -8
- data/test/rubygems/test_gem_commands_owner_command.rb +368 -70
- data/test/rubygems/test_gem_commands_pristine_command.rb +318 -101
- data/test/rubygems/test_gem_commands_push_command.rb +331 -58
- data/test/rubygems/test_gem_commands_query_command.rb +329 -128
- data/test/rubygems/test_gem_commands_search_command.rb +3 -5
- data/test/rubygems/test_gem_commands_server_command.rb +7 -47
- data/test/rubygems/test_gem_commands_setup_command.rb +404 -66
- data/test/rubygems/test_gem_commands_signin_command.rb +259 -0
- data/test/rubygems/test_gem_commands_signout_command.rb +30 -0
- data/test/rubygems/test_gem_commands_sources_command.rb +316 -31
- data/test/rubygems/test_gem_commands_specification_command.rb +82 -56
- data/test/rubygems/test_gem_commands_stale_command.rb +9 -9
- data/test/rubygems/test_gem_commands_uninstall_command.rb +347 -88
- data/test/rubygems/test_gem_commands_unpack_command.rb +49 -34
- data/test/rubygems/test_gem_commands_update_command.rb +429 -107
- data/test/rubygems/test_gem_commands_which_command.rb +13 -15
- data/test/rubygems/test_gem_commands_yank_command.rb +227 -28
- data/test/rubygems/test_gem_config_file.rb +168 -108
- data/test/rubygems/test_gem_dependency.rb +112 -76
- data/test/rubygems/test_gem_dependency_installer.rb +346 -391
- data/test/rubygems/test_gem_dependency_list.rb +68 -63
- data/test/rubygems/test_gem_dependency_resolution_error.rb +6 -8
- data/test/rubygems/test_gem_doctor.rb +75 -49
- data/test/rubygems/test_gem_ext_builder.rb +121 -125
- 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 +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock +249 -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 +3 -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 +249 -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 +10 -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 +167 -0
- data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +34 -0
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +60 -0
- data/test/rubygems/test_gem_ext_cmake_builder.rb +33 -36
- data/test/rubygems/test_gem_ext_configure_builder.rb +25 -32
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +94 -76
- data/test/rubygems/test_gem_ext_rake_builder.rb +79 -31
- data/test/rubygems/test_gem_gem_runner.rb +59 -9
- data/test/rubygems/test_gem_gemcutter_utilities.rb +210 -84
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +5 -7
- data/test/rubygems/test_gem_indexer.rb +121 -107
- data/test/rubygems/test_gem_install_update_options.rb +65 -54
- data/test/rubygems/test_gem_installer.rb +1517 -557
- data/test/rubygems/test_gem_local_remote_options.rb +14 -15
- data/test/rubygems/test_gem_name_tuple.rb +5 -7
- data/test/rubygems/test_gem_package.rb +673 -243
- data/test/rubygems/test_gem_package_old.rb +58 -57
- data/test/rubygems/test_gem_package_tar_header.rb +129 -50
- data/test/rubygems/test_gem_package_tar_reader.rb +71 -11
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +229 -21
- data/test/rubygems/test_gem_package_tar_writer.rb +168 -101
- data/test/rubygems/test_gem_package_task.rb +59 -25
- data/test/rubygems/test_gem_path_support.rb +49 -31
- data/test/rubygems/test_gem_platform.rb +393 -204
- data/test/rubygems/test_gem_rdoc.rb +23 -156
- data/test/rubygems/test_gem_remote_fetcher.rb +580 -404
- data/test/rubygems/test_gem_request.rb +270 -86
- data/test/rubygems/test_gem_request_connection_pools.rb +57 -35
- data/test/rubygems/test_gem_request_set.rb +192 -115
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +300 -278
- data/test/rubygems/test_gem_request_set_lockfile.rb +95 -96
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +73 -78
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +138 -137
- data/test/rubygems/test_gem_requirement.rb +175 -57
- data/test/rubygems/test_gem_resolver.rb +257 -113
- data/test/rubygems/test_gem_resolver_activation_request.rb +10 -41
- data/test/rubygems/test_gem_resolver_api_set.rb +80 -79
- data/test/rubygems/test_gem_resolver_api_specification.rb +64 -42
- data/test/rubygems/test_gem_resolver_best_set.rb +44 -23
- data/test/rubygems/test_gem_resolver_composed_set.rb +2 -4
- data/test/rubygems/test_gem_resolver_conflict.rb +13 -19
- data/test/rubygems/test_gem_resolver_dependency_request.rb +16 -18
- data/test/rubygems/test_gem_resolver_git_set.rb +23 -25
- data/test/rubygems/test_gem_resolver_git_specification.rb +23 -23
- data/test/rubygems/test_gem_resolver_index_set.rb +15 -17
- data/test/rubygems/test_gem_resolver_index_specification.rb +22 -19
- data/test/rubygems/test_gem_resolver_installed_specification.rb +6 -9
- data/test/rubygems/test_gem_resolver_installer_set.rb +110 -48
- data/test/rubygems/test_gem_resolver_local_specification.rb +8 -10
- data/test/rubygems/test_gem_resolver_lock_set.rb +16 -18
- data/test/rubygems/test_gem_resolver_lock_specification.rb +18 -20
- data/test/rubygems/test_gem_resolver_requirement_list.rb +2 -4
- data/test/rubygems/test_gem_resolver_specification.rb +10 -12
- data/test/rubygems/test_gem_resolver_vendor_set.rb +10 -12
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +11 -13
- data/test/rubygems/test_gem_security.rb +116 -82
- data/test/rubygems/test_gem_security_policy.rb +128 -134
- data/test/rubygems/test_gem_security_signer.rb +58 -49
- data/test/rubygems/test_gem_security_trust_dir.rb +19 -21
- data/test/rubygems/test_gem_silent_ui.rb +48 -42
- data/test/rubygems/test_gem_source.rb +73 -61
- data/test/rubygems/test_gem_source_fetch_problem.rb +23 -6
- data/test/rubygems/test_gem_source_git.rb +79 -78
- data/test/rubygems/test_gem_source_installed.rb +17 -19
- data/test/rubygems/test_gem_source_list.rb +6 -5
- data/test/rubygems/test_gem_source_local.rb +16 -16
- data/test/rubygems/test_gem_source_lock.rb +32 -34
- data/test/rubygems/test_gem_source_specific_file.rb +19 -19
- data/test/rubygems/test_gem_source_subpath_problem.rb +50 -0
- data/test/rubygems/test_gem_source_vendor.rb +14 -16
- data/test/rubygems/test_gem_spec_fetcher.rb +89 -62
- data/test/rubygems/test_gem_specification.rb +1441 -1104
- data/test/rubygems/test_gem_stream_ui.rb +71 -55
- data/test/rubygems/test_gem_stub_specification.rb +102 -41
- data/test/rubygems/test_gem_text.rb +27 -1
- data/test/rubygems/test_gem_uninstaller.rb +289 -99
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +4 -6
- data/test/rubygems/test_gem_update_suggestion.rb +209 -0
- data/test/rubygems/test_gem_uri.rb +41 -0
- data/test/rubygems/test_gem_uri_formatter.rb +15 -17
- data/test/rubygems/test_gem_util.rb +68 -17
- data/test/rubygems/test_gem_validator.rb +12 -16
- data/test/rubygems/test_gem_version.rb +123 -40
- data/test/rubygems/test_gem_version_option.rb +30 -17
- data/test/rubygems/test_kernel.rb +75 -37
- data/test/rubygems/test_project_sanity.rb +49 -0
- data/test/rubygems/test_remote_fetch_error.rb +20 -0
- data/test/rubygems/test_require.rb +527 -117
- data/test/rubygems/test_rubygems.rb +76 -0
- data/test/rubygems/test_webauthn_listener.rb +143 -0
- data/test/rubygems/test_webauthn_listener_response.rb +93 -0
- data/test/rubygems/test_webauthn_poller.rb +124 -0
- data/{lib/rubygems/test_utilities.rb → test/rubygems/utilities.rb} +135 -83
- data/test/rubygems/wrong_key_cert.pem +16 -15
- data/test/rubygems/wrong_key_cert_32.pem +16 -15
- data/test/test_changelog_generator.rb +17 -0
- metadata +513 -189
- data/.autotest +0 -71
- data/.document +0 -5
- data/.travis.yml +0 -46
- data/CONTRIBUTING.rdoc +0 -129
- data/CVE-2013-4287.txt +0 -35
- data/CVE-2013-4363.txt +0 -45
- data/CVE-2015-3900.txt +0 -40
- data/History.txt +0 -3094
- data/MAINTAINERS.md +0 -5
- data/POLICIES.rdoc +0 -61
- data/README.rdoc +0 -54
- data/Rakefile +0 -449
- data/UPGRADING.rdoc +0 -92
- data/appveyor.yml +0 -36
- data/bin/gem +0 -25
- data/bin/update_rubygems +0 -37
- data/lib/gauntlet_rubygems.rb +0 -51
- data/lib/rubygems/psych_additions.rb +0 -10
- data/lib/rubygems/server.rb +0 -869
- data/lib/rubygems/source_local.rb +0 -6
- data/lib/rubygems/source_specific_file.rb +0 -5
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +0 -32
- data/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
- data/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
- data/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem +0 -20
- data/lib/rubygems/syck_hack.rb +0 -77
- data/lib/ubygems.rb +0 -11
- data/test/rubygems/data/null-type.gemspec.rz +0 -0
- data/test/rubygems/fix_openssl_warnings.rb +0 -13
- data/test/rubygems/test_gem_server.rb +0 -409
- data/util/CL2notes +0 -56
- data/util/create_certs.rb +0 -157
- data/util/create_encrypted_key.rb +0 -17
- data/util/generate_spdx_license_list.rb +0 -51
- data/util/update_bundled_ca_certificates.rb +0 -118
data/test/rubygems/test_gem.rb
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
# coding: US-ASCII
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
$SAFE=1
|
|
11
|
-
$LOAD_PATH.map! do |path|
|
|
12
|
-
path.dup.untaint
|
|
13
|
-
end
|
|
2
|
+
|
|
3
|
+
require_relative "helper"
|
|
4
|
+
require "rubygems"
|
|
5
|
+
require "rubygems/command"
|
|
6
|
+
require "rubygems/installer"
|
|
7
|
+
require "pathname"
|
|
8
|
+
require "tmpdir"
|
|
9
|
+
require "rbconfig"
|
|
14
10
|
|
|
15
11
|
class TestGem < Gem::TestCase
|
|
12
|
+
PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
PROJECT_DIR = File.expand_path("../..", __dir__).tap(&Gem::UNTAINT)
|
|
18
15
|
|
|
19
16
|
def setup
|
|
20
17
|
super
|
|
@@ -23,180 +20,488 @@ class TestGem < Gem::TestCase
|
|
|
23
20
|
|
|
24
21
|
common_installer_setup
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
@additional = %w[a b].map { |d| File.join @tempdir, d }
|
|
23
|
+
@additional = %w[a b].map {|d| File.join @tempdir, d }
|
|
28
24
|
|
|
29
25
|
util_remove_interrupt_command
|
|
30
26
|
end
|
|
31
27
|
|
|
32
28
|
def test_self_finish_resolve
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
c2 = new_spec "c", "2"
|
|
29
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
|
30
|
+
b1 = util_spec "b", "1", "c" => ">= 1"
|
|
31
|
+
b2 = util_spec "b", "2", "c" => ">= 2"
|
|
32
|
+
c1 = util_spec "c", "1"
|
|
33
|
+
c2 = util_spec "c", "2"
|
|
39
34
|
|
|
40
|
-
|
|
35
|
+
install_specs c1, c2, b1, b2, a1
|
|
41
36
|
|
|
42
|
-
|
|
37
|
+
a1.activate
|
|
43
38
|
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
assert_equal %w[a-1], loaded_spec_names
|
|
40
|
+
assert_equal ["b (> 0)"], unresolved_names
|
|
46
41
|
|
|
47
|
-
|
|
42
|
+
Gem.finish_resolve
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
end
|
|
44
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
|
45
|
+
assert_equal [], unresolved_names
|
|
52
46
|
end
|
|
53
47
|
|
|
54
48
|
def test_self_finish_resolve_wtf
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
d2 = new_spec "d", "2", { "c" => "< 2" }, "lib/d.rb" # this
|
|
49
|
+
a1 = util_spec "a", "1", "b" => "> 0", "d" => "> 0" # this
|
|
50
|
+
b1 = util_spec "b", "1", { "c" => ">= 1" }, "lib/b.rb" # this
|
|
51
|
+
b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/b.rb"
|
|
52
|
+
c1 = util_spec "c", "1" # this
|
|
53
|
+
c2 = util_spec "c", "2"
|
|
54
|
+
d1 = util_spec "d", "1", { "c" => "< 2" }, "lib/d.rb"
|
|
55
|
+
d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d.rb" # this
|
|
63
56
|
|
|
64
|
-
|
|
57
|
+
install_specs c1, c2, b1, b2, d1, d2, a1
|
|
65
58
|
|
|
66
|
-
|
|
59
|
+
a1.activate
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
assert_equal %w[a-1], loaded_spec_names
|
|
62
|
+
assert_equal ["b (> 0)", "d (> 0)"], unresolved_names
|
|
70
63
|
|
|
71
|
-
|
|
64
|
+
Gem.finish_resolve
|
|
72
65
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
assert_equal %w[a-1 b-1 c-1 d-2], loaded_spec_names
|
|
67
|
+
assert_equal [], unresolved_names
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def test_self_finish_resolve_respects_loaded_specs
|
|
71
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
|
72
|
+
b1 = util_spec "b", "1", "c" => ">= 1"
|
|
73
|
+
b2 = util_spec "b", "2", "c" => ">= 2"
|
|
74
|
+
c1 = util_spec "c", "1"
|
|
75
|
+
c2 = util_spec "c", "2"
|
|
76
|
+
|
|
77
|
+
install_specs c1, c2, b1, b2, a1
|
|
78
|
+
|
|
79
|
+
a1.activate
|
|
80
|
+
c1.activate
|
|
81
|
+
|
|
82
|
+
assert_equal %w[a-1 c-1], loaded_spec_names
|
|
83
|
+
assert_equal ["b (> 0)"], unresolved_names
|
|
84
|
+
|
|
85
|
+
Gem.finish_resolve
|
|
86
|
+
|
|
87
|
+
assert_equal %w[a-1 b-1 c-1], loaded_spec_names
|
|
88
|
+
assert_equal [], unresolved_names
|
|
76
89
|
end
|
|
77
90
|
|
|
78
91
|
def test_self_install
|
|
79
92
|
spec_fetcher do |f|
|
|
80
|
-
f.gem
|
|
81
|
-
f.spec
|
|
93
|
+
f.gem "a", 1
|
|
94
|
+
f.spec "a", 2
|
|
82
95
|
end
|
|
83
96
|
|
|
84
97
|
gemhome2 = "#{@gemhome}2"
|
|
85
98
|
|
|
86
|
-
installed = Gem.install
|
|
99
|
+
installed = Gem.install "a", "= 1", :install_dir => gemhome2
|
|
87
100
|
|
|
88
|
-
assert_equal %w[a-1], installed.map {
|
|
101
|
+
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
|
|
89
102
|
|
|
90
|
-
|
|
103
|
+
assert_path_exist File.join(gemhome2, "gems", "a-1")
|
|
91
104
|
end
|
|
92
105
|
|
|
93
106
|
def test_self_install_in_rescue
|
|
94
107
|
spec_fetcher do |f|
|
|
95
|
-
f.gem
|
|
96
|
-
f.spec
|
|
108
|
+
f.gem "a", 1
|
|
109
|
+
f.spec "a", 2
|
|
97
110
|
end
|
|
98
111
|
|
|
99
112
|
gemhome2 = "#{@gemhome}2"
|
|
100
113
|
|
|
101
114
|
installed =
|
|
102
115
|
begin
|
|
103
|
-
raise
|
|
116
|
+
raise "Error"
|
|
104
117
|
rescue StandardError
|
|
105
|
-
Gem.install
|
|
118
|
+
Gem.install "a", "= 1", :install_dir => gemhome2
|
|
106
119
|
end
|
|
107
|
-
assert_equal %w[a-1], installed.map {
|
|
120
|
+
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
|
|
108
121
|
end
|
|
109
122
|
|
|
110
|
-
def
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
123
|
+
def test_self_install_permissions
|
|
124
|
+
assert_self_install_permissions
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def test_self_install_permissions_umask_0
|
|
128
|
+
umask = File.umask(0)
|
|
129
|
+
assert_self_install_permissions
|
|
130
|
+
ensure
|
|
131
|
+
File.umask(umask)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def test_self_install_permissions_umask_077
|
|
135
|
+
umask = File.umask(0o77)
|
|
136
|
+
assert_self_install_permissions
|
|
137
|
+
ensure
|
|
138
|
+
File.umask(umask)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def test_self_install_permissions_with_format_executable
|
|
142
|
+
assert_self_install_permissions(format_executable: true)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def test_self_install_permissions_with_format_executable_and_non_standard_ruby_install_name
|
|
146
|
+
Gem::Installer.exec_format = nil
|
|
147
|
+
ruby_install_name "ruby27" do
|
|
148
|
+
assert_self_install_permissions(format_executable: true)
|
|
115
149
|
end
|
|
150
|
+
ensure
|
|
151
|
+
Gem::Installer.exec_format = nil
|
|
116
152
|
end
|
|
117
153
|
|
|
118
|
-
def
|
|
119
|
-
|
|
120
|
-
|
|
154
|
+
def assert_self_install_permissions(format_executable: false)
|
|
155
|
+
mask = win_platform? ? 0o700 : 0o777
|
|
156
|
+
options = {
|
|
157
|
+
:dir_mode => 0o500,
|
|
158
|
+
:prog_mode => win_platform? ? 0o410 : 0o510,
|
|
159
|
+
:data_mode => 0o640,
|
|
160
|
+
:wrappers => true,
|
|
161
|
+
:format_executable => format_executable,
|
|
162
|
+
}
|
|
163
|
+
Dir.chdir @tempdir do
|
|
164
|
+
Dir.mkdir "bin"
|
|
165
|
+
Dir.mkdir "data"
|
|
166
|
+
|
|
167
|
+
File.write "bin/foo", "#!/usr/bin/env ruby\n"
|
|
168
|
+
File.chmod 0o755, "bin/foo"
|
|
121
169
|
|
|
122
|
-
|
|
170
|
+
File.write "data/foo.txt", "blah\n"
|
|
123
171
|
|
|
124
|
-
|
|
125
|
-
|
|
172
|
+
spec_fetcher do |f|
|
|
173
|
+
f.gem "foo", 1 do |s|
|
|
174
|
+
s.executables = ["foo"]
|
|
175
|
+
s.files = %w[bin/foo data/foo.txt]
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
Gem.install "foo", Gem::Requirement.default, options
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
prog_mode = (options[:prog_mode] & mask).to_s(8)
|
|
182
|
+
dir_mode = (options[:dir_mode] & mask).to_s(8)
|
|
183
|
+
data_mode = (options[:data_mode] & mask).to_s(8)
|
|
184
|
+
prog_name = "foo"
|
|
185
|
+
prog_name = RbConfig::CONFIG["ruby_install_name"].sub("ruby", "foo") if options[:format_executable]
|
|
186
|
+
expected = {
|
|
187
|
+
"bin/#{prog_name}" => prog_mode,
|
|
188
|
+
"gems/foo-1" => dir_mode,
|
|
189
|
+
"gems/foo-1/bin" => dir_mode,
|
|
190
|
+
"gems/foo-1/data" => dir_mode,
|
|
191
|
+
"gems/foo-1/bin/foo" => prog_mode,
|
|
192
|
+
"gems/foo-1/data/foo.txt" => data_mode,
|
|
193
|
+
}
|
|
194
|
+
# add Windows script
|
|
195
|
+
expected["bin/#{prog_name}.bat"] = mask.to_s(8) if win_platform?
|
|
196
|
+
result = {}
|
|
197
|
+
Dir.chdir @gemhome do
|
|
198
|
+
expected.each_key do |n|
|
|
199
|
+
result[n] = (File.stat(n).mode & mask).to_s(8)
|
|
126
200
|
end
|
|
201
|
+
end
|
|
202
|
+
assert_equal(expected, result)
|
|
203
|
+
ensure
|
|
204
|
+
File.chmod(0o755, *Dir.glob(@gemhome + "/gems/**/").map {|path| path.tap(&Gem::UNTAINT) })
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def test_require_missing
|
|
208
|
+
assert_raise ::LoadError do
|
|
209
|
+
require "test_require_missing"
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def test_require_does_not_glob
|
|
214
|
+
a1 = util_spec "a", "1", nil, "lib/a1.rb"
|
|
215
|
+
|
|
216
|
+
install_specs a1
|
|
127
217
|
|
|
128
|
-
|
|
218
|
+
assert_raise ::LoadError do
|
|
219
|
+
require "a*"
|
|
129
220
|
end
|
|
221
|
+
|
|
222
|
+
assert_equal [], loaded_spec_names
|
|
130
223
|
end
|
|
131
224
|
|
|
132
225
|
def test_self_bin_path_active
|
|
133
|
-
a1 = util_spec
|
|
134
|
-
s.executables = [
|
|
226
|
+
a1 = util_spec "a", "1" do |s|
|
|
227
|
+
s.executables = ["exec"]
|
|
135
228
|
end
|
|
136
229
|
|
|
137
|
-
util_spec
|
|
138
|
-
s.executables = [
|
|
230
|
+
util_spec "a", "2" do |s|
|
|
231
|
+
s.executables = ["exec"]
|
|
139
232
|
end
|
|
140
233
|
|
|
141
234
|
a1.activate
|
|
142
235
|
|
|
143
|
-
assert_match
|
|
236
|
+
assert_match "a-1/bin/exec", Gem.bin_path("a", "exec", ">= 0")
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def test_self_bin_path_picking_newest
|
|
240
|
+
a1 = util_spec "a", "1" do |s|
|
|
241
|
+
s.executables = ["exec"]
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
a2 = util_spec "a", "2" do |s|
|
|
245
|
+
s.executables = ["exec"]
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
install_specs a1, a2
|
|
249
|
+
|
|
250
|
+
assert_match "a-2/bin/exec", Gem.bin_path("a", "exec", ">= 0")
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def test_self_activate_bin_path_no_exec_name
|
|
254
|
+
e = assert_raise ArgumentError do
|
|
255
|
+
Gem.activate_bin_path "a"
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
assert_equal "you must supply exec_name", e.message
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
def test_activate_bin_path_resolves_eagerly
|
|
262
|
+
a1 = util_spec "a", "1" do |s|
|
|
263
|
+
s.executables = ["exec"]
|
|
264
|
+
s.add_dependency "b"
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
b1 = util_spec "b", "1" do |s|
|
|
268
|
+
s.add_dependency "c", "2"
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
b2 = util_spec "b", "2" do |s|
|
|
272
|
+
s.add_dependency "c", "1"
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
c1 = util_spec "c", "1"
|
|
276
|
+
c2 = util_spec "c", "2"
|
|
277
|
+
|
|
278
|
+
install_specs c1, c2, b1, b2, a1
|
|
279
|
+
|
|
280
|
+
Gem.activate_bin_path("a", "exec", ">= 0")
|
|
281
|
+
|
|
282
|
+
# If we didn't eagerly resolve, this would activate c-2 and then the
|
|
283
|
+
# finish_resolve would cause a conflict
|
|
284
|
+
gem "c"
|
|
285
|
+
Gem.finish_resolve
|
|
286
|
+
|
|
287
|
+
assert_equal %w[a-1 b-2 c-1], loaded_spec_names
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
def test_activate_bin_path_does_not_error_if_a_gem_thats_not_finally_activated_has_orphaned_dependencies
|
|
291
|
+
a1 = util_spec "a", "1" do |s|
|
|
292
|
+
s.executables = ["exec"]
|
|
293
|
+
s.add_dependency "b"
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
b1 = util_spec "b", "1" do |s|
|
|
297
|
+
s.add_dependency "c", "1"
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
b2 = util_spec "b", "2" do |s|
|
|
301
|
+
s.add_dependency "c", "2"
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
c2 = util_spec "c", "2"
|
|
305
|
+
|
|
306
|
+
install_specs c2, b1, b2, a1
|
|
307
|
+
|
|
308
|
+
# c1 is missing, but not needed for activation, so we should not get any errors here
|
|
309
|
+
|
|
310
|
+
Gem.activate_bin_path("a", "exec", ">= 0")
|
|
311
|
+
|
|
312
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
def test_activate_bin_path_raises_a_meaningful_error_if_a_gem_thats_finally_activated_has_orphaned_dependencies
|
|
316
|
+
a1 = util_spec "a", "1" do |s|
|
|
317
|
+
s.executables = ["exec"]
|
|
318
|
+
s.add_dependency "b"
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
b1 = util_spec "b", "1" do |s|
|
|
322
|
+
s.add_dependency "c", "1"
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
b2 = util_spec "b", "2" do |s|
|
|
326
|
+
s.add_dependency "c", "2"
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
c1 = util_spec "c", "1"
|
|
330
|
+
|
|
331
|
+
install_specs c1, b1, b2, a1
|
|
332
|
+
|
|
333
|
+
# c2 is missing, and b2 which has it as a dependency will be activated, so we should get an error about the orphaned dependency
|
|
334
|
+
|
|
335
|
+
e = assert_raise Gem::UnsatisfiableDependencyError do
|
|
336
|
+
load Gem.activate_bin_path("a", "exec", ">= 0")
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
assert_equal "Unable to resolve dependency: 'b (>= 0)' requires 'c (= 2)'", e.message
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
def test_activate_bin_path_in_debug_mode
|
|
343
|
+
a1 = util_spec "a", "1" do |s|
|
|
344
|
+
s.executables = ["exec"]
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
install_specs a1
|
|
348
|
+
|
|
349
|
+
require "open3"
|
|
350
|
+
output, status = Open3.capture2e(
|
|
351
|
+
{ "GEM_HOME" => Gem.paths.home, "DEBUG_RESOLVER" => "1" },
|
|
352
|
+
*ruby_with_rubygems_in_load_path, "-e", "\"Gem.activate_bin_path('a', 'exec', '>= 0')\""
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
assert status.success?, output
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def test_activate_bin_path_selects_exact_bundler_version_if_present
|
|
359
|
+
bundler_latest = util_spec "bundler", "2.0.1" do |s|
|
|
360
|
+
s.executables = ["bundle"]
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
bundler_previous = util_spec "bundler", "2.0.0" do |s|
|
|
364
|
+
s.executables = ["bundle"]
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
install_specs bundler_latest, bundler_previous
|
|
368
|
+
|
|
369
|
+
File.open("Gemfile.lock", "w") do |f|
|
|
370
|
+
f.write <<-L.gsub(/ {8}/, "")
|
|
371
|
+
GEM
|
|
372
|
+
remote: https://rubygems.org/
|
|
373
|
+
specs:
|
|
374
|
+
|
|
375
|
+
PLATFORMS
|
|
376
|
+
ruby
|
|
377
|
+
|
|
378
|
+
DEPENDENCIES
|
|
379
|
+
|
|
380
|
+
BUNDLED WITH
|
|
381
|
+
2.0.0
|
|
382
|
+
L
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
|
386
|
+
|
|
387
|
+
load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
|
|
388
|
+
|
|
389
|
+
assert_equal %w[bundler-2.0.0], loaded_spec_names
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
def test_activate_bin_path_respects_underscore_selection_if_given
|
|
393
|
+
bundler_latest = util_spec "bundler", "2.0.1" do |s|
|
|
394
|
+
s.executables = ["bundle"]
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
bundler_previous = util_spec "bundler", "1.17.3" do |s|
|
|
398
|
+
s.executables = ["bundle"]
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
install_specs bundler_latest, bundler_previous
|
|
402
|
+
|
|
403
|
+
File.open("Gemfile.lock", "w") do |f|
|
|
404
|
+
f.write <<-L.gsub(/ {8}/, "")
|
|
405
|
+
GEM
|
|
406
|
+
remote: https://rubygems.org/
|
|
407
|
+
specs:
|
|
408
|
+
|
|
409
|
+
PLATFORMS
|
|
410
|
+
ruby
|
|
411
|
+
|
|
412
|
+
DEPENDENCIES
|
|
413
|
+
|
|
414
|
+
BUNDLED WITH
|
|
415
|
+
2.0.1
|
|
416
|
+
L
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
|
420
|
+
|
|
421
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 1.17.3")
|
|
422
|
+
|
|
423
|
+
assert_equal %w[bundler-1.17.3], loaded_spec_names
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
def test_activate_bin_path_gives_proper_error_for_bundler_when_underscore_selection_given
|
|
427
|
+
File.open("Gemfile.lock", "w") do |f|
|
|
428
|
+
f.write <<-L.gsub(/ {8}/, "")
|
|
429
|
+
GEM
|
|
430
|
+
remote: https://rubygems.org/
|
|
431
|
+
specs:
|
|
432
|
+
|
|
433
|
+
PLATFORMS
|
|
434
|
+
ruby
|
|
435
|
+
|
|
436
|
+
DEPENDENCIES
|
|
437
|
+
|
|
438
|
+
BUNDLED WITH
|
|
439
|
+
2.1.4
|
|
440
|
+
L
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
|
444
|
+
|
|
445
|
+
e = assert_raise Gem::GemNotFoundException do
|
|
446
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 2.2.8")
|
|
447
|
+
end
|
|
448
|
+
|
|
449
|
+
assert_equal "can't find gem bundler (= 2.2.8) with executable bundle", e.message
|
|
144
450
|
end
|
|
145
451
|
|
|
146
452
|
def test_self_bin_path_no_exec_name
|
|
147
|
-
e =
|
|
148
|
-
Gem.bin_path
|
|
453
|
+
e = assert_raise ArgumentError do
|
|
454
|
+
Gem.bin_path "a"
|
|
149
455
|
end
|
|
150
456
|
|
|
151
|
-
assert_equal
|
|
457
|
+
assert_equal "you must supply exec_name", e.message
|
|
152
458
|
end
|
|
153
459
|
|
|
154
460
|
def test_self_bin_path_bin_name
|
|
155
461
|
install_specs util_exec_gem
|
|
156
|
-
assert_equal @abin_path, Gem.bin_path(
|
|
462
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin")
|
|
157
463
|
end
|
|
158
464
|
|
|
159
465
|
def test_self_bin_path_bin_name_version
|
|
160
466
|
install_specs util_exec_gem
|
|
161
|
-
assert_equal @abin_path, Gem.bin_path(
|
|
467
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin", "4")
|
|
162
468
|
end
|
|
163
469
|
|
|
164
470
|
def test_self_bin_path_nonexistent_binfile
|
|
165
|
-
util_spec
|
|
166
|
-
s.executables = [
|
|
471
|
+
util_spec "a", "2" do |s|
|
|
472
|
+
s.executables = ["exec"]
|
|
167
473
|
end
|
|
168
|
-
|
|
169
|
-
Gem.bin_path(
|
|
474
|
+
assert_raise(Gem::GemNotFoundException) do
|
|
475
|
+
Gem.bin_path("a", "other", "2")
|
|
170
476
|
end
|
|
171
477
|
end
|
|
172
478
|
|
|
173
479
|
def test_self_bin_path_no_bin_file
|
|
174
|
-
util_spec
|
|
175
|
-
|
|
176
|
-
Gem.bin_path(
|
|
480
|
+
util_spec "a", "1"
|
|
481
|
+
assert_raise(ArgumentError) do
|
|
482
|
+
Gem.bin_path("a", nil, "1")
|
|
177
483
|
end
|
|
178
484
|
end
|
|
179
485
|
|
|
180
486
|
def test_self_bin_path_not_found
|
|
181
|
-
|
|
182
|
-
Gem.bin_path(
|
|
487
|
+
assert_raise(Gem::GemNotFoundException) do
|
|
488
|
+
Gem.bin_path("non-existent", "blah")
|
|
183
489
|
end
|
|
184
490
|
end
|
|
185
491
|
|
|
186
492
|
def test_self_bin_path_bin_file_gone_in_latest
|
|
187
493
|
install_specs util_exec_gem
|
|
188
|
-
spec = util_spec
|
|
494
|
+
spec = util_spec "a", "10" do |s|
|
|
189
495
|
s.executables = []
|
|
190
496
|
end
|
|
191
497
|
install_specs spec
|
|
192
|
-
|
|
193
|
-
assert_equal @abin_path, Gem.bin_path('a', 'abin')
|
|
498
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin")
|
|
194
499
|
end
|
|
195
500
|
|
|
196
501
|
def test_self_bindir
|
|
197
|
-
assert_equal File.join(@gemhome,
|
|
198
|
-
assert_equal File.join(@gemhome,
|
|
199
|
-
assert_equal File.join(@gemhome,
|
|
502
|
+
assert_equal File.join(@gemhome, "bin"), Gem.bindir
|
|
503
|
+
assert_equal File.join(@gemhome, "bin"), Gem.bindir(Gem.dir)
|
|
504
|
+
assert_equal File.join(@gemhome, "bin"), Gem.bindir(Pathname.new(Gem.dir))
|
|
200
505
|
end
|
|
201
506
|
|
|
202
507
|
def test_self_bindir_default_dir
|
|
@@ -225,120 +530,93 @@ class TestGem < Gem::TestCase
|
|
|
225
530
|
foo = nil
|
|
226
531
|
|
|
227
532
|
Dir.chdir @tempdir do
|
|
228
|
-
FileUtils.mkdir_p
|
|
229
|
-
File.open File.join(
|
|
230
|
-
fp.puts
|
|
533
|
+
FileUtils.mkdir_p "data"
|
|
534
|
+
File.open File.join("data", "foo.txt"), "w" do |fp|
|
|
535
|
+
fp.puts "blah"
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
foo = util_spec "foo" do |s|
|
|
539
|
+
s.files = %w[data/foo.txt]
|
|
231
540
|
end
|
|
232
541
|
|
|
233
|
-
foo = util_spec 'foo' do |s| s.files = %w[data/foo.txt] end
|
|
234
542
|
install_gem foo
|
|
235
543
|
end
|
|
236
544
|
|
|
237
|
-
gem
|
|
545
|
+
gem "foo"
|
|
238
546
|
|
|
239
|
-
expected = File.join @gemhome,
|
|
547
|
+
expected = File.join @gemhome, "gems", foo.full_name, "data", "foo"
|
|
240
548
|
|
|
241
|
-
assert_equal expected, Gem.
|
|
549
|
+
assert_equal expected, Gem::Specification.find_by_name("foo").datadir
|
|
242
550
|
end
|
|
243
551
|
|
|
244
552
|
def test_self_datadir_nonexistent_package
|
|
245
|
-
|
|
553
|
+
assert_raise(Gem::MissingSpecError) do
|
|
554
|
+
Gem::Specification.find_by_name("xyzzy").datadir
|
|
555
|
+
end
|
|
246
556
|
end
|
|
247
557
|
|
|
248
558
|
def test_self_default_exec_format
|
|
249
|
-
ruby_install_name
|
|
250
|
-
assert_equal
|
|
559
|
+
ruby_install_name "ruby" do
|
|
560
|
+
assert_equal "%s", Gem.default_exec_format
|
|
251
561
|
end
|
|
252
562
|
end
|
|
253
563
|
|
|
254
564
|
def test_self_default_exec_format_18
|
|
255
|
-
ruby_install_name
|
|
256
|
-
assert_equal
|
|
565
|
+
ruby_install_name "ruby18" do
|
|
566
|
+
assert_equal "%s18", Gem.default_exec_format
|
|
257
567
|
end
|
|
258
568
|
end
|
|
259
569
|
|
|
260
570
|
def test_self_default_exec_format_jruby
|
|
261
|
-
ruby_install_name
|
|
262
|
-
assert_equal
|
|
571
|
+
ruby_install_name "jruby" do
|
|
572
|
+
assert_equal "j%s", Gem.default_exec_format
|
|
263
573
|
end
|
|
264
574
|
end
|
|
265
575
|
|
|
266
576
|
def test_default_path
|
|
267
|
-
|
|
268
|
-
|
|
577
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
|
578
|
+
FileUtils.rm_rf Gem.user_home
|
|
269
579
|
|
|
270
|
-
|
|
580
|
+
expected = [Gem.default_dir]
|
|
271
581
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
assert_equal expected, Gem.default_path
|
|
275
|
-
ensure
|
|
276
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
|
582
|
+
assert_equal expected, Gem.default_path
|
|
583
|
+
end
|
|
277
584
|
end
|
|
278
585
|
|
|
279
586
|
def test_default_path_missing_vendor
|
|
280
|
-
|
|
281
|
-
|
|
587
|
+
vendordir(nil) do
|
|
588
|
+
FileUtils.rm_rf Gem.user_home
|
|
282
589
|
|
|
283
|
-
|
|
590
|
+
expected = [Gem.default_dir]
|
|
284
591
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
assert_equal expected, Gem.default_path
|
|
288
|
-
ensure
|
|
289
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
|
592
|
+
assert_equal expected, Gem.default_path
|
|
593
|
+
end
|
|
290
594
|
end
|
|
291
595
|
|
|
292
596
|
def test_default_path_user_home
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
expected = [Gem.user_dir, Gem.default_dir]
|
|
597
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
|
598
|
+
expected = [Gem.user_dir, Gem.default_dir]
|
|
297
599
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
|
600
|
+
assert_equal expected, Gem.default_path
|
|
601
|
+
end
|
|
301
602
|
end
|
|
302
603
|
|
|
303
604
|
def test_default_path_vendor_dir
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
FileUtils.mkdir_p Gem.vendor_dir
|
|
605
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
|
606
|
+
FileUtils.mkdir_p Gem.vendor_dir
|
|
308
607
|
|
|
309
|
-
|
|
608
|
+
FileUtils.rm_rf Gem.user_home
|
|
310
609
|
|
|
311
|
-
|
|
610
|
+
expected = [Gem.default_dir, Gem.vendor_dir]
|
|
312
611
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
|
612
|
+
assert_equal expected, Gem.default_path
|
|
613
|
+
end
|
|
316
614
|
end
|
|
317
615
|
|
|
318
616
|
def test_self_default_sources
|
|
319
617
|
assert_equal %w[https://rubygems.org/], Gem.default_sources
|
|
320
618
|
end
|
|
321
619
|
|
|
322
|
-
def test_self_detect_gemdeps
|
|
323
|
-
skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
|
|
324
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
|
|
325
|
-
|
|
326
|
-
FileUtils.mkdir_p 'detect/a/b'
|
|
327
|
-
FileUtils.mkdir_p 'detect/a/Isolate'
|
|
328
|
-
|
|
329
|
-
FileUtils.touch 'detect/Isolate'
|
|
330
|
-
|
|
331
|
-
begin
|
|
332
|
-
Dir.chdir 'detect/a/b'
|
|
333
|
-
|
|
334
|
-
assert_empty Gem.detect_gemdeps
|
|
335
|
-
ensure
|
|
336
|
-
Dir.chdir @tempdir
|
|
337
|
-
end
|
|
338
|
-
ensure
|
|
339
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
|
340
|
-
end
|
|
341
|
-
|
|
342
620
|
def test_self_dir
|
|
343
621
|
assert_equal @gemhome, Gem.dir
|
|
344
622
|
end
|
|
@@ -349,24 +627,24 @@ class TestGem < Gem::TestCase
|
|
|
349
627
|
|
|
350
628
|
Gem.ensure_gem_subdirectories @gemhome
|
|
351
629
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
630
|
+
assert_path_exist File.join @gemhome, "build_info"
|
|
631
|
+
assert_path_exist File.join @gemhome, "cache"
|
|
632
|
+
assert_path_exist File.join @gemhome, "doc"
|
|
633
|
+
assert_path_exist File.join @gemhome, "extensions"
|
|
634
|
+
assert_path_exist File.join @gemhome, "gems"
|
|
635
|
+
assert_path_exist File.join @gemhome, "specifications"
|
|
358
636
|
end
|
|
359
637
|
|
|
360
638
|
def test_self_ensure_gem_directories_permissions
|
|
361
639
|
FileUtils.rm_r @gemhome
|
|
362
640
|
Gem.use_paths @gemhome
|
|
363
641
|
|
|
364
|
-
Gem.ensure_gem_subdirectories @gemhome,
|
|
642
|
+
Gem.ensure_gem_subdirectories @gemhome, 0o750
|
|
365
643
|
|
|
366
|
-
|
|
644
|
+
assert_directory_exists File.join(@gemhome, "cache")
|
|
367
645
|
|
|
368
|
-
assert_equal
|
|
369
|
-
assert_equal
|
|
646
|
+
assert_equal 0o750, File::Stat.new(@gemhome).mode & 0o777
|
|
647
|
+
assert_equal 0o750, File::Stat.new(File.join(@gemhome, "cache")).mode & 0o777
|
|
370
648
|
end unless win_platform?
|
|
371
649
|
|
|
372
650
|
def test_self_ensure_gem_directories_safe_permissions
|
|
@@ -377,220 +655,237 @@ class TestGem < Gem::TestCase
|
|
|
377
655
|
File.umask 0
|
|
378
656
|
Gem.ensure_gem_subdirectories @gemhome
|
|
379
657
|
|
|
380
|
-
assert_equal 0, File::Stat.new(@gemhome).mode &
|
|
381
|
-
assert_equal 0, File::Stat.new(File.join(@gemhome, "cache")).mode &
|
|
658
|
+
assert_equal 0, File::Stat.new(@gemhome).mode & 0o02
|
|
659
|
+
assert_equal 0, File::Stat.new(File.join(@gemhome, "cache")).mode & 0o02
|
|
382
660
|
ensure
|
|
383
661
|
File.umask old_umask
|
|
384
662
|
end unless win_platform?
|
|
385
663
|
|
|
386
664
|
def test_self_ensure_gem_directories_missing_parents
|
|
387
|
-
gemdir = File.join @tempdir,
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
665
|
+
gemdir = File.join @tempdir, "a/b/c/gemdir"
|
|
666
|
+
begin
|
|
667
|
+
FileUtils.rm_rf File.join(@tempdir, "a")
|
|
668
|
+
rescue StandardError
|
|
669
|
+
nil
|
|
670
|
+
end
|
|
671
|
+
refute File.exist?(File.join(@tempdir, "a")),
|
|
672
|
+
"manually remove #{File.join @tempdir, "a"}, tests are broken"
|
|
391
673
|
Gem.use_paths gemdir
|
|
392
674
|
|
|
393
675
|
Gem.ensure_gem_subdirectories gemdir
|
|
394
676
|
|
|
395
|
-
|
|
677
|
+
assert_directory_exists util_cache_dir
|
|
396
678
|
end
|
|
397
679
|
|
|
398
|
-
unless win_platform?
|
|
680
|
+
unless win_platform? || Process.uid.zero? # only for FS that support write protection
|
|
399
681
|
def test_self_ensure_gem_directories_write_protected
|
|
400
682
|
gemdir = File.join @tempdir, "egd"
|
|
401
|
-
|
|
683
|
+
begin
|
|
684
|
+
FileUtils.rm_r gemdir
|
|
685
|
+
rescue StandardError
|
|
686
|
+
nil
|
|
687
|
+
end
|
|
402
688
|
refute File.exist?(gemdir), "manually remove #{gemdir}, tests are broken"
|
|
403
689
|
FileUtils.mkdir_p gemdir
|
|
404
|
-
FileUtils.chmod
|
|
690
|
+
FileUtils.chmod 0o400, gemdir
|
|
405
691
|
Gem.use_paths gemdir
|
|
406
692
|
|
|
407
693
|
Gem.ensure_gem_subdirectories gemdir
|
|
408
694
|
|
|
409
695
|
refute File.exist?(util_cache_dir)
|
|
410
696
|
ensure
|
|
411
|
-
FileUtils.chmod
|
|
697
|
+
FileUtils.chmod 0o600, gemdir
|
|
412
698
|
end
|
|
413
699
|
|
|
414
700
|
def test_self_ensure_gem_directories_write_protected_parents
|
|
415
701
|
parent = File.join(@tempdir, "egd")
|
|
416
702
|
gemdir = "#{parent}/a/b/c"
|
|
417
703
|
|
|
418
|
-
|
|
704
|
+
begin
|
|
705
|
+
FileUtils.rm_r parent
|
|
706
|
+
rescue StandardError
|
|
707
|
+
nil
|
|
708
|
+
end
|
|
419
709
|
refute File.exist?(parent), "manually remove #{parent}, tests are broken"
|
|
420
710
|
FileUtils.mkdir_p parent
|
|
421
|
-
FileUtils.chmod
|
|
711
|
+
FileUtils.chmod 0o400, parent
|
|
422
712
|
Gem.use_paths(gemdir)
|
|
423
713
|
|
|
424
714
|
Gem.ensure_gem_subdirectories gemdir
|
|
425
715
|
|
|
426
716
|
refute File.exist? File.join(gemdir, "gems")
|
|
427
717
|
ensure
|
|
428
|
-
FileUtils.chmod
|
|
718
|
+
FileUtils.chmod 0o600, parent
|
|
719
|
+
end
|
|
720
|
+
|
|
721
|
+
def test_self_ensure_gem_directories_non_existent_paths
|
|
722
|
+
Gem.ensure_gem_subdirectories "/proc/0123456789/bogus" # should not raise
|
|
723
|
+
Gem.ensure_gem_subdirectories "classpath:/bogus/x" # JRuby embed scenario
|
|
429
724
|
end
|
|
430
725
|
end
|
|
431
726
|
|
|
432
727
|
def test_self_extension_dir_shared
|
|
433
|
-
enable_shared
|
|
728
|
+
enable_shared "yes" do
|
|
434
729
|
assert_equal Gem.ruby_api_version, Gem.extension_api_version
|
|
435
730
|
end
|
|
436
731
|
end
|
|
437
732
|
|
|
438
733
|
def test_self_extension_dir_static
|
|
439
|
-
enable_shared
|
|
734
|
+
enable_shared "no" do
|
|
440
735
|
assert_equal "#{Gem.ruby_api_version}-static", Gem.extension_api_version
|
|
441
736
|
end
|
|
442
737
|
end
|
|
443
738
|
|
|
444
739
|
def test_self_find_files
|
|
445
|
-
cwd = File.expand_path("test/rubygems",
|
|
740
|
+
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
|
446
741
|
$LOAD_PATH.unshift cwd
|
|
447
742
|
|
|
448
|
-
discover_path = File.join
|
|
743
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
|
449
744
|
|
|
450
|
-
foo1, foo2 = %w
|
|
451
|
-
spec = quick_gem
|
|
745
|
+
foo1, foo2 = %w[1 2].map do |version|
|
|
746
|
+
spec = quick_gem "sff", version do |s|
|
|
452
747
|
s.files << discover_path
|
|
453
748
|
end
|
|
454
749
|
|
|
455
|
-
write_file(File.join
|
|
750
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
|
456
751
|
fp.puts "# #{spec.full_name}"
|
|
457
752
|
end
|
|
458
753
|
|
|
459
754
|
spec
|
|
460
|
-
|
|
755
|
+
end
|
|
461
756
|
|
|
462
757
|
Gem.refresh
|
|
463
758
|
|
|
464
759
|
expected = [
|
|
465
|
-
File.expand_path(
|
|
760
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
|
466
761
|
File.join(foo2.full_gem_path, discover_path),
|
|
467
762
|
File.join(foo1.full_gem_path, discover_path),
|
|
468
763
|
]
|
|
469
764
|
|
|
470
|
-
assert_equal expected, Gem.find_files(
|
|
471
|
-
assert_equal expected, Gem.find_files(
|
|
765
|
+
assert_equal expected, Gem.find_files("sff/discover")
|
|
766
|
+
assert_equal expected, Gem.find_files("sff/**.rb"), "[ruby-core:31730]"
|
|
472
767
|
ensure
|
|
473
768
|
assert_equal cwd, $LOAD_PATH.shift
|
|
474
769
|
end
|
|
475
770
|
|
|
476
|
-
def test_self_find_files_with_gemfile
|
|
477
|
-
# write_file(File.join Dir.pwd, 'Gemfile') fails on travis 1.8.7 with $SAFE=1
|
|
478
|
-
skip if RUBY_VERSION <= "1.8.7"
|
|
479
|
-
|
|
480
|
-
cwd = File.expand_path("test/rubygems", @@project_dir)
|
|
481
|
-
$LOAD_PATH.unshift cwd
|
|
482
|
-
|
|
483
|
-
discover_path = File.join 'lib', 'sff', 'discover.rb'
|
|
484
|
-
|
|
485
|
-
foo1, _ = %w(1 2).map { |version|
|
|
486
|
-
spec = quick_gem 'sff', version do |s|
|
|
487
|
-
s.files << discover_path
|
|
488
|
-
end
|
|
489
|
-
|
|
490
|
-
write_file(File.join 'gems', spec.full_name, discover_path) do |fp|
|
|
491
|
-
fp.puts "# #{spec.full_name}"
|
|
492
|
-
end
|
|
493
|
-
|
|
494
|
-
spec
|
|
495
|
-
}
|
|
496
|
-
Gem.refresh
|
|
497
|
-
|
|
498
|
-
write_file(File.join Dir.pwd, 'Gemfile') do |fp|
|
|
499
|
-
fp.puts "source 'https://rubygems.org'"
|
|
500
|
-
fp.puts "gem '#{foo1.name}', '#{foo1.version}'"
|
|
501
|
-
end
|
|
502
|
-
Gem.use_gemdeps(File.join Dir.pwd, 'Gemfile')
|
|
503
|
-
|
|
504
|
-
expected = [
|
|
505
|
-
File.expand_path('test/rubygems/sff/discover.rb', @@project_dir),
|
|
506
|
-
File.join(foo1.full_gem_path, discover_path)
|
|
507
|
-
]
|
|
508
|
-
|
|
509
|
-
assert_equal expected, Gem.find_files('sff/discover')
|
|
510
|
-
assert_equal expected, Gem.find_files('sff/**.rb'), '[ruby-core:31730]'
|
|
511
|
-
ensure
|
|
512
|
-
assert_equal cwd, $LOAD_PATH.shift unless RUBY_VERSION <= "1.8.7"
|
|
513
|
-
end
|
|
514
|
-
|
|
515
771
|
def test_self_find_latest_files
|
|
516
|
-
cwd = File.expand_path("test/rubygems",
|
|
772
|
+
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
|
517
773
|
$LOAD_PATH.unshift cwd
|
|
518
774
|
|
|
519
|
-
discover_path = File.join
|
|
775
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
|
520
776
|
|
|
521
|
-
_, foo2 = %w
|
|
522
|
-
spec = quick_gem
|
|
777
|
+
_, foo2 = %w[1 2].map do |version|
|
|
778
|
+
spec = quick_gem "sff", version do |s|
|
|
523
779
|
s.files << discover_path
|
|
524
780
|
end
|
|
525
781
|
|
|
526
|
-
write_file(File.join
|
|
782
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
|
527
783
|
fp.puts "# #{spec.full_name}"
|
|
528
784
|
end
|
|
529
785
|
|
|
530
786
|
spec
|
|
531
|
-
|
|
787
|
+
end
|
|
532
788
|
|
|
533
789
|
Gem.refresh
|
|
534
790
|
|
|
535
791
|
expected = [
|
|
536
|
-
File.expand_path(
|
|
792
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
|
537
793
|
File.join(foo2.full_gem_path, discover_path),
|
|
538
794
|
]
|
|
539
795
|
|
|
540
|
-
assert_equal expected, Gem.find_latest_files(
|
|
541
|
-
assert_equal expected, Gem.find_latest_files(
|
|
796
|
+
assert_equal expected, Gem.find_latest_files("sff/discover")
|
|
797
|
+
assert_equal expected, Gem.find_latest_files("sff/**.rb"), "[ruby-core:31730]"
|
|
542
798
|
ensure
|
|
543
799
|
assert_equal cwd, $LOAD_PATH.shift
|
|
544
800
|
end
|
|
545
801
|
|
|
546
802
|
def test_self_latest_spec_for
|
|
547
803
|
gems = spec_fetcher do |fetcher|
|
|
548
|
-
fetcher.spec
|
|
549
|
-
fetcher.spec
|
|
550
|
-
fetcher.spec
|
|
804
|
+
fetcher.spec "a", 1
|
|
805
|
+
fetcher.spec "a", "3.a"
|
|
806
|
+
fetcher.spec "a", 2
|
|
551
807
|
end
|
|
552
808
|
|
|
553
|
-
spec = Gem.latest_spec_for
|
|
809
|
+
spec = Gem.latest_spec_for "a"
|
|
810
|
+
|
|
811
|
+
assert_equal gems["a-2"], spec
|
|
812
|
+
end
|
|
813
|
+
|
|
814
|
+
def test_self_latest_spec_for_multiple_sources
|
|
815
|
+
uri = "https://example.sample.com/"
|
|
816
|
+
source = Gem::Source.new(uri)
|
|
817
|
+
source_list = Gem::SourceList.new
|
|
818
|
+
source_list << Gem::Source.new(@uri)
|
|
819
|
+
source_list << source
|
|
820
|
+
Gem.sources.replace source_list
|
|
821
|
+
|
|
822
|
+
spec_fetcher(uri) do |fetcher|
|
|
823
|
+
fetcher.spec "a", 1.1
|
|
824
|
+
end
|
|
554
825
|
|
|
555
|
-
|
|
826
|
+
gems = spec_fetcher do |fetcher|
|
|
827
|
+
fetcher.spec "a", 1
|
|
828
|
+
fetcher.spec "a", "3.a"
|
|
829
|
+
fetcher.spec "a", 2
|
|
830
|
+
end
|
|
831
|
+
spec = Gem.latest_spec_for "a"
|
|
832
|
+
assert_equal gems["a-2"], spec
|
|
556
833
|
end
|
|
557
834
|
|
|
558
835
|
def test_self_latest_rubygems_version
|
|
559
836
|
spec_fetcher do |fetcher|
|
|
560
|
-
fetcher.spec
|
|
561
|
-
fetcher.spec
|
|
562
|
-
fetcher.spec
|
|
837
|
+
fetcher.spec "rubygems-update", "1.8.23"
|
|
838
|
+
fetcher.spec "rubygems-update", "1.8.24"
|
|
839
|
+
fetcher.spec "rubygems-update", "2.0.0.preview3"
|
|
563
840
|
end
|
|
564
841
|
|
|
565
842
|
version = Gem.latest_rubygems_version
|
|
566
843
|
|
|
567
|
-
assert_equal Gem::Version.new(
|
|
844
|
+
assert_equal Gem::Version.new("1.8.24"), version
|
|
568
845
|
end
|
|
569
846
|
|
|
570
847
|
def test_self_latest_version_for
|
|
571
848
|
spec_fetcher do |fetcher|
|
|
572
|
-
fetcher.spec
|
|
573
|
-
fetcher.spec
|
|
574
|
-
fetcher.spec
|
|
849
|
+
fetcher.spec "a", 1
|
|
850
|
+
fetcher.spec "a", 2
|
|
851
|
+
fetcher.spec "a", "3.a"
|
|
852
|
+
end
|
|
853
|
+
|
|
854
|
+
version = Gem.latest_version_for "a"
|
|
855
|
+
|
|
856
|
+
assert_equal Gem::Version.new(2), version
|
|
857
|
+
end
|
|
858
|
+
|
|
859
|
+
def test_self_latest_version_for_multiple_sources
|
|
860
|
+
uri = "https://example.sample.com/"
|
|
861
|
+
source = Gem::Source.new(uri)
|
|
862
|
+
source_list = Gem::SourceList.new
|
|
863
|
+
source_list << Gem::Source.new(@uri)
|
|
864
|
+
source_list << source
|
|
865
|
+
Gem.sources.replace source_list
|
|
866
|
+
|
|
867
|
+
spec_fetcher(uri) do |fetcher|
|
|
868
|
+
fetcher.spec "a", 1.1
|
|
869
|
+
end
|
|
870
|
+
|
|
871
|
+
spec_fetcher do |fetcher|
|
|
872
|
+
fetcher.spec "a", 1
|
|
873
|
+
fetcher.spec "a", 2
|
|
874
|
+
fetcher.spec "a", "3.a"
|
|
575
875
|
end
|
|
576
876
|
|
|
577
|
-
version = Gem.latest_version_for
|
|
877
|
+
version = Gem.latest_version_for "a"
|
|
578
878
|
|
|
579
879
|
assert_equal Gem::Version.new(2), version
|
|
580
880
|
end
|
|
581
881
|
|
|
582
882
|
def test_self_loaded_specs
|
|
583
|
-
foo = util_spec
|
|
883
|
+
foo = util_spec "foo"
|
|
584
884
|
install_gem foo
|
|
585
885
|
|
|
586
886
|
foo.activate
|
|
587
887
|
|
|
588
|
-
assert_equal true, Gem.loaded_specs.keys.include?(
|
|
589
|
-
end
|
|
590
|
-
|
|
591
|
-
def util_path
|
|
592
|
-
ENV.delete "GEM_HOME"
|
|
593
|
-
ENV.delete "GEM_PATH"
|
|
888
|
+
assert_equal true, Gem.loaded_specs.keys.include?("foo")
|
|
594
889
|
end
|
|
595
890
|
|
|
596
891
|
def test_self_path
|
|
@@ -598,53 +893,19 @@ class TestGem < Gem::TestCase
|
|
|
598
893
|
end
|
|
599
894
|
|
|
600
895
|
def test_self_path_default
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
if defined?(APPLE_GEM_HOME)
|
|
604
|
-
orig_APPLE_GEM_HOME = APPLE_GEM_HOME
|
|
605
|
-
Object.send :remove_const, :APPLE_GEM_HOME
|
|
606
|
-
end
|
|
896
|
+
ENV.delete "GEM_HOME"
|
|
897
|
+
ENV.delete "GEM_PATH"
|
|
607
898
|
|
|
608
899
|
Gem.instance_variable_set :@paths, nil
|
|
609
900
|
|
|
610
901
|
assert_equal [Gem.default_path, Gem.dir].flatten.uniq, Gem.path
|
|
611
|
-
ensure
|
|
612
|
-
Object.const_set :APPLE_GEM_HOME, orig_APPLE_GEM_HOME if orig_APPLE_GEM_HOME
|
|
613
|
-
end
|
|
614
|
-
|
|
615
|
-
unless win_platform?
|
|
616
|
-
def test_self_path_APPLE_GEM_HOME
|
|
617
|
-
util_path
|
|
618
|
-
|
|
619
|
-
Gem.clear_paths
|
|
620
|
-
apple_gem_home = File.join @tempdir, 'apple_gem_home'
|
|
621
|
-
|
|
622
|
-
old, $-w = $-w, nil
|
|
623
|
-
Object.const_set :APPLE_GEM_HOME, apple_gem_home
|
|
624
|
-
$-w = old
|
|
625
|
-
|
|
626
|
-
assert_includes Gem.path, apple_gem_home
|
|
627
|
-
ensure
|
|
628
|
-
Object.send :remove_const, :APPLE_GEM_HOME
|
|
629
|
-
end
|
|
630
|
-
|
|
631
|
-
def test_self_path_APPLE_GEM_HOME_GEM_PATH
|
|
632
|
-
Gem.clear_paths
|
|
633
|
-
ENV['GEM_PATH'] = @gemhome
|
|
634
|
-
apple_gem_home = File.join @tempdir, 'apple_gem_home'
|
|
635
|
-
Gem.const_set :APPLE_GEM_HOME, apple_gem_home
|
|
636
|
-
|
|
637
|
-
refute Gem.path.include?(apple_gem_home)
|
|
638
|
-
ensure
|
|
639
|
-
Gem.send :remove_const, :APPLE_GEM_HOME
|
|
640
|
-
end
|
|
641
902
|
end
|
|
642
903
|
|
|
643
904
|
def test_self_path_ENV_PATH
|
|
644
905
|
path_count = Gem.path.size
|
|
645
906
|
Gem.clear_paths
|
|
646
907
|
|
|
647
|
-
ENV[
|
|
908
|
+
ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
|
|
648
909
|
|
|
649
910
|
assert_equal @additional, Gem.path[0,2]
|
|
650
911
|
|
|
@@ -656,10 +917,10 @@ class TestGem < Gem::TestCase
|
|
|
656
917
|
def test_self_path_duplicate
|
|
657
918
|
Gem.clear_paths
|
|
658
919
|
util_ensure_gem_dirs
|
|
659
|
-
dirs = @additional + [@gemhome] + [File.join(@tempdir,
|
|
920
|
+
dirs = @additional + [@gemhome] + [File.join(@tempdir, "a")]
|
|
660
921
|
|
|
661
|
-
ENV[
|
|
662
|
-
ENV[
|
|
922
|
+
ENV["GEM_HOME"] = @gemhome
|
|
923
|
+
ENV["GEM_PATH"] = dirs.join File::PATH_SEPARATOR
|
|
663
924
|
|
|
664
925
|
assert_equal @gemhome, Gem.dir
|
|
665
926
|
|
|
@@ -671,8 +932,8 @@ class TestGem < Gem::TestCase
|
|
|
671
932
|
Gem.clear_paths
|
|
672
933
|
|
|
673
934
|
util_ensure_gem_dirs
|
|
674
|
-
ENV[
|
|
675
|
-
ENV[
|
|
935
|
+
ENV["GEM_HOME"] = @gemhome
|
|
936
|
+
ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
|
|
676
937
|
|
|
677
938
|
assert_equal @gemhome, Gem.dir
|
|
678
939
|
|
|
@@ -685,47 +946,46 @@ class TestGem < Gem::TestCase
|
|
|
685
946
|
end
|
|
686
947
|
|
|
687
948
|
def test_self_prefix
|
|
688
|
-
assert_equal
|
|
949
|
+
assert_equal PROJECT_DIR, Gem.prefix
|
|
689
950
|
end
|
|
690
951
|
|
|
691
952
|
def test_self_prefix_libdir
|
|
692
|
-
orig_libdir = RbConfig::CONFIG[
|
|
693
|
-
RbConfig::CONFIG[
|
|
953
|
+
orig_libdir = RbConfig::CONFIG["libdir"]
|
|
954
|
+
RbConfig::CONFIG["libdir"] = PROJECT_DIR
|
|
694
955
|
|
|
695
956
|
assert_nil Gem.prefix
|
|
696
957
|
ensure
|
|
697
|
-
RbConfig::CONFIG[
|
|
958
|
+
RbConfig::CONFIG["libdir"] = orig_libdir
|
|
698
959
|
end
|
|
699
960
|
|
|
700
961
|
def test_self_prefix_sitelibdir
|
|
701
|
-
orig_sitelibdir = RbConfig::CONFIG[
|
|
702
|
-
RbConfig::CONFIG[
|
|
962
|
+
orig_sitelibdir = RbConfig::CONFIG["sitelibdir"]
|
|
963
|
+
RbConfig::CONFIG["sitelibdir"] = PROJECT_DIR
|
|
703
964
|
|
|
704
965
|
assert_nil Gem.prefix
|
|
705
966
|
ensure
|
|
706
|
-
RbConfig::CONFIG[
|
|
967
|
+
RbConfig::CONFIG["sitelibdir"] = orig_sitelibdir
|
|
707
968
|
end
|
|
708
969
|
|
|
709
970
|
def test_self_read_binary
|
|
710
|
-
open
|
|
971
|
+
File.open "test", "w" do |io|
|
|
711
972
|
io.write "\xCF\x80"
|
|
712
973
|
end
|
|
713
974
|
|
|
714
|
-
assert_equal ["\xCF", "\x80"], Gem.read_binary(
|
|
975
|
+
assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
|
|
715
976
|
|
|
716
|
-
|
|
977
|
+
pend "chmod not supported" if Gem.win_platform?
|
|
717
978
|
|
|
718
979
|
begin
|
|
719
|
-
File.chmod
|
|
980
|
+
File.chmod 0o444, "test"
|
|
720
981
|
|
|
721
|
-
assert_equal ["\xCF", "\x80"], Gem.read_binary(
|
|
982
|
+
assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
|
|
722
983
|
ensure
|
|
723
|
-
File.chmod
|
|
984
|
+
File.chmod 0o644, "test"
|
|
724
985
|
end
|
|
725
986
|
end
|
|
726
987
|
|
|
727
988
|
def test_self_refresh
|
|
728
|
-
skip 'Insecure operation - mkdir' if RUBY_VERSION <= "1.8.7"
|
|
729
989
|
util_make_gems
|
|
730
990
|
|
|
731
991
|
a1_spec = @a1.spec_file
|
|
@@ -745,7 +1005,6 @@ class TestGem < Gem::TestCase
|
|
|
745
1005
|
end
|
|
746
1006
|
|
|
747
1007
|
def test_self_refresh_keeps_loaded_specs_activated
|
|
748
|
-
skip 'Insecure operation - mkdir' if RUBY_VERSION <= "1.8.7"
|
|
749
1008
|
util_make_gems
|
|
750
1009
|
|
|
751
1010
|
a1_spec = @a1.spec_file
|
|
@@ -760,82 +1019,96 @@ class TestGem < Gem::TestCase
|
|
|
760
1019
|
|
|
761
1020
|
Gem.refresh
|
|
762
1021
|
|
|
763
|
-
Gem::Specification.each{|spec| assert spec.activated? if spec == s}
|
|
1022
|
+
Gem::Specification.each {|spec| assert spec.activated? if spec == s }
|
|
764
1023
|
|
|
765
1024
|
Gem.loaded_specs.delete(s)
|
|
766
1025
|
Gem.refresh
|
|
767
1026
|
end
|
|
768
1027
|
|
|
769
1028
|
def test_self_ruby_escaping_spaces_in_path
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
1029
|
+
with_clean_path_to_ruby do
|
|
1030
|
+
with_rb_config_ruby("C:/Ruby 1.8/bin/ruby.exe") do
|
|
1031
|
+
assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby
|
|
1032
|
+
end
|
|
1033
|
+
end
|
|
1034
|
+
end
|
|
774
1035
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
1036
|
+
def test_self_ruby_path_without_spaces
|
|
1037
|
+
with_clean_path_to_ruby do
|
|
1038
|
+
with_rb_config_ruby("C:/Ruby18/bin/ruby.exe") do
|
|
1039
|
+
assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby
|
|
1040
|
+
end
|
|
1041
|
+
end
|
|
1042
|
+
end
|
|
1043
|
+
|
|
1044
|
+
def test_self_ruby_api_version
|
|
1045
|
+
orig_ruby_version = RbConfig::CONFIG["ruby_version"]
|
|
1046
|
+
RbConfig::CONFIG["ruby_version"] = "1.2.3"
|
|
779
1047
|
|
|
780
|
-
|
|
1048
|
+
Gem.instance_variable_set :@ruby_api_version, nil
|
|
1049
|
+
|
|
1050
|
+
assert_equal "1.2.3", Gem.ruby_api_version
|
|
781
1051
|
ensure
|
|
782
|
-
Gem.instance_variable_set
|
|
783
|
-
|
|
784
|
-
RbConfig::CONFIG[
|
|
785
|
-
RbConfig::CONFIG['EXEEXT'] = orig_exe_ext
|
|
1052
|
+
Gem.instance_variable_set :@ruby_api_version, nil
|
|
1053
|
+
|
|
1054
|
+
RbConfig::CONFIG["ruby_version"] = orig_ruby_version
|
|
786
1055
|
end
|
|
787
1056
|
|
|
788
|
-
def
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
1057
|
+
def test_self_env_requirement
|
|
1058
|
+
ENV["GEM_REQUIREMENT_FOO"] = ">= 1.2.3"
|
|
1059
|
+
ENV["GEM_REQUIREMENT_BAR"] = "1.2.3"
|
|
1060
|
+
ENV["GEM_REQUIREMENT_BAZ"] = "abcd"
|
|
1061
|
+
|
|
1062
|
+
assert_equal Gem::Requirement.create(">= 1.2.3"), Gem.env_requirement("foo")
|
|
1063
|
+
assert_equal Gem::Requirement.create("1.2.3"), Gem.env_requirement("bAr")
|
|
1064
|
+
assert_raise(Gem::Requirement::BadRequirementError) { Gem.env_requirement("baz") }
|
|
1065
|
+
assert_equal Gem::Requirement.default, Gem.env_requirement("qux")
|
|
1066
|
+
end
|
|
793
1067
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
RbConfig::CONFIG['EXEEXT'] = ".exe"
|
|
797
|
-
Gem.instance_variable_set("@ruby", nil)
|
|
1068
|
+
def test_self_ruby_version_with_non_mri_implementations
|
|
1069
|
+
util_set_RUBY_VERSION "2.5.0", 0, 60_928, "jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]"
|
|
798
1070
|
|
|
799
|
-
assert_equal "
|
|
1071
|
+
assert_equal Gem::Version.new("2.5.0"), Gem.ruby_version
|
|
800
1072
|
ensure
|
|
801
|
-
|
|
802
|
-
RbConfig::CONFIG['bindir'] = orig_bindir
|
|
803
|
-
RbConfig::CONFIG['ruby_install_name'] = orig_ruby_install_name
|
|
804
|
-
RbConfig::CONFIG['EXEEXT'] = orig_exe_ext
|
|
1073
|
+
util_restore_RUBY_VERSION
|
|
805
1074
|
end
|
|
806
1075
|
|
|
807
|
-
def
|
|
808
|
-
|
|
1076
|
+
def test_self_ruby_version_with_svn_prerelease
|
|
1077
|
+
util_set_RUBY_VERSION "2.6.0", -1, 63_539, "ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]"
|
|
809
1078
|
|
|
810
|
-
Gem.
|
|
811
|
-
|
|
812
|
-
assert_equal '1.2.3', Gem.ruby_api_version
|
|
1079
|
+
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
|
|
813
1080
|
ensure
|
|
814
|
-
|
|
1081
|
+
util_restore_RUBY_VERSION
|
|
1082
|
+
end
|
|
815
1083
|
|
|
816
|
-
|
|
1084
|
+
def test_self_ruby_version_with_git_prerelease
|
|
1085
|
+
util_set_RUBY_VERSION "2.7.0", -1, "b563439274a402e33541f5695b1bfd4ac1085638", "ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]"
|
|
1086
|
+
|
|
1087
|
+
assert_equal Gem::Version.new("2.7.0.preview3"), Gem.ruby_version
|
|
1088
|
+
ensure
|
|
1089
|
+
util_restore_RUBY_VERSION
|
|
817
1090
|
end
|
|
818
1091
|
|
|
819
|
-
def
|
|
820
|
-
util_set_RUBY_VERSION
|
|
1092
|
+
def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
|
|
1093
|
+
util_set_RUBY_VERSION "2.6.0", -1, 63_539, "weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]", "weirdjruby", "9.2.0.0"
|
|
821
1094
|
|
|
822
|
-
assert_equal Gem::Version.new(
|
|
1095
|
+
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
|
|
823
1096
|
ensure
|
|
824
1097
|
util_restore_RUBY_VERSION
|
|
825
1098
|
end
|
|
826
1099
|
|
|
827
|
-
def
|
|
828
|
-
util_set_RUBY_VERSION
|
|
1100
|
+
def test_self_ruby_version_with_svn_trunk
|
|
1101
|
+
util_set_RUBY_VERSION "1.9.2", -1, 23_493, "ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]"
|
|
829
1102
|
|
|
830
|
-
assert_equal Gem::Version.new(
|
|
1103
|
+
assert_equal Gem::Version.new("1.9.2.dev"), Gem.ruby_version
|
|
831
1104
|
ensure
|
|
832
1105
|
util_restore_RUBY_VERSION
|
|
833
1106
|
end
|
|
834
1107
|
|
|
835
|
-
def
|
|
836
|
-
util_set_RUBY_VERSION
|
|
1108
|
+
def test_self_ruby_version_with_git_master
|
|
1109
|
+
util_set_RUBY_VERSION "2.7.0", -1, "5de284ec78220e75643f89b454ce999da0c1c195", "ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]"
|
|
837
1110
|
|
|
838
|
-
assert_equal Gem::Version.new(
|
|
1111
|
+
assert_equal Gem::Version.new("2.7.0.dev"), Gem.ruby_version
|
|
839
1112
|
ensure
|
|
840
1113
|
util_restore_RUBY_VERSION
|
|
841
1114
|
end
|
|
@@ -845,7 +1118,7 @@ class TestGem < Gem::TestCase
|
|
|
845
1118
|
end
|
|
846
1119
|
|
|
847
1120
|
def test_self_paths_eq
|
|
848
|
-
other = File.join @tempdir,
|
|
1121
|
+
other = File.join @tempdir, "other"
|
|
849
1122
|
path = [@userhome, other].join File::PATH_SEPARATOR
|
|
850
1123
|
|
|
851
1124
|
#
|
|
@@ -858,12 +1131,12 @@ class TestGem < Gem::TestCase
|
|
|
858
1131
|
end
|
|
859
1132
|
|
|
860
1133
|
def test_self_paths_eq_nonexistent_home
|
|
861
|
-
ENV[
|
|
1134
|
+
ENV["GEM_HOME"] = @gemhome
|
|
862
1135
|
Gem.clear_paths
|
|
863
1136
|
|
|
864
|
-
other = File.join @tempdir,
|
|
1137
|
+
other = File.join @tempdir, "other"
|
|
865
1138
|
|
|
866
|
-
ENV[
|
|
1139
|
+
ENV["HOME"] = other
|
|
867
1140
|
|
|
868
1141
|
Gem.paths = { "GEM_PATH" => other }
|
|
869
1142
|
|
|
@@ -873,7 +1146,7 @@ class TestGem < Gem::TestCase
|
|
|
873
1146
|
def test_self_post_build
|
|
874
1147
|
assert_equal 1, Gem.post_build_hooks.length
|
|
875
1148
|
|
|
876
|
-
Gem.post_build
|
|
1149
|
+
Gem.post_build {|installer| }
|
|
877
1150
|
|
|
878
1151
|
assert_equal 2, Gem.post_build_hooks.length
|
|
879
1152
|
end
|
|
@@ -881,7 +1154,7 @@ class TestGem < Gem::TestCase
|
|
|
881
1154
|
def test_self_post_install
|
|
882
1155
|
assert_equal 1, Gem.post_install_hooks.length
|
|
883
1156
|
|
|
884
|
-
Gem.post_install
|
|
1157
|
+
Gem.post_install {|installer| }
|
|
885
1158
|
|
|
886
1159
|
assert_equal 2, Gem.post_install_hooks.length
|
|
887
1160
|
end
|
|
@@ -889,7 +1162,7 @@ class TestGem < Gem::TestCase
|
|
|
889
1162
|
def test_self_done_installing
|
|
890
1163
|
assert_empty Gem.done_installing_hooks
|
|
891
1164
|
|
|
892
|
-
Gem.done_installing
|
|
1165
|
+
Gem.done_installing {|gems| }
|
|
893
1166
|
|
|
894
1167
|
assert_equal 1, Gem.done_installing_hooks.length
|
|
895
1168
|
end
|
|
@@ -897,7 +1170,7 @@ class TestGem < Gem::TestCase
|
|
|
897
1170
|
def test_self_post_reset
|
|
898
1171
|
assert_empty Gem.post_reset_hooks
|
|
899
1172
|
|
|
900
|
-
Gem.post_reset {
|
|
1173
|
+
Gem.post_reset {}
|
|
901
1174
|
|
|
902
1175
|
assert_equal 1, Gem.post_reset_hooks.length
|
|
903
1176
|
end
|
|
@@ -905,7 +1178,7 @@ class TestGem < Gem::TestCase
|
|
|
905
1178
|
def test_self_post_uninstall
|
|
906
1179
|
assert_equal 1, Gem.post_uninstall_hooks.length
|
|
907
1180
|
|
|
908
|
-
Gem.post_uninstall
|
|
1181
|
+
Gem.post_uninstall {|installer| }
|
|
909
1182
|
|
|
910
1183
|
assert_equal 2, Gem.post_uninstall_hooks.length
|
|
911
1184
|
end
|
|
@@ -913,7 +1186,7 @@ class TestGem < Gem::TestCase
|
|
|
913
1186
|
def test_self_pre_install
|
|
914
1187
|
assert_equal 1, Gem.pre_install_hooks.length
|
|
915
1188
|
|
|
916
|
-
Gem.pre_install
|
|
1189
|
+
Gem.pre_install {|installer| }
|
|
917
1190
|
|
|
918
1191
|
assert_equal 2, Gem.pre_install_hooks.length
|
|
919
1192
|
end
|
|
@@ -921,7 +1194,7 @@ class TestGem < Gem::TestCase
|
|
|
921
1194
|
def test_self_pre_reset
|
|
922
1195
|
assert_empty Gem.pre_reset_hooks
|
|
923
1196
|
|
|
924
|
-
Gem.pre_reset {
|
|
1197
|
+
Gem.pre_reset {}
|
|
925
1198
|
|
|
926
1199
|
assert_equal 1, Gem.pre_reset_hooks.length
|
|
927
1200
|
end
|
|
@@ -929,70 +1202,87 @@ class TestGem < Gem::TestCase
|
|
|
929
1202
|
def test_self_pre_uninstall
|
|
930
1203
|
assert_equal 1, Gem.pre_uninstall_hooks.length
|
|
931
1204
|
|
|
932
|
-
Gem.pre_uninstall
|
|
1205
|
+
Gem.pre_uninstall {|installer| }
|
|
933
1206
|
|
|
934
1207
|
assert_equal 2, Gem.pre_uninstall_hooks.length
|
|
935
1208
|
end
|
|
936
1209
|
|
|
937
1210
|
def test_self_sources
|
|
938
1211
|
assert_equal %w[http://gems.example.com/], Gem.sources
|
|
1212
|
+
Gem.sources = nil
|
|
1213
|
+
Gem.configuration.sources = %w[http://test.example.com/]
|
|
1214
|
+
assert_equal %w[http://test.example.com/], Gem.sources
|
|
939
1215
|
end
|
|
940
1216
|
|
|
941
1217
|
def test_try_activate_returns_true_for_activated_specs
|
|
942
|
-
b = util_spec
|
|
943
|
-
spec.files <<
|
|
1218
|
+
b = util_spec "b", "1.0" do |spec|
|
|
1219
|
+
spec.files << "lib/b.rb"
|
|
944
1220
|
end
|
|
945
1221
|
install_specs b
|
|
946
1222
|
|
|
947
|
-
assert Gem.try_activate(
|
|
948
|
-
assert Gem.try_activate(
|
|
1223
|
+
assert Gem.try_activate("b"), "try_activate should return true"
|
|
1224
|
+
assert Gem.try_activate("b"), "try_activate should still return true"
|
|
1225
|
+
end
|
|
1226
|
+
|
|
1227
|
+
def test_spec_order_is_consistent
|
|
1228
|
+
b1 = util_spec "b", "1.0"
|
|
1229
|
+
b2 = util_spec "b", "2.0"
|
|
1230
|
+
b3 = util_spec "b", "3.0"
|
|
1231
|
+
|
|
1232
|
+
install_specs b1, b2, b3
|
|
1233
|
+
|
|
1234
|
+
specs1 = Gem::Specification.stubs.find_all {|s| s.name == "b" }
|
|
1235
|
+
Gem::Specification.reset
|
|
1236
|
+
specs2 = Gem::Specification.stubs_for("b")
|
|
1237
|
+
assert_equal specs1.map(&:version), specs2.map(&:version)
|
|
949
1238
|
end
|
|
950
1239
|
|
|
951
1240
|
def test_self_try_activate_missing_dep
|
|
952
|
-
b = util_spec
|
|
953
|
-
a = util_spec
|
|
1241
|
+
b = util_spec "b", "1.0"
|
|
1242
|
+
a = util_spec "a", "1.0", "b" => ">= 1.0"
|
|
954
1243
|
|
|
955
1244
|
install_specs b, a
|
|
956
1245
|
uninstall_gem b
|
|
957
1246
|
|
|
958
|
-
a_file = File.join a.gem_dir,
|
|
1247
|
+
a_file = File.join a.gem_dir, "lib", "a_file.rb"
|
|
959
1248
|
|
|
960
1249
|
write_file a_file do |io|
|
|
961
|
-
io.puts
|
|
1250
|
+
io.puts "# a_file.rb"
|
|
962
1251
|
end
|
|
963
1252
|
|
|
964
|
-
e =
|
|
965
|
-
Gem.try_activate
|
|
1253
|
+
e = assert_raise Gem::MissingSpecError do
|
|
1254
|
+
Gem.try_activate "a_file"
|
|
966
1255
|
end
|
|
967
1256
|
|
|
968
|
-
assert_match %r
|
|
1257
|
+
assert_match %r{Could not find 'b' }, e.message
|
|
1258
|
+
assert_match %r{at: #{a.spec_file}}, e.message
|
|
969
1259
|
end
|
|
970
1260
|
|
|
971
1261
|
def test_self_try_activate_missing_prerelease
|
|
972
|
-
b = util_spec
|
|
973
|
-
a = util_spec
|
|
1262
|
+
b = util_spec "b", "1.0rc1"
|
|
1263
|
+
a = util_spec "a", "1.0rc1", "b" => "1.0rc1"
|
|
974
1264
|
|
|
975
1265
|
install_specs b, a
|
|
976
1266
|
uninstall_gem b
|
|
977
1267
|
|
|
978
|
-
a_file = File.join a.gem_dir,
|
|
1268
|
+
a_file = File.join a.gem_dir, "lib", "a_file.rb"
|
|
979
1269
|
|
|
980
1270
|
write_file a_file do |io|
|
|
981
|
-
io.puts
|
|
1271
|
+
io.puts "# a_file.rb"
|
|
982
1272
|
end
|
|
983
1273
|
|
|
984
|
-
e =
|
|
985
|
-
Gem.try_activate
|
|
1274
|
+
e = assert_raise Gem::MissingSpecError do
|
|
1275
|
+
Gem.try_activate "a_file"
|
|
986
1276
|
end
|
|
987
1277
|
|
|
988
|
-
assert_match %r
|
|
1278
|
+
assert_match %r{Could not find 'b' \(= 1.0rc1\)}, e.message
|
|
989
1279
|
end
|
|
990
1280
|
|
|
991
1281
|
def test_self_try_activate_missing_extensions
|
|
992
|
-
spec = util_spec
|
|
1282
|
+
spec = util_spec "ext", "1" do |s|
|
|
993
1283
|
s.extensions = %w[ext/extconf.rb]
|
|
994
1284
|
s.mark_version
|
|
995
|
-
s.installed_by_version = v(
|
|
1285
|
+
s.installed_by_version = v("2.2")
|
|
996
1286
|
end
|
|
997
1287
|
|
|
998
1288
|
# write the spec without install to simulate a failed install
|
|
@@ -1000,16 +1290,56 @@ class TestGem < Gem::TestCase
|
|
|
1000
1290
|
io.write spec.to_ruby_for_cache
|
|
1001
1291
|
end
|
|
1002
1292
|
|
|
1003
|
-
_, err =
|
|
1004
|
-
refute Gem.try_activate
|
|
1293
|
+
_, err = capture_output do
|
|
1294
|
+
refute Gem.try_activate "nonexistent"
|
|
1005
1295
|
end
|
|
1006
1296
|
|
|
1007
|
-
expected = "Ignoring ext-1 because its extensions are not built.
|
|
1297
|
+
expected = "Ignoring ext-1 because its extensions are not built. " +
|
|
1008
1298
|
"Try: gem pristine ext --version 1\n"
|
|
1009
1299
|
|
|
1010
1300
|
assert_equal expected, err
|
|
1011
1301
|
end
|
|
1012
1302
|
|
|
1303
|
+
def test_self_use_paths_with_nils
|
|
1304
|
+
orig_home = ENV.delete "GEM_HOME"
|
|
1305
|
+
orig_path = ENV.delete "GEM_PATH"
|
|
1306
|
+
Gem.use_paths nil, nil
|
|
1307
|
+
assert_equal Gem.default_dir, Gem.paths.home
|
|
1308
|
+
path = (Gem.default_path + [Gem.paths.home]).uniq
|
|
1309
|
+
assert_equal path, Gem.paths.path
|
|
1310
|
+
ensure
|
|
1311
|
+
ENV["GEM_HOME"] = orig_home
|
|
1312
|
+
ENV["GEM_PATH"] = orig_path
|
|
1313
|
+
end
|
|
1314
|
+
|
|
1315
|
+
def test_setting_paths_does_not_warn_about_unknown_keys
|
|
1316
|
+
stdout, stderr = capture_output do
|
|
1317
|
+
Gem.paths = { "foo" => [],
|
|
1318
|
+
"bar" => Object.new,
|
|
1319
|
+
"GEM_HOME" => Gem.paths.home,
|
|
1320
|
+
"GEM_PATH" => "foo" }
|
|
1321
|
+
end
|
|
1322
|
+
assert_equal ["foo", Gem.paths.home], Gem.paths.path
|
|
1323
|
+
assert_equal "", stderr
|
|
1324
|
+
assert_equal "", stdout
|
|
1325
|
+
end
|
|
1326
|
+
|
|
1327
|
+
def test_setting_paths_does_not_mutate_parameter_object
|
|
1328
|
+
Gem.paths = { "GEM_HOME" => Gem.paths.home,
|
|
1329
|
+
"GEM_PATH" => "foo" }.freeze
|
|
1330
|
+
assert_equal ["foo", Gem.paths.home], Gem.paths.path
|
|
1331
|
+
end
|
|
1332
|
+
|
|
1333
|
+
def test_deprecated_paths=
|
|
1334
|
+
stdout, stderr = capture_output do
|
|
1335
|
+
Gem.paths = { "GEM_HOME" => Gem.paths.home,
|
|
1336
|
+
"GEM_PATH" => [Gem.paths.home, "foo"] }
|
|
1337
|
+
end
|
|
1338
|
+
assert_equal [Gem.paths.home, "foo"], Gem.paths.path
|
|
1339
|
+
assert_match(/Array values in the parameter to `Gem.paths=` are deprecated.\nPlease use a String or nil/m, stderr)
|
|
1340
|
+
assert_equal "", stdout
|
|
1341
|
+
end
|
|
1342
|
+
|
|
1013
1343
|
def test_self_use_paths
|
|
1014
1344
|
util_ensure_gem_dirs
|
|
1015
1345
|
|
|
@@ -1020,22 +1350,23 @@ class TestGem < Gem::TestCase
|
|
|
1020
1350
|
end
|
|
1021
1351
|
|
|
1022
1352
|
def test_self_user_dir
|
|
1023
|
-
parts = [@userhome,
|
|
1024
|
-
parts << RbConfig::CONFIG[
|
|
1353
|
+
parts = [@userhome, ".gem", Gem.ruby_engine]
|
|
1354
|
+
parts << RbConfig::CONFIG["ruby_version"] unless RbConfig::CONFIG["ruby_version"].empty?
|
|
1355
|
+
|
|
1356
|
+
FileUtils.mkdir_p File.join(parts)
|
|
1025
1357
|
|
|
1026
1358
|
assert_equal File.join(parts), Gem.user_dir
|
|
1027
1359
|
end
|
|
1028
1360
|
|
|
1029
1361
|
def test_self_user_home
|
|
1030
|
-
if ENV[
|
|
1031
|
-
assert_equal ENV[
|
|
1362
|
+
if ENV["HOME"]
|
|
1363
|
+
assert_equal ENV["HOME"], Gem.user_home
|
|
1032
1364
|
else
|
|
1033
|
-
assert true,
|
|
1365
|
+
assert true, "count this test"
|
|
1034
1366
|
end
|
|
1035
1367
|
end
|
|
1036
1368
|
|
|
1037
1369
|
def test_self_needs
|
|
1038
|
-
util_clear_gems
|
|
1039
1370
|
a = util_spec "a", "1"
|
|
1040
1371
|
b = util_spec "b", "1", "c" => nil
|
|
1041
1372
|
c = util_spec "c", "2"
|
|
@@ -1047,186 +1378,179 @@ class TestGem < Gem::TestCase
|
|
|
1047
1378
|
r.gem "b", "= 1"
|
|
1048
1379
|
end
|
|
1049
1380
|
|
|
1050
|
-
activated = Gem::Specification.map {
|
|
1381
|
+
activated = Gem::Specification.map {|x| x.full_name }
|
|
1051
1382
|
|
|
1052
|
-
assert_equal %w
|
|
1383
|
+
assert_equal %w[a-1 b-1 c-2], activated.sort
|
|
1053
1384
|
end
|
|
1054
1385
|
|
|
1055
1386
|
def test_self_needs_picks_up_unresolved_deps
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
e = util_spec "e", "1"
|
|
1064
|
-
|
|
1065
|
-
install_specs a, c, b, e, d
|
|
1066
|
-
|
|
1067
|
-
Gem.needs do |r|
|
|
1068
|
-
r.gem "a"
|
|
1069
|
-
r.gem "b", "= 1"
|
|
1070
|
-
|
|
1071
|
-
require 'd'
|
|
1072
|
-
end
|
|
1387
|
+
a = util_spec "a", "1"
|
|
1388
|
+
b = util_spec "b", "1", "c" => nil
|
|
1389
|
+
c = util_spec "c", "2"
|
|
1390
|
+
d = util_spec "d", "1", { "e" => "= 1" }, "lib/d#{$$}.rb"
|
|
1391
|
+
e = util_spec "e", "1"
|
|
1392
|
+
|
|
1393
|
+
install_specs a, c, b, e, d
|
|
1073
1394
|
|
|
1074
|
-
|
|
1395
|
+
Gem.needs do |r|
|
|
1396
|
+
r.gem "a"
|
|
1397
|
+
r.gem "b", "= 1"
|
|
1398
|
+
|
|
1399
|
+
require "d#{$$}"
|
|
1075
1400
|
end
|
|
1401
|
+
|
|
1402
|
+
assert_equal %w[a-1 b-1 c-2 d-1 e-1], loaded_spec_names
|
|
1076
1403
|
end
|
|
1077
1404
|
|
|
1078
1405
|
def test_self_gunzip
|
|
1079
1406
|
input = "\x1F\x8B\b\0\xED\xA3\x1AQ\0\x03\xCBH" +
|
|
1080
1407
|
"\xCD\xC9\xC9\a\0\x86\xA6\x106\x05\0\0\0"
|
|
1081
1408
|
|
|
1082
|
-
output = Gem.gunzip input
|
|
1083
|
-
|
|
1084
|
-
assert_equal 'hello', output
|
|
1085
|
-
|
|
1086
|
-
return unless Object.const_defined? :Encoding
|
|
1409
|
+
output = Gem::Util.gunzip input
|
|
1087
1410
|
|
|
1411
|
+
assert_equal "hello", output
|
|
1088
1412
|
assert_equal Encoding::BINARY, output.encoding
|
|
1089
1413
|
end
|
|
1090
1414
|
|
|
1091
1415
|
def test_self_gzip
|
|
1092
|
-
input =
|
|
1416
|
+
input = "hello"
|
|
1093
1417
|
|
|
1094
|
-
output = Gem.gzip input
|
|
1418
|
+
output = Gem::Util.gzip input
|
|
1095
1419
|
|
|
1096
1420
|
zipped = StringIO.new output
|
|
1097
1421
|
|
|
1098
|
-
assert_equal
|
|
1099
|
-
|
|
1100
|
-
return unless Object.const_defined? :Encoding
|
|
1101
|
-
|
|
1422
|
+
assert_equal "hello", Zlib::GzipReader.new(zipped).read
|
|
1102
1423
|
assert_equal Encoding::BINARY, output.encoding
|
|
1103
1424
|
end
|
|
1104
1425
|
|
|
1105
|
-
if Gem.win_platform? && '1.9' > RUBY_VERSION
|
|
1106
|
-
# Ruby 1.9 properly handles ~ path expansion, so no need to run such tests.
|
|
1107
|
-
def test_self_user_home_userprofile
|
|
1108
|
-
|
|
1109
|
-
Gem.clear_paths
|
|
1110
|
-
|
|
1111
|
-
# safe-keep env variables
|
|
1112
|
-
orig_home, orig_user_profile = ENV['HOME'], ENV['USERPROFILE']
|
|
1113
|
-
|
|
1114
|
-
# prepare for the test
|
|
1115
|
-
ENV.delete('HOME')
|
|
1116
|
-
ENV['USERPROFILE'] = "W:\\Users\\RubyUser"
|
|
1117
|
-
|
|
1118
|
-
assert_equal 'W:/Users/RubyUser', Gem.user_home
|
|
1119
|
-
|
|
1120
|
-
ensure
|
|
1121
|
-
ENV['HOME'] = orig_home
|
|
1122
|
-
ENV['USERPROFILE'] = orig_user_profile
|
|
1123
|
-
end
|
|
1124
|
-
|
|
1125
|
-
def test_self_user_home_user_drive_and_path
|
|
1126
|
-
Gem.clear_paths
|
|
1127
|
-
|
|
1128
|
-
# safe-keep env variables
|
|
1129
|
-
orig_home, orig_user_profile = ENV['HOME'], ENV['USERPROFILE']
|
|
1130
|
-
orig_home_drive, orig_home_path = ENV['HOMEDRIVE'], ENV['HOMEPATH']
|
|
1131
|
-
|
|
1132
|
-
# prepare the environment
|
|
1133
|
-
ENV.delete('HOME')
|
|
1134
|
-
ENV.delete('USERPROFILE')
|
|
1135
|
-
ENV['HOMEDRIVE'] = 'Z:'
|
|
1136
|
-
ENV['HOMEPATH'] = "\\Users\\RubyUser"
|
|
1137
|
-
|
|
1138
|
-
assert_equal 'Z:/Users/RubyUser', Gem.user_home
|
|
1139
|
-
|
|
1140
|
-
ensure
|
|
1141
|
-
ENV['HOME'] = orig_home
|
|
1142
|
-
ENV['USERPROFILE'] = orig_user_profile
|
|
1143
|
-
ENV['HOMEDRIVE'] = orig_home_drive
|
|
1144
|
-
ENV['HOMEPATH'] = orig_home_path
|
|
1145
|
-
end
|
|
1146
|
-
end
|
|
1147
|
-
|
|
1148
1426
|
def test_self_vendor_dir
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1427
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
|
1428
|
+
expected =
|
|
1429
|
+
File.join RbConfig::CONFIG["vendordir"], "gems",
|
|
1430
|
+
RbConfig::CONFIG["ruby_version"]
|
|
1152
1431
|
|
|
1153
|
-
|
|
1432
|
+
assert_equal expected, Gem.vendor_dir
|
|
1433
|
+
end
|
|
1154
1434
|
end
|
|
1155
1435
|
|
|
1156
1436
|
def test_self_vendor_dir_ENV_GEM_VENDOR
|
|
1157
|
-
ENV[
|
|
1437
|
+
ENV["GEM_VENDOR"] = File.join @tempdir, "vendor", "gems"
|
|
1158
1438
|
|
|
1159
|
-
assert_equal ENV[
|
|
1439
|
+
assert_equal ENV["GEM_VENDOR"], Gem.vendor_dir
|
|
1160
1440
|
refute Gem.vendor_dir.frozen?
|
|
1161
1441
|
end
|
|
1162
1442
|
|
|
1163
1443
|
def test_self_vendor_dir_missing
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
assert_nil Gem.vendor_dir
|
|
1168
|
-
ensure
|
|
1169
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
|
1444
|
+
vendordir(nil) do
|
|
1445
|
+
assert_nil Gem.vendor_dir
|
|
1446
|
+
end
|
|
1170
1447
|
end
|
|
1171
1448
|
|
|
1172
1449
|
def test_load_plugins
|
|
1173
|
-
skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
|
|
1174
1450
|
plugin_path = File.join "lib", "rubygems_plugin.rb"
|
|
1175
1451
|
|
|
1452
|
+
foo1_plugin_path = nil
|
|
1453
|
+
foo2_plugin_path = nil
|
|
1176
1454
|
Dir.chdir @tempdir do
|
|
1177
|
-
FileUtils.mkdir_p
|
|
1455
|
+
FileUtils.mkdir_p "lib"
|
|
1178
1456
|
File.open plugin_path, "w" do |fp|
|
|
1179
1457
|
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
|
|
1180
1458
|
end
|
|
1181
1459
|
|
|
1182
|
-
foo1 = util_spec
|
|
1460
|
+
foo1 = util_spec "foo", "1" do |s|
|
|
1183
1461
|
s.files << plugin_path
|
|
1184
1462
|
end
|
|
1463
|
+
foo1_plugin_path = File.join(foo1.gem_dir, plugin_path)
|
|
1185
1464
|
|
|
1186
1465
|
install_gem foo1
|
|
1187
1466
|
|
|
1188
|
-
foo2 = util_spec
|
|
1467
|
+
foo2 = util_spec "foo", "2" do |s|
|
|
1189
1468
|
s.files << plugin_path
|
|
1190
1469
|
end
|
|
1470
|
+
foo2_plugin_path = File.join(foo2.gem_dir, plugin_path)
|
|
1191
1471
|
|
|
1192
1472
|
install_gem foo2
|
|
1193
1473
|
end
|
|
1194
1474
|
|
|
1195
|
-
Gem.searcher = nil
|
|
1196
1475
|
Gem::Specification.reset
|
|
1476
|
+
PLUGINS_LOADED.clear
|
|
1477
|
+
$LOADED_FEATURES.delete(foo1_plugin_path)
|
|
1478
|
+
$LOADED_FEATURES.delete(foo2_plugin_path)
|
|
1479
|
+
|
|
1480
|
+
gem "foo"
|
|
1481
|
+
|
|
1482
|
+
Gem.load_plugins
|
|
1483
|
+
|
|
1484
|
+
assert_equal %w[plugin], PLUGINS_LOADED
|
|
1485
|
+
end
|
|
1486
|
+
|
|
1487
|
+
def test_load_user_installed_plugins
|
|
1488
|
+
@orig_gem_home = ENV["GEM_HOME"]
|
|
1489
|
+
ENV["GEM_HOME"] = @gemhome
|
|
1490
|
+
|
|
1491
|
+
plugin_path = File.join "lib", "rubygems_plugin.rb"
|
|
1197
1492
|
|
|
1198
|
-
|
|
1493
|
+
Dir.chdir @tempdir do
|
|
1494
|
+
FileUtils.mkdir_p "lib"
|
|
1495
|
+
File.open plugin_path, "w" do |fp|
|
|
1496
|
+
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
|
|
1497
|
+
end
|
|
1498
|
+
|
|
1499
|
+
foo = util_spec "foo", "1" do |s|
|
|
1500
|
+
s.files << plugin_path
|
|
1501
|
+
end
|
|
1502
|
+
|
|
1503
|
+
install_gem_user foo
|
|
1504
|
+
end
|
|
1505
|
+
|
|
1506
|
+
Gem.paths = { "GEM_PATH" => [Gem.dir, Gem.user_dir].join(File::PATH_SEPARATOR) }
|
|
1507
|
+
|
|
1508
|
+
gem "foo"
|
|
1199
1509
|
|
|
1200
1510
|
Gem.load_plugins
|
|
1201
1511
|
|
|
1202
1512
|
assert_equal %w[plugin], PLUGINS_LOADED
|
|
1513
|
+
ensure
|
|
1514
|
+
ENV["GEM_HOME"] = @orig_gem_home
|
|
1203
1515
|
end
|
|
1204
1516
|
|
|
1205
1517
|
def test_load_env_plugins
|
|
1206
|
-
with_plugin(
|
|
1207
|
-
|
|
1518
|
+
with_plugin("load") { Gem.load_env_plugins }
|
|
1519
|
+
begin
|
|
1520
|
+
assert_equal :loaded, TEST_PLUGIN_LOAD
|
|
1521
|
+
rescue StandardError
|
|
1522
|
+
nil
|
|
1523
|
+
end
|
|
1208
1524
|
|
|
1209
1525
|
util_remove_interrupt_command
|
|
1210
1526
|
|
|
1211
1527
|
# Should attempt to cause a StandardError
|
|
1212
|
-
with_plugin(
|
|
1213
|
-
|
|
1528
|
+
with_plugin("standarderror") { Gem.load_env_plugins }
|
|
1529
|
+
begin
|
|
1530
|
+
assert_equal :loaded, TEST_PLUGIN_STANDARDERROR
|
|
1531
|
+
rescue StandardError
|
|
1532
|
+
nil
|
|
1533
|
+
end
|
|
1214
1534
|
|
|
1215
1535
|
util_remove_interrupt_command
|
|
1216
1536
|
|
|
1217
1537
|
# Should attempt to cause an Exception
|
|
1218
|
-
with_plugin(
|
|
1219
|
-
|
|
1538
|
+
with_plugin("exception") { Gem.load_env_plugins }
|
|
1539
|
+
begin
|
|
1540
|
+
assert_equal :loaded, TEST_PLUGIN_EXCEPTION
|
|
1541
|
+
rescue StandardError
|
|
1542
|
+
nil
|
|
1543
|
+
end
|
|
1220
1544
|
end
|
|
1221
1545
|
|
|
1222
1546
|
def test_gem_path_ordering
|
|
1223
1547
|
refute_equal Gem.dir, Gem.user_dir
|
|
1224
1548
|
|
|
1225
|
-
write_file File.join(@tempdir,
|
|
1226
|
-
write_file File.join(@tempdir,
|
|
1549
|
+
write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
|
|
1550
|
+
write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
|
|
1227
1551
|
|
|
1228
|
-
g =
|
|
1229
|
-
m =
|
|
1552
|
+
g = util_spec "g", "1", nil, "lib/g.rb"
|
|
1553
|
+
m = util_spec "m", "1", nil, "lib/m.rb"
|
|
1230
1554
|
|
|
1231
1555
|
install_gem g, :install_dir => Gem.dir
|
|
1232
1556
|
m0 = install_gem m, :install_dir => Gem.dir
|
|
@@ -1237,7 +1561,7 @@ class TestGem < Gem::TestCase
|
|
|
1237
1561
|
|
|
1238
1562
|
tests = [
|
|
1239
1563
|
[:dir0, [ Gem.dir, Gem.user_dir], m0],
|
|
1240
|
-
[:dir1, [ Gem.user_dir, Gem.dir], m1]
|
|
1564
|
+
[:dir1, [ Gem.user_dir, Gem.dir], m1],
|
|
1241
1565
|
]
|
|
1242
1566
|
|
|
1243
1567
|
tests.each do |_name, _paths, expected|
|
|
@@ -1245,15 +1569,15 @@ class TestGem < Gem::TestCase
|
|
|
1245
1569
|
Gem::Specification.reset
|
|
1246
1570
|
Gem.searcher = nil
|
|
1247
1571
|
|
|
1248
|
-
assert_equal Gem::Dependency.new(
|
|
1249
|
-
Gem::Dependency.new(
|
|
1572
|
+
assert_equal Gem::Dependency.new("m","1").to_specs,
|
|
1573
|
+
Gem::Dependency.new("m","1").to_specs.sort
|
|
1250
1574
|
|
|
1251
1575
|
assert_equal \
|
|
1252
1576
|
[expected.gem_dir],
|
|
1253
|
-
Gem::Dependency.new(
|
|
1577
|
+
Gem::Dependency.new("m","1").to_specs.map(&:gem_dir).sort,
|
|
1254
1578
|
"Wrong specs for #{_name}"
|
|
1255
1579
|
|
|
1256
|
-
spec = Gem::Dependency.new(
|
|
1580
|
+
spec = Gem::Dependency.new("m","1").to_spec
|
|
1257
1581
|
|
|
1258
1582
|
assert_equal \
|
|
1259
1583
|
File.join(_paths.first, "gems", "m-1"),
|
|
@@ -1263,7 +1587,7 @@ class TestGem < Gem::TestCase
|
|
|
1263
1587
|
|
|
1264
1588
|
gem "m"
|
|
1265
1589
|
|
|
1266
|
-
spec = Gem::Dependency.new(
|
|
1590
|
+
spec = Gem::Dependency.new("m","1").to_spec
|
|
1267
1591
|
assert spec.activated?, "dependency not activated for #{_name}"
|
|
1268
1592
|
|
|
1269
1593
|
assert_equal \
|
|
@@ -1278,11 +1602,11 @@ class TestGem < Gem::TestCase
|
|
|
1278
1602
|
end
|
|
1279
1603
|
|
|
1280
1604
|
def test_gem_path_ordering_short
|
|
1281
|
-
write_file File.join(@tempdir,
|
|
1282
|
-
write_file File.join(@tempdir,
|
|
1605
|
+
write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
|
|
1606
|
+
write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
|
|
1283
1607
|
|
|
1284
|
-
g =
|
|
1285
|
-
m =
|
|
1608
|
+
g = util_spec "g", "1", nil, "lib/g.rb"
|
|
1609
|
+
m = util_spec "m", "1", nil, "lib/m.rb"
|
|
1286
1610
|
|
|
1287
1611
|
install_gem g, :install_dir => Gem.dir
|
|
1288
1612
|
install_gem m, :install_dir => Gem.dir
|
|
@@ -1292,124 +1616,10 @@ class TestGem < Gem::TestCase
|
|
|
1292
1616
|
|
|
1293
1617
|
assert_equal \
|
|
1294
1618
|
File.join(Gem.dir, "gems", "m-1"),
|
|
1295
|
-
Gem::Dependency.new(
|
|
1619
|
+
Gem::Dependency.new("m","1").to_spec.gem_dir,
|
|
1296
1620
|
"Wrong spec selected"
|
|
1297
1621
|
end
|
|
1298
1622
|
|
|
1299
|
-
def test_auto_activation_of_specific_gemdeps_file
|
|
1300
|
-
util_clear_gems
|
|
1301
|
-
|
|
1302
|
-
a = new_spec "a", "1", nil, "lib/a.rb"
|
|
1303
|
-
b = new_spec "b", "1", nil, "lib/b.rb"
|
|
1304
|
-
c = new_spec "c", "1", nil, "lib/c.rb"
|
|
1305
|
-
|
|
1306
|
-
install_specs a, b, c
|
|
1307
|
-
|
|
1308
|
-
path = File.join @tempdir, "gem.deps.rb"
|
|
1309
|
-
|
|
1310
|
-
File.open path, "w" do |f|
|
|
1311
|
-
f.puts "gem 'a'"
|
|
1312
|
-
f.puts "gem 'b'"
|
|
1313
|
-
f.puts "gem 'c'"
|
|
1314
|
-
end
|
|
1315
|
-
|
|
1316
|
-
ENV['RUBYGEMS_GEMDEPS'] = path
|
|
1317
|
-
|
|
1318
|
-
Gem.detect_gemdeps
|
|
1319
|
-
|
|
1320
|
-
assert_equal %w!a-1 b-1 c-1!, loaded_spec_names
|
|
1321
|
-
end
|
|
1322
|
-
|
|
1323
|
-
def test_auto_activation_of_detected_gemdeps_file
|
|
1324
|
-
skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
|
|
1325
|
-
util_clear_gems
|
|
1326
|
-
|
|
1327
|
-
a = new_spec "a", "1", nil, "lib/a.rb"
|
|
1328
|
-
b = new_spec "b", "1", nil, "lib/b.rb"
|
|
1329
|
-
c = new_spec "c", "1", nil, "lib/c.rb"
|
|
1330
|
-
|
|
1331
|
-
install_specs a, b, c
|
|
1332
|
-
|
|
1333
|
-
path = File.join @tempdir, "gem.deps.rb"
|
|
1334
|
-
|
|
1335
|
-
File.open path, "w" do |f|
|
|
1336
|
-
f.puts "gem 'a'"
|
|
1337
|
-
f.puts "gem 'b'"
|
|
1338
|
-
f.puts "gem 'c'"
|
|
1339
|
-
end
|
|
1340
|
-
|
|
1341
|
-
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
|
1342
|
-
|
|
1343
|
-
assert_equal [a,b,c], Gem.detect_gemdeps.sort_by { |s| s.name }
|
|
1344
|
-
end
|
|
1345
|
-
|
|
1346
|
-
LIB_PATH = File.expand_path "../../../lib".dup.untaint, __FILE__.dup.untaint
|
|
1347
|
-
|
|
1348
|
-
def test_looks_for_gemdeps_files_automatically_on_start
|
|
1349
|
-
util_clear_gems
|
|
1350
|
-
|
|
1351
|
-
a = new_spec "a", "1", nil, "lib/a.rb"
|
|
1352
|
-
b = new_spec "b", "1", nil, "lib/b.rb"
|
|
1353
|
-
c = new_spec "c", "1", nil, "lib/c.rb"
|
|
1354
|
-
|
|
1355
|
-
install_specs a, b, c
|
|
1356
|
-
|
|
1357
|
-
path = File.join @tempdir, "gem.deps.rb"
|
|
1358
|
-
|
|
1359
|
-
File.open path, "w" do |f|
|
|
1360
|
-
f.puts "gem 'a'"
|
|
1361
|
-
f.puts "gem 'b'"
|
|
1362
|
-
f.puts "gem 'c'"
|
|
1363
|
-
end
|
|
1364
|
-
|
|
1365
|
-
path = File.join(@tempdir, "gd-tmp")
|
|
1366
|
-
install_gem a, :install_dir => path
|
|
1367
|
-
install_gem b, :install_dir => path
|
|
1368
|
-
install_gem c, :install_dir => path
|
|
1369
|
-
|
|
1370
|
-
ENV['GEM_PATH'] = path
|
|
1371
|
-
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
|
1372
|
-
|
|
1373
|
-
out = `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
|
|
1374
|
-
|
|
1375
|
-
assert_equal '["a-1", "b-1", "c-1"]', out.strip
|
|
1376
|
-
end
|
|
1377
|
-
|
|
1378
|
-
def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
|
|
1379
|
-
util_clear_gems
|
|
1380
|
-
|
|
1381
|
-
a = new_spec "a", "1", nil, "lib/a.rb"
|
|
1382
|
-
b = new_spec "b", "1", nil, "lib/b.rb"
|
|
1383
|
-
c = new_spec "c", "1", nil, "lib/c.rb"
|
|
1384
|
-
|
|
1385
|
-
install_specs a, b, c
|
|
1386
|
-
|
|
1387
|
-
path = File.join @tempdir, "gem.deps.rb"
|
|
1388
|
-
|
|
1389
|
-
File.open path, "w" do |f|
|
|
1390
|
-
f.puts "gem 'a'"
|
|
1391
|
-
f.puts "gem 'b'"
|
|
1392
|
-
f.puts "gem 'c'"
|
|
1393
|
-
end
|
|
1394
|
-
|
|
1395
|
-
path = File.join(@tempdir, "gd-tmp")
|
|
1396
|
-
install_gem a, :install_dir => path
|
|
1397
|
-
install_gem b, :install_dir => path
|
|
1398
|
-
install_gem c, :install_dir => path
|
|
1399
|
-
|
|
1400
|
-
ENV['GEM_PATH'] = path
|
|
1401
|
-
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
|
1402
|
-
|
|
1403
|
-
Dir.mkdir "sub1"
|
|
1404
|
-
out = Dir.chdir "sub1" do
|
|
1405
|
-
`#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
|
|
1406
|
-
end
|
|
1407
|
-
|
|
1408
|
-
Dir.rmdir "sub1"
|
|
1409
|
-
|
|
1410
|
-
assert_equal '["a-1", "b-1", "c-1"]', out.strip
|
|
1411
|
-
end
|
|
1412
|
-
|
|
1413
1623
|
def test_register_default_spec
|
|
1414
1624
|
Gem.clear_default_specs
|
|
1415
1625
|
|
|
@@ -1421,7 +1631,7 @@ class TestGem < Gem::TestCase
|
|
|
1421
1631
|
|
|
1422
1632
|
assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
|
|
1423
1633
|
assert_equal old_style, Gem.find_unresolved_default_spec("bar.rb")
|
|
1424
|
-
|
|
1634
|
+
assert_nil Gem.find_unresolved_default_spec("baz.rb")
|
|
1425
1635
|
|
|
1426
1636
|
Gem.clear_default_specs
|
|
1427
1637
|
|
|
@@ -1434,213 +1644,123 @@ class TestGem < Gem::TestCase
|
|
|
1434
1644
|
|
|
1435
1645
|
assert_equal new_style, Gem.find_unresolved_default_spec("foo.rb")
|
|
1436
1646
|
assert_equal new_style, Gem.find_unresolved_default_spec("bar.rb")
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
end
|
|
1440
|
-
|
|
1441
|
-
def test_default_gems_use_full_paths
|
|
1442
|
-
begin
|
|
1443
|
-
if defined?(RUBY_ENGINE) then
|
|
1444
|
-
engine = RUBY_ENGINE
|
|
1445
|
-
Object.send :remove_const, :RUBY_ENGINE
|
|
1446
|
-
end
|
|
1447
|
-
Object.const_set :RUBY_ENGINE, 'ruby'
|
|
1448
|
-
|
|
1449
|
-
refute Gem.default_gems_use_full_paths?
|
|
1450
|
-
ensure
|
|
1451
|
-
Object.send :remove_const, :RUBY_ENGINE
|
|
1452
|
-
Object.const_set :RUBY_ENGINE, engine if engine
|
|
1453
|
-
end
|
|
1454
|
-
|
|
1455
|
-
begin
|
|
1456
|
-
if defined?(RUBY_ENGINE) then
|
|
1457
|
-
engine = RUBY_ENGINE
|
|
1458
|
-
Object.send :remove_const, :RUBY_ENGINE
|
|
1459
|
-
end
|
|
1460
|
-
Object.const_set :RUBY_ENGINE, 'jruby'
|
|
1461
|
-
assert Gem.default_gems_use_full_paths?
|
|
1462
|
-
ensure
|
|
1463
|
-
Object.send :remove_const, :RUBY_ENGINE
|
|
1464
|
-
Object.const_set :RUBY_ENGINE, engine if engine
|
|
1465
|
-
end
|
|
1647
|
+
assert_nil Gem.find_unresolved_default_spec("exec")
|
|
1648
|
+
assert_nil Gem.find_unresolved_default_spec("README")
|
|
1466
1649
|
end
|
|
1467
1650
|
|
|
1468
|
-
def
|
|
1469
|
-
|
|
1470
|
-
spec = util_spec 'a', 1
|
|
1471
|
-
install_specs spec
|
|
1472
|
-
|
|
1473
|
-
spec = Gem::Specification.find { |s| s == spec }
|
|
1474
|
-
refute spec.activated?
|
|
1651
|
+
def test_register_default_spec_old_style_with_folder_starting_with_lib
|
|
1652
|
+
Gem.clear_default_specs
|
|
1475
1653
|
|
|
1476
|
-
|
|
1477
|
-
|
|
1654
|
+
old_style = Gem::Specification.new do |spec|
|
|
1655
|
+
spec.files = ["libexec/bundle", "foo.rb", "bar.rb"]
|
|
1478
1656
|
end
|
|
1479
1657
|
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
Gem.use_gemdeps gem_deps_file
|
|
1658
|
+
Gem.register_default_spec old_style
|
|
1483
1659
|
|
|
1484
|
-
|
|
1485
|
-
refute_nil Gem.gemdeps
|
|
1660
|
+
assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
|
|
1486
1661
|
end
|
|
1487
1662
|
|
|
1488
|
-
def
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
spec = util_spec 'a', 1
|
|
1492
|
-
|
|
1493
|
-
refute spec.activated?
|
|
1494
|
-
|
|
1495
|
-
open 'gem.deps.rb', 'w' do |io|
|
|
1496
|
-
io.write 'gem "a"'
|
|
1497
|
-
end
|
|
1498
|
-
|
|
1499
|
-
Gem.use_gemdeps
|
|
1663
|
+
def test_operating_system_defaults
|
|
1664
|
+
operating_system_defaults = Gem.operating_system_defaults
|
|
1500
1665
|
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
|
1666
|
+
assert operating_system_defaults != nil
|
|
1667
|
+
assert operating_system_defaults.is_a? Hash
|
|
1504
1668
|
end
|
|
1505
1669
|
|
|
1506
|
-
def
|
|
1507
|
-
|
|
1508
|
-
Gem.use_gemdeps 'gem.deps.rb'
|
|
1509
|
-
end
|
|
1670
|
+
def test_platform_defaults
|
|
1671
|
+
platform_defaults = Gem.platform_defaults
|
|
1510
1672
|
|
|
1511
|
-
|
|
1512
|
-
|
|
1673
|
+
assert platform_defaults != nil
|
|
1674
|
+
assert platform_defaults.is_a? Hash
|
|
1513
1675
|
end
|
|
1514
1676
|
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1677
|
+
# Ensure that `Gem.source_date_epoch` is consistent even if
|
|
1678
|
+
# $SOURCE_DATE_EPOCH has not been set.
|
|
1679
|
+
def test_default_source_date_epoch_doesnt_change
|
|
1680
|
+
old_epoch = ENV["SOURCE_DATE_EPOCH"]
|
|
1681
|
+
ENV["SOURCE_DATE_EPOCH"] = nil
|
|
1518
1682
|
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1683
|
+
# Unfortunately, there is no real way to test this aside from waiting
|
|
1684
|
+
# enough for `Time.now.to_i` to change -- which is a whole second.
|
|
1685
|
+
#
|
|
1686
|
+
# Fortunately, we only need to do this once.
|
|
1687
|
+
a = Gem.source_date_epoch
|
|
1688
|
+
sleep 1
|
|
1689
|
+
b = Gem.source_date_epoch
|
|
1690
|
+
assert_equal a, b
|
|
1525
1691
|
ensure
|
|
1526
|
-
ENV[
|
|
1692
|
+
ENV["SOURCE_DATE_EPOCH"] = old_epoch
|
|
1527
1693
|
end
|
|
1528
1694
|
|
|
1529
|
-
def
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
spec = util_spec 'a', 1
|
|
1534
|
-
install_specs spec
|
|
1535
|
-
spec = Gem::Specification.find { |s| s == spec }
|
|
1536
|
-
|
|
1537
|
-
refute spec.activated?
|
|
1538
|
-
|
|
1539
|
-
open 'Gemfile', 'w' do |io|
|
|
1540
|
-
io.write 'gem "a"'
|
|
1541
|
-
end
|
|
1542
|
-
|
|
1543
|
-
Gem.use_gemdeps
|
|
1544
|
-
|
|
1545
|
-
assert spec.activated?
|
|
1546
|
-
ensure
|
|
1547
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
|
1695
|
+
def test_data_home_default
|
|
1696
|
+
expected = File.join(@userhome, ".local", "share")
|
|
1697
|
+
assert_equal expected, Gem.data_home
|
|
1548
1698
|
end
|
|
1549
1699
|
|
|
1550
|
-
def
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
Gem.use_gemdeps
|
|
1555
|
-
|
|
1556
|
-
assert true # count
|
|
1557
|
-
ensure
|
|
1558
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
|
1700
|
+
def test_data_home_from_env
|
|
1701
|
+
ENV["XDG_DATA_HOME"] = expected = "/test/data/home"
|
|
1702
|
+
assert_equal expected, Gem.data_home
|
|
1559
1703
|
end
|
|
1560
1704
|
|
|
1561
|
-
def
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
refute spec.activated?
|
|
1567
|
-
|
|
1568
|
-
open 'gem.deps.rb', 'w' do |io|
|
|
1569
|
-
io.write 'gem "a"'
|
|
1570
|
-
end
|
|
1571
|
-
|
|
1572
|
-
Gem.use_gemdeps
|
|
1573
|
-
|
|
1574
|
-
refute spec.activated?
|
|
1575
|
-
ensure
|
|
1576
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
|
1705
|
+
def test_state_home_default
|
|
1706
|
+
Gem.instance_variable_set :@state_home, nil
|
|
1707
|
+
Gem.data_home # memoize @data_home, to demonstrate GH-6418
|
|
1708
|
+
expected = File.join(@userhome, ".local", "state")
|
|
1709
|
+
assert_equal expected, Gem.state_home
|
|
1577
1710
|
end
|
|
1578
1711
|
|
|
1579
|
-
def
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
end
|
|
1712
|
+
def test_state_home_from_env
|
|
1713
|
+
Gem.instance_variable_set :@state_home, nil
|
|
1714
|
+
Gem.data_home # memoize @data_home, to demonstrate GH-6418
|
|
1715
|
+
ENV["XDG_STATE_HOME"] = expected = "/test/state/home"
|
|
1716
|
+
assert_equal expected, Gem.state_home
|
|
1717
|
+
end
|
|
1586
1718
|
|
|
1587
|
-
|
|
1588
|
-
Unable to resolve dependency: user requested 'a (>= 0)'
|
|
1589
|
-
You may need to `gem install -g` to install missing gems
|
|
1719
|
+
private
|
|
1590
1720
|
|
|
1591
|
-
|
|
1721
|
+
def ruby_install_name(name)
|
|
1722
|
+
with_clean_path_to_ruby do
|
|
1723
|
+
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG["ruby_install_name"]
|
|
1724
|
+
RbConfig::CONFIG["ruby_install_name"] = name
|
|
1592
1725
|
|
|
1593
|
-
|
|
1594
|
-
|
|
1726
|
+
begin
|
|
1727
|
+
yield
|
|
1728
|
+
ensure
|
|
1729
|
+
if orig_RUBY_INSTALL_NAME
|
|
1730
|
+
RbConfig::CONFIG["ruby_install_name"] = orig_RUBY_INSTALL_NAME
|
|
1731
|
+
else
|
|
1732
|
+
RbConfig::CONFIG.delete "ruby_install_name"
|
|
1733
|
+
end
|
|
1734
|
+
end
|
|
1595
1735
|
end
|
|
1596
|
-
ensure
|
|
1597
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
|
1598
1736
|
end
|
|
1599
1737
|
|
|
1600
|
-
def
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
spec = util_spec 'a', 1
|
|
1605
|
-
install_specs spec
|
|
1606
|
-
|
|
1607
|
-
spec = Gem::Specification.find { |s| s == spec }
|
|
1608
|
-
refute spec.activated?
|
|
1609
|
-
|
|
1610
|
-
open 'x', 'w' do |io|
|
|
1611
|
-
io.write 'gem "a"'
|
|
1612
|
-
end
|
|
1738
|
+
def with_rb_config_ruby(path)
|
|
1739
|
+
rb_config_singleton_class = class << RbConfig; self; end
|
|
1740
|
+
orig_path = RbConfig.ruby
|
|
1613
1741
|
|
|
1614
|
-
|
|
1742
|
+
redefine_method(rb_config_singleton_class, :ruby, path)
|
|
1615
1743
|
|
|
1616
|
-
|
|
1744
|
+
yield
|
|
1617
1745
|
ensure
|
|
1618
|
-
|
|
1746
|
+
redefine_method(rb_config_singleton_class, :ruby, orig_path)
|
|
1619
1747
|
end
|
|
1620
1748
|
|
|
1621
|
-
def
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
yield
|
|
1626
|
-
ensure
|
|
1627
|
-
if orig_RUBY_INSTALL_NAME then
|
|
1628
|
-
RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
|
|
1629
|
-
else
|
|
1630
|
-
RbConfig::CONFIG.delete 'ruby_install_name'
|
|
1631
|
-
end
|
|
1749
|
+
def redefine_method(base, method, new_result)
|
|
1750
|
+
base.alias_method(method, method)
|
|
1751
|
+
base.define_method(method) { new_result }
|
|
1632
1752
|
end
|
|
1633
1753
|
|
|
1634
1754
|
def with_plugin(path)
|
|
1635
1755
|
test_plugin_path = File.expand_path("test/rubygems/plugin/#{path}",
|
|
1636
|
-
|
|
1756
|
+
PROJECT_DIR)
|
|
1637
1757
|
|
|
1638
1758
|
# A single test plugin should get loaded once only, in order to preserve
|
|
1639
1759
|
# sane test semantics.
|
|
1640
1760
|
refute_includes $LOAD_PATH, test_plugin_path
|
|
1641
1761
|
$LOAD_PATH.unshift test_plugin_path
|
|
1642
1762
|
|
|
1643
|
-
|
|
1763
|
+
capture_output do
|
|
1644
1764
|
yield
|
|
1645
1765
|
end
|
|
1646
1766
|
ensure
|
|
@@ -1659,12 +1779,12 @@ You may need to `gem install -g` to install missing gems
|
|
|
1659
1779
|
end
|
|
1660
1780
|
|
|
1661
1781
|
def util_exec_gem
|
|
1662
|
-
spec, _ = util_spec
|
|
1663
|
-
s.executables = [
|
|
1782
|
+
spec, _ = util_spec "a", "4" do |s|
|
|
1783
|
+
s.executables = ["exec", "abin"]
|
|
1664
1784
|
end
|
|
1665
1785
|
|
|
1666
|
-
@exec_path = File.join spec.full_gem_path, spec.bindir,
|
|
1667
|
-
@abin_path = File.join spec.full_gem_path, spec.bindir,
|
|
1786
|
+
@exec_path = File.join spec.full_gem_path, spec.bindir, "exec"
|
|
1787
|
+
@abin_path = File.join spec.full_gem_path, spec.bindir, "abin"
|
|
1668
1788
|
spec
|
|
1669
1789
|
end
|
|
1670
1790
|
|