rubygems-update 2.6.0 → 3.4.22
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,89 +1,79 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# TODO: $SAFE = 1
|
3
2
|
|
4
|
-
|
5
|
-
gem 'minitest', '~> 4.0'
|
6
|
-
rescue NoMethodError, Gem::LoadError
|
7
|
-
# for ruby tests
|
8
|
-
end
|
9
|
-
|
10
|
-
if defined? Gem::QuickLoader
|
11
|
-
Gem::QuickLoader.load_full_rubygems_library
|
12
|
-
else
|
13
|
-
require 'rubygems'
|
14
|
-
end
|
3
|
+
require "rubygems"
|
15
4
|
|
16
5
|
begin
|
17
|
-
gem
|
6
|
+
gem "test-unit", "~> 3.0"
|
18
7
|
rescue Gem::LoadError
|
19
8
|
end
|
20
9
|
|
21
|
-
|
22
|
-
# them while we're testing rubygems, and thus we can't actually load them.
|
23
|
-
unless Gem::Dependency.new('rdoc', '>= 3.10').matching_specs.empty?
|
24
|
-
gem 'rdoc'
|
25
|
-
gem 'json'
|
26
|
-
end
|
10
|
+
require "test/unit"
|
27
11
|
|
28
|
-
|
12
|
+
ENV["JARS_SKIP"] = "true" if Gem.java_platform? # avoid unnecessary and noisy `jar-dependencies` post install hook
|
29
13
|
|
30
|
-
require
|
14
|
+
require "rubygems/deprecate"
|
31
15
|
|
32
|
-
require
|
33
|
-
require
|
34
|
-
require
|
35
|
-
require
|
36
|
-
require
|
37
|
-
require
|
38
|
-
require
|
39
|
-
require
|
40
|
-
require
|
41
|
-
require
|
16
|
+
require "fileutils"
|
17
|
+
require "pathname"
|
18
|
+
require "pp"
|
19
|
+
require "rubygems/package"
|
20
|
+
require "shellwords"
|
21
|
+
require "tmpdir"
|
22
|
+
require "uri"
|
23
|
+
require "zlib"
|
24
|
+
require "benchmark" # stdlib
|
25
|
+
require "rubygems/mock_gem_ui"
|
42
26
|
|
43
27
|
module Gem
|
44
28
|
|
45
29
|
##
|
46
|
-
# Allows setting the gem path searcher.
|
47
|
-
# requiring 'rubygems/test_case'
|
30
|
+
# Allows setting the gem path searcher.
|
48
31
|
|
49
32
|
def self.searcher=(searcher)
|
50
33
|
@searcher = searcher
|
51
34
|
end
|
52
35
|
|
53
36
|
##
|
54
|
-
# Allows toggling Windows behavior.
|
55
|
-
# 'rubygems/test_case'
|
37
|
+
# Allows toggling Windows behavior.
|
56
38
|
|
57
39
|
def self.win_platform=(val)
|
58
40
|
@@win_platform = val
|
59
41
|
end
|
60
42
|
|
61
43
|
##
|
62
|
-
# Allows setting path to Ruby.
|
63
|
-
# 'rubygems/test_case'
|
44
|
+
# Allows setting path to Ruby.
|
64
45
|
|
65
|
-
def self.ruby=
|
46
|
+
def self.ruby=(ruby)
|
66
47
|
@ruby = ruby
|
67
48
|
end
|
68
49
|
|
69
50
|
##
|
70
|
-
#
|
71
|
-
# MockGemUi.
|
51
|
+
# Sets the default user interaction to a MockGemUi.
|
72
52
|
|
73
53
|
module DefaultUserInteraction
|
74
54
|
@ui = Gem::MockGemUi.new
|
75
55
|
end
|
76
56
|
end
|
77
57
|
|
58
|
+
require "rubygems/command"
|
59
|
+
|
60
|
+
class Gem::Command
|
61
|
+
##
|
62
|
+
# Allows resetting the hash of specific args per command.
|
63
|
+
|
64
|
+
def self.specific_extra_args_hash=(value)
|
65
|
+
@specific_extra_args_hash = value
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
78
69
|
##
|
79
70
|
# RubyGemTestCase provides a variety of methods for testing rubygems and
|
80
71
|
# gem-related behavior in a sandbox. Through RubyGemTestCase you can install
|
81
72
|
# and uninstall gems, fetch remote gems through a stub fetcher and be assured
|
82
73
|
# your normal set of gems is not affected.
|
83
|
-
#
|
84
|
-
# Tests are always run at a safe level of 1.
|
85
74
|
|
86
|
-
class Gem::TestCase <
|
75
|
+
class Gem::TestCase < Test::Unit::TestCase
|
76
|
+
extend Gem::Deprecate
|
87
77
|
|
88
78
|
attr_accessor :fetcher # :nodoc:
|
89
79
|
|
@@ -91,7 +81,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
91
81
|
|
92
82
|
attr_accessor :uri # :nodoc:
|
93
83
|
|
94
|
-
def assert_activate
|
84
|
+
def assert_activate(expected, *specs)
|
95
85
|
specs.each do |spec|
|
96
86
|
case spec
|
97
87
|
when String then
|
@@ -108,85 +98,183 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
108
98
|
assert_equal expected.sort, loaded.sort if expected
|
109
99
|
end
|
110
100
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
assert File.
|
101
|
+
def assert_directory_exists(path, msg = nil)
|
102
|
+
msg = build_message(msg, "Expected path '#{path}' to be a directory")
|
103
|
+
assert_path_exist path
|
104
|
+
assert File.directory?(path), msg
|
105
|
+
end
|
106
|
+
|
107
|
+
def refute_directory_exists(path, msg = nil)
|
108
|
+
msg = build_message(msg, "Expected path '#{path}' not to be a directory")
|
109
|
+
assert_path_not_exist path
|
110
|
+
refute File.directory?(path), msg
|
111
|
+
end
|
112
|
+
|
113
|
+
# https://github.com/seattlerb/minitest/blob/21d9e804b63c619f602f3f4ece6c71b48974707a/lib/minitest/assertions.rb#L188
|
114
|
+
def _synchronize
|
115
|
+
yield
|
116
|
+
end
|
117
|
+
|
118
|
+
# https://github.com/seattlerb/minitest/blob/21d9e804b63c619f602f3f4ece6c71b48974707a/lib/minitest/assertions.rb#L546
|
119
|
+
def capture_subprocess_io
|
120
|
+
_synchronize do
|
121
|
+
require "tempfile"
|
122
|
+
|
123
|
+
captured_stdout = Tempfile.new("out")
|
124
|
+
captured_stderr = Tempfile.new("err")
|
125
|
+
|
126
|
+
orig_stdout = $stdout.dup
|
127
|
+
orig_stderr = $stderr.dup
|
128
|
+
$stdout.reopen captured_stdout
|
129
|
+
$stderr.reopen captured_stderr
|
130
|
+
|
131
|
+
yield
|
132
|
+
|
133
|
+
$stdout.rewind
|
134
|
+
$stderr.rewind
|
135
|
+
|
136
|
+
return captured_stdout.read, captured_stderr.read
|
137
|
+
ensure
|
138
|
+
$stdout.reopen orig_stdout
|
139
|
+
$stderr.reopen orig_stderr
|
140
|
+
|
141
|
+
orig_stdout.close
|
142
|
+
orig_stderr.close
|
143
|
+
captured_stdout.close!
|
144
|
+
captured_stderr.close!
|
145
|
+
end
|
115
146
|
end
|
116
147
|
|
117
148
|
##
|
118
149
|
# Sets the ENABLE_SHARED entry in RbConfig::CONFIG to +value+ and restores
|
119
150
|
# the original value when the block ends
|
120
151
|
|
121
|
-
def enable_shared
|
122
|
-
enable_shared = RbConfig::CONFIG[
|
123
|
-
RbConfig::CONFIG[
|
152
|
+
def enable_shared(value)
|
153
|
+
enable_shared = RbConfig::CONFIG["ENABLE_SHARED"]
|
154
|
+
RbConfig::CONFIG["ENABLE_SHARED"] = value
|
124
155
|
|
125
156
|
yield
|
126
157
|
ensure
|
127
|
-
if enable_shared
|
128
|
-
RbConfig::CONFIG[
|
158
|
+
if enable_shared
|
159
|
+
RbConfig::CONFIG["ENABLE_SHARED"] = enable_shared
|
129
160
|
else
|
130
|
-
RbConfig::CONFIG.delete
|
161
|
+
RbConfig::CONFIG.delete "ENABLE_SHARED"
|
131
162
|
end
|
132
163
|
end
|
133
164
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
165
|
+
##
|
166
|
+
# Sets the vendordir entry in RbConfig::CONFIG to +value+ and restores the
|
167
|
+
# original value when the block ends
|
168
|
+
#
|
169
|
+
def vendordir(value)
|
170
|
+
vendordir = RbConfig::CONFIG["vendordir"]
|
171
|
+
|
172
|
+
if value
|
173
|
+
RbConfig::CONFIG["vendordir"] = value
|
174
|
+
else
|
175
|
+
RbConfig::CONFIG.delete "vendordir"
|
176
|
+
end
|
177
|
+
|
178
|
+
yield
|
179
|
+
ensure
|
180
|
+
if vendordir
|
181
|
+
RbConfig::CONFIG["vendordir"] = vendordir
|
182
|
+
else
|
183
|
+
RbConfig::CONFIG.delete "vendordir"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
##
|
188
|
+
# Sets the bindir entry in RbConfig::CONFIG to +value+ and restores the
|
189
|
+
# original value when the block ends
|
190
|
+
#
|
191
|
+
def bindir(value)
|
192
|
+
with_clean_path_to_ruby do
|
193
|
+
bindir = RbConfig::CONFIG["bindir"]
|
194
|
+
|
195
|
+
if value
|
196
|
+
RbConfig::CONFIG["bindir"] = value
|
197
|
+
else
|
198
|
+
RbConfig::CONFIG.delete "bindir"
|
199
|
+
end
|
200
|
+
|
201
|
+
begin
|
202
|
+
yield
|
203
|
+
ensure
|
204
|
+
if bindir
|
205
|
+
RbConfig::CONFIG["bindir"] = bindir
|
206
|
+
else
|
207
|
+
RbConfig::CONFIG.delete "bindir"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
##
|
214
|
+
# Sets the EXEEXT entry in RbConfig::CONFIG to +value+ and restores the
|
215
|
+
# original value when the block ends
|
216
|
+
#
|
217
|
+
def exeext(value)
|
218
|
+
exeext = RbConfig::CONFIG["EXEEXT"]
|
219
|
+
|
220
|
+
if value
|
221
|
+
RbConfig::CONFIG["EXEEXT"] = value
|
222
|
+
else
|
223
|
+
RbConfig::CONFIG.delete "EXEEXT"
|
224
|
+
end
|
225
|
+
|
226
|
+
yield
|
227
|
+
ensure
|
228
|
+
if exeext
|
229
|
+
RbConfig::CONFIG["EXEEXT"] = exeext
|
230
|
+
else
|
231
|
+
RbConfig::CONFIG.delete "EXEEXT"
|
232
|
+
end
|
138
233
|
end
|
139
234
|
|
140
235
|
def scan_make_command_lines(output)
|
141
236
|
output.scan(/^#{Regexp.escape make_command}(?:[[:blank:]].*)?$/)
|
142
237
|
end
|
143
238
|
|
144
|
-
def
|
145
|
-
|
239
|
+
def parse_make_command_line_targets(line)
|
240
|
+
args = line.sub(/^#{Regexp.escape make_command}/, "").shellsplit
|
146
241
|
|
147
242
|
targets = []
|
148
|
-
macros = {}
|
149
243
|
|
150
244
|
args.each do |arg|
|
151
245
|
case arg
|
152
246
|
when /\A(\w+)=/
|
153
|
-
macros[$1] = $'
|
154
247
|
else
|
155
248
|
targets << arg
|
156
249
|
end
|
157
250
|
end
|
158
251
|
|
159
|
-
targets <<
|
252
|
+
targets << "" if targets.empty?
|
160
253
|
|
161
|
-
|
162
|
-
:command => command,
|
163
|
-
:targets => targets,
|
164
|
-
:macros => macros,
|
165
|
-
}
|
254
|
+
targets
|
166
255
|
end
|
167
256
|
|
168
257
|
def assert_contains_make_command(target, output, msg = nil)
|
169
|
-
if output.
|
170
|
-
msg =
|
171
|
-
|
172
|
-
(
|
173
|
-
output
|
258
|
+
if output.include?("\n")
|
259
|
+
msg = build_message(msg,
|
260
|
+
"Expected output containing make command \"%s\", but was \n\nBEGIN_OF_OUTPUT\n%sEND_OF_OUTPUT" % [
|
261
|
+
("%s %s" % [make_command, target]).rstrip,
|
262
|
+
output,
|
174
263
|
]
|
175
|
-
|
264
|
+
)
|
176
265
|
else
|
177
|
-
msg =
|
178
|
-
'Expected make command "%s"
|
179
|
-
(
|
180
|
-
output
|
266
|
+
msg = build_message(msg,
|
267
|
+
'Expected make command "%s", but was "%s"' % [
|
268
|
+
("%s %s" % [make_command, target]).rstrip,
|
269
|
+
output,
|
181
270
|
]
|
182
|
-
|
271
|
+
)
|
183
272
|
end
|
184
273
|
|
185
|
-
assert scan_make_command_lines(output).any? {
|
186
|
-
|
274
|
+
assert scan_make_command_lines(output).any? {|line|
|
275
|
+
targets = parse_make_command_line_targets(line)
|
187
276
|
|
188
|
-
if
|
189
|
-
yield make, line if block_given?
|
277
|
+
if targets.include?(target)
|
190
278
|
true
|
191
279
|
else
|
192
280
|
false
|
@@ -196,13 +284,6 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
196
284
|
|
197
285
|
include Gem::DefaultUserInteraction
|
198
286
|
|
199
|
-
undef_method :default_test if instance_methods.include? 'default_test' or
|
200
|
-
instance_methods.include? :default_test
|
201
|
-
|
202
|
-
@@project_dir = Dir.pwd.untaint unless defined?(@@project_dir)
|
203
|
-
|
204
|
-
@@initial_reset = false
|
205
|
-
|
206
287
|
##
|
207
288
|
# #setup prepares a sandboxed location to install gems. All installs are
|
208
289
|
# directed to a temporary directory. All install plugins are removed.
|
@@ -210,103 +291,117 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
210
291
|
# If the +RUBY+ environment variable is set the given path is used for
|
211
292
|
# Gem::ruby. The local platform is set to <tt>i386-mswin32</tt> for Windows
|
212
293
|
# or <tt>i686-darwin8.10.1</tt> otherwise.
|
213
|
-
#
|
214
|
-
# If the +KEEP_FILES+ environment variable is set the files will not be
|
215
|
-
# removed from <tt>/tmp/test_rubygems_#{$$}.#{Time.now.to_i}</tt>.
|
216
294
|
|
217
295
|
def setup
|
218
|
-
|
296
|
+
@orig_hooks = {}
|
297
|
+
@orig_env = ENV.to_hash
|
298
|
+
@tmp = File.expand_path("tmp")
|
299
|
+
|
300
|
+
FileUtils.mkdir_p @tmp
|
219
301
|
|
220
|
-
@
|
221
|
-
@
|
222
|
-
@orig_gem_vendor = ENV['GEM_VENDOR']
|
223
|
-
@orig_gem_spec_cache = ENV['GEM_SPEC_CACHE']
|
224
|
-
@orig_rubygems_gemdeps = ENV['RUBYGEMS_GEMDEPS']
|
225
|
-
@orig_rubygems_host = ENV['RUBYGEMS_HOST']
|
302
|
+
@tempdir = Dir.mktmpdir("test_rubygems_", @tmp)
|
303
|
+
@tempdir.tap(&Gem::UNTAINT)
|
226
304
|
|
227
|
-
ENV[
|
305
|
+
ENV["GEM_VENDOR"] = nil
|
306
|
+
ENV["GEMRC"] = nil
|
307
|
+
ENV["XDG_CACHE_HOME"] = nil
|
308
|
+
ENV["XDG_CONFIG_HOME"] = nil
|
309
|
+
ENV["XDG_DATA_HOME"] = nil
|
310
|
+
ENV["XDG_STATE_HOME"] = nil
|
311
|
+
ENV["SOURCE_DATE_EPOCH"] = nil
|
312
|
+
ENV["BUNDLER_VERSION"] = nil
|
313
|
+
ENV["RUBYGEMS_PREVENT_UPDATE_SUGGESTION"] = "true"
|
228
314
|
|
229
315
|
@current_dir = Dir.pwd
|
230
316
|
@fetcher = nil
|
231
|
-
@ui = Gem::MockGemUi.new
|
232
|
-
|
233
|
-
tmpdir = File.expand_path Dir.tmpdir
|
234
|
-
tmpdir.untaint
|
235
|
-
|
236
|
-
if ENV['KEEP_FILES'] then
|
237
|
-
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}.#{Time.now.to_i}")
|
238
|
-
else
|
239
|
-
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}")
|
240
|
-
end
|
241
|
-
@tempdir.untaint
|
242
317
|
|
243
|
-
|
244
|
-
|
245
|
-
# This
|
246
|
-
#
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
318
|
+
@back_ui = Gem::DefaultUserInteraction.ui
|
319
|
+
@ui = Gem::MockGemUi.new
|
320
|
+
# This needs to be a new instance since we call use_ui(@ui) when we want to
|
321
|
+
# capture output
|
322
|
+
Gem::DefaultUserInteraction.ui = Gem::MockGemUi.new
|
323
|
+
|
324
|
+
@orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
|
325
|
+
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
|
326
|
+
Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
|
327
|
+
File.join(@tempdir, "system-gemrc")
|
328
|
+
|
329
|
+
@gemhome = File.join @tempdir, "gemhome"
|
330
|
+
@userhome = File.join @tempdir, "userhome"
|
331
|
+
@statehome = File.join @tempdir, "statehome"
|
332
|
+
ENV["GEM_SPEC_CACHE"] = File.join @tempdir, "spec_cache"
|
333
|
+
|
334
|
+
@orig_ruby = if ENV["RUBY"]
|
335
|
+
ruby = Gem.ruby
|
336
|
+
Gem.ruby = ENV["RUBY"]
|
337
|
+
ruby
|
253
338
|
end
|
254
339
|
|
255
|
-
@
|
256
|
-
@userhome = File.join @tempdir, 'userhome'
|
257
|
-
ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'
|
258
|
-
|
259
|
-
@orig_ruby = if ENV['RUBY'] then
|
260
|
-
ruby = Gem.ruby
|
261
|
-
Gem.ruby = ENV['RUBY']
|
262
|
-
ruby
|
263
|
-
end
|
264
|
-
|
265
|
-
@git = ENV['GIT'] || 'git'
|
340
|
+
@git = ENV["GIT"] || "git#{RbConfig::CONFIG["EXEEXT"]}"
|
266
341
|
|
267
342
|
Gem.ensure_gem_subdirectories @gemhome
|
343
|
+
Gem.ensure_default_gem_subdirectories @gemhome
|
268
344
|
|
269
345
|
@orig_LOAD_PATH = $LOAD_PATH.dup
|
270
|
-
$LOAD_PATH.map!
|
271
|
-
|
272
|
-
|
346
|
+
$LOAD_PATH.map! do |s|
|
347
|
+
expand_path = begin
|
348
|
+
File.realpath(s)
|
349
|
+
rescue StandardError
|
350
|
+
File.expand_path(s)
|
351
|
+
end
|
352
|
+
if expand_path != s
|
353
|
+
expand_path.tap(&Gem::UNTAINT)
|
354
|
+
if s.instance_variable_defined?(:@gem_prelude_index)
|
355
|
+
expand_path.instance_variable_set(:@gem_prelude_index, expand_path)
|
356
|
+
end
|
357
|
+
expand_path.freeze if s.frozen?
|
358
|
+
s = expand_path
|
359
|
+
end
|
360
|
+
s
|
361
|
+
end
|
273
362
|
|
274
363
|
Dir.chdir @tempdir
|
275
364
|
|
276
|
-
|
277
|
-
|
365
|
+
ENV["HOME"] = @userhome
|
366
|
+
Gem.instance_variable_set :@config_file, nil
|
278
367
|
Gem.instance_variable_set :@user_home, nil
|
368
|
+
Gem.instance_variable_set :@config_home, nil
|
369
|
+
Gem.instance_variable_set :@data_home, nil
|
370
|
+
Gem.instance_variable_set :@state_home, @statehome
|
279
371
|
Gem.instance_variable_set :@gemdeps, nil
|
372
|
+
Gem.instance_variable_set :@env_requirements_by_name, nil
|
280
373
|
Gem.send :remove_instance_variable, :@ruby_version if
|
281
374
|
Gem.instance_variables.include? :@ruby_version
|
282
375
|
|
283
|
-
FileUtils.mkdir_p @gemhome
|
284
376
|
FileUtils.mkdir_p @userhome
|
285
377
|
|
286
|
-
|
287
|
-
ENV['GEM_PRIVATE_KEY_PASSPHRASE'] = PRIVATE_KEY_PASSPHRASE
|
288
|
-
|
289
|
-
@default_dir = File.join @tempdir, 'default'
|
290
|
-
@default_spec_dir = File.join @default_dir, "specifications", "default"
|
291
|
-
Gem.instance_variable_set :@default_dir, @default_dir
|
292
|
-
FileUtils.mkdir_p @default_spec_dir
|
378
|
+
ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = PRIVATE_KEY_PASSPHRASE
|
293
379
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
Gem::Specification.unresolved_deps.clear # done to avoid cross-test warnings
|
380
|
+
Gem.instance_variable_set(:@default_specifications_dir, nil)
|
381
|
+
if Gem.java_platform?
|
382
|
+
@orig_default_gem_home = RbConfig::CONFIG["default_gem_home"]
|
383
|
+
RbConfig::CONFIG["default_gem_home"] = @gemhome
|
299
384
|
else
|
300
|
-
|
301
|
-
Gem::Specification.reset
|
385
|
+
Gem.instance_variable_set(:@default_dir, @gemhome)
|
302
386
|
end
|
303
|
-
Gem.use_paths(@gemhome)
|
304
387
|
|
305
|
-
|
388
|
+
@orig_bindir = RbConfig::CONFIG["bindir"]
|
389
|
+
RbConfig::CONFIG["bindir"] = File.join @gemhome, "bin"
|
390
|
+
|
391
|
+
@orig_sitelibdir = RbConfig::CONFIG["sitelibdir"]
|
392
|
+
new_sitelibdir = @orig_sitelibdir.sub(RbConfig::CONFIG["prefix"], @gemhome)
|
393
|
+
$LOAD_PATH.insert(Gem.load_path_insert_index, new_sitelibdir)
|
394
|
+
RbConfig::CONFIG["sitelibdir"] = new_sitelibdir
|
395
|
+
|
396
|
+
@orig_mandir = RbConfig::CONFIG["mandir"]
|
397
|
+
RbConfig::CONFIG["mandir"] = File.join @gemhome, "share", "man"
|
398
|
+
|
399
|
+
Gem::Specification.unresolved_deps.clear
|
400
|
+
Gem.use_paths(@gemhome)
|
306
401
|
|
307
402
|
Gem.loaded_specs.clear
|
403
|
+
Gem.instance_variable_set(:@activated_gem_paths, 0)
|
308
404
|
Gem.clear_default_specs
|
309
|
-
Gem::Specification.unresolved_deps.clear
|
310
405
|
|
311
406
|
Gem.configuration.verbose = true
|
312
407
|
Gem.configuration.update_sources = true
|
@@ -319,15 +414,17 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
319
414
|
|
320
415
|
Gem.searcher = nil
|
321
416
|
Gem::SpecFetcher.fetcher = nil
|
322
|
-
@orig_BASERUBY = RbConfig::CONFIG['BASERUBY']
|
323
|
-
RbConfig::CONFIG['BASERUBY'] = RbConfig::CONFIG['ruby_install_name']
|
324
417
|
|
325
|
-
@orig_arch = RbConfig::CONFIG[
|
418
|
+
@orig_arch = RbConfig::CONFIG["arch"]
|
326
419
|
|
327
420
|
if win_platform?
|
328
|
-
util_set_arch
|
421
|
+
util_set_arch "i386-mswin32"
|
329
422
|
else
|
330
|
-
util_set_arch
|
423
|
+
util_set_arch "i686-darwin8.10.1"
|
424
|
+
end
|
425
|
+
|
426
|
+
%w[post_install_hooks done_installing_hooks post_uninstall_hooks pre_uninstall_hooks pre_install_hooks pre_reset_hooks post_reset_hooks post_build_hooks].each do |name|
|
427
|
+
@orig_hooks[name] = Gem.send(name).dup
|
331
428
|
end
|
332
429
|
|
333
430
|
@marshal_version = "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}"
|
@@ -336,59 +433,68 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
336
433
|
|
337
434
|
##
|
338
435
|
# #teardown restores the process to its original state and removes the
|
339
|
-
# tempdir
|
436
|
+
# tempdir
|
340
437
|
|
341
438
|
def teardown
|
342
439
|
$LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
|
343
440
|
if @orig_LOADED_FEATURES
|
344
441
|
if @orig_LOAD_PATH
|
345
|
-
paths = @orig_LOAD_PATH.map {|path| File.join(File.expand_path(path), "/")}
|
346
442
|
($LOADED_FEATURES - @orig_LOADED_FEATURES).each do |feat|
|
347
|
-
|
348
|
-
$LOADED_FEATURES.delete(feat)
|
349
|
-
end
|
443
|
+
$LOADED_FEATURES.delete(feat) if feat.start_with?(@tmp)
|
350
444
|
end
|
351
445
|
else
|
352
446
|
$LOADED_FEATURES.replace @orig_LOADED_FEATURES
|
353
447
|
end
|
354
448
|
end
|
355
449
|
|
356
|
-
|
357
|
-
RbConfig::CONFIG['BASERUBY'] = @orig_BASERUBY
|
358
|
-
else
|
359
|
-
RbConfig::CONFIG.delete('BASERUBY')
|
360
|
-
end
|
361
|
-
RbConfig::CONFIG['arch'] = @orig_arch
|
450
|
+
RbConfig::CONFIG["arch"] = @orig_arch
|
362
451
|
|
363
|
-
if defined? Gem::RemoteFetcher
|
452
|
+
if defined? Gem::RemoteFetcher
|
364
453
|
Gem::RemoteFetcher.fetcher = nil
|
365
454
|
end
|
366
455
|
|
367
456
|
Dir.chdir @current_dir
|
368
457
|
|
369
|
-
FileUtils.rm_rf @tempdir
|
458
|
+
FileUtils.rm_rf @tempdir
|
459
|
+
|
460
|
+
restore_env
|
370
461
|
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
ENV['GEM_SPEC_CACHE'] = @orig_gem_spec_cache
|
375
|
-
ENV['RUBYGEMS_GEMDEPS'] = @orig_rubygems_gemdeps
|
376
|
-
ENV['RUBYGEMS_HOST'] = @orig_rubygems_host
|
462
|
+
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
|
463
|
+
Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
|
464
|
+
@orig_SYSTEM_WIDE_CONFIG_FILE
|
377
465
|
|
378
466
|
Gem.ruby = @orig_ruby if @orig_ruby
|
379
467
|
|
380
|
-
|
381
|
-
|
468
|
+
RbConfig::CONFIG["mandir"] = @orig_mandir
|
469
|
+
RbConfig::CONFIG["sitelibdir"] = @orig_sitelibdir
|
470
|
+
RbConfig::CONFIG["bindir"] = @orig_bindir
|
471
|
+
|
472
|
+
Gem.instance_variable_set :@default_specifications_dir, nil
|
473
|
+
if Gem.java_platform?
|
474
|
+
RbConfig::CONFIG["default_gem_home"] = @orig_default_gem_home
|
382
475
|
else
|
383
|
-
|
476
|
+
Gem.instance_variable_set :@default_dir, nil
|
384
477
|
end
|
385
478
|
|
386
|
-
Gem.
|
479
|
+
Gem::Specification.unresolved_deps.clear
|
480
|
+
Gem::refresh
|
387
481
|
|
388
|
-
|
482
|
+
@orig_hooks.each do |name, hooks|
|
483
|
+
Gem.send(name).replace hooks
|
484
|
+
end
|
389
485
|
|
390
|
-
|
391
|
-
|
486
|
+
@back_ui.close
|
487
|
+
end
|
488
|
+
|
489
|
+
def credential_setup
|
490
|
+
@temp_cred = File.join(@userhome, ".gem", "credentials")
|
491
|
+
FileUtils.mkdir_p File.dirname(@temp_cred)
|
492
|
+
File.write @temp_cred, ":rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97"
|
493
|
+
File.chmod 0o600, @temp_cred
|
494
|
+
end
|
495
|
+
|
496
|
+
def credential_teardown
|
497
|
+
FileUtils.rm_rf @temp_cred
|
392
498
|
end
|
393
499
|
|
394
500
|
def common_installer_setup
|
@@ -428,16 +534,20 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
428
534
|
Gem.pre_uninstall_hooks.clear
|
429
535
|
end
|
430
536
|
|
537
|
+
def without_any_upwards_gemfiles
|
538
|
+
ENV["BUNDLE_GEMFILE"] = File.join(@tempdir, "Gemfile")
|
539
|
+
end
|
540
|
+
|
431
541
|
##
|
432
542
|
# A git_gem is used with a gem dependencies file. The gem created here
|
433
543
|
# has no files, just a gem specification for the given +name+ and +version+.
|
434
544
|
#
|
435
545
|
# Yields the +specification+ to the block, if given
|
436
546
|
|
437
|
-
def git_gem
|
547
|
+
def git_gem(name = "a", version = 1)
|
438
548
|
have_git?
|
439
549
|
|
440
|
-
directory = File.join
|
550
|
+
directory = File.join "git", name
|
441
551
|
directory = File.expand_path directory
|
442
552
|
|
443
553
|
git_spec = Gem::Specification.new name, version do |specification|
|
@@ -448,25 +558,25 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
448
558
|
|
449
559
|
gemspec = "#{name}.gemspec"
|
450
560
|
|
451
|
-
open File.join(directory, gemspec),
|
561
|
+
File.open File.join(directory, gemspec), "w" do |io|
|
452
562
|
io.write git_spec.to_ruby
|
453
563
|
end
|
454
564
|
|
455
565
|
head = nil
|
456
566
|
|
457
567
|
Dir.chdir directory do
|
458
|
-
unless File.exist?
|
459
|
-
system @git,
|
460
|
-
system @git,
|
461
|
-
system @git,
|
568
|
+
unless File.exist? ".git"
|
569
|
+
system @git, "init", "--quiet"
|
570
|
+
system @git, "config", "user.name", "RubyGems Tests"
|
571
|
+
system @git, "config", "user.email", "rubygems@example"
|
462
572
|
end
|
463
573
|
|
464
|
-
system @git,
|
465
|
-
system @git,
|
466
|
-
head = Gem::Util.popen(
|
574
|
+
system @git, "add", gemspec
|
575
|
+
system @git, "commit", "-a", "-m", "a non-empty commit message", "--quiet"
|
576
|
+
head = Gem::Util.popen(@git, "rev-parse", "HEAD").strip
|
467
577
|
end
|
468
578
|
|
469
|
-
|
579
|
+
[name, git_spec.version, directory, head]
|
470
580
|
end
|
471
581
|
|
472
582
|
##
|
@@ -475,13 +585,13 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
475
585
|
def have_git?
|
476
586
|
return if in_path? @git
|
477
587
|
|
478
|
-
|
588
|
+
pend "cannot find git executable, use GIT environment variable to set"
|
479
589
|
end
|
480
590
|
|
481
|
-
def in_path?
|
482
|
-
return true if %r
|
591
|
+
def in_path?(executable) # :nodoc:
|
592
|
+
return true if %r{\A([A-Z]:|/)} =~ executable && File.exist?(executable)
|
483
593
|
|
484
|
-
ENV[
|
594
|
+
ENV["PATH"].split(File::PATH_SEPARATOR).any? do |directory|
|
485
595
|
File.exist? File.join directory, executable
|
486
596
|
end
|
487
597
|
end
|
@@ -489,53 +599,41 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
489
599
|
##
|
490
600
|
# Builds and installs the Gem::Specification +spec+
|
491
601
|
|
492
|
-
def install_gem
|
493
|
-
require
|
602
|
+
def install_gem(spec, options = {})
|
603
|
+
require "rubygems/installer"
|
494
604
|
|
495
|
-
gem =
|
605
|
+
gem = spec.cache_file
|
496
606
|
|
497
|
-
unless File.exist? gem
|
607
|
+
unless File.exist? gem
|
498
608
|
use_ui Gem::MockGemUi.new do
|
499
609
|
Dir.chdir @tempdir do
|
500
610
|
Gem::Package.build spec
|
501
611
|
end
|
502
612
|
end
|
503
613
|
|
504
|
-
gem = File.join(@tempdir, File.basename(
|
614
|
+
gem = File.join(@tempdir, File.basename(gem)).tap(&Gem::UNTAINT)
|
505
615
|
end
|
506
616
|
|
507
|
-
Gem::Installer.at(gem, options.merge({:wrappers => true})).install
|
617
|
+
Gem::Installer.at(gem, options.merge({ :wrappers => true })).install
|
508
618
|
end
|
509
619
|
|
510
620
|
##
|
511
621
|
# Builds and installs the Gem::Specification +spec+ into the user dir
|
512
622
|
|
513
|
-
def install_gem_user
|
623
|
+
def install_gem_user(spec)
|
514
624
|
install_gem spec, :user_install => true
|
515
625
|
end
|
516
626
|
|
517
627
|
##
|
518
628
|
# Uninstalls the Gem::Specification +spec+
|
519
|
-
def uninstall_gem
|
520
|
-
require
|
629
|
+
def uninstall_gem(spec)
|
630
|
+
require "rubygems/uninstaller"
|
521
631
|
|
522
|
-
Class.new(Gem::Uninstaller)
|
523
|
-
def ask_if_ok
|
632
|
+
Class.new(Gem::Uninstaller) do
|
633
|
+
def ask_if_ok(spec)
|
524
634
|
true
|
525
635
|
end
|
526
|
-
|
527
|
-
end
|
528
|
-
|
529
|
-
##
|
530
|
-
# creates a temporary directory with hax
|
531
|
-
# TODO: deprecate and remove
|
532
|
-
|
533
|
-
def create_tmpdir
|
534
|
-
tmpdir = nil
|
535
|
-
Dir.chdir Dir.tmpdir do tmpdir = Dir.pwd end # HACK OSX /private/tmp
|
536
|
-
tmpdir = File.join tmpdir, "test_rubygems_#{$$}"
|
537
|
-
FileUtils.mkdir_p tmpdir
|
538
|
-
return tmpdir
|
636
|
+
end.new(spec.name, :executables => true, :user_install => true).uninstall
|
539
637
|
end
|
540
638
|
|
541
639
|
##
|
@@ -544,7 +642,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
544
642
|
def mu_pp(obj)
|
545
643
|
s = String.new
|
546
644
|
s = PP.pp obj, s
|
547
|
-
s = s.force_encoding(Encoding.default_external)
|
645
|
+
s = s.force_encoding(Encoding.default_external)
|
548
646
|
s.chomp
|
549
647
|
end
|
550
648
|
|
@@ -552,7 +650,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
552
650
|
# Reads a Marshal file at +path+
|
553
651
|
|
554
652
|
def read_cache(path)
|
555
|
-
open path.dup.
|
653
|
+
File.open path.dup.tap(&Gem::UNTAINT), "rb" do |io|
|
556
654
|
Marshal.load io.read
|
557
655
|
end
|
558
656
|
end
|
@@ -572,13 +670,32 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
572
670
|
dir = File.dirname path
|
573
671
|
FileUtils.mkdir_p dir unless File.directory? dir
|
574
672
|
|
575
|
-
open path,
|
673
|
+
File.open path, "wb" do |io|
|
576
674
|
yield io if block_given?
|
577
675
|
end
|
578
676
|
|
579
677
|
path
|
580
678
|
end
|
581
679
|
|
680
|
+
##
|
681
|
+
# Load a YAML string, the psych 3 way
|
682
|
+
|
683
|
+
def load_yaml(yaml)
|
684
|
+
if Psych.respond_to?(:unsafe_load)
|
685
|
+
Psych.unsafe_load(yaml)
|
686
|
+
else
|
687
|
+
Psych.load(yaml)
|
688
|
+
end
|
689
|
+
end
|
690
|
+
|
691
|
+
##
|
692
|
+
# Load a YAML file, the psych 3 way
|
693
|
+
|
694
|
+
def load_yaml_file(file)
|
695
|
+
require "rubygems/config_file"
|
696
|
+
Gem::ConfigFile.load_with_rubygems_config_hash(File.read(file))
|
697
|
+
end
|
698
|
+
|
582
699
|
def all_spec_names
|
583
700
|
Gem::Specification.map(&:full_name)
|
584
701
|
end
|
@@ -593,40 +710,31 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
593
710
|
#
|
594
711
|
# Use this with #write_file to build an installed gem.
|
595
712
|
|
596
|
-
def quick_gem(name, version=
|
597
|
-
require
|
713
|
+
def quick_gem(name, version="2")
|
714
|
+
require "rubygems/specification"
|
598
715
|
|
599
716
|
spec = Gem::Specification.new do |s|
|
600
717
|
s.platform = Gem::Platform::RUBY
|
601
718
|
s.name = name
|
602
719
|
s.version = version
|
603
|
-
s.author =
|
604
|
-
s.email =
|
605
|
-
s.homepage =
|
720
|
+
s.author = "A User"
|
721
|
+
s.email = "example@example.com"
|
722
|
+
s.homepage = "http://example.com"
|
606
723
|
s.summary = "this is a summary"
|
607
724
|
s.description = "This is a test description"
|
608
725
|
|
609
726
|
yield(s) if block_given?
|
610
727
|
end
|
611
728
|
|
612
|
-
Gem::Specification.map # HACK: force specs to (re-)load before we write
|
613
|
-
|
614
729
|
written_path = write_file spec.spec_file do |io|
|
615
730
|
io.write spec.to_ruby_for_cache
|
616
731
|
end
|
617
732
|
|
618
|
-
spec.loaded_from =
|
733
|
+
spec.loaded_from = written_path
|
619
734
|
|
620
735
|
Gem::Specification.reset
|
621
736
|
|
622
|
-
|
623
|
-
end
|
624
|
-
|
625
|
-
##
|
626
|
-
# TODO: remove in RubyGems 3.0
|
627
|
-
|
628
|
-
def quick_spec name, version = '2' # :nodoc:
|
629
|
-
util_spec name, version
|
737
|
+
spec
|
630
738
|
end
|
631
739
|
|
632
740
|
##
|
@@ -641,7 +749,10 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
641
749
|
spec.files.each do |file|
|
642
750
|
next if File.exist? file
|
643
751
|
FileUtils.mkdir_p File.dirname(file)
|
644
|
-
|
752
|
+
|
753
|
+
File.open file, "w" do |fp|
|
754
|
+
fp.puts "# #{file}"
|
755
|
+
end
|
645
756
|
end
|
646
757
|
|
647
758
|
use_ui Gem::MockGemUi.new do
|
@@ -662,7 +773,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
662
773
|
# Removes all installed gems from +@gemhome+.
|
663
774
|
|
664
775
|
def util_clear_gems
|
665
|
-
FileUtils.rm_rf File.join(@gemhome, "gems")
|
776
|
+
FileUtils.rm_rf File.join(@gemhome, "gems")
|
666
777
|
FileUtils.mkdir File.join(@gemhome, "gems")
|
667
778
|
FileUtils.rm_rf File.join(@gemhome, "specifications")
|
668
779
|
FileUtils.mkdir File.join(@gemhome, "specifications")
|
@@ -674,7 +785,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
674
785
|
|
675
786
|
def install_specs(*specs)
|
676
787
|
specs.each do |spec|
|
677
|
-
Gem::Installer.for_spec(spec).install
|
788
|
+
Gem::Installer.for_spec(spec, :force => true).install
|
678
789
|
end
|
679
790
|
|
680
791
|
Gem.searcher = nil
|
@@ -684,19 +795,6 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
684
795
|
# Installs the provided default specs including writing the spec file
|
685
796
|
|
686
797
|
def install_default_gems(*specs)
|
687
|
-
install_default_specs(*specs)
|
688
|
-
|
689
|
-
specs.each do |spec|
|
690
|
-
open spec.loaded_from, 'w' do |io|
|
691
|
-
io.write spec.to_ruby_for_cache
|
692
|
-
end
|
693
|
-
end
|
694
|
-
end
|
695
|
-
|
696
|
-
##
|
697
|
-
# Install the provided default specs
|
698
|
-
|
699
|
-
def install_default_specs(*specs)
|
700
798
|
specs.each do |spec|
|
701
799
|
installer = Gem::Installer.for_spec(spec, :install_as_default => true)
|
702
800
|
installer.install
|
@@ -712,65 +810,15 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
712
810
|
Gem::Specification.unresolved_deps.values.map(&:to_s).sort
|
713
811
|
end
|
714
812
|
|
715
|
-
def save_loaded_features
|
716
|
-
old_loaded_features = $LOADED_FEATURES.dup
|
717
|
-
yield
|
718
|
-
ensure
|
719
|
-
$LOADED_FEATURES.replace old_loaded_features
|
720
|
-
end
|
721
|
-
|
722
|
-
##
|
723
|
-
# new_spec is deprecated as it is never used.
|
724
|
-
#
|
725
|
-
# TODO: remove in RubyGems 3.0
|
726
|
-
|
727
|
-
def new_spec name, version, deps = nil, *files # :nodoc:
|
728
|
-
require 'rubygems/specification'
|
729
|
-
|
730
|
-
spec = Gem::Specification.new do |s|
|
731
|
-
s.platform = Gem::Platform::RUBY
|
732
|
-
s.name = name
|
733
|
-
s.version = version
|
734
|
-
s.author = 'A User'
|
735
|
-
s.email = 'example@example.com'
|
736
|
-
s.homepage = 'http://example.com'
|
737
|
-
s.summary = "this is a summary"
|
738
|
-
s.description = "This is a test description"
|
739
|
-
|
740
|
-
Array(deps).each do |n, req|
|
741
|
-
s.add_dependency n, (req || '>= 0')
|
742
|
-
end
|
743
|
-
|
744
|
-
s.files.push(*files) unless files.empty?
|
745
|
-
|
746
|
-
yield s if block_given?
|
747
|
-
end
|
748
|
-
|
749
|
-
spec.loaded_from = spec.spec_file
|
750
|
-
|
751
|
-
unless files.empty? then
|
752
|
-
write_file spec.spec_file do |io|
|
753
|
-
io.write spec.to_ruby_for_cache
|
754
|
-
end
|
755
|
-
|
756
|
-
util_build_gem spec
|
757
|
-
|
758
|
-
cache_file = File.join @tempdir, 'gems', "#{spec.full_name}.gem"
|
759
|
-
FileUtils.mkdir_p File.dirname cache_file
|
760
|
-
FileUtils.mv spec.cache_file, cache_file
|
761
|
-
FileUtils.rm spec.spec_file
|
762
|
-
end
|
763
|
-
|
764
|
-
spec
|
765
|
-
end
|
766
|
-
|
767
813
|
def new_default_spec(name, version, deps = nil, *files)
|
768
814
|
spec = util_spec name, version, deps
|
769
815
|
|
770
|
-
spec.loaded_from = File.join(@
|
816
|
+
spec.loaded_from = File.join(@gemhome, "specifications", "default", spec.spec_name)
|
771
817
|
spec.files = files
|
772
818
|
|
773
819
|
lib_dir = File.join(@tempdir, "default_gems", "lib")
|
820
|
+
lib_dir.instance_variable_set(:@gem_prelude_index, lib_dir)
|
821
|
+
Gem.instance_variable_set(:@default_gem_load_paths, [*Gem.send(:default_gem_load_paths), lib_dir])
|
774
822
|
$LOAD_PATH.unshift(lib_dir)
|
775
823
|
files.each do |file|
|
776
824
|
rb_path = File.join(lib_dir, file)
|
@@ -787,33 +835,41 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
787
835
|
# Creates a spec with +name+, +version+. +deps+ can specify the dependency
|
788
836
|
# or a +block+ can be given for full customization of the specification.
|
789
837
|
|
790
|
-
def util_spec
|
791
|
-
raise "deps or block, not both" if deps
|
838
|
+
def util_spec(name, version = 2, deps = nil, *files) # :yields: specification
|
839
|
+
raise "deps or block, not both" if deps && block_given?
|
792
840
|
|
793
841
|
spec = Gem::Specification.new do |s|
|
794
842
|
s.platform = Gem::Platform::RUBY
|
795
843
|
s.name = name
|
796
844
|
s.version = version
|
797
|
-
s.author =
|
798
|
-
s.email =
|
799
|
-
s.homepage =
|
845
|
+
s.author = "A User"
|
846
|
+
s.email = "example@example.com"
|
847
|
+
s.homepage = "http://example.com"
|
800
848
|
s.summary = "this is a summary"
|
801
849
|
s.description = "This is a test description"
|
802
850
|
|
851
|
+
s.files.push(*files) unless files.empty?
|
852
|
+
|
803
853
|
yield s if block_given?
|
804
854
|
end
|
805
855
|
|
806
|
-
if deps
|
807
|
-
|
808
|
-
|
809
|
-
deps.keys.sort.each do |n|
|
810
|
-
spec.add_dependency n, (deps[n] || '>= 0')
|
856
|
+
if deps
|
857
|
+
deps.keys.each do |n|
|
858
|
+
spec.add_dependency n, (deps[n] || ">= 0")
|
811
859
|
end
|
812
860
|
end
|
813
861
|
|
814
|
-
|
862
|
+
unless files.empty?
|
863
|
+
write_file spec.spec_file do |io|
|
864
|
+
io.write spec.to_ruby_for_cache
|
865
|
+
end
|
815
866
|
|
816
|
-
|
867
|
+
util_build_gem spec
|
868
|
+
|
869
|
+
FileUtils.rm spec.spec_file
|
870
|
+
end
|
871
|
+
|
872
|
+
spec
|
817
873
|
end
|
818
874
|
|
819
875
|
##
|
@@ -823,16 +879,10 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
823
879
|
# location are returned.
|
824
880
|
|
825
881
|
def util_gem(name, version, deps = nil, &block)
|
826
|
-
|
827
|
-
raise "deps or block, not both" if deps and block
|
828
|
-
|
829
|
-
if deps then
|
882
|
+
if deps
|
830
883
|
block = proc do |s|
|
831
|
-
|
832
|
-
|
833
|
-
# deterministic on all implementations.
|
834
|
-
deps.keys.sort.each do |n|
|
835
|
-
s.add_dependency n, (deps[n] || '>= 0')
|
884
|
+
deps.keys.each do |n|
|
885
|
+
s.add_dependency n, (deps[n] || ">= 0")
|
836
886
|
end
|
837
887
|
end
|
838
888
|
end
|
@@ -841,7 +891,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
841
891
|
|
842
892
|
util_build_gem spec
|
843
893
|
|
844
|
-
cache_file = File.join @tempdir,
|
894
|
+
cache_file = File.join @tempdir, "gems", "#{spec.original_name}.gem"
|
845
895
|
FileUtils.mkdir_p File.dirname cache_file
|
846
896
|
FileUtils.mv spec.cache_file, cache_file
|
847
897
|
FileUtils.rm spec.spec_file
|
@@ -883,11 +933,11 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
883
933
|
# TODO: nuke this and fix tests. this should speed up a lot
|
884
934
|
|
885
935
|
def util_make_gems(prerelease = false)
|
886
|
-
@a1 = quick_gem
|
936
|
+
@a1 = quick_gem "a", "1" do |s|
|
887
937
|
s.files = %w[lib/code.rb]
|
888
938
|
s.require_paths = %w[lib]
|
889
|
-
s.date = Gem::Specification::TODAY -
|
890
|
-
s.homepage =
|
939
|
+
s.date = Gem::Specification::TODAY - 86_400
|
940
|
+
s.homepage = "http://a.example.com"
|
891
941
|
s.email = %w[example@example.com example2@example.com]
|
892
942
|
s.authors = %w[Example Example2]
|
893
943
|
s.description = <<-DESC
|
@@ -904,27 +954,27 @@ Also, a list:
|
|
904
954
|
s.require_paths = %w[lib]
|
905
955
|
end
|
906
956
|
|
907
|
-
@a2 = quick_gem(
|
908
|
-
@a3a = quick_gem(
|
909
|
-
@a_evil9 = quick_gem(
|
910
|
-
@b2 = quick_gem(
|
911
|
-
@c1_2 = quick_gem(
|
912
|
-
@x = quick_gem(
|
913
|
-
@dep_x = quick_gem(
|
957
|
+
@a2 = quick_gem("a", "2", &init)
|
958
|
+
@a3a = quick_gem("a", "3.a", &init)
|
959
|
+
@a_evil9 = quick_gem("a_evil", "9", &init)
|
960
|
+
@b2 = quick_gem("b", "2", &init)
|
961
|
+
@c1_2 = quick_gem("c", "1.2", &init)
|
962
|
+
@x = quick_gem("x", "1", &init)
|
963
|
+
@dep_x = quick_gem("dep_x", "1") do |s|
|
914
964
|
s.files = %w[lib/code.rb]
|
915
965
|
s.require_paths = %w[lib]
|
916
|
-
s.add_dependency
|
966
|
+
s.add_dependency "x", ">= 1"
|
917
967
|
end
|
918
968
|
|
919
|
-
@pl1
|
969
|
+
@pl1 = quick_gem "pl", "1" do |s| # l for legacy
|
920
970
|
s.files = %w[lib/code.rb]
|
921
971
|
s.require_paths = %w[lib]
|
922
|
-
s.platform = Gem::Platform.new
|
923
|
-
s.instance_variable_set :@original_platform,
|
972
|
+
s.platform = Gem::Platform.new "i386-linux"
|
973
|
+
s.instance_variable_set :@original_platform, "i386-linux"
|
924
974
|
end
|
925
975
|
|
926
976
|
if prerelease
|
927
|
-
@a2_pre = quick_gem(
|
977
|
+
@a2_pre = quick_gem("a", "2.a", &init)
|
928
978
|
write_file File.join(*%W[gems #{@a2_pre.original_name} lib code.rb])
|
929
979
|
util_build_gem @a2_pre
|
930
980
|
end
|
@@ -950,38 +1000,15 @@ Also, a list:
|
|
950
1000
|
# Set the platform to +arch+
|
951
1001
|
|
952
1002
|
def util_set_arch(arch)
|
953
|
-
RbConfig::CONFIG[
|
1003
|
+
RbConfig::CONFIG["arch"] = arch
|
954
1004
|
platform = Gem::Platform.new arch
|
955
1005
|
|
956
1006
|
Gem.instance_variable_set :@platforms, nil
|
957
1007
|
Gem::Platform.instance_variable_set :@local, nil
|
958
1008
|
|
959
|
-
|
960
|
-
end
|
961
|
-
|
962
|
-
##
|
963
|
-
# Sets up a fake fetcher using the gems from #util_make_gems. Optionally
|
964
|
-
# additional +prerelease+ gems may be included.
|
965
|
-
#
|
966
|
-
# Gems created by this method may be fetched using Gem::RemoteFetcher.
|
967
|
-
|
968
|
-
def util_setup_fake_fetcher(prerelease = false)
|
969
|
-
require 'zlib'
|
970
|
-
require 'socket'
|
971
|
-
require 'rubygems/remote_fetcher'
|
1009
|
+
yield if block_given?
|
972
1010
|
|
973
|
-
|
974
|
-
|
975
|
-
util_make_gems(prerelease)
|
976
|
-
Gem::Specification.reset
|
977
|
-
|
978
|
-
@all_gems = [@a1, @a2, @a3a, @a_evil9, @b2, @c1_2].sort
|
979
|
-
@all_gem_names = @all_gems.map { |gem| gem.full_name }
|
980
|
-
|
981
|
-
gem_names = [@a1.full_name, @a2.full_name, @a3a.full_name, @b2.full_name]
|
982
|
-
@gem_names = gem_names.sort.join("\n")
|
983
|
-
|
984
|
-
Gem::RemoteFetcher.fetcher = @fetcher
|
1011
|
+
platform
|
985
1012
|
end
|
986
1013
|
|
987
1014
|
##
|
@@ -995,7 +1022,6 @@ Also, a list:
|
|
995
1022
|
|
996
1023
|
##
|
997
1024
|
# Sets up Gem::SpecFetcher to return information from the gems in +specs+.
|
998
|
-
# Best used with +@all_gems+ from #util_setup_fake_fetcher.
|
999
1025
|
|
1000
1026
|
def util_setup_spec_fetcher(*specs)
|
1001
1027
|
all_specs = Gem::Specification.to_a + specs
|
@@ -1003,7 +1029,7 @@ Also, a list:
|
|
1003
1029
|
|
1004
1030
|
spec_fetcher = Gem::SpecFetcher.fetcher
|
1005
1031
|
|
1006
|
-
prerelease, all = all_specs.partition {
|
1032
|
+
prerelease, all = all_specs.partition {|spec| spec.version.prerelease? }
|
1007
1033
|
latest = Gem::Specification._latest_specs all_specs
|
1008
1034
|
|
1009
1035
|
spec_fetcher.specs[@uri] = []
|
@@ -1021,11 +1047,11 @@ Also, a list:
|
|
1021
1047
|
spec_fetcher.prerelease_specs[@uri] << spec.name_tuple
|
1022
1048
|
end
|
1023
1049
|
|
1024
|
-
# HACK for test_download_to_cache
|
1025
|
-
unless Gem::RemoteFetcher === @fetcher
|
1050
|
+
# HACK: for test_download_to_cache
|
1051
|
+
unless Gem::RemoteFetcher === @fetcher
|
1026
1052
|
v = Gem.marshal_version
|
1027
1053
|
|
1028
|
-
specs = all.map {
|
1054
|
+
specs = all.map {|spec| spec.name_tuple }
|
1029
1055
|
s_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic specs
|
1030
1056
|
|
1031
1057
|
latest_specs = latest.map do |spec|
|
@@ -1034,26 +1060,30 @@ Also, a list:
|
|
1034
1060
|
|
1035
1061
|
l_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic latest_specs
|
1036
1062
|
|
1037
|
-
prerelease_specs = prerelease.map {
|
1063
|
+
prerelease_specs = prerelease.map {|spec| spec.name_tuple }
|
1038
1064
|
p_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic prerelease_specs
|
1039
1065
|
|
1040
1066
|
@fetcher.data["#{@gem_repo}specs.#{v}.gz"] = s_zip
|
1041
1067
|
@fetcher.data["#{@gem_repo}latest_specs.#{v}.gz"] = l_zip
|
1042
1068
|
@fetcher.data["#{@gem_repo}prerelease_specs.#{v}.gz"] = p_zip
|
1043
1069
|
|
1044
|
-
|
1045
|
-
|
1046
|
-
all_specs.each do |spec|
|
1047
|
-
path = "#{@gem_repo}quick/Marshal.#{v}/#{spec.original_name}.gemspec.rz"
|
1048
|
-
data = Marshal.dump spec
|
1049
|
-
data_deflate = Zlib::Deflate.deflate data
|
1050
|
-
@fetcher.data[path] = data_deflate
|
1051
|
-
end
|
1070
|
+
write_marshalled_gemspecs(*all_specs)
|
1052
1071
|
end
|
1053
1072
|
|
1054
1073
|
nil # force errors
|
1055
1074
|
end
|
1056
1075
|
|
1076
|
+
def write_marshalled_gemspecs(*all_specs)
|
1077
|
+
v = Gem.marshal_version
|
1078
|
+
|
1079
|
+
all_specs.each do |spec|
|
1080
|
+
path = "#{@gem_repo}quick/Marshal.#{v}/#{spec.original_name}.gemspec.rz"
|
1081
|
+
data = Marshal.dump spec
|
1082
|
+
data_deflate = Zlib::Deflate.deflate data
|
1083
|
+
@fetcher.data[path] = data_deflate
|
1084
|
+
end
|
1085
|
+
end
|
1086
|
+
|
1057
1087
|
##
|
1058
1088
|
# Deflates +data+
|
1059
1089
|
|
@@ -1061,35 +1091,49 @@ Also, a list:
|
|
1061
1091
|
Zlib::Deflate.deflate data
|
1062
1092
|
end
|
1063
1093
|
|
1064
|
-
def util_set_RUBY_VERSION(version, patchlevel =
|
1065
|
-
if Gem.instance_variables.include? :@ruby_version
|
1066
|
-
Gem.instance_variables.include? '@ruby_version' then
|
1094
|
+
def util_set_RUBY_VERSION(version, patchlevel, revision, description, engine = "ruby", engine_version = nil)
|
1095
|
+
if Gem.instance_variables.include? :@ruby_version
|
1067
1096
|
Gem.send :remove_instance_variable, :@ruby_version
|
1068
1097
|
end
|
1069
1098
|
|
1070
|
-
@RUBY_VERSION
|
1071
|
-
@RUBY_PATCHLEVEL
|
1072
|
-
@RUBY_REVISION
|
1099
|
+
@RUBY_VERSION = RUBY_VERSION
|
1100
|
+
@RUBY_PATCHLEVEL = RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1101
|
+
@RUBY_REVISION = RUBY_REVISION if defined?(RUBY_REVISION)
|
1102
|
+
@RUBY_DESCRIPTION = RUBY_DESCRIPTION
|
1103
|
+
@RUBY_ENGINE = RUBY_ENGINE
|
1104
|
+
@RUBY_ENGINE_VERSION = RUBY_ENGINE_VERSION if defined?(RUBY_ENGINE_VERSION)
|
1073
1105
|
|
1074
|
-
|
1075
|
-
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1076
|
-
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
1106
|
+
util_clear_RUBY_VERSION
|
1077
1107
|
|
1078
|
-
Object.const_set :RUBY_VERSION,
|
1079
|
-
Object.const_set :RUBY_PATCHLEVEL,
|
1080
|
-
Object.const_set :RUBY_REVISION,
|
1108
|
+
Object.const_set :RUBY_VERSION, version
|
1109
|
+
Object.const_set :RUBY_PATCHLEVEL, patchlevel
|
1110
|
+
Object.const_set :RUBY_REVISION, revision
|
1111
|
+
Object.const_set :RUBY_DESCRIPTION, description
|
1112
|
+
Object.const_set :RUBY_ENGINE, engine
|
1113
|
+
Object.const_set :RUBY_ENGINE_VERSION, engine_version if engine_version
|
1081
1114
|
end
|
1082
1115
|
|
1083
1116
|
def util_restore_RUBY_VERSION
|
1084
|
-
|
1085
|
-
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1086
|
-
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
1117
|
+
util_clear_RUBY_VERSION
|
1087
1118
|
|
1088
|
-
Object.const_set :RUBY_VERSION,
|
1089
|
-
Object.const_set :RUBY_PATCHLEVEL,
|
1119
|
+
Object.const_set :RUBY_VERSION, @RUBY_VERSION
|
1120
|
+
Object.const_set :RUBY_PATCHLEVEL, @RUBY_PATCHLEVEL if
|
1090
1121
|
defined?(@RUBY_PATCHLEVEL)
|
1091
|
-
Object.const_set :RUBY_REVISION,
|
1122
|
+
Object.const_set :RUBY_REVISION, @RUBY_REVISION if
|
1092
1123
|
defined?(@RUBY_REVISION)
|
1124
|
+
Object.const_set :RUBY_DESCRIPTION, @RUBY_DESCRIPTION
|
1125
|
+
Object.const_set :RUBY_ENGINE, @RUBY_ENGINE
|
1126
|
+
Object.const_set :RUBY_ENGINE_VERSION, @RUBY_ENGINE_VERSION if
|
1127
|
+
defined?(@RUBY_ENGINE_VERSION)
|
1128
|
+
end
|
1129
|
+
|
1130
|
+
def util_clear_RUBY_VERSION
|
1131
|
+
Object.send :remove_const, :RUBY_VERSION
|
1132
|
+
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1133
|
+
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
1134
|
+
Object.send :remove_const, :RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION)
|
1135
|
+
Object.send :remove_const, :RUBY_ENGINE
|
1136
|
+
Object.send :remove_const, :RUBY_ENGINE_VERSION if defined?(RUBY_ENGINE_VERSION)
|
1093
1137
|
end
|
1094
1138
|
|
1095
1139
|
##
|
@@ -1106,12 +1150,26 @@ Also, a list:
|
|
1106
1150
|
Gem.win_platform?
|
1107
1151
|
end
|
1108
1152
|
|
1153
|
+
##
|
1154
|
+
# Is this test being run on a Java platform?
|
1155
|
+
|
1156
|
+
def self.java_platform?
|
1157
|
+
Gem.java_platform?
|
1158
|
+
end
|
1159
|
+
|
1160
|
+
##
|
1161
|
+
# Is this test being run on a Java platform?
|
1162
|
+
|
1163
|
+
def java_platform?
|
1164
|
+
Gem.java_platform?
|
1165
|
+
end
|
1166
|
+
|
1109
1167
|
##
|
1110
1168
|
# Returns whether or not we're on a version of Ruby built with VC++ (or
|
1111
1169
|
# Borland) versus Cygwin, Mingw, etc.
|
1112
1170
|
|
1113
1171
|
def self.vc_windows?
|
1114
|
-
RUBY_PLATFORM.match(
|
1172
|
+
RUBY_PLATFORM.match("mswin")
|
1115
1173
|
end
|
1116
1174
|
|
1117
1175
|
##
|
@@ -1119,7 +1177,29 @@ Also, a list:
|
|
1119
1177
|
# Borland) versus Cygwin, Mingw, etc.
|
1120
1178
|
|
1121
1179
|
def vc_windows?
|
1122
|
-
RUBY_PLATFORM.match(
|
1180
|
+
RUBY_PLATFORM.match("mswin")
|
1181
|
+
end
|
1182
|
+
|
1183
|
+
##
|
1184
|
+
# Is this test being run on a version of Ruby built with mingw?
|
1185
|
+
|
1186
|
+
def self.mingw_windows?
|
1187
|
+
RUBY_PLATFORM.match("mingw")
|
1188
|
+
end
|
1189
|
+
|
1190
|
+
##
|
1191
|
+
# Is this test being run on a version of Ruby built with mingw?
|
1192
|
+
|
1193
|
+
def mingw_windows?
|
1194
|
+
RUBY_PLATFORM.match("mingw")
|
1195
|
+
end
|
1196
|
+
|
1197
|
+
##
|
1198
|
+
# Is this test being run on a ruby/ruby repository?
|
1199
|
+
#
|
1200
|
+
|
1201
|
+
def ruby_repo?
|
1202
|
+
!ENV["GEM_COMMAND"].nil?
|
1123
1203
|
end
|
1124
1204
|
|
1125
1205
|
##
|
@@ -1128,7 +1208,7 @@ Also, a list:
|
|
1128
1208
|
# other platforms, including Cygwin, it will return 'make'.
|
1129
1209
|
|
1130
1210
|
def self.make_command
|
1131
|
-
ENV["make"] || ENV["MAKE"] || (vc_windows? ?
|
1211
|
+
ENV["make"] || ENV["MAKE"] || (vc_windows? ? "nmake" : "make")
|
1132
1212
|
end
|
1133
1213
|
|
1134
1214
|
##
|
@@ -1137,14 +1217,14 @@ Also, a list:
|
|
1137
1217
|
# other platforms, including Cygwin, it will return 'make'.
|
1138
1218
|
|
1139
1219
|
def make_command
|
1140
|
-
ENV["make"] || ENV["MAKE"] || (vc_windows? ?
|
1220
|
+
ENV["make"] || ENV["MAKE"] || (vc_windows? ? "nmake" : "make")
|
1141
1221
|
end
|
1142
1222
|
|
1143
1223
|
##
|
1144
1224
|
# Returns whether or not the nmake command could be found.
|
1145
1225
|
|
1146
1226
|
def nmake_found?
|
1147
|
-
system(
|
1227
|
+
system("nmake /? 1>NUL 2>&1")
|
1148
1228
|
end
|
1149
1229
|
|
1150
1230
|
# In case we're building docs in a background process, this method waits for
|
@@ -1176,7 +1256,7 @@ Also, a list:
|
|
1176
1256
|
|
1177
1257
|
def build_rake_in(good=true)
|
1178
1258
|
gem_ruby = Gem.ruby
|
1179
|
-
Gem.ruby =
|
1259
|
+
Gem.ruby = self.class.rubybin
|
1180
1260
|
env_rake = ENV["rake"]
|
1181
1261
|
rake = (good ? @@good_rake : @@bad_rake)
|
1182
1262
|
ENV["rake"] = rake
|
@@ -1197,36 +1277,89 @@ Also, a list:
|
|
1197
1277
|
ruby = ENV["RUBY"]
|
1198
1278
|
return ruby if ruby
|
1199
1279
|
ruby = "ruby"
|
1200
|
-
rubyexe = "#{ruby}
|
1280
|
+
rubyexe = "#{ruby}#{RbConfig::CONFIG["EXEEXT"]}"
|
1201
1281
|
|
1202
1282
|
3.times do
|
1203
|
-
if File.exist?
|
1283
|
+
if File.exist?(ruby) && File.executable?(ruby) && !File.directory?(ruby)
|
1204
1284
|
return File.expand_path(ruby)
|
1205
1285
|
end
|
1206
|
-
if File.exist?
|
1286
|
+
if File.exist?(rubyexe) && File.executable?(rubyexe)
|
1207
1287
|
return File.expand_path(rubyexe)
|
1208
1288
|
end
|
1209
1289
|
ruby = File.join("..", ruby)
|
1210
1290
|
end
|
1211
1291
|
|
1212
1292
|
begin
|
1213
|
-
|
1214
|
-
File.join(RbConfig::CONFIG["bindir"],
|
1215
|
-
RbConfig::CONFIG["ruby_install_name"] +
|
1216
|
-
RbConfig::CONFIG["EXEEXT"])
|
1293
|
+
Gem.ruby
|
1217
1294
|
rescue LoadError
|
1218
1295
|
"ruby"
|
1219
1296
|
end
|
1220
1297
|
end
|
1221
1298
|
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1299
|
+
def ruby_with_rubygems_in_load_path
|
1300
|
+
[Gem.ruby, "-I", rubygems_path]
|
1301
|
+
end
|
1302
|
+
|
1303
|
+
def rubygems_path
|
1304
|
+
$LOAD_PATH.find {|p| p == File.dirname($LOADED_FEATURES.find {|f| f.end_with?("/rubygems.rb") }) }
|
1305
|
+
end
|
1306
|
+
|
1307
|
+
def bundler_path
|
1308
|
+
$LOAD_PATH.find {|p| p == File.dirname($LOADED_FEATURES.find {|f| f.end_with?("/bundler.rb") }) }
|
1309
|
+
end
|
1310
|
+
|
1311
|
+
def with_clean_path_to_ruby
|
1312
|
+
orig_ruby = Gem.ruby
|
1313
|
+
|
1314
|
+
Gem.instance_variable_set :@ruby, nil
|
1315
|
+
|
1316
|
+
yield
|
1317
|
+
ensure
|
1318
|
+
Gem.instance_variable_set :@ruby, orig_ruby
|
1319
|
+
end
|
1320
|
+
|
1321
|
+
def with_internal_encoding(encoding)
|
1322
|
+
int_enc = Encoding.default_internal
|
1323
|
+
silence_warnings { Encoding.default_internal = encoding }
|
1324
|
+
|
1325
|
+
yield
|
1326
|
+
ensure
|
1327
|
+
silence_warnings { Encoding.default_internal = int_enc }
|
1328
|
+
end
|
1329
|
+
|
1330
|
+
def silence_warnings
|
1331
|
+
old_verbose = $VERBOSE
|
1332
|
+
$VERBOSE = false
|
1333
|
+
yield
|
1334
|
+
ensure
|
1335
|
+
$VERBOSE = old_verbose
|
1336
|
+
end
|
1337
|
+
|
1338
|
+
class << self
|
1339
|
+
# :nodoc:
|
1340
|
+
##
|
1341
|
+
# Return the join path, with escaping backticks, dollars, and
|
1342
|
+
# double-quotes. Unlike `shellescape`, equal-sign is not escaped.
|
1343
|
+
|
1344
|
+
private
|
1345
|
+
|
1346
|
+
def escape_path(*path)
|
1347
|
+
path = File.join(*path)
|
1348
|
+
if %r{\A[-+:/=@,.\w]+\z}.match?(path)
|
1349
|
+
path
|
1350
|
+
else
|
1351
|
+
"\"#{path.gsub(/[`$"]/, '\\&')}\""
|
1352
|
+
end
|
1353
|
+
end
|
1354
|
+
end
|
1355
|
+
|
1356
|
+
@@good_rake = "#{rubybin} #{escape_path(__dir__, "good_rake.rb")}"
|
1357
|
+
@@bad_rake = "#{rubybin} #{escape_path(__dir__, "bad_rake.rb")}"
|
1225
1358
|
|
1226
1359
|
##
|
1227
1360
|
# Construct a new Gem::Dependency.
|
1228
1361
|
|
1229
|
-
def dep
|
1362
|
+
def dep(name, *requirements)
|
1230
1363
|
Gem::Dependency.new name, *requirements
|
1231
1364
|
end
|
1232
1365
|
|
@@ -1235,10 +1368,10 @@ Also, a list:
|
|
1235
1368
|
# Gem::Dependency +dep+, a +from_name+ and +from_version+ requesting the
|
1236
1369
|
# dependency and a +parent+ DependencyRequest
|
1237
1370
|
|
1238
|
-
def dependency_request
|
1371
|
+
def dependency_request(dep, from_name, from_version, parent = nil)
|
1239
1372
|
remote = Gem::Source.new @uri
|
1240
1373
|
|
1241
|
-
unless parent
|
1374
|
+
unless parent
|
1242
1375
|
parent_dep = dep from_name, from_version
|
1243
1376
|
parent = Gem::Resolver::DependencyRequest.new parent_dep, nil
|
1244
1377
|
end
|
@@ -1253,7 +1386,7 @@ Also, a list:
|
|
1253
1386
|
##
|
1254
1387
|
# Constructs a new Gem::Requirement.
|
1255
1388
|
|
1256
|
-
def req
|
1389
|
+
def req(*requirements)
|
1257
1390
|
return requirements.first if Gem::Requirement === requirements.first
|
1258
1391
|
Gem::Requirement.create requirements
|
1259
1392
|
end
|
@@ -1261,7 +1394,7 @@ Also, a list:
|
|
1261
1394
|
##
|
1262
1395
|
# Constructs a new Gem::Specification.
|
1263
1396
|
|
1264
|
-
def spec
|
1397
|
+
def spec(name, version, &block)
|
1265
1398
|
Gem::Specification.new name, v(version), &block
|
1266
1399
|
end
|
1267
1400
|
|
@@ -1285,7 +1418,7 @@ Also, a list:
|
|
1285
1418
|
# end
|
1286
1419
|
# end
|
1287
1420
|
|
1288
|
-
def spec_fetcher
|
1421
|
+
def spec_fetcher(repository = @gem_repo)
|
1289
1422
|
Gem::TestCase::SpecFetcherSetup.declare self, repository do |spec_fetcher_setup|
|
1290
1423
|
yield spec_fetcher_setup if block_given?
|
1291
1424
|
end
|
@@ -1294,7 +1427,7 @@ Also, a list:
|
|
1294
1427
|
##
|
1295
1428
|
# Construct a new Gem::Version.
|
1296
1429
|
|
1297
|
-
def v
|
1430
|
+
def v(string)
|
1298
1431
|
Gem::Version.create string
|
1299
1432
|
end
|
1300
1433
|
|
@@ -1304,8 +1437,8 @@ Also, a list:
|
|
1304
1437
|
#
|
1305
1438
|
# Yields the +specification+ to the block, if given
|
1306
1439
|
|
1307
|
-
def vendor_gem
|
1308
|
-
directory = File.join
|
1440
|
+
def vendor_gem(name = "a", version = 1)
|
1441
|
+
directory = File.join "vendor", name
|
1309
1442
|
|
1310
1443
|
FileUtils.mkdir_p directory
|
1311
1444
|
|
@@ -1313,21 +1446,21 @@ Also, a list:
|
|
1313
1446
|
end
|
1314
1447
|
|
1315
1448
|
##
|
1316
|
-
# create_gemspec creates gem specification in given +
|
1449
|
+
# create_gemspec creates gem specification in given +directory+ or '.'
|
1317
1450
|
# for the given +name+ and +version+.
|
1318
1451
|
#
|
1319
1452
|
# Yields the +specification+ to the block, if given
|
1320
1453
|
|
1321
|
-
def save_gemspec
|
1454
|
+
def save_gemspec(name = "a", version = 1, directory = ".")
|
1322
1455
|
vendor_spec = Gem::Specification.new name, version do |specification|
|
1323
1456
|
yield specification if block_given?
|
1324
1457
|
end
|
1325
1458
|
|
1326
|
-
open File.join(directory, "#{name}.gemspec"),
|
1459
|
+
File.open File.join(directory, "#{name}.gemspec"), "w" do |io|
|
1327
1460
|
io.write vendor_spec.to_ruby
|
1328
1461
|
end
|
1329
1462
|
|
1330
|
-
|
1463
|
+
[name, vendor_spec.version, directory]
|
1331
1464
|
end
|
1332
1465
|
|
1333
1466
|
##
|
@@ -1335,7 +1468,6 @@ Also, a list:
|
|
1335
1468
|
# It is available by requiring Gem::TestCase.
|
1336
1469
|
|
1337
1470
|
class StaticSet < Gem::Resolver::Set
|
1338
|
-
|
1339
1471
|
##
|
1340
1472
|
# A StaticSet ignores remote because it has a fixed set of gems.
|
1341
1473
|
|
@@ -1355,7 +1487,7 @@ Also, a list:
|
|
1355
1487
|
##
|
1356
1488
|
# Adds +spec+ to this set.
|
1357
1489
|
|
1358
|
-
def add
|
1490
|
+
def add(spec)
|
1359
1491
|
@specs << spec
|
1360
1492
|
end
|
1361
1493
|
|
@@ -1372,14 +1504,14 @@ Also, a list:
|
|
1372
1504
|
# Finds all gems matching +dep+ in this set.
|
1373
1505
|
|
1374
1506
|
def find_all(dep)
|
1375
|
-
@specs.find_all {
|
1507
|
+
@specs.find_all {|s| dep.match? s, @prerelease }
|
1376
1508
|
end
|
1377
1509
|
|
1378
1510
|
##
|
1379
1511
|
# Loads a Gem::Specification from this set which has the given +name+,
|
1380
1512
|
# version +ver+, +platform+. The +source+ is ignored.
|
1381
1513
|
|
1382
|
-
def load_spec
|
1514
|
+
def load_spec(name, ver, platform, source)
|
1383
1515
|
dep = Gem::Dependency.new name, ver
|
1384
1516
|
spec = find_spec dep
|
1385
1517
|
|
@@ -1388,14 +1520,14 @@ Also, a list:
|
|
1388
1520
|
end
|
1389
1521
|
end
|
1390
1522
|
|
1391
|
-
def prefetch
|
1523
|
+
def prefetch(reqs) # :nodoc:
|
1392
1524
|
end
|
1393
1525
|
end
|
1394
1526
|
|
1395
1527
|
##
|
1396
1528
|
# Loads certificate named +cert_name+ from <tt>test/rubygems/</tt>.
|
1397
1529
|
|
1398
|
-
def self.load_cert
|
1530
|
+
def self.load_cert(cert_name)
|
1399
1531
|
cert_file = cert_path cert_name
|
1400
1532
|
|
1401
1533
|
cert = File.read cert_file
|
@@ -1407,90 +1539,111 @@ Also, a list:
|
|
1407
1539
|
# Returns the path to the certificate named +cert_name+ from
|
1408
1540
|
# <tt>test/rubygems/</tt>.
|
1409
1541
|
|
1410
|
-
def self.cert_path
|
1411
|
-
if 32 ==
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1542
|
+
def self.cert_path(cert_name)
|
1543
|
+
if 32 == begin
|
1544
|
+
Time.at(2**32)
|
1545
|
+
rescue StandardError
|
1546
|
+
32
|
1547
|
+
end
|
1548
|
+
cert_file = "#{__dir__}/#{cert_name}_cert_32.pem"
|
1415
1549
|
|
1416
1550
|
return cert_file if File.exist? cert_file
|
1417
1551
|
end
|
1418
1552
|
|
1419
|
-
|
1553
|
+
"#{__dir__}/#{cert_name}_cert.pem"
|
1420
1554
|
end
|
1421
1555
|
|
1422
1556
|
##
|
1423
|
-
# Loads
|
1557
|
+
# Loads a private key named +key_name+ with +passphrase+ in <tt>test/rubygems/</tt>
|
1424
1558
|
|
1425
|
-
def self.load_key
|
1559
|
+
def self.load_key(key_name, passphrase = nil)
|
1426
1560
|
key_file = key_path key_name
|
1427
1561
|
|
1428
1562
|
key = File.read key_file
|
1429
1563
|
|
1430
|
-
OpenSSL::PKey
|
1564
|
+
OpenSSL::PKey.read key, passphrase
|
1431
1565
|
end
|
1432
1566
|
|
1433
1567
|
##
|
1434
1568
|
# Returns the path to the key named +key_name+ from <tt>test/rubygems</tt>
|
1435
1569
|
|
1436
|
-
def self.key_path
|
1437
|
-
|
1570
|
+
def self.key_path(key_name)
|
1571
|
+
"#{__dir__}/#{key_name}_key.pem"
|
1438
1572
|
end
|
1439
1573
|
|
1440
1574
|
# :stopdoc:
|
1441
1575
|
# only available in RubyGems tests
|
1442
1576
|
|
1443
|
-
PRIVATE_KEY_PASSPHRASE
|
1577
|
+
PRIVATE_KEY_PASSPHRASE = "Foo bar"
|
1444
1578
|
|
1445
1579
|
begin
|
1446
|
-
PRIVATE_KEY = load_key
|
1447
|
-
PRIVATE_KEY_PATH = key_path
|
1580
|
+
PRIVATE_KEY = load_key "private"
|
1581
|
+
PRIVATE_KEY_PATH = key_path "private"
|
1448
1582
|
|
1449
1583
|
# ENCRYPTED_PRIVATE_KEY is PRIVATE_KEY encrypted with PRIVATE_KEY_PASSPHRASE
|
1450
|
-
ENCRYPTED_PRIVATE_KEY = load_key
|
1451
|
-
ENCRYPTED_PRIVATE_KEY_PATH = key_path
|
1584
|
+
ENCRYPTED_PRIVATE_KEY = load_key "encrypted_private", PRIVATE_KEY_PASSPHRASE
|
1585
|
+
ENCRYPTED_PRIVATE_KEY_PATH = key_path "encrypted_private"
|
1452
1586
|
|
1453
1587
|
PUBLIC_KEY = PRIVATE_KEY.public_key
|
1454
1588
|
|
1455
|
-
PUBLIC_CERT = load_cert
|
1456
|
-
PUBLIC_CERT_PATH = cert_path
|
1589
|
+
PUBLIC_CERT = load_cert "public"
|
1590
|
+
PUBLIC_CERT_PATH = cert_path "public"
|
1457
1591
|
rescue Errno::ENOENT
|
1458
1592
|
PRIVATE_KEY = nil
|
1459
1593
|
PUBLIC_KEY = nil
|
1460
1594
|
PUBLIC_CERT = nil
|
1461
|
-
end if
|
1595
|
+
end if Gem::HAVE_OPENSSL
|
1462
1596
|
|
1463
|
-
|
1597
|
+
private
|
1464
1598
|
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
end
|
1599
|
+
def restore_env
|
1600
|
+
unless Gem.win_platform?
|
1601
|
+
ENV.replace(@orig_env)
|
1602
|
+
return
|
1603
|
+
end
|
1471
1604
|
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
end
|
1605
|
+
# Fallback logic for Windows below to workaround
|
1606
|
+
# https://bugs.ruby-lang.org/issues/16798. Can be dropped once all
|
1607
|
+
# supported rubies include the fix for that.
|
1476
1608
|
|
1477
|
-
|
1478
|
-
gem 'rdoc'
|
1479
|
-
require 'rdoc'
|
1480
|
-
rescue LoadError, Gem::LoadError
|
1481
|
-
end
|
1609
|
+
ENV.clear
|
1482
1610
|
|
1483
|
-
|
1484
|
-
|
1485
|
-
require 'builder/xchar'
|
1486
|
-
rescue LoadError, Gem::LoadError
|
1611
|
+
@orig_env.each {|k, v| ENV[k] = v }
|
1612
|
+
end
|
1487
1613
|
end
|
1488
1614
|
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1615
|
+
# https://github.com/seattlerb/minitest/blob/13c48a03d84a2a87855a4de0c959f96800100357/lib/minitest/mock.rb#L192
|
1616
|
+
class Object
|
1617
|
+
def stub(name, val_or_callable, *block_args)
|
1618
|
+
new_name = "__minitest_stub__#{name}"
|
1619
|
+
|
1620
|
+
metaclass = class << self; self; end
|
1621
|
+
|
1622
|
+
if respond_to?(name) && !methods.map(&:to_s).include?(name.to_s)
|
1623
|
+
metaclass.send :define_method, name do |*args|
|
1624
|
+
super(*args)
|
1625
|
+
end
|
1626
|
+
end
|
1627
|
+
|
1628
|
+
metaclass.send :alias_method, new_name, name
|
1629
|
+
|
1630
|
+
metaclass.send :define_method, name do |*args, &blk|
|
1631
|
+
if val_or_callable.respond_to? :call
|
1632
|
+
val_or_callable.call(*args, &blk)
|
1633
|
+
else
|
1634
|
+
blk&.call(*block_args)
|
1635
|
+
val_or_callable
|
1636
|
+
end
|
1637
|
+
end
|
1638
|
+
|
1639
|
+
metaclass.send(:ruby2_keywords, name) if metaclass.respond_to?(:ruby2_keywords, true)
|
1640
|
+
|
1641
|
+
yield self
|
1642
|
+
ensure
|
1643
|
+
metaclass.send :undef_method, name
|
1644
|
+
metaclass.send :alias_method, name, new_name
|
1645
|
+
metaclass.send :undef_method, new_name
|
1646
|
+
end unless method_defined?(:stub) # lib/resolv/test_dns.rb also has the same method definition
|
1647
|
+
end
|
1496
1648
|
|
1649
|
+
require_relative "utilities"
|