rubygems-update 3.0.3 → 3.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5556 -0
- data/CODE_OF_CONDUCT.md +62 -24
- data/CONTRIBUTING.md +111 -21
- data/MAINTAINERS.txt +1 -6
- data/Manifest.txt +209 -101
- data/POLICIES.md +65 -22
- data/README.md +23 -15
- data/UPGRADING.md +5 -81
- data/bin/gem +2 -16
- data/bin/update_rubygems +5 -5
- data/bundler/CHANGELOG.md +2619 -1256
- data/bundler/LICENSE.md +18 -19
- data/bundler/README.md +11 -12
- data/bundler/UPGRADING.md +222 -0
- data/bundler/bundler.gemspec +13 -33
- data/bundler/exe/bundle +26 -11
- data/bundler/exe/bundler +1 -1
- data/bundler/lib/bundler/.document +1 -0
- data/bundler/lib/bundler/build_metadata.rb +5 -13
- data/bundler/lib/bundler/capistrano.rb +4 -4
- data/bundler/lib/bundler/cli/add.rb +28 -16
- data/bundler/lib/bundler/cli/binstubs.rb +11 -3
- data/bundler/lib/bundler/cli/cache.rb +24 -17
- data/bundler/lib/bundler/cli/check.rb +5 -3
- data/bundler/lib/bundler/cli/clean.rb +1 -1
- data/bundler/lib/bundler/cli/common.rb +41 -13
- data/bundler/lib/bundler/cli/config.rb +170 -86
- data/bundler/lib/bundler/cli/console.rb +3 -3
- data/bundler/lib/bundler/cli/doctor.rb +27 -10
- data/bundler/lib/bundler/cli/exec.rb +8 -25
- data/bundler/lib/bundler/cli/fund.rb +36 -0
- data/bundler/lib/bundler/cli/gem.rb +261 -48
- data/bundler/lib/bundler/cli/info.rb +52 -8
- data/bundler/lib/bundler/cli/init.rb +7 -3
- data/bundler/lib/bundler/cli/inject.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +38 -66
- data/bundler/lib/bundler/cli/issue.rb +8 -7
- data/bundler/lib/bundler/cli/list.rb +19 -11
- data/bundler/lib/bundler/cli/lock.rb +11 -4
- data/bundler/lib/bundler/cli/open.rb +14 -9
- data/bundler/lib/bundler/cli/outdated.rb +152 -121
- data/bundler/lib/bundler/cli/platform.rb +2 -2
- data/bundler/lib/bundler/cli/plugin.rb +19 -2
- data/bundler/lib/bundler/cli/pristine.rb +6 -1
- data/bundler/lib/bundler/cli/remove.rb +1 -2
- data/bundler/lib/bundler/cli/show.rb +3 -3
- data/bundler/lib/bundler/cli/update.rb +49 -18
- data/bundler/lib/bundler/cli/viz.rb +1 -1
- data/bundler/lib/bundler/cli.rb +269 -165
- data/bundler/lib/bundler/compact_index_client/cache.rb +7 -24
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +58 -57
- data/bundler/lib/bundler/compact_index_client.rb +28 -18
- data/bundler/lib/bundler/constants.rb +1 -1
- data/bundler/lib/bundler/current_ruby.rb +26 -11
- data/bundler/lib/bundler/definition.rb +359 -441
- data/bundler/lib/bundler/dependency.rb +29 -71
- data/bundler/lib/bundler/deployment.rb +1 -1
- data/bundler/lib/bundler/digest.rb +71 -0
- data/bundler/lib/bundler/dsl.rb +84 -116
- data/bundler/lib/bundler/endpoint_specification.rb +20 -14
- data/bundler/lib/bundler/env.rb +10 -15
- data/bundler/lib/bundler/environment_preserver.rb +30 -3
- data/bundler/lib/bundler/errors.rb +31 -14
- data/bundler/lib/bundler/feature_flag.rb +13 -33
- data/bundler/lib/bundler/fetcher/base.rb +7 -9
- data/bundler/lib/bundler/fetcher/compact_index.rb +46 -39
- data/bundler/lib/bundler/fetcher/dependency.rb +2 -2
- data/bundler/lib/bundler/fetcher/downloader.rb +15 -12
- data/bundler/lib/bundler/fetcher/index.rb +4 -30
- data/bundler/lib/bundler/fetcher.rb +39 -41
- data/bundler/lib/bundler/force_platform.rb +18 -0
- data/bundler/lib/bundler/friendly_errors.rb +49 -54
- data/bundler/lib/bundler/gem_helper.rb +79 -43
- data/bundler/lib/bundler/gem_helpers.rb +44 -28
- data/bundler/lib/bundler/gem_tasks.rb +1 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +54 -99
- data/bundler/lib/bundler/graph.rb +5 -5
- data/bundler/lib/bundler/index.rb +14 -52
- data/bundler/lib/bundler/injector.rb +50 -16
- data/bundler/lib/bundler/inline.rb +28 -29
- data/bundler/lib/bundler/installer/gem_installer.rb +22 -23
- data/bundler/lib/bundler/installer/parallel_installer.rb +51 -51
- data/bundler/lib/bundler/installer/standalone.rb +62 -12
- data/bundler/lib/bundler/installer.rb +46 -97
- data/bundler/lib/bundler/lazy_specification.rb +88 -48
- data/bundler/lib/bundler/lockfile_generator.rb +3 -3
- data/bundler/lib/bundler/lockfile_parser.rb +30 -62
- data/bundler/{man → lib/bundler/man}/bundle-add.1 +29 -5
- data/bundler/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +22 -4
- data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +6 -4
- data/bundler/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
- data/bundler/lib/bundler/man/bundle-cache.1 +61 -0
- data/bundler/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +22 -15
- data/bundler/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-clean.1 +2 -2
- data/bundler/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-config.1 +78 -60
- data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +96 -85
- data/bundler/lib/bundler/man/bundle-console.1 +53 -0
- data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-exec.1 +6 -6
- data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +6 -6
- data/bundler/lib/bundler/man/bundle-gem.1 +105 -0
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +117 -0
- data/bundler/lib/bundler/man/bundle-help.1 +13 -0
- data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/bundler/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-init.1 +6 -2
- data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +3 -1
- data/bundler/{man → lib/bundler/man}/bundle-inject.1 +5 -2
- data/bundler/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
- data/bundler/{man → lib/bundler/man}/bundle-install.1 +42 -37
- data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +42 -38
- data/bundler/{man → lib/bundler/man}/bundle-list.1 +7 -7
- data/bundler/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
- data/bundler/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-open.1 +22 -2
- data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +9 -1
- data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +3 -10
- data/bundler/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +1 -10
- data/bundler/{man → lib/bundler/man}/bundle-platform.1 +16 -6
- data/bundler/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
- data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/bundler/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-update.1 +8 -8
- data/bundler/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +8 -7
- data/bundler/lib/bundler/man/bundle-version.1 +35 -0
- data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/bundler/{man → lib/bundler/man}/bundle-viz.1 +4 -1
- data/bundler/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +2 -0
- data/bundler/{man → lib/bundler/man}/bundle.1 +17 -12
- data/bundler/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +14 -9
- data/bundler/lib/bundler/man/gemfile.5 +723 -0
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +112 -95
- data/bundler/lib/bundler/man/index.txt +29 -0
- data/bundler/lib/bundler/match_metadata.rb +13 -0
- data/bundler/lib/bundler/match_platform.rb +1 -2
- data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
- data/bundler/lib/bundler/mirror.rb +10 -12
- data/bundler/lib/bundler/plugin/api/source.rb +29 -15
- data/bundler/lib/bundler/plugin/api.rb +1 -1
- data/bundler/lib/bundler/plugin/dsl.rb +1 -1
- data/bundler/lib/bundler/plugin/index.rb +31 -8
- data/bundler/lib/bundler/plugin/installer/git.rb +0 -4
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -9
- data/bundler/lib/bundler/plugin/installer.rb +35 -22
- data/bundler/lib/bundler/plugin/source_list.rb +5 -1
- data/bundler/lib/bundler/plugin.rb +102 -42
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/remote_specification.rb +15 -8
- data/bundler/lib/bundler/resolver/base.rb +77 -0
- data/bundler/lib/bundler/resolver/candidate.rb +94 -0
- data/bundler/lib/bundler/resolver/incompatibility.rb +15 -0
- data/bundler/lib/bundler/resolver/package.rb +72 -0
- data/bundler/lib/bundler/resolver/root.rb +25 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +49 -73
- data/bundler/lib/bundler/resolver.rb +343 -300
- data/bundler/lib/bundler/retry.rb +4 -4
- data/bundler/lib/bundler/ruby_dsl.rb +1 -1
- data/bundler/lib/bundler/ruby_version.rb +9 -37
- data/bundler/lib/bundler/rubygems_ext.rb +235 -92
- data/bundler/lib/bundler/rubygems_gem_installer.rb +87 -21
- data/bundler/lib/bundler/rubygems_integration.rb +179 -515
- data/bundler/lib/bundler/runtime.rb +25 -40
- data/bundler/lib/bundler/self_manager.rb +168 -0
- data/bundler/lib/bundler/settings.rb +162 -118
- data/bundler/lib/bundler/setup.rb +11 -12
- data/bundler/lib/bundler/shared_helpers.rb +61 -102
- data/bundler/lib/bundler/similarity_detector.rb +3 -3
- data/bundler/lib/bundler/source/git/git_proxy.rb +257 -128
- data/bundler/lib/bundler/source/git.rb +84 -61
- data/bundler/lib/bundler/source/metadata.rb +9 -9
- data/bundler/lib/bundler/source/path/installer.rb +11 -32
- data/bundler/lib/bundler/source/path.rb +28 -17
- data/bundler/lib/bundler/source/rubygems/remote.rb +3 -4
- data/bundler/lib/bundler/source/rubygems.rb +171 -197
- data/bundler/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/bundler/lib/bundler/source.rb +30 -10
- data/bundler/lib/bundler/source_list.rb +112 -67
- data/bundler/lib/bundler/source_map.rb +71 -0
- data/bundler/lib/bundler/spec_set.rb +86 -72
- data/bundler/lib/bundler/stub_specification.rb +45 -37
- data/bundler/lib/bundler/templates/Executable +3 -5
- data/bundler/lib/bundler/templates/Executable.bundler +21 -17
- data/bundler/lib/bundler/templates/Executable.standalone +4 -4
- data/bundler/lib/bundler/templates/Gemfile +0 -2
- data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
- data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +22 -2
- data/bundler/lib/bundler/templates/newgem/README.md.tt +13 -15
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +33 -5
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +2 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
- data/bundler/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +36 -41
- data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
- data/bundler/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
- data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/ui/rg_proxy.rb +1 -1
- data/bundler/lib/bundler/ui/shell.rb +39 -20
- data/bundler/lib/bundler/ui/silent.rb +21 -5
- data/bundler/lib/bundler/ui.rb +3 -3
- data/bundler/lib/bundler/uri_credentials_filter.rb +10 -4
- data/bundler/lib/bundler/vendor/.document +1 -0
- data/bundler/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +128 -0
- data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1493 -425
- data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
- data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +155 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +243 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/bundler/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +25 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +20 -10
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +34 -15
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +83 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +40 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +88 -13
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +5 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +16 -9
- data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
- data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +729 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +100 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1587 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +125 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +293 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +539 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +119 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/bundler/lib/bundler/vendored_fileutils.rb +1 -6
- data/bundler/lib/bundler/vendored_persistent.rb +2 -39
- data/bundler/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
- data/bundler/lib/bundler/vendored_thor.rb +2 -2
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/vendored_uri.rb +4 -0
- data/bundler/lib/bundler/version.rb +5 -20
- data/bundler/lib/bundler/vlad.rb +2 -2
- data/bundler/lib/bundler/worker.rb +26 -15
- data/bundler/lib/bundler/yaml_serializer.rb +3 -4
- data/bundler/lib/bundler.rb +285 -183
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/available_set.rb +7 -8
- data/lib/rubygems/basic_specification.rb +44 -31
- data/lib/rubygems/bundler_version_finder.rb +28 -50
- data/lib/rubygems/command.rb +104 -46
- data/lib/rubygems/command_manager.rb +35 -16
- data/lib/rubygems/commands/build_command.rb +77 -26
- data/lib/rubygems/commands/cert_command.rb +78 -76
- data/lib/rubygems/commands/check_command.rb +20 -22
- data/lib/rubygems/commands/cleanup_command.rb +36 -32
- data/lib/rubygems/commands/contents_command.rb +16 -18
- data/lib/rubygems/commands/dependency_command.rb +39 -50
- data/lib/rubygems/commands/environment_command.rb +11 -13
- data/lib/rubygems/commands/fetch_command.rb +33 -16
- data/lib/rubygems/commands/generate_index_command.rb +18 -17
- data/lib/rubygems/commands/help_command.rb +7 -7
- data/lib/rubygems/commands/info_command.rb +11 -6
- data/lib/rubygems/commands/install_command.rb +45 -79
- data/lib/rubygems/commands/list_command.rb +9 -8
- data/lib/rubygems/commands/lock_command.rb +7 -9
- data/lib/rubygems/commands/mirror_command.rb +3 -4
- data/lib/rubygems/commands/open_command.rb +11 -14
- data/lib/rubygems/commands/outdated_command.rb +5 -6
- data/lib/rubygems/commands/owner_command.rb +29 -22
- data/lib/rubygems/commands/pristine_command.rb +61 -51
- data/lib/rubygems/commands/push_command.rb +26 -63
- data/lib/rubygems/commands/query_command.rb +21 -337
- data/lib/rubygems/commands/rdoc_command.rb +26 -26
- data/lib/rubygems/commands/search_command.rb +8 -8
- data/lib/rubygems/commands/server_command.rb +16 -77
- data/lib/rubygems/commands/setup_command.rb +282 -241
- data/lib/rubygems/commands/signin_command.rb +9 -10
- data/lib/rubygems/commands/signout_command.rb +7 -9
- data/lib/rubygems/commands/sources_command.rb +42 -26
- data/lib/rubygems/commands/specification_command.rb +25 -20
- data/lib/rubygems/commands/stale_command.rb +3 -3
- data/lib/rubygems/commands/uninstall_command.rb +58 -49
- data/lib/rubygems/commands/unpack_command.rb +15 -44
- data/lib/rubygems/commands/update_command.rb +133 -81
- data/lib/rubygems/commands/which_command.rb +8 -11
- data/lib/rubygems/commands/yank_command.rb +22 -19
- data/lib/rubygems/compatibility.rb +7 -5
- data/lib/rubygems/config_file.rb +101 -47
- data/lib/rubygems/core_ext/kernel_gem.rb +8 -12
- data/lib/rubygems/core_ext/kernel_require.rb +124 -83
- data/lib/rubygems/core_ext/kernel_warn.rb +35 -30
- data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
- data/lib/rubygems/defaults.rb +131 -55
- data/lib/rubygems/dependency.rb +44 -27
- data/lib/rubygems/dependency_installer.rb +49 -205
- data/lib/rubygems/dependency_list.rb +24 -25
- data/lib/rubygems/deprecate.rb +106 -12
- data/lib/rubygems/doctor.rb +22 -22
- data/lib/rubygems/errors.rb +8 -14
- data/lib/rubygems/exceptions.rb +35 -33
- data/lib/rubygems/ext/build_error.rb +2 -0
- data/lib/rubygems/ext/builder.rb +71 -95
- data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +27 -0
- data/lib/rubygems/ext/cargo_builder.rb +360 -0
- data/lib/rubygems/ext/cmake_builder.rb +6 -7
- data/lib/rubygems/ext/configure_builder.rb +5 -8
- data/lib/rubygems/ext/ext_conf_builder.rb +45 -65
- data/lib/rubygems/ext/rake_builder.rb +7 -10
- data/lib/rubygems/ext.rb +7 -6
- data/lib/rubygems/gem_runner.rb +15 -26
- data/lib/rubygems/gemcutter_utilities.rb +179 -54
- data/lib/rubygems/indexer.rb +38 -53
- data/lib/rubygems/install_default_message.rb +2 -2
- data/lib/rubygems/install_message.rb +2 -2
- data/lib/rubygems/install_update_options.rb +73 -64
- data/lib/rubygems/installer.rb +230 -173
- data/lib/rubygems/installer_uninstaller_utils.rb +29 -0
- data/lib/rubygems/local_remote_options.rb +22 -24
- data/lib/rubygems/mock_gem_ui.rb +2 -5
- data/lib/rubygems/name_tuple.rb +10 -14
- data/lib/rubygems/openssl.rb +7 -0
- data/lib/rubygems/optparse/.document +1 -0
- data/lib/rubygems/optparse/COPYING +56 -0
- data/lib/rubygems/optparse/lib/optionparser.rb +2 -0
- data/lib/rubygems/optparse/lib/optparse/ac.rb +54 -0
- data/lib/rubygems/optparse/lib/optparse/date.rb +18 -0
- data/lib/rubygems/optparse/lib/optparse/kwargs.rb +22 -0
- data/lib/rubygems/optparse/lib/optparse/shellwords.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/time.rb +11 -0
- data/lib/rubygems/optparse/lib/optparse/uri.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/version.rb +71 -0
- data/lib/rubygems/optparse/lib/optparse.rb +2308 -0
- data/lib/rubygems/optparse.rb +3 -0
- data/lib/rubygems/package/digest_io.rb +0 -2
- data/lib/rubygems/package/file_source.rb +2 -4
- data/lib/rubygems/package/io_source.rb +4 -2
- data/lib/rubygems/package/old.rb +9 -11
- data/lib/rubygems/package/tar_header.rb +73 -66
- data/lib/rubygems/package/tar_reader/entry.rb +8 -9
- data/lib/rubygems/package/tar_reader.rb +16 -13
- data/lib/rubygems/package/tar_writer.rb +12 -22
- data/lib/rubygems/package.rb +142 -125
- data/lib/rubygems/package_task.rb +5 -11
- data/lib/rubygems/path_support.rb +3 -8
- data/lib/rubygems/platform.rb +113 -73
- data/lib/rubygems/psych_tree.rb +1 -1
- data/lib/rubygems/query_utils.rb +351 -0
- data/lib/rubygems/rdoc.rb +4 -16
- data/lib/rubygems/remote_fetcher.rb +64 -136
- data/lib/rubygems/request/connection_pools.rb +7 -11
- data/lib/rubygems/request/http_pool.rb +2 -3
- data/lib/rubygems/request.rb +31 -32
- data/lib/rubygems/request_set/gem_dependency_api.rb +135 -136
- data/lib/rubygems/request_set/lockfile/parser.rb +28 -28
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +5 -5
- data/lib/rubygems/request_set/lockfile.rb +21 -20
- data/lib/rubygems/request_set.rb +30 -43
- data/lib/rubygems/requirement.rb +42 -64
- data/lib/rubygems/resolver/activation_request.rb +29 -53
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_set.rb +33 -26
- data/lib/rubygems/resolver/api_specification.rb +30 -16
- data/lib/rubygems/resolver/best_set.rb +9 -11
- data/lib/rubygems/resolver/composed_set.rb +3 -5
- data/lib/rubygems/resolver/conflict.rb +12 -19
- data/lib/rubygems/resolver/current_set.rb +0 -2
- data/lib/rubygems/resolver/dependency_request.rb +3 -5
- data/lib/rubygems/resolver/git_set.rb +2 -4
- data/lib/rubygems/resolver/git_specification.rb +6 -8
- data/lib/rubygems/resolver/index_set.rb +4 -6
- data/lib/rubygems/resolver/index_specification.rb +38 -7
- data/lib/rubygems/resolver/installed_specification.rb +4 -6
- data/lib/rubygems/resolver/installer_set.rb +69 -27
- data/lib/rubygems/resolver/local_specification.rb +2 -4
- data/lib/rubygems/resolver/lock_set.rb +7 -9
- data/lib/rubygems/resolver/lock_specification.rb +6 -8
- data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +8 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +51 -12
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +42 -9
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +82 -8
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +13 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +510 -165
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- data/lib/rubygems/resolver/molinillo.rb +1 -1
- data/lib/rubygems/resolver/requirement_list.rb +0 -1
- data/lib/rubygems/resolver/set.rb +0 -3
- data/lib/rubygems/resolver/source_set.rb +0 -2
- data/lib/rubygems/resolver/spec_specification.rb +14 -2
- data/lib/rubygems/resolver/specification.rb +14 -3
- data/lib/rubygems/resolver/vendor_set.rb +1 -3
- data/lib/rubygems/resolver/vendor_specification.rb +3 -5
- data/lib/rubygems/resolver.rb +58 -54
- data/lib/rubygems/s3_uri_signer.rb +175 -0
- data/lib/rubygems/safe_yaml.rb +14 -16
- data/lib/rubygems/security/policies.rb +47 -47
- data/lib/rubygems/security/policy.rb +25 -29
- data/lib/rubygems/security/signer.rb +16 -18
- data/lib/rubygems/security/trust_dir.rb +5 -6
- data/lib/rubygems/security.rb +90 -69
- data/lib/rubygems/security_option.rb +7 -8
- data/lib/rubygems/source/git.rb +30 -30
- data/lib/rubygems/source/installed.rb +1 -3
- data/lib/rubygems/source/local.rb +4 -6
- data/lib/rubygems/source/lock.rb +0 -2
- data/lib/rubygems/source/specific_file.rb +1 -3
- data/lib/rubygems/source/vendor.rb +0 -2
- data/lib/rubygems/source.rb +50 -38
- data/lib/rubygems/source_list.rb +9 -13
- data/lib/rubygems/spec_fetcher.rb +52 -64
- data/lib/rubygems/specification.rb +432 -463
- data/lib/rubygems/specification_policy.rb +185 -87
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +24 -29
- data/lib/rubygems/text.rb +21 -21
- data/lib/rubygems/tsort/.document +1 -0
- data/lib/rubygems/tsort/LICENSE.txt +22 -0
- data/lib/rubygems/tsort/lib/tsort.rb +452 -0
- data/lib/rubygems/tsort.rb +3 -0
- data/lib/rubygems/uninstaller.rb +110 -57
- data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
- data/lib/rubygems/update_suggestion.rb +69 -0
- data/lib/rubygems/uri.rb +126 -0
- data/lib/rubygems/uri_formatter.rb +2 -4
- data/lib/rubygems/user_interaction.rb +46 -49
- data/lib/rubygems/util/licenses.rb +511 -404
- data/lib/rubygems/util.rb +40 -56
- data/lib/rubygems/validator.rb +15 -37
- data/lib/rubygems/version.rb +48 -29
- data/lib/rubygems/version_option.rb +11 -5
- data/lib/rubygems.rb +305 -332
- data/rubygems-update.gemspec +6 -13
- data/setup.rb +11 -22
- data/test/rubygems/alternate_cert.pem +14 -14
- data/test/rubygems/alternate_cert_32.pem +15 -15
- data/test/rubygems/alternate_key.pem +25 -25
- data/test/rubygems/bundler_test_gem.rb +419 -0
- data/test/rubygems/ca_cert.pem +74 -65
- data/test/rubygems/child_cert.pem +15 -16
- data/test/rubygems/child_cert_32.pem +15 -16
- data/test/rubygems/child_key.pem +25 -25
- data/test/rubygems/client.pem +103 -45
- data/test/rubygems/data/excon-0.7.7.gemspec.rz +0 -0
- data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
- data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
- data/test/rubygems/data/pry-0.4.7.gemspec.rz +0 -0
- data/test/rubygems/encrypted_private_key.pem +26 -26
- data/test/rubygems/expired_cert.pem +15 -15
- data/test/rubygems/future_cert.pem +15 -15
- data/test/rubygems/future_cert_32.pem +15 -15
- data/test/rubygems/grandchild_cert.pem +15 -16
- data/test/rubygems/grandchild_cert_32.pem +15 -16
- data/test/rubygems/grandchild_key.pem +25 -25
- data/{lib/rubygems/test_case.rb → test/rubygems/helper.rb} +505 -507
- data/{lib → test}/rubygems/installer_test_case.rb +115 -53
- data/test/rubygems/invalid_issuer_cert.pem +16 -16
- data/test/rubygems/invalid_issuer_cert_32.pem +16 -16
- data/test/rubygems/invalid_key.pem +25 -25
- data/test/rubygems/invalid_signer_cert.pem +15 -15
- data/test/rubygems/invalid_signer_cert_32.pem +15 -15
- data/test/rubygems/invalidchild_cert.pem +15 -16
- data/test/rubygems/invalidchild_cert_32.pem +15 -16
- data/test/rubygems/invalidchild_key.pem +25 -25
- data/{lib → test}/rubygems/package/tar_test_case.rb +4 -6
- data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
- data/test/rubygems/packages/ascii_binder-0.1.10.1.gem +0 -0
- data/test/rubygems/packages/ill-formatted-platform-1.0.0.10.gem +0 -0
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
- data/test/rubygems/private_ec_key.pem +9 -0
- data/test/rubygems/private_key.pem +25 -25
- data/test/rubygems/public_cert.pem +16 -16
- data/test/rubygems/public_cert_32.pem +15 -15
- data/test/rubygems/public_key.pem +7 -7
- data/test/rubygems/rubygems/commands/crash_command.rb +0 -2
- data/test/rubygems/rubygems_plugin.rb +2 -4
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +12 -0
- data/test/rubygems/ssl_cert.pem +78 -17
- data/test/rubygems/ssl_key.pem +25 -13
- data/test/rubygems/test_bundled_ca.rb +44 -47
- data/test/rubygems/test_config.rb +5 -7
- data/test/rubygems/test_deprecate.rb +90 -10
- data/test/rubygems/test_exit.rb +17 -0
- data/test/rubygems/test_gem.rb +679 -885
- data/test/rubygems/test_gem_available_set.rb +24 -25
- data/test/rubygems/test_gem_bundler_version_finder.rb +42 -42
- data/test/rubygems/test_gem_command.rb +186 -39
- data/test/rubygems/test_gem_command_manager.rb +166 -36
- data/test/rubygems/test_gem_commands_build_command.rb +436 -52
- data/test/rubygems/test_gem_commands_cert_command.rb +193 -124
- data/test/rubygems/test_gem_commands_check_command.rb +9 -11
- data/test/rubygems/test_gem_commands_cleanup_command.rb +87 -62
- data/test/rubygems/test_gem_commands_contents_command.rb +73 -42
- data/test/rubygems/test_gem_commands_dependency_command.rb +39 -41
- data/test/rubygems/test_gem_commands_environment_command.rb +60 -48
- data/test/rubygems/test_gem_commands_fetch_command.rb +163 -32
- data/test/rubygems/test_gem_commands_generate_index_command.rb +39 -9
- data/test/rubygems/test_gem_commands_help_command.rb +34 -19
- data/test/rubygems/test_gem_commands_info_command.rb +34 -9
- data/test/rubygems/test_gem_commands_install_command.rb +600 -173
- data/test/rubygems/test_gem_commands_list_command.rb +5 -7
- data/test/rubygems/test_gem_commands_lock_command.rb +11 -13
- data/test/rubygems/test_gem_commands_mirror.rb +3 -4
- data/test/rubygems/test_gem_commands_open_command.rb +16 -19
- data/test/rubygems/test_gem_commands_outdated_command.rb +24 -7
- data/test/rubygems/test_gem_commands_owner_command.rb +183 -49
- data/test/rubygems/test_gem_commands_pristine_command.rb +222 -89
- data/test/rubygems/test_gem_commands_push_command.rb +178 -69
- data/test/rubygems/test_gem_commands_query_command.rb +114 -89
- data/test/rubygems/test_gem_commands_search_command.rb +2 -4
- data/test/rubygems/test_gem_commands_server_command.rb +6 -46
- data/test/rubygems/test_gem_commands_setup_command.rb +334 -157
- data/test/rubygems/test_gem_commands_signin_command.rb +187 -27
- data/test/rubygems/test_gem_commands_signout_command.rb +3 -10
- data/test/rubygems/test_gem_commands_sources_command.rb +266 -33
- data/test/rubygems/test_gem_commands_specification_command.rb +81 -55
- data/test/rubygems/test_gem_commands_stale_command.rb +4 -6
- data/test/rubygems/test_gem_commands_uninstall_command.rb +230 -95
- data/test/rubygems/test_gem_commands_unpack_command.rb +32 -34
- data/test/rubygems/test_gem_commands_update_command.rb +412 -102
- data/test/rubygems/test_gem_commands_which_command.rb +12 -14
- data/test/rubygems/test_gem_commands_yank_command.rb +107 -26
- data/test/rubygems/test_gem_config_file.rb +120 -96
- data/test/rubygems/test_gem_dependency.rb +94 -86
- data/test/rubygems/test_gem_dependency_installer.rb +305 -388
- data/test/rubygems/test_gem_dependency_list.rb +66 -61
- data/test/rubygems/test_gem_dependency_resolution_error.rb +5 -7
- data/test/rubygems/test_gem_doctor.rb +73 -47
- data/test/rubygems/test_gem_ext_builder.rb +116 -106
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +8 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock +233 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/src/lib.rs +27 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +233 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec +8 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +51 -0
- data/test/rubygems/test_gem_ext_cargo_builder.rb +166 -0
- data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +33 -0
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +60 -0
- data/test/rubygems/test_gem_ext_cmake_builder.rb +32 -37
- data/test/rubygems/test_gem_ext_configure_builder.rb +23 -31
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +75 -79
- data/test/rubygems/test_gem_ext_rake_builder.rb +49 -30
- data/test/rubygems/test_gem_gem_runner.rb +52 -7
- data/test/rubygems/test_gem_gemcutter_utilities.rb +91 -76
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -6
- data/test/rubygems/test_gem_indexer.rb +120 -105
- data/test/rubygems/test_gem_install_update_options.rb +57 -33
- data/test/rubygems/test_gem_installer.rb +1230 -644
- data/test/rubygems/test_gem_local_remote_options.rb +11 -13
- data/test/rubygems/test_gem_name_tuple.rb +4 -6
- data/test/rubygems/test_gem_package.rb +396 -266
- data/test/rubygems/test_gem_package_old.rb +57 -56
- data/test/rubygems/test_gem_package_tar_header.rb +108 -50
- data/test/rubygems/test_gem_package_tar_reader.rb +8 -10
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +77 -20
- data/test/rubygems/test_gem_package_tar_writer.rb +107 -101
- data/test/rubygems/test_gem_package_task.rb +58 -25
- data/test/rubygems/test_gem_path_support.rb +29 -29
- data/test/rubygems/test_gem_platform.rb +388 -199
- data/test/rubygems/test_gem_rdoc.rb +20 -155
- data/test/rubygems/test_gem_remote_fetcher.rb +474 -303
- data/test/rubygems/test_gem_request.rb +128 -85
- data/test/rubygems/test_gem_request_connection_pools.rb +32 -32
- data/test/rubygems/test_gem_request_set.rb +186 -110
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +280 -261
- data/test/rubygems/test_gem_request_set_lockfile.rb +93 -94
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +68 -69
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +136 -136
- data/test/rubygems/test_gem_requirement.rb +140 -55
- data/test/rubygems/test_gem_resolver.rb +224 -115
- data/test/rubygems/test_gem_resolver_activation_request.rb +9 -40
- data/test/rubygems/test_gem_resolver_api_set.rb +79 -78
- data/test/rubygems/test_gem_resolver_api_specification.rb +47 -49
- data/test/rubygems/test_gem_resolver_best_set.rb +43 -22
- data/test/rubygems/test_gem_resolver_composed_set.rb +1 -3
- data/test/rubygems/test_gem_resolver_conflict.rb +12 -18
- data/test/rubygems/test_gem_resolver_dependency_request.rb +15 -17
- data/test/rubygems/test_gem_resolver_git_set.rb +22 -24
- data/test/rubygems/test_gem_resolver_git_specification.rb +22 -22
- data/test/rubygems/test_gem_resolver_index_set.rb +14 -16
- data/test/rubygems/test_gem_resolver_index_specification.rb +21 -18
- data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -8
- data/test/rubygems/test_gem_resolver_installer_set.rb +106 -44
- data/test/rubygems/test_gem_resolver_local_specification.rb +7 -9
- data/test/rubygems/test_gem_resolver_lock_set.rb +15 -17
- data/test/rubygems/test_gem_resolver_lock_specification.rb +17 -19
- data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -3
- data/test/rubygems/test_gem_resolver_specification.rb +8 -10
- data/test/rubygems/test_gem_resolver_vendor_set.rb +9 -11
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +10 -12
- data/test/rubygems/test_gem_security.rb +109 -79
- data/test/rubygems/test_gem_security_policy.rb +102 -107
- data/test/rubygems/test_gem_security_signer.rb +51 -52
- data/test/rubygems/test_gem_security_trust_dir.rb +14 -16
- data/test/rubygems/test_gem_silent_ui.rb +47 -42
- data/test/rubygems/test_gem_source.rb +66 -51
- data/test/rubygems/test_gem_source_fetch_problem.rb +17 -8
- data/test/rubygems/test_gem_source_git.rb +74 -74
- data/test/rubygems/test_gem_source_installed.rb +16 -18
- data/test/rubygems/test_gem_source_list.rb +5 -5
- data/test/rubygems/test_gem_source_local.rb +15 -16
- data/test/rubygems/test_gem_source_lock.rb +31 -33
- data/test/rubygems/test_gem_source_specific_file.rb +18 -19
- data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
- data/test/rubygems/test_gem_source_vendor.rb +13 -15
- data/test/rubygems/test_gem_spec_fetcher.rb +74 -67
- data/test/rubygems/test_gem_specification.rb +1051 -1071
- data/test/rubygems/test_gem_stream_ui.rb +25 -23
- data/test/rubygems/test_gem_stub_specification.rb +39 -56
- data/test/rubygems/test_gem_text.rb +8 -3
- data/test/rubygems/test_gem_uninstaller.rb +269 -100
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -5
- data/test/rubygems/test_gem_update_suggestion.rb +208 -0
- data/test/rubygems/test_gem_uri.rb +39 -0
- data/test/rubygems/test_gem_uri_formatter.rb +14 -16
- data/test/rubygems/test_gem_util.rb +46 -34
- data/test/rubygems/test_gem_validator.rb +12 -15
- data/test/rubygems/test_gem_version.rb +49 -34
- data/test/rubygems/test_gem_version_option.rb +16 -18
- data/test/rubygems/test_kernel.rb +61 -53
- data/test/rubygems/test_project_sanity.rb +20 -0
- data/test/rubygems/test_remote_fetch_error.rb +7 -8
- data/test/rubygems/test_require.rb +415 -121
- data/test/rubygems/test_rubygems.rb +74 -0
- data/{lib/rubygems/test_utilities.rb → test/rubygems/utilities.rb} +74 -50
- data/test/rubygems/wrong_key_cert.pem +15 -15
- data/test/rubygems/wrong_key_cert_32.pem +15 -15
- data/test/test_changelog_generator.rb +17 -0
- metadata +218 -244
- data/.rubocop.yml +0 -66
- data/.travis.yml +0 -38
- data/History.txt +0 -3965
- data/Rakefile +0 -372
- data/appveyor.yml +0 -43
- data/bundler/CODE_OF_CONDUCT.md +0 -42
- data/bundler/CONTRIBUTING.md +0 -17
- data/bundler/exe/bundle_ruby +0 -60
- data/bundler/lib/bundler/cli/package.rb +0 -49
- data/bundler/lib/bundler/compatibility_guard.rb +0 -14
- data/bundler/lib/bundler/dep_proxy.rb +0 -48
- data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/bundler/lib/bundler/gemdeps.rb +0 -29
- data/bundler/lib/bundler/psyched_yaml.rb +0 -37
- data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/bundler/lib/bundler/templates/gems.rb +0 -8
- data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -7
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -81
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -136
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -101
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -12
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/bundler/lib/bundler/version_ranges.rb +0 -76
- data/bundler/man/bundle-gem.1 +0 -80
- data/bundler/man/bundle-gem.ronn +0 -78
- data/bundler/man/bundle-package.1 +0 -55
- data/lib/rubygems/psych_additions.rb +0 -10
- data/lib/rubygems/server.rb +0 -878
- data/lib/rubygems/source_local.rb +0 -7
- data/lib/rubygems/source_specific_file.rb +0 -6
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/rubygems/syck_hack.rb +0 -77
- data/lib/ubygems.rb +0 -14
- data/test/rubygems/bogussources.rb +0 -9
- data/test/rubygems/data/null-type.gemspec.rz +0 -0
- data/test/rubygems/test_gem_server.rb +0 -607
- data/util/CL2notes +0 -55
- data/util/ci +0 -77
- data/util/create_certs.rb +0 -171
- data/util/create_encrypted_key.rb +0 -16
- data/util/generate_spdx_license_list.rb +0 -61
- data/util/patch_with_prs.rb +0 -77
- data/util/rubocop +0 -8
- data/util/update_bundled_ca_certificates.rb +0 -139
- data/util/update_changelog.rb +0 -67
- /data/bundler/lib/bundler/{ssl_certs → man}/.document +0 -0
- /data/bundler/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- /data/bundler/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- /data/bundler/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- /data/bundler/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- /data/bundler/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- /data/bundler/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- /data/bundler/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
- /data/{bundler/lib/bundler/ssl_certs/index.rubygems.org → lib/rubygems/ssl_certs/rubygems.org}/GlobalSignRootCA.pem +0 -0
@@ -1,112 +1,78 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# TODO: $SAFE = 1
|
3
2
|
|
4
|
-
|
5
|
-
gem 'minitest', '~> 5.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
|
15
|
-
|
16
|
-
# If bundler gemspec exists, add to stubs
|
17
|
-
bundler_gemspec = File.expand_path("../../../bundler/bundler.gemspec", __FILE__)
|
18
|
-
if File.exist?(bundler_gemspec)
|
19
|
-
Gem::Specification.dirs.unshift File.dirname(bundler_gemspec)
|
20
|
-
Gem::Specification.class_variable_set :@@stubs, nil
|
21
|
-
Gem::Specification.stubs
|
22
|
-
Gem::Specification.dirs.shift
|
23
|
-
end
|
3
|
+
require "rubygems"
|
24
4
|
|
25
5
|
begin
|
26
|
-
gem
|
6
|
+
gem "test-unit", "~> 3.0"
|
27
7
|
rescue Gem::LoadError
|
28
8
|
end
|
29
9
|
|
30
|
-
|
31
|
-
require 'simplecov'
|
32
|
-
SimpleCov.start do
|
33
|
-
add_filter "/test/"
|
34
|
-
add_filter "/bundler/"
|
35
|
-
add_filter "/lib/rubygems/resolver/molinillo"
|
36
|
-
end
|
37
|
-
rescue LoadError
|
38
|
-
end
|
10
|
+
require "test/unit"
|
39
11
|
|
40
|
-
|
41
|
-
# them while we're testing rubygems, and thus we can't actually load them.
|
42
|
-
unless Gem::Dependency.new('rdoc', '>= 3.10').matching_specs.empty?
|
43
|
-
gem 'rdoc'
|
44
|
-
gem 'json'
|
45
|
-
end
|
46
|
-
|
47
|
-
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
48
|
-
require 'bundler'
|
49
|
-
end
|
50
|
-
require 'minitest/autorun'
|
12
|
+
ENV["JARS_SKIP"] = "true" if Gem.java_platform? # avoid unnecessary and noisy `jar-dependencies` post install hook
|
51
13
|
|
52
|
-
require
|
14
|
+
require "rubygems/deprecate"
|
53
15
|
|
54
|
-
require
|
55
|
-
require
|
56
|
-
require
|
57
|
-
require
|
58
|
-
require
|
59
|
-
require
|
60
|
-
require
|
61
|
-
require
|
62
|
-
require
|
63
|
-
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"
|
64
26
|
|
65
27
|
module Gem
|
66
28
|
|
67
29
|
##
|
68
|
-
# Allows setting the gem path searcher.
|
69
|
-
# requiring 'rubygems/test_case'
|
30
|
+
# Allows setting the gem path searcher.
|
70
31
|
|
71
32
|
def self.searcher=(searcher)
|
72
33
|
@searcher = searcher
|
73
34
|
end
|
74
35
|
|
75
36
|
##
|
76
|
-
# Allows toggling Windows behavior.
|
77
|
-
# 'rubygems/test_case'
|
37
|
+
# Allows toggling Windows behavior.
|
78
38
|
|
79
39
|
def self.win_platform=(val)
|
80
40
|
@@win_platform = val
|
81
41
|
end
|
82
42
|
|
83
43
|
##
|
84
|
-
# Allows setting path to Ruby.
|
85
|
-
# 'rubygems/test_case'
|
44
|
+
# Allows setting path to Ruby.
|
86
45
|
|
87
46
|
def self.ruby=(ruby)
|
88
47
|
@ruby = ruby
|
89
48
|
end
|
90
49
|
|
91
50
|
##
|
92
|
-
#
|
93
|
-
# MockGemUi.
|
51
|
+
# Sets the default user interaction to a MockGemUi.
|
94
52
|
|
95
53
|
module DefaultUserInteraction
|
96
54
|
@ui = Gem::MockGemUi.new
|
97
55
|
end
|
98
56
|
end
|
99
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
|
+
|
100
69
|
##
|
101
70
|
# RubyGemTestCase provides a variety of methods for testing rubygems and
|
102
71
|
# gem-related behavior in a sandbox. Through RubyGemTestCase you can install
|
103
72
|
# and uninstall gems, fetch remote gems through a stub fetcher and be assured
|
104
73
|
# your normal set of gems is not affected.
|
105
|
-
#
|
106
|
-
# Tests are always run at a safe level of 1.
|
107
|
-
|
108
|
-
class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase)
|
109
74
|
|
75
|
+
class Gem::TestCase < Test::Unit::TestCase
|
110
76
|
extend Gem::Deprecate
|
111
77
|
|
112
78
|
attr_accessor :fetcher # :nodoc:
|
@@ -132,10 +98,51 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
132
98
|
assert_equal expected.sort, loaded.sort if expected
|
133
99
|
end
|
134
100
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
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
|
+
begin
|
122
|
+
require "tempfile"
|
123
|
+
|
124
|
+
captured_stdout, captured_stderr = Tempfile.new("out"), Tempfile.new("err")
|
125
|
+
|
126
|
+
orig_stdout, orig_stderr = $stdout.dup, $stderr.dup
|
127
|
+
$stdout.reopen captured_stdout
|
128
|
+
$stderr.reopen captured_stderr
|
129
|
+
|
130
|
+
yield
|
131
|
+
|
132
|
+
$stdout.rewind
|
133
|
+
$stderr.rewind
|
134
|
+
|
135
|
+
return captured_stdout.read, captured_stderr.read
|
136
|
+
ensure
|
137
|
+
$stdout.reopen orig_stdout
|
138
|
+
$stderr.reopen orig_stderr
|
139
|
+
|
140
|
+
orig_stdout.close
|
141
|
+
orig_stderr.close
|
142
|
+
captured_stdout.close!
|
143
|
+
captured_stderr.close!
|
144
|
+
end
|
145
|
+
end
|
139
146
|
end
|
140
147
|
|
141
148
|
##
|
@@ -143,74 +150,131 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
143
150
|
# the original value when the block ends
|
144
151
|
|
145
152
|
def enable_shared(value)
|
146
|
-
enable_shared = RbConfig::CONFIG[
|
147
|
-
RbConfig::CONFIG[
|
153
|
+
enable_shared = RbConfig::CONFIG["ENABLE_SHARED"]
|
154
|
+
RbConfig::CONFIG["ENABLE_SHARED"] = value
|
148
155
|
|
149
156
|
yield
|
150
157
|
ensure
|
151
158
|
if enable_shared
|
152
|
-
RbConfig::CONFIG[
|
159
|
+
RbConfig::CONFIG["ENABLE_SHARED"] = enable_shared
|
160
|
+
else
|
161
|
+
RbConfig::CONFIG.delete "ENABLE_SHARED"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
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
|
153
174
|
else
|
154
|
-
RbConfig::CONFIG.delete
|
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"
|
155
184
|
end
|
156
185
|
end
|
157
186
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
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
|
162
233
|
end
|
163
234
|
|
164
235
|
def scan_make_command_lines(output)
|
165
236
|
output.scan(/^#{Regexp.escape make_command}(?:[[:blank:]].*)?$/)
|
166
237
|
end
|
167
238
|
|
168
|
-
def
|
169
|
-
|
239
|
+
def parse_make_command_line_targets(line)
|
240
|
+
args = line.sub(/^#{Regexp.escape make_command}/, "").shellsplit
|
170
241
|
|
171
242
|
targets = []
|
172
|
-
macros = {}
|
173
243
|
|
174
244
|
args.each do |arg|
|
175
245
|
case arg
|
176
246
|
when /\A(\w+)=/
|
177
|
-
macros[$1] = $'
|
178
247
|
else
|
179
248
|
targets << arg
|
180
249
|
end
|
181
250
|
end
|
182
251
|
|
183
|
-
targets <<
|
252
|
+
targets << "" if targets.empty?
|
184
253
|
|
185
|
-
|
186
|
-
:command => command,
|
187
|
-
:targets => targets,
|
188
|
-
:macros => macros,
|
189
|
-
}
|
254
|
+
targets
|
190
255
|
end
|
191
256
|
|
192
257
|
def assert_contains_make_command(target, output, msg = nil)
|
193
|
-
if output.
|
194
|
-
msg =
|
195
|
-
|
196
|
-
(
|
197
|
-
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,
|
198
263
|
]
|
199
|
-
|
264
|
+
)
|
200
265
|
else
|
201
|
-
msg =
|
202
|
-
'Expected make command "%s"
|
203
|
-
(
|
204
|
-
output
|
266
|
+
msg = build_message(msg,
|
267
|
+
'Expected make command "%s", but was "%s"' % [
|
268
|
+
("%s %s" % [make_command, target]).rstrip,
|
269
|
+
output,
|
205
270
|
]
|
206
|
-
|
271
|
+
)
|
207
272
|
end
|
208
273
|
|
209
|
-
assert scan_make_command_lines(output).any? {
|
210
|
-
|
274
|
+
assert scan_make_command_lines(output).any? {|line|
|
275
|
+
targets = parse_make_command_line_targets(line)
|
211
276
|
|
212
|
-
if
|
213
|
-
yield make, line if block_given?
|
277
|
+
if targets.include?(target)
|
214
278
|
true
|
215
279
|
else
|
216
280
|
false
|
@@ -220,13 +284,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
220
284
|
|
221
285
|
include Gem::DefaultUserInteraction
|
222
286
|
|
223
|
-
undef_method :default_test if instance_methods.include? 'default_test' or
|
224
|
-
instance_methods.include? :default_test
|
225
|
-
|
226
|
-
@@project_dir = Dir.pwd.untaint unless defined?(@@project_dir)
|
227
|
-
|
228
|
-
@@initial_reset = false
|
229
|
-
|
230
287
|
##
|
231
288
|
# #setup prepares a sandboxed location to install gems. All installs are
|
232
289
|
# directed to a temporary directory. All install plugins are removed.
|
@@ -234,92 +291,62 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
234
291
|
# If the +RUBY+ environment variable is set the given path is used for
|
235
292
|
# Gem::ruby. The local platform is set to <tt>i386-mswin32</tt> for Windows
|
236
293
|
# or <tt>i686-darwin8.10.1</tt> otherwise.
|
237
|
-
#
|
238
|
-
# If the +KEEP_FILES+ environment variable is set the files will not be
|
239
|
-
# removed from <tt>/tmp/test_rubygems_#{$$}.#{Time.now.to_i}</tt>.
|
240
294
|
|
241
295
|
def setup
|
242
|
-
|
296
|
+
@orig_hooks = {}
|
297
|
+
@orig_env = ENV.to_hash
|
298
|
+
@tmp = File.expand_path("tmp")
|
243
299
|
|
244
|
-
@
|
245
|
-
@orig_gem_path = ENV['GEM_PATH']
|
246
|
-
@orig_gem_vendor = ENV['GEM_VENDOR']
|
247
|
-
@orig_gem_spec_cache = ENV['GEM_SPEC_CACHE']
|
248
|
-
@orig_rubygems_gemdeps = ENV['RUBYGEMS_GEMDEPS']
|
249
|
-
@orig_bundle_gemfile = ENV['BUNDLE_GEMFILE']
|
250
|
-
@orig_rubygems_host = ENV['RUBYGEMS_HOST']
|
251
|
-
ENV.keys.find_all { |k| k.start_with?('GEM_REQUIREMENT_') }.each do |k|
|
252
|
-
ENV.delete k
|
253
|
-
end
|
254
|
-
@orig_gem_env_requirements = ENV.to_hash
|
300
|
+
FileUtils.mkdir_p @tmp
|
255
301
|
|
256
|
-
|
257
|
-
|
302
|
+
@tempdir = Dir.mktmpdir("test_rubygems_", @tmp)
|
303
|
+
@tempdir.tap(&Gem::UNTAINT)
|
304
|
+
|
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"
|
258
314
|
|
259
315
|
@current_dir = Dir.pwd
|
260
316
|
@fetcher = nil
|
261
317
|
|
262
|
-
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
263
|
-
Bundler.ui = Bundler::UI::Silent.new
|
264
|
-
end
|
265
318
|
@back_ui = Gem::DefaultUserInteraction.ui
|
266
319
|
@ui = Gem::MockGemUi.new
|
267
320
|
# This needs to be a new instance since we call use_ui(@ui) when we want to
|
268
321
|
# capture output
|
269
322
|
Gem::DefaultUserInteraction.ui = Gem::MockGemUi.new
|
270
323
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}.#{Time.now.to_i}")
|
276
|
-
else
|
277
|
-
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}")
|
278
|
-
end
|
279
|
-
@tempdir.untaint
|
280
|
-
|
281
|
-
FileUtils.mkdir_p @tempdir
|
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")
|
282
328
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
# dropped.
|
288
|
-
Dir.chdir @tempdir do
|
289
|
-
@tempdir = File.expand_path '.'
|
290
|
-
@tempdir.untaint
|
291
|
-
end
|
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"
|
292
333
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
# name. Only Dir[] (= Dir.glob) works.
|
298
|
-
# Short and long path name is specific to Windows filesystem.
|
299
|
-
if win_platform?
|
300
|
-
@tempdir = Dir[@tempdir][0]
|
301
|
-
@tempdir.untaint
|
334
|
+
@orig_ruby = if ENV["RUBY"]
|
335
|
+
ruby = Gem.ruby
|
336
|
+
Gem.ruby = ENV["RUBY"]
|
337
|
+
ruby
|
302
338
|
end
|
303
339
|
|
304
|
-
@
|
305
|
-
@userhome = File.join @tempdir, 'userhome'
|
306
|
-
ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'
|
307
|
-
|
308
|
-
@orig_ruby = if ENV['RUBY']
|
309
|
-
ruby = Gem.ruby
|
310
|
-
Gem.ruby = ENV['RUBY']
|
311
|
-
ruby
|
312
|
-
end
|
313
|
-
|
314
|
-
@git = ENV['GIT'] || 'git'
|
340
|
+
@git = ENV["GIT"] || "git#{RbConfig::CONFIG['EXEEXT']}"
|
315
341
|
|
316
342
|
Gem.ensure_gem_subdirectories @gemhome
|
343
|
+
Gem.ensure_default_gem_subdirectories @gemhome
|
317
344
|
|
318
345
|
@orig_LOAD_PATH = $LOAD_PATH.dup
|
319
|
-
$LOAD_PATH.map!
|
320
|
-
expand_path = File.expand_path(s)
|
346
|
+
$LOAD_PATH.map! do |s|
|
347
|
+
expand_path = File.realpath(s) rescue File.expand_path(s)
|
321
348
|
if expand_path != s
|
322
|
-
expand_path.
|
349
|
+
expand_path.tap(&Gem::UNTAINT)
|
323
350
|
if s.instance_variable_defined?(:@gem_prelude_index)
|
324
351
|
expand_path.instance_variable_set(:@gem_prelude_index, expand_path)
|
325
352
|
end
|
@@ -327,48 +354,50 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
327
354
|
s = expand_path
|
328
355
|
end
|
329
356
|
s
|
330
|
-
|
357
|
+
end
|
331
358
|
|
332
359
|
Dir.chdir @tempdir
|
333
360
|
|
334
|
-
|
335
|
-
|
361
|
+
ENV["HOME"] = @userhome
|
362
|
+
Gem.instance_variable_set :@config_file, nil
|
336
363
|
Gem.instance_variable_set :@user_home, nil
|
364
|
+
Gem.instance_variable_set :@config_home, nil
|
365
|
+
Gem.instance_variable_set :@data_home, nil
|
366
|
+
Gem.instance_variable_set :@state_home, @statehome
|
337
367
|
Gem.instance_variable_set :@gemdeps, nil
|
338
368
|
Gem.instance_variable_set :@env_requirements_by_name, nil
|
339
369
|
Gem.send :remove_instance_variable, :@ruby_version if
|
340
370
|
Gem.instance_variables.include? :@ruby_version
|
341
371
|
|
342
|
-
FileUtils.mkdir_p @gemhome
|
343
372
|
FileUtils.mkdir_p @userhome
|
344
373
|
|
345
|
-
|
346
|
-
ENV['GEM_PRIVATE_KEY_PASSPHRASE'] = PRIVATE_KEY_PASSPHRASE
|
347
|
-
|
348
|
-
@default_dir = File.join @tempdir, 'default'
|
349
|
-
@default_spec_dir = File.join @default_dir, "specifications", "default"
|
350
|
-
Gem.instance_variable_set :@default_dir, @default_dir
|
351
|
-
FileUtils.mkdir_p @default_spec_dir
|
374
|
+
ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = PRIVATE_KEY_PASSPHRASE
|
352
375
|
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
Gem::Specification.unresolved_deps.clear # done to avoid cross-test warnings
|
376
|
+
Gem.instance_variable_set(:@default_specifications_dir, nil)
|
377
|
+
if Gem.java_platform?
|
378
|
+
@orig_default_gem_home = RbConfig::CONFIG["default_gem_home"]
|
379
|
+
RbConfig::CONFIG["default_gem_home"] = @gemhome
|
358
380
|
else
|
359
|
-
|
360
|
-
Gem::Specification.reset
|
381
|
+
Gem.instance_variable_set(:@default_dir, @gemhome)
|
361
382
|
end
|
362
|
-
Gem.use_paths(@gemhome)
|
363
383
|
|
364
|
-
|
384
|
+
@orig_bindir = RbConfig::CONFIG["bindir"]
|
385
|
+
RbConfig::CONFIG["bindir"] = File.join @gemhome, "bin"
|
386
|
+
|
387
|
+
@orig_sitelibdir = RbConfig::CONFIG["sitelibdir"]
|
388
|
+
new_sitelibdir = @orig_sitelibdir.sub(RbConfig::CONFIG["prefix"], @gemhome)
|
389
|
+
$LOAD_PATH.insert(Gem.load_path_insert_index, new_sitelibdir)
|
390
|
+
RbConfig::CONFIG["sitelibdir"] = new_sitelibdir
|
391
|
+
|
392
|
+
@orig_mandir = RbConfig::CONFIG["mandir"]
|
393
|
+
RbConfig::CONFIG["mandir"] = File.join @gemhome, "share", "man"
|
394
|
+
|
395
|
+
Gem::Specification.unresolved_deps.clear
|
396
|
+
Gem.use_paths(@gemhome)
|
365
397
|
|
366
398
|
Gem.loaded_specs.clear
|
399
|
+
Gem.instance_variable_set(:@activated_gem_paths, 0)
|
367
400
|
Gem.clear_default_specs
|
368
|
-
Gem::Specification.unresolved_deps.clear
|
369
|
-
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
370
|
-
Bundler.reset!
|
371
|
-
end
|
372
401
|
|
373
402
|
Gem.configuration.verbose = true
|
374
403
|
Gem.configuration.update_sources = true
|
@@ -381,18 +410,15 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
381
410
|
|
382
411
|
Gem.searcher = nil
|
383
412
|
Gem::SpecFetcher.fetcher = nil
|
384
|
-
@orig_BASERUBY = RbConfig::CONFIG['BASERUBY']
|
385
|
-
RbConfig::CONFIG['BASERUBY'] = RbConfig::CONFIG['ruby_install_name']
|
386
413
|
|
387
|
-
@orig_arch = RbConfig::CONFIG[
|
414
|
+
@orig_arch = RbConfig::CONFIG["arch"]
|
388
415
|
|
389
416
|
if win_platform?
|
390
|
-
util_set_arch
|
417
|
+
util_set_arch "i386-mswin32"
|
391
418
|
else
|
392
|
-
util_set_arch
|
419
|
+
util_set_arch "i686-darwin8.10.1"
|
393
420
|
end
|
394
421
|
|
395
|
-
@orig_hooks = {}
|
396
422
|
%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|
|
397
423
|
@orig_hooks[name] = Gem.send(name).dup
|
398
424
|
end
|
@@ -403,29 +429,21 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
403
429
|
|
404
430
|
##
|
405
431
|
# #teardown restores the process to its original state and removes the
|
406
|
-
# tempdir
|
432
|
+
# tempdir
|
407
433
|
|
408
434
|
def teardown
|
409
435
|
$LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
|
410
436
|
if @orig_LOADED_FEATURES
|
411
437
|
if @orig_LOAD_PATH
|
412
|
-
paths = @orig_LOAD_PATH.map {|path| File.join(File.expand_path(path), "/")}
|
413
438
|
($LOADED_FEATURES - @orig_LOADED_FEATURES).each do |feat|
|
414
|
-
|
415
|
-
$LOADED_FEATURES.delete(feat)
|
416
|
-
end
|
439
|
+
$LOADED_FEATURES.delete(feat) if feat.start_with?(@tmp)
|
417
440
|
end
|
418
441
|
else
|
419
442
|
$LOADED_FEATURES.replace @orig_LOADED_FEATURES
|
420
443
|
end
|
421
444
|
end
|
422
445
|
|
423
|
-
|
424
|
-
RbConfig::CONFIG['BASERUBY'] = @orig_BASERUBY
|
425
|
-
else
|
426
|
-
RbConfig::CONFIG.delete('BASERUBY')
|
427
|
-
end
|
428
|
-
RbConfig::CONFIG['arch'] = @orig_arch
|
446
|
+
RbConfig::CONFIG["arch"] = @orig_arch
|
429
447
|
|
430
448
|
if defined? Gem::RemoteFetcher
|
431
449
|
Gem::RemoteFetcher.fetcher = nil
|
@@ -433,34 +451,27 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
433
451
|
|
434
452
|
Dir.chdir @current_dir
|
435
453
|
|
436
|
-
FileUtils.rm_rf @tempdir
|
454
|
+
FileUtils.rm_rf @tempdir
|
437
455
|
|
438
|
-
|
439
|
-
@orig_gem_env_requirements.each do |k,v|
|
440
|
-
ENV[k] = v
|
441
|
-
end
|
456
|
+
restore_env
|
442
457
|
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
ENV['GEM_SPEC_CACHE'] = @orig_gem_spec_cache
|
447
|
-
ENV['RUBYGEMS_GEMDEPS'] = @orig_rubygems_gemdeps
|
448
|
-
ENV['BUNDLE_GEMFILE'] = @orig_bundle_gemfile
|
449
|
-
ENV['RUBYGEMS_HOST'] = @orig_rubygems_host
|
458
|
+
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
|
459
|
+
Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
|
460
|
+
@orig_SYSTEM_WIDE_CONFIG_FILE
|
450
461
|
|
451
462
|
Gem.ruby = @orig_ruby if @orig_ruby
|
452
463
|
|
453
|
-
|
454
|
-
|
464
|
+
RbConfig::CONFIG["mandir"] = @orig_mandir
|
465
|
+
RbConfig::CONFIG["sitelibdir"] = @orig_sitelibdir
|
466
|
+
RbConfig::CONFIG["bindir"] = @orig_bindir
|
467
|
+
|
468
|
+
Gem.instance_variable_set :@default_specifications_dir, nil
|
469
|
+
if Gem.java_platform?
|
470
|
+
RbConfig::CONFIG["default_gem_home"] = @orig_default_gem_home
|
455
471
|
else
|
456
|
-
|
472
|
+
Gem.instance_variable_set :@default_dir, nil
|
457
473
|
end
|
458
474
|
|
459
|
-
Gem.instance_variable_set :@default_dir, nil
|
460
|
-
|
461
|
-
ENV['GEM_PRIVATE_KEY_PASSPHRASE'] = @orig_gem_private_key_passphrase
|
462
|
-
|
463
|
-
Gem::Specification._clear_load_cache
|
464
475
|
Gem::Specification.unresolved_deps.clear
|
465
476
|
Gem::refresh
|
466
477
|
|
@@ -471,6 +482,17 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
471
482
|
@back_ui.close
|
472
483
|
end
|
473
484
|
|
485
|
+
def credential_setup
|
486
|
+
@temp_cred = File.join(@userhome, ".gem", "credentials")
|
487
|
+
FileUtils.mkdir_p File.dirname(@temp_cred)
|
488
|
+
File.write @temp_cred, ":rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97"
|
489
|
+
File.chmod 0600, @temp_cred
|
490
|
+
end
|
491
|
+
|
492
|
+
def credential_teardown
|
493
|
+
FileUtils.rm_rf @temp_cred
|
494
|
+
end
|
495
|
+
|
474
496
|
def common_installer_setup
|
475
497
|
common_installer_teardown
|
476
498
|
|
@@ -508,16 +530,20 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
508
530
|
Gem.pre_uninstall_hooks.clear
|
509
531
|
end
|
510
532
|
|
533
|
+
def without_any_upwards_gemfiles
|
534
|
+
ENV["BUNDLE_GEMFILE"] = File.join(@tempdir, "Gemfile")
|
535
|
+
end
|
536
|
+
|
511
537
|
##
|
512
538
|
# A git_gem is used with a gem dependencies file. The gem created here
|
513
539
|
# has no files, just a gem specification for the given +name+ and +version+.
|
514
540
|
#
|
515
541
|
# Yields the +specification+ to the block, if given
|
516
542
|
|
517
|
-
def git_gem(name =
|
543
|
+
def git_gem(name = "a", version = 1)
|
518
544
|
have_git?
|
519
545
|
|
520
|
-
directory = File.join
|
546
|
+
directory = File.join "git", name
|
521
547
|
directory = File.expand_path directory
|
522
548
|
|
523
549
|
git_spec = Gem::Specification.new name, version do |specification|
|
@@ -528,22 +554,23 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
528
554
|
|
529
555
|
gemspec = "#{name}.gemspec"
|
530
556
|
|
531
|
-
File.open File.join(directory, gemspec),
|
557
|
+
File.open File.join(directory, gemspec), "w" do |io|
|
532
558
|
io.write git_spec.to_ruby
|
533
559
|
end
|
534
560
|
|
535
561
|
head = nil
|
536
562
|
|
537
563
|
Dir.chdir directory do
|
538
|
-
unless File.exist?
|
539
|
-
system @git,
|
540
|
-
system @git,
|
541
|
-
system @git,
|
564
|
+
unless File.exist? ".git"
|
565
|
+
system @git, "init", "--quiet"
|
566
|
+
system @git, "checkout", "-b", "master", "--quiet"
|
567
|
+
system @git, "config", "user.name", "RubyGems Tests"
|
568
|
+
system @git, "config", "user.email", "rubygems@example"
|
542
569
|
end
|
543
570
|
|
544
|
-
system @git,
|
545
|
-
system @git,
|
546
|
-
head = Gem::Util.popen(@git,
|
571
|
+
system @git, "add", gemspec
|
572
|
+
system @git, "commit", "-a", "-m", "a non-empty commit message", "--quiet"
|
573
|
+
head = Gem::Util.popen(@git, "rev-parse", "master").strip
|
547
574
|
end
|
548
575
|
|
549
576
|
return name, git_spec.version, directory, head
|
@@ -555,13 +582,13 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
555
582
|
def have_git?
|
556
583
|
return if in_path? @git
|
557
584
|
|
558
|
-
|
585
|
+
pend "cannot find git executable, use GIT environment variable to set"
|
559
586
|
end
|
560
587
|
|
561
588
|
def in_path?(executable) # :nodoc:
|
562
|
-
return true if %r
|
589
|
+
return true if %r{\A([A-Z]:|/)} =~ executable && File.exist?(executable)
|
563
590
|
|
564
|
-
ENV[
|
591
|
+
ENV["PATH"].split(File::PATH_SEPARATOR).any? do |directory|
|
565
592
|
File.exist? File.join directory, executable
|
566
593
|
end
|
567
594
|
end
|
@@ -570,9 +597,9 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
570
597
|
# Builds and installs the Gem::Specification +spec+
|
571
598
|
|
572
599
|
def install_gem(spec, options = {})
|
573
|
-
require
|
600
|
+
require "rubygems/installer"
|
574
601
|
|
575
|
-
gem =
|
602
|
+
gem = spec.cache_file
|
576
603
|
|
577
604
|
unless File.exist? gem
|
578
605
|
use_ui Gem::MockGemUi.new do
|
@@ -581,10 +608,10 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
581
608
|
end
|
582
609
|
end
|
583
610
|
|
584
|
-
gem = File.join(@tempdir, File.basename(
|
611
|
+
gem = File.join(@tempdir, File.basename(gem)).tap(&Gem::UNTAINT)
|
585
612
|
end
|
586
613
|
|
587
|
-
Gem::Installer.at(gem, options.merge({:wrappers => true})).install
|
614
|
+
Gem::Installer.at(gem, options.merge({ :wrappers => true })).install
|
588
615
|
end
|
589
616
|
|
590
617
|
##
|
@@ -597,25 +624,13 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
597
624
|
##
|
598
625
|
# Uninstalls the Gem::Specification +spec+
|
599
626
|
def uninstall_gem(spec)
|
600
|
-
require
|
627
|
+
require "rubygems/uninstaller"
|
601
628
|
|
602
|
-
Class.new(Gem::Uninstaller)
|
629
|
+
Class.new(Gem::Uninstaller) do
|
603
630
|
def ask_if_ok(spec)
|
604
631
|
true
|
605
632
|
end
|
606
|
-
|
607
|
-
end
|
608
|
-
|
609
|
-
##
|
610
|
-
# creates a temporary directory with hax
|
611
|
-
# TODO: deprecate and remove
|
612
|
-
|
613
|
-
def create_tmpdir
|
614
|
-
tmpdir = nil
|
615
|
-
Dir.chdir Dir.tmpdir do tmpdir = Dir.pwd end # HACK OSX /private/tmp
|
616
|
-
tmpdir = File.join tmpdir, "test_rubygems_#{$$}"
|
617
|
-
FileUtils.mkdir_p tmpdir
|
618
|
-
return tmpdir
|
633
|
+
end.new(spec.name, :executables => true, :user_install => true).uninstall
|
619
634
|
end
|
620
635
|
|
621
636
|
##
|
@@ -632,7 +647,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
632
647
|
# Reads a Marshal file at +path+
|
633
648
|
|
634
649
|
def read_cache(path)
|
635
|
-
File.open path.dup.
|
650
|
+
File.open path.dup.tap(&Gem::UNTAINT), "rb" do |io|
|
636
651
|
Marshal.load io.read
|
637
652
|
end
|
638
653
|
end
|
@@ -652,13 +667,35 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
652
667
|
dir = File.dirname path
|
653
668
|
FileUtils.mkdir_p dir unless File.directory? dir
|
654
669
|
|
655
|
-
File.open path,
|
670
|
+
File.open path, "wb" do |io|
|
656
671
|
yield io if block_given?
|
657
672
|
end
|
658
673
|
|
659
674
|
path
|
660
675
|
end
|
661
676
|
|
677
|
+
##
|
678
|
+
# Load a YAML string, the psych 3 way
|
679
|
+
|
680
|
+
def load_yaml(yaml)
|
681
|
+
if Psych.respond_to?(:unsafe_load)
|
682
|
+
Psych.unsafe_load(yaml)
|
683
|
+
else
|
684
|
+
Psych.load(yaml)
|
685
|
+
end
|
686
|
+
end
|
687
|
+
|
688
|
+
##
|
689
|
+
# Load a YAML file, the psych 3 way
|
690
|
+
|
691
|
+
def load_yaml_file(file)
|
692
|
+
if Psych.respond_to?(:unsafe_load_file)
|
693
|
+
Psych.unsafe_load_file(file)
|
694
|
+
else
|
695
|
+
Psych.load_file(file)
|
696
|
+
end
|
697
|
+
end
|
698
|
+
|
662
699
|
def all_spec_names
|
663
700
|
Gem::Specification.map(&:full_name)
|
664
701
|
end
|
@@ -673,44 +710,33 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
673
710
|
#
|
674
711
|
# Use this with #write_file to build an installed gem.
|
675
712
|
|
676
|
-
def quick_gem(name, version=
|
677
|
-
require
|
713
|
+
def quick_gem(name, version="2")
|
714
|
+
require "rubygems/specification"
|
678
715
|
|
679
716
|
spec = Gem::Specification.new do |s|
|
680
717
|
s.platform = Gem::Platform::RUBY
|
681
718
|
s.name = name
|
682
719
|
s.version = version
|
683
|
-
s.author =
|
684
|
-
s.email =
|
685
|
-
s.homepage =
|
720
|
+
s.author = "A User"
|
721
|
+
s.email = "example@example.com"
|
722
|
+
s.homepage = "http://example.com"
|
686
723
|
s.summary = "this is a summary"
|
687
724
|
s.description = "This is a test description"
|
688
725
|
|
689
726
|
yield(s) if block_given?
|
690
727
|
end
|
691
728
|
|
692
|
-
Gem::Specification.map # HACK: force specs to (re-)load before we write
|
693
|
-
|
694
729
|
written_path = write_file spec.spec_file do |io|
|
695
730
|
io.write spec.to_ruby_for_cache
|
696
731
|
end
|
697
732
|
|
698
|
-
spec.loaded_from =
|
733
|
+
spec.loaded_from = written_path
|
699
734
|
|
700
735
|
Gem::Specification.reset
|
701
736
|
|
702
737
|
return spec
|
703
738
|
end
|
704
739
|
|
705
|
-
##
|
706
|
-
# TODO: remove in RubyGems 4.0
|
707
|
-
|
708
|
-
def quick_spec(name, version = '2') # :nodoc:
|
709
|
-
util_spec name, version
|
710
|
-
end
|
711
|
-
deprecate :quick_spec, :util_spec, 2018, 12
|
712
|
-
|
713
|
-
|
714
740
|
##
|
715
741
|
# Builds a gem from +spec+ and places it in <tt>File.join @gemhome,
|
716
742
|
# 'cache'</tt>. Automatically creates files based on +spec.files+
|
@@ -723,7 +749,10 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
723
749
|
spec.files.each do |file|
|
724
750
|
next if File.exist? file
|
725
751
|
FileUtils.mkdir_p File.dirname(file)
|
726
|
-
|
752
|
+
|
753
|
+
File.open file, "w" do |fp|
|
754
|
+
fp.puts "# #{file}"
|
755
|
+
end
|
727
756
|
end
|
728
757
|
|
729
758
|
use_ui Gem::MockGemUi.new do
|
@@ -744,7 +773,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
744
773
|
# Removes all installed gems from +@gemhome+.
|
745
774
|
|
746
775
|
def util_clear_gems
|
747
|
-
FileUtils.rm_rf File.join(@gemhome, "gems")
|
776
|
+
FileUtils.rm_rf File.join(@gemhome, "gems")
|
748
777
|
FileUtils.mkdir File.join(@gemhome, "gems")
|
749
778
|
FileUtils.rm_rf File.join(@gemhome, "specifications")
|
750
779
|
FileUtils.mkdir File.join(@gemhome, "specifications")
|
@@ -756,7 +785,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
756
785
|
|
757
786
|
def install_specs(*specs)
|
758
787
|
specs.each do |spec|
|
759
|
-
Gem::Installer.for_spec(spec).install
|
788
|
+
Gem::Installer.for_spec(spec, :force => true).install
|
760
789
|
end
|
761
790
|
|
762
791
|
Gem.searcher = nil
|
@@ -766,19 +795,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
766
795
|
# Installs the provided default specs including writing the spec file
|
767
796
|
|
768
797
|
def install_default_gems(*specs)
|
769
|
-
install_default_specs(*specs)
|
770
|
-
|
771
|
-
specs.each do |spec|
|
772
|
-
File.open spec.loaded_from, 'w' do |io|
|
773
|
-
io.write spec.to_ruby_for_cache
|
774
|
-
end
|
775
|
-
end
|
776
|
-
end
|
777
|
-
|
778
|
-
##
|
779
|
-
# Install the provided default specs
|
780
|
-
|
781
|
-
def install_default_specs(*specs)
|
782
798
|
specs.each do |spec|
|
783
799
|
installer = Gem::Installer.for_spec(spec, :install_as_default => true)
|
784
800
|
installer.install
|
@@ -794,69 +810,15 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
794
810
|
Gem::Specification.unresolved_deps.values.map(&:to_s).sort
|
795
811
|
end
|
796
812
|
|
797
|
-
def save_loaded_features
|
798
|
-
old_loaded_features = $LOADED_FEATURES.dup
|
799
|
-
yield
|
800
|
-
ensure
|
801
|
-
prefix = File.dirname(__FILE__) + "/"
|
802
|
-
new_features = ($LOADED_FEATURES - old_loaded_features)
|
803
|
-
old_loaded_features.concat(new_features.select {|f| f.rindex(prefix, 0)})
|
804
|
-
$LOADED_FEATURES.replace old_loaded_features
|
805
|
-
end
|
806
|
-
|
807
|
-
##
|
808
|
-
# new_spec is deprecated as it is never used.
|
809
|
-
#
|
810
|
-
# TODO: remove in RubyGems 4.0
|
811
|
-
|
812
|
-
def new_spec(name, version, deps = nil, *files) # :nodoc:
|
813
|
-
require 'rubygems/specification'
|
814
|
-
|
815
|
-
spec = Gem::Specification.new do |s|
|
816
|
-
s.platform = Gem::Platform::RUBY
|
817
|
-
s.name = name
|
818
|
-
s.version = version
|
819
|
-
s.author = 'A User'
|
820
|
-
s.email = 'example@example.com'
|
821
|
-
s.homepage = 'http://example.com'
|
822
|
-
s.summary = "this is a summary"
|
823
|
-
s.description = "This is a test description"
|
824
|
-
|
825
|
-
Array(deps).each do |n, req|
|
826
|
-
s.add_dependency n, (req || '>= 0')
|
827
|
-
end
|
828
|
-
|
829
|
-
s.files.push(*files) unless files.empty?
|
830
|
-
|
831
|
-
yield s if block_given?
|
832
|
-
end
|
833
|
-
|
834
|
-
spec.loaded_from = spec.spec_file
|
835
|
-
|
836
|
-
unless files.empty?
|
837
|
-
write_file spec.spec_file do |io|
|
838
|
-
io.write spec.to_ruby_for_cache
|
839
|
-
end
|
840
|
-
|
841
|
-
util_build_gem spec
|
842
|
-
|
843
|
-
cache_file = File.join @tempdir, 'gems', "#{spec.full_name}.gem"
|
844
|
-
FileUtils.mkdir_p File.dirname cache_file
|
845
|
-
FileUtils.mv spec.cache_file, cache_file
|
846
|
-
FileUtils.rm spec.spec_file
|
847
|
-
end
|
848
|
-
|
849
|
-
spec
|
850
|
-
end
|
851
|
-
deprecate :new_spec, :none, 2018, 12
|
852
|
-
|
853
813
|
def new_default_spec(name, version, deps = nil, *files)
|
854
814
|
spec = util_spec name, version, deps
|
855
815
|
|
856
|
-
spec.loaded_from = File.join(@
|
816
|
+
spec.loaded_from = File.join(@gemhome, "specifications", "default", spec.spec_name)
|
857
817
|
spec.files = files
|
858
818
|
|
859
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])
|
860
822
|
$LOAD_PATH.unshift(lib_dir)
|
861
823
|
files.each do |file|
|
862
824
|
rb_path = File.join(lib_dir, file)
|
@@ -874,15 +836,15 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
874
836
|
# or a +block+ can be given for full customization of the specification.
|
875
837
|
|
876
838
|
def util_spec(name, version = 2, deps = nil, *files) # :yields: specification
|
877
|
-
raise "deps or block, not both" if deps
|
839
|
+
raise "deps or block, not both" if deps && block_given?
|
878
840
|
|
879
841
|
spec = Gem::Specification.new do |s|
|
880
842
|
s.platform = Gem::Platform::RUBY
|
881
843
|
s.name = name
|
882
844
|
s.version = version
|
883
|
-
s.author =
|
884
|
-
s.email =
|
885
|
-
s.homepage =
|
845
|
+
s.author = "A User"
|
846
|
+
s.email = "example@example.com"
|
847
|
+
s.homepage = "http://example.com"
|
886
848
|
s.summary = "this is a summary"
|
887
849
|
s.description = "This is a test description"
|
888
850
|
|
@@ -892,10 +854,8 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
892
854
|
end
|
893
855
|
|
894
856
|
if deps
|
895
|
-
|
896
|
-
|
897
|
-
deps.keys.sort.each do |n|
|
898
|
-
spec.add_dependency n, (deps[n] || '>= 0')
|
857
|
+
deps.keys.each do |n|
|
858
|
+
spec.add_dependency n, (deps[n] || ">= 0")
|
899
859
|
end
|
900
860
|
end
|
901
861
|
|
@@ -906,14 +866,9 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
906
866
|
|
907
867
|
util_build_gem spec
|
908
868
|
|
909
|
-
cache_file = File.join @tempdir, 'gems', "#{spec.full_name}.gem"
|
910
|
-
FileUtils.mkdir_p File.dirname cache_file
|
911
|
-
FileUtils.mv spec.cache_file, cache_file
|
912
869
|
FileUtils.rm spec.spec_file
|
913
870
|
end
|
914
871
|
|
915
|
-
Gem::Specification.reset
|
916
|
-
|
917
872
|
return spec
|
918
873
|
end
|
919
874
|
|
@@ -924,16 +879,10 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
924
879
|
# location are returned.
|
925
880
|
|
926
881
|
def util_gem(name, version, deps = nil, &block)
|
927
|
-
# TODO: deprecate
|
928
|
-
raise "deps or block, not both" if deps and block
|
929
|
-
|
930
882
|
if deps
|
931
883
|
block = proc do |s|
|
932
|
-
|
933
|
-
|
934
|
-
# deterministic on all implementations.
|
935
|
-
deps.keys.sort.each do |n|
|
936
|
-
s.add_dependency n, (deps[n] || '>= 0')
|
884
|
+
deps.keys.each do |n|
|
885
|
+
s.add_dependency n, (deps[n] || ">= 0")
|
937
886
|
end
|
938
887
|
end
|
939
888
|
end
|
@@ -942,7 +891,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
942
891
|
|
943
892
|
util_build_gem spec
|
944
893
|
|
945
|
-
cache_file = File.join @tempdir,
|
894
|
+
cache_file = File.join @tempdir, "gems", "#{spec.original_name}.gem"
|
946
895
|
FileUtils.mkdir_p File.dirname cache_file
|
947
896
|
FileUtils.mv spec.cache_file, cache_file
|
948
897
|
FileUtils.rm spec.spec_file
|
@@ -984,11 +933,11 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
984
933
|
# TODO: nuke this and fix tests. this should speed up a lot
|
985
934
|
|
986
935
|
def util_make_gems(prerelease = false)
|
987
|
-
@a1 = quick_gem
|
936
|
+
@a1 = quick_gem "a", "1" do |s|
|
988
937
|
s.files = %w[lib/code.rb]
|
989
938
|
s.require_paths = %w[lib]
|
990
939
|
s.date = Gem::Specification::TODAY - 86400
|
991
|
-
s.homepage =
|
940
|
+
s.homepage = "http://a.example.com"
|
992
941
|
s.email = %w[example@example.com example2@example.com]
|
993
942
|
s.authors = %w[Example Example2]
|
994
943
|
s.description = <<-DESC
|
@@ -1005,27 +954,27 @@ Also, a list:
|
|
1005
954
|
s.require_paths = %w[lib]
|
1006
955
|
end
|
1007
956
|
|
1008
|
-
@a2 = quick_gem(
|
1009
|
-
@a3a = quick_gem(
|
1010
|
-
@a_evil9 = quick_gem(
|
1011
|
-
@b2 = quick_gem(
|
1012
|
-
@c1_2 = quick_gem(
|
1013
|
-
@x = quick_gem(
|
1014
|
-
@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|
|
1015
964
|
s.files = %w[lib/code.rb]
|
1016
965
|
s.require_paths = %w[lib]
|
1017
|
-
s.add_dependency
|
966
|
+
s.add_dependency "x", ">= 1"
|
1018
967
|
end
|
1019
968
|
|
1020
|
-
@pl1
|
969
|
+
@pl1 = quick_gem "pl", "1" do |s| # l for legacy
|
1021
970
|
s.files = %w[lib/code.rb]
|
1022
971
|
s.require_paths = %w[lib]
|
1023
|
-
s.platform = Gem::Platform.new
|
1024
|
-
s.instance_variable_set :@original_platform,
|
972
|
+
s.platform = Gem::Platform.new "i386-linux"
|
973
|
+
s.instance_variable_set :@original_platform, "i386-linux"
|
1025
974
|
end
|
1026
975
|
|
1027
976
|
if prerelease
|
1028
|
-
@a2_pre = quick_gem(
|
977
|
+
@a2_pre = quick_gem("a", "2.a", &init)
|
1029
978
|
write_file File.join(*%W[gems #{@a2_pre.original_name} lib code.rb])
|
1030
979
|
util_build_gem @a2_pre
|
1031
980
|
end
|
@@ -1051,38 +1000,15 @@ Also, a list:
|
|
1051
1000
|
# Set the platform to +arch+
|
1052
1001
|
|
1053
1002
|
def util_set_arch(arch)
|
1054
|
-
RbConfig::CONFIG[
|
1003
|
+
RbConfig::CONFIG["arch"] = arch
|
1055
1004
|
platform = Gem::Platform.new arch
|
1056
1005
|
|
1057
1006
|
Gem.instance_variable_set :@platforms, nil
|
1058
1007
|
Gem::Platform.instance_variable_set :@local, nil
|
1059
1008
|
|
1060
|
-
|
1061
|
-
end
|
1062
|
-
|
1063
|
-
##
|
1064
|
-
# Sets up a fake fetcher using the gems from #util_make_gems. Optionally
|
1065
|
-
# additional +prerelease+ gems may be included.
|
1066
|
-
#
|
1067
|
-
# Gems created by this method may be fetched using Gem::RemoteFetcher.
|
1068
|
-
|
1069
|
-
def util_setup_fake_fetcher(prerelease = false)
|
1070
|
-
require 'zlib'
|
1071
|
-
require 'socket'
|
1072
|
-
require 'rubygems/remote_fetcher'
|
1073
|
-
|
1074
|
-
@fetcher = Gem::FakeFetcher.new
|
1009
|
+
yield if block_given?
|
1075
1010
|
|
1076
|
-
|
1077
|
-
Gem::Specification.reset
|
1078
|
-
|
1079
|
-
@all_gems = [@a1, @a2, @a3a, @a_evil9, @b2, @c1_2].sort
|
1080
|
-
@all_gem_names = @all_gems.map { |gem| gem.full_name }
|
1081
|
-
|
1082
|
-
gem_names = [@a1.full_name, @a2.full_name, @a3a.full_name, @b2.full_name]
|
1083
|
-
@gem_names = gem_names.sort.join("\n")
|
1084
|
-
|
1085
|
-
Gem::RemoteFetcher.fetcher = @fetcher
|
1011
|
+
platform
|
1086
1012
|
end
|
1087
1013
|
|
1088
1014
|
##
|
@@ -1096,7 +1022,6 @@ Also, a list:
|
|
1096
1022
|
|
1097
1023
|
##
|
1098
1024
|
# Sets up Gem::SpecFetcher to return information from the gems in +specs+.
|
1099
|
-
# Best used with +@all_gems+ from #util_setup_fake_fetcher.
|
1100
1025
|
|
1101
1026
|
def util_setup_spec_fetcher(*specs)
|
1102
1027
|
all_specs = Gem::Specification.to_a + specs
|
@@ -1104,7 +1029,7 @@ Also, a list:
|
|
1104
1029
|
|
1105
1030
|
spec_fetcher = Gem::SpecFetcher.fetcher
|
1106
1031
|
|
1107
|
-
prerelease, all = all_specs.partition {
|
1032
|
+
prerelease, all = all_specs.partition {|spec| spec.version.prerelease? }
|
1108
1033
|
latest = Gem::Specification._latest_specs all_specs
|
1109
1034
|
|
1110
1035
|
spec_fetcher.specs[@uri] = []
|
@@ -1126,7 +1051,7 @@ Also, a list:
|
|
1126
1051
|
unless Gem::RemoteFetcher === @fetcher
|
1127
1052
|
v = Gem.marshal_version
|
1128
1053
|
|
1129
|
-
specs = all.map {
|
1054
|
+
specs = all.map {|spec| spec.name_tuple }
|
1130
1055
|
s_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic specs
|
1131
1056
|
|
1132
1057
|
latest_specs = latest.map do |spec|
|
@@ -1135,26 +1060,30 @@ Also, a list:
|
|
1135
1060
|
|
1136
1061
|
l_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic latest_specs
|
1137
1062
|
|
1138
|
-
prerelease_specs = prerelease.map {
|
1063
|
+
prerelease_specs = prerelease.map {|spec| spec.name_tuple }
|
1139
1064
|
p_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic prerelease_specs
|
1140
1065
|
|
1141
1066
|
@fetcher.data["#{@gem_repo}specs.#{v}.gz"] = s_zip
|
1142
1067
|
@fetcher.data["#{@gem_repo}latest_specs.#{v}.gz"] = l_zip
|
1143
1068
|
@fetcher.data["#{@gem_repo}prerelease_specs.#{v}.gz"] = p_zip
|
1144
1069
|
|
1145
|
-
|
1146
|
-
|
1147
|
-
all_specs.each do |spec|
|
1148
|
-
path = "#{@gem_repo}quick/Marshal.#{v}/#{spec.original_name}.gemspec.rz"
|
1149
|
-
data = Marshal.dump spec
|
1150
|
-
data_deflate = Zlib::Deflate.deflate data
|
1151
|
-
@fetcher.data[path] = data_deflate
|
1152
|
-
end
|
1070
|
+
write_marshalled_gemspecs(*all_specs)
|
1153
1071
|
end
|
1154
1072
|
|
1155
1073
|
nil # force errors
|
1156
1074
|
end
|
1157
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
|
+
|
1158
1087
|
##
|
1159
1088
|
# Deflates +data+
|
1160
1089
|
|
@@ -1162,25 +1091,24 @@ Also, a list:
|
|
1162
1091
|
Zlib::Deflate.deflate data
|
1163
1092
|
end
|
1164
1093
|
|
1165
|
-
def util_set_RUBY_VERSION(version, patchlevel
|
1166
|
-
if Gem.instance_variables.include? :@ruby_version
|
1167
|
-
Gem.instance_variables.include? '@ruby_version'
|
1094
|
+
def util_set_RUBY_VERSION(version, patchlevel, revision, description, engine = "ruby", engine_version = nil)
|
1095
|
+
if Gem.instance_variables.include? :@ruby_version
|
1168
1096
|
Gem.send :remove_instance_variable, :@ruby_version
|
1169
1097
|
end
|
1170
1098
|
|
1171
1099
|
@RUBY_VERSION = RUBY_VERSION
|
1172
1100
|
@RUBY_PATCHLEVEL = RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1173
1101
|
@RUBY_REVISION = RUBY_REVISION if defined?(RUBY_REVISION)
|
1174
|
-
@RUBY_DESCRIPTION = RUBY_DESCRIPTION
|
1102
|
+
@RUBY_DESCRIPTION = RUBY_DESCRIPTION
|
1175
1103
|
@RUBY_ENGINE = RUBY_ENGINE
|
1176
1104
|
@RUBY_ENGINE_VERSION = RUBY_ENGINE_VERSION if defined?(RUBY_ENGINE_VERSION)
|
1177
1105
|
|
1178
1106
|
util_clear_RUBY_VERSION
|
1179
1107
|
|
1180
1108
|
Object.const_set :RUBY_VERSION, version
|
1181
|
-
Object.const_set :RUBY_PATCHLEVEL, patchlevel
|
1182
|
-
Object.const_set :RUBY_REVISION, revision
|
1183
|
-
Object.const_set :RUBY_DESCRIPTION, description
|
1109
|
+
Object.const_set :RUBY_PATCHLEVEL, patchlevel
|
1110
|
+
Object.const_set :RUBY_REVISION, revision
|
1111
|
+
Object.const_set :RUBY_DESCRIPTION, description
|
1184
1112
|
Object.const_set :RUBY_ENGINE, engine
|
1185
1113
|
Object.const_set :RUBY_ENGINE_VERSION, engine_version if engine_version
|
1186
1114
|
end
|
@@ -1193,8 +1121,7 @@ Also, a list:
|
|
1193
1121
|
defined?(@RUBY_PATCHLEVEL)
|
1194
1122
|
Object.const_set :RUBY_REVISION, @RUBY_REVISION if
|
1195
1123
|
defined?(@RUBY_REVISION)
|
1196
|
-
Object.const_set :RUBY_DESCRIPTION, @RUBY_DESCRIPTION
|
1197
|
-
defined?(@RUBY_DESCRIPTION)
|
1124
|
+
Object.const_set :RUBY_DESCRIPTION, @RUBY_DESCRIPTION
|
1198
1125
|
Object.const_set :RUBY_ENGINE, @RUBY_ENGINE
|
1199
1126
|
Object.const_set :RUBY_ENGINE_VERSION, @RUBY_ENGINE_VERSION if
|
1200
1127
|
defined?(@RUBY_ENGINE_VERSION)
|
@@ -1223,12 +1150,26 @@ Also, a list:
|
|
1223
1150
|
Gem.win_platform?
|
1224
1151
|
end
|
1225
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
|
+
|
1226
1167
|
##
|
1227
1168
|
# Returns whether or not we're on a version of Ruby built with VC++ (or
|
1228
1169
|
# Borland) versus Cygwin, Mingw, etc.
|
1229
1170
|
|
1230
1171
|
def self.vc_windows?
|
1231
|
-
RUBY_PLATFORM.match(
|
1172
|
+
RUBY_PLATFORM.match("mswin")
|
1232
1173
|
end
|
1233
1174
|
|
1234
1175
|
##
|
@@ -1236,7 +1177,15 @@ Also, a list:
|
|
1236
1177
|
# Borland) versus Cygwin, Mingw, etc.
|
1237
1178
|
|
1238
1179
|
def vc_windows?
|
1239
|
-
RUBY_PLATFORM.match(
|
1180
|
+
RUBY_PLATFORM.match("mswin")
|
1181
|
+
end
|
1182
|
+
|
1183
|
+
##
|
1184
|
+
# Is this test being run on a ruby/ruby repository?
|
1185
|
+
#
|
1186
|
+
|
1187
|
+
def ruby_repo?
|
1188
|
+
!ENV["GEM_COMMAND"].nil?
|
1240
1189
|
end
|
1241
1190
|
|
1242
1191
|
##
|
@@ -1245,7 +1194,7 @@ Also, a list:
|
|
1245
1194
|
# other platforms, including Cygwin, it will return 'make'.
|
1246
1195
|
|
1247
1196
|
def self.make_command
|
1248
|
-
ENV["make"] || ENV["MAKE"] || (vc_windows? ?
|
1197
|
+
ENV["make"] || ENV["MAKE"] || (vc_windows? ? "nmake" : "make")
|
1249
1198
|
end
|
1250
1199
|
|
1251
1200
|
##
|
@@ -1254,14 +1203,14 @@ Also, a list:
|
|
1254
1203
|
# other platforms, including Cygwin, it will return 'make'.
|
1255
1204
|
|
1256
1205
|
def make_command
|
1257
|
-
ENV["make"] || ENV["MAKE"] || (vc_windows? ?
|
1206
|
+
ENV["make"] || ENV["MAKE"] || (vc_windows? ? "nmake" : "make")
|
1258
1207
|
end
|
1259
1208
|
|
1260
1209
|
##
|
1261
1210
|
# Returns whether or not the nmake command could be found.
|
1262
1211
|
|
1263
1212
|
def nmake_found?
|
1264
|
-
system(
|
1213
|
+
system("nmake /? 1>NUL 2>&1")
|
1265
1214
|
end
|
1266
1215
|
|
1267
1216
|
# In case we're building docs in a background process, this method waits for
|
@@ -1293,7 +1242,7 @@ Also, a list:
|
|
1293
1242
|
|
1294
1243
|
def build_rake_in(good=true)
|
1295
1244
|
gem_ruby = Gem.ruby
|
1296
|
-
Gem.ruby =
|
1245
|
+
Gem.ruby = self.class.rubybin
|
1297
1246
|
env_rake = ENV["rake"]
|
1298
1247
|
rake = (good ? @@good_rake : @@bad_rake)
|
1299
1248
|
ENV["rake"] = rake
|
@@ -1314,37 +1263,74 @@ Also, a list:
|
|
1314
1263
|
ruby = ENV["RUBY"]
|
1315
1264
|
return ruby if ruby
|
1316
1265
|
ruby = "ruby"
|
1317
|
-
rubyexe = "#{ruby}
|
1266
|
+
rubyexe = "#{ruby}#{RbConfig::CONFIG['EXEEXT']}"
|
1318
1267
|
|
1319
1268
|
3.times do
|
1320
|
-
if File.exist?
|
1269
|
+
if File.exist?(ruby) && File.executable?(ruby) && !File.directory?(ruby)
|
1321
1270
|
return File.expand_path(ruby)
|
1322
1271
|
end
|
1323
|
-
if File.exist?
|
1272
|
+
if File.exist?(rubyexe) && File.executable?(rubyexe)
|
1324
1273
|
return File.expand_path(rubyexe)
|
1325
1274
|
end
|
1326
1275
|
ruby = File.join("..", ruby)
|
1327
1276
|
end
|
1328
1277
|
|
1329
1278
|
begin
|
1330
|
-
|
1331
|
-
File.join(RbConfig::CONFIG["bindir"],
|
1332
|
-
RbConfig::CONFIG["ruby_install_name"] +
|
1333
|
-
RbConfig::CONFIG["EXEEXT"])
|
1279
|
+
Gem.ruby
|
1334
1280
|
rescue LoadError
|
1335
1281
|
"ruby"
|
1336
1282
|
end
|
1337
1283
|
end
|
1338
1284
|
|
1285
|
+
def ruby_with_rubygems_in_load_path
|
1286
|
+
[Gem.ruby, "-I", rubygems_path]
|
1287
|
+
end
|
1288
|
+
|
1289
|
+
def rubygems_path
|
1290
|
+
$LOAD_PATH.find {|p| p == File.dirname($LOADED_FEATURES.find {|f| f.end_with?("/rubygems.rb") }) }
|
1291
|
+
end
|
1292
|
+
|
1293
|
+
def bundler_path
|
1294
|
+
$LOAD_PATH.find {|p| p == File.dirname($LOADED_FEATURES.find {|f| f.end_with?("/bundler.rb") }) }
|
1295
|
+
end
|
1296
|
+
|
1297
|
+
def with_clean_path_to_ruby
|
1298
|
+
orig_ruby = Gem.ruby
|
1299
|
+
|
1300
|
+
Gem.instance_variable_set :@ruby, nil
|
1301
|
+
|
1302
|
+
yield
|
1303
|
+
ensure
|
1304
|
+
Gem.instance_variable_set :@ruby, orig_ruby
|
1305
|
+
end
|
1306
|
+
|
1307
|
+
def with_internal_encoding(encoding)
|
1308
|
+
int_enc = Encoding.default_internal
|
1309
|
+
silence_warnings { Encoding.default_internal = encoding }
|
1310
|
+
|
1311
|
+
yield
|
1312
|
+
ensure
|
1313
|
+
silence_warnings { Encoding.default_internal = int_enc }
|
1314
|
+
end
|
1315
|
+
|
1316
|
+
def silence_warnings
|
1317
|
+
old_verbose, $VERBOSE = $VERBOSE, false
|
1318
|
+
yield
|
1319
|
+
ensure
|
1320
|
+
$VERBOSE = old_verbose
|
1321
|
+
end
|
1322
|
+
|
1339
1323
|
class << self
|
1340
1324
|
# :nodoc:
|
1341
1325
|
##
|
1342
1326
|
# Return the join path, with escaping backticks, dollars, and
|
1343
1327
|
# double-quotes. Unlike `shellescape`, equal-sign is not escaped.
|
1328
|
+
|
1344
1329
|
private
|
1330
|
+
|
1345
1331
|
def escape_path(*path)
|
1346
1332
|
path = File.join(*path)
|
1347
|
-
if %r
|
1333
|
+
if %r{\A[-+:/=@,.\w]+\z} =~ path
|
1348
1334
|
path
|
1349
1335
|
else
|
1350
1336
|
"\"#{path.gsub(/[`$"]/, '\\&')}\""
|
@@ -1352,10 +1338,8 @@ Also, a list:
|
|
1352
1338
|
end
|
1353
1339
|
end
|
1354
1340
|
|
1355
|
-
@@
|
1356
|
-
|
1357
|
-
@@good_rake = "#{rubybin} #{escape_path(gempath, 'good_rake.rb')}"
|
1358
|
-
@@bad_rake = "#{rubybin} #{escape_path(gempath, 'bad_rake.rb')}"
|
1341
|
+
@@good_rake = "#{rubybin} #{escape_path(__dir__, 'good_rake.rb')}"
|
1342
|
+
@@bad_rake = "#{rubybin} #{escape_path(__dir__, 'bad_rake.rb')}"
|
1359
1343
|
|
1360
1344
|
##
|
1361
1345
|
# Construct a new Gem::Dependency.
|
@@ -1438,8 +1422,8 @@ Also, a list:
|
|
1438
1422
|
#
|
1439
1423
|
# Yields the +specification+ to the block, if given
|
1440
1424
|
|
1441
|
-
def vendor_gem(name =
|
1442
|
-
directory = File.join
|
1425
|
+
def vendor_gem(name = "a", version = 1)
|
1426
|
+
directory = File.join "vendor", name
|
1443
1427
|
|
1444
1428
|
FileUtils.mkdir_p directory
|
1445
1429
|
|
@@ -1452,12 +1436,12 @@ Also, a list:
|
|
1452
1436
|
#
|
1453
1437
|
# Yields the +specification+ to the block, if given
|
1454
1438
|
|
1455
|
-
def save_gemspec(name =
|
1439
|
+
def save_gemspec(name = "a", version = 1, directory = ".")
|
1456
1440
|
vendor_spec = Gem::Specification.new name, version do |specification|
|
1457
1441
|
yield specification if block_given?
|
1458
1442
|
end
|
1459
1443
|
|
1460
|
-
File.open File.join(directory, "#{name}.gemspec"),
|
1444
|
+
File.open File.join(directory, "#{name}.gemspec"), "w" do |io|
|
1461
1445
|
io.write vendor_spec.to_ruby
|
1462
1446
|
end
|
1463
1447
|
|
@@ -1469,7 +1453,6 @@ Also, a list:
|
|
1469
1453
|
# It is available by requiring Gem::TestCase.
|
1470
1454
|
|
1471
1455
|
class StaticSet < Gem::Resolver::Set
|
1472
|
-
|
1473
1456
|
##
|
1474
1457
|
# A StaticSet ignores remote because it has a fixed set of gems.
|
1475
1458
|
|
@@ -1506,7 +1489,7 @@ Also, a list:
|
|
1506
1489
|
# Finds all gems matching +dep+ in this set.
|
1507
1490
|
|
1508
1491
|
def find_all(dep)
|
1509
|
-
@specs.find_all {
|
1492
|
+
@specs.find_all {|s| dep.match? s, @prerelease }
|
1510
1493
|
end
|
1511
1494
|
|
1512
1495
|
##
|
@@ -1543,90 +1526,105 @@ Also, a list:
|
|
1543
1526
|
|
1544
1527
|
def self.cert_path(cert_name)
|
1545
1528
|
if 32 == (Time.at(2**32) rescue 32)
|
1546
|
-
cert_file =
|
1547
|
-
File.expand_path "../../../test/rubygems/#{cert_name}_cert_32.pem",
|
1548
|
-
__FILE__
|
1529
|
+
cert_file = "#{__dir__}/#{cert_name}_cert_32.pem"
|
1549
1530
|
|
1550
1531
|
return cert_file if File.exist? cert_file
|
1551
1532
|
end
|
1552
1533
|
|
1553
|
-
|
1534
|
+
"#{__dir__}/#{cert_name}_cert.pem"
|
1554
1535
|
end
|
1555
1536
|
|
1556
1537
|
##
|
1557
|
-
# Loads
|
1538
|
+
# Loads a private key named +key_name+ with +passphrase+ in <tt>test/rubygems/</tt>
|
1558
1539
|
|
1559
1540
|
def self.load_key(key_name, passphrase = nil)
|
1560
1541
|
key_file = key_path key_name
|
1561
1542
|
|
1562
1543
|
key = File.read key_file
|
1563
1544
|
|
1564
|
-
OpenSSL::PKey
|
1545
|
+
OpenSSL::PKey.read key, passphrase
|
1565
1546
|
end
|
1566
1547
|
|
1567
1548
|
##
|
1568
1549
|
# Returns the path to the key named +key_name+ from <tt>test/rubygems</tt>
|
1569
1550
|
|
1570
1551
|
def self.key_path(key_name)
|
1571
|
-
|
1552
|
+
"#{__dir__}/#{key_name}_key.pem"
|
1572
1553
|
end
|
1573
1554
|
|
1574
1555
|
# :stopdoc:
|
1575
1556
|
# only available in RubyGems tests
|
1576
1557
|
|
1577
|
-
PRIVATE_KEY_PASSPHRASE
|
1558
|
+
PRIVATE_KEY_PASSPHRASE = "Foo bar".freeze
|
1578
1559
|
|
1579
1560
|
begin
|
1580
|
-
PRIVATE_KEY = load_key
|
1581
|
-
PRIVATE_KEY_PATH = key_path
|
1561
|
+
PRIVATE_KEY = load_key "private"
|
1562
|
+
PRIVATE_KEY_PATH = key_path "private"
|
1582
1563
|
|
1583
1564
|
# ENCRYPTED_PRIVATE_KEY is PRIVATE_KEY encrypted with PRIVATE_KEY_PASSPHRASE
|
1584
|
-
ENCRYPTED_PRIVATE_KEY = load_key
|
1585
|
-
ENCRYPTED_PRIVATE_KEY_PATH = key_path
|
1565
|
+
ENCRYPTED_PRIVATE_KEY = load_key "encrypted_private", PRIVATE_KEY_PASSPHRASE
|
1566
|
+
ENCRYPTED_PRIVATE_KEY_PATH = key_path "encrypted_private"
|
1586
1567
|
|
1587
1568
|
PUBLIC_KEY = PRIVATE_KEY.public_key
|
1588
1569
|
|
1589
|
-
PUBLIC_CERT = load_cert
|
1590
|
-
PUBLIC_CERT_PATH = cert_path
|
1570
|
+
PUBLIC_CERT = load_cert "public"
|
1571
|
+
PUBLIC_CERT_PATH = cert_path "public"
|
1591
1572
|
rescue Errno::ENOENT
|
1592
1573
|
PRIVATE_KEY = nil
|
1593
1574
|
PUBLIC_KEY = nil
|
1594
1575
|
PUBLIC_CERT = nil
|
1595
|
-
end if
|
1576
|
+
end if Gem::HAVE_OPENSSL
|
1596
1577
|
|
1597
|
-
|
1578
|
+
private
|
1598
1579
|
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
end
|
1580
|
+
def restore_env
|
1581
|
+
unless Gem.win_platform?
|
1582
|
+
ENV.replace(@orig_env)
|
1583
|
+
return
|
1584
|
+
end
|
1605
1585
|
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
end
|
1586
|
+
# Fallback logic for Windows below to workaround
|
1587
|
+
# https://bugs.ruby-lang.org/issues/16798. Can be dropped once all
|
1588
|
+
# supported rubies include the fix for that.
|
1610
1589
|
|
1611
|
-
|
1612
|
-
gem 'rdoc'
|
1613
|
-
require 'rdoc'
|
1590
|
+
ENV.clear
|
1614
1591
|
|
1615
|
-
|
1616
|
-
|
1592
|
+
@orig_env.each {|k, v| ENV[k] = v }
|
1593
|
+
end
|
1617
1594
|
end
|
1618
1595
|
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1596
|
+
# https://github.com/seattlerb/minitest/blob/13c48a03d84a2a87855a4de0c959f96800100357/lib/minitest/mock.rb#L192
|
1597
|
+
class Object
|
1598
|
+
def stub(name, val_or_callable, *block_args)
|
1599
|
+
new_name = "__minitest_stub__#{name}"
|
1600
|
+
|
1601
|
+
metaclass = class << self; self; end
|
1602
|
+
|
1603
|
+
if respond_to?(name) && !methods.map(&:to_s).include?(name.to_s)
|
1604
|
+
metaclass.send :define_method, name do |*args|
|
1605
|
+
super(*args)
|
1606
|
+
end
|
1607
|
+
end
|
1608
|
+
|
1609
|
+
metaclass.send :alias_method, new_name, name
|
1610
|
+
|
1611
|
+
metaclass.send :define_method, name do |*args, &blk|
|
1612
|
+
if val_or_callable.respond_to? :call
|
1613
|
+
val_or_callable.call(*args, &blk)
|
1614
|
+
else
|
1615
|
+
blk.call(*block_args) if blk
|
1616
|
+
val_or_callable
|
1617
|
+
end
|
1618
|
+
end
|
1619
|
+
|
1620
|
+
metaclass.send(:ruby2_keywords, name) if metaclass.respond_to?(:ruby2_keywords, true)
|
1621
|
+
|
1622
|
+
yield self
|
1623
|
+
ensure
|
1624
|
+
metaclass.send :undef_method, name
|
1625
|
+
metaclass.send :alias_method, name, new_name
|
1626
|
+
metaclass.send :undef_method, new_name
|
1627
|
+
end unless method_defined?(:stub) # lib/resolv/test_dns.rb also has the same method definition
|
1623
1628
|
end
|
1624
1629
|
|
1625
|
-
|
1626
|
-
tmpdirs = []
|
1627
|
-
tmpdirs << (ENV['GEM_HOME'] = Dir.mktmpdir("home"))
|
1628
|
-
tmpdirs << (ENV['GEM_PATH'] = Dir.mktmpdir("path"))
|
1629
|
-
pid = $$
|
1630
|
-
END {tmpdirs.each {|dir| Dir.rmdir(dir)} if $$ == pid}
|
1631
|
-
Gem.clear_paths
|
1632
|
-
Gem.loaded_specs.clear
|
1630
|
+
require_relative "utilities"
|