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
data/test/rubygems/test_gem.rb
CHANGED
@@ -1,23 +1,17 @@
|
|
1
1
|
# coding: US-ASCII
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
|
10
|
-
# TODO: push this up to test_case.rb once battle tested
|
11
|
-
|
12
|
-
$LOAD_PATH.map! do |path|
|
13
|
-
path.dup.untaint
|
14
|
-
end
|
2
|
+
require_relative "helper"
|
3
|
+
require "rubygems"
|
4
|
+
require "rubygems/command"
|
5
|
+
require "rubygems/installer"
|
6
|
+
require "pathname"
|
7
|
+
require "tmpdir"
|
8
|
+
require "rbconfig"
|
15
9
|
|
16
10
|
class TestGem < Gem::TestCase
|
17
|
-
RUBY_INSTALL_NAME = RbConfig::CONFIG['RUBY_INSTALL_NAME']
|
18
|
-
|
19
11
|
PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
|
20
12
|
|
13
|
+
PROJECT_DIR = File.expand_path("../..", __dir__).tap(&Gem::UNTAINT)
|
14
|
+
|
21
15
|
def setup
|
22
16
|
super
|
23
17
|
|
@@ -25,111 +19,104 @@ class TestGem < Gem::TestCase
|
|
25
19
|
|
26
20
|
common_installer_setup
|
27
21
|
|
28
|
-
|
29
|
-
@additional = %w[a b].map { |d| File.join @tempdir, d }
|
22
|
+
@additional = %w[a b].map {|d| File.join @tempdir, d }
|
30
23
|
|
31
24
|
util_remove_interrupt_command
|
32
25
|
end
|
33
26
|
|
34
27
|
def test_self_finish_resolve
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
c2 = util_spec "c", "2"
|
28
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
29
|
+
b1 = util_spec "b", "1", "c" => ">= 1"
|
30
|
+
b2 = util_spec "b", "2", "c" => ">= 2"
|
31
|
+
c1 = util_spec "c", "1"
|
32
|
+
c2 = util_spec "c", "2"
|
41
33
|
|
42
|
-
|
34
|
+
install_specs c1, c2, b1, b2, a1
|
43
35
|
|
44
|
-
|
36
|
+
a1.activate
|
45
37
|
|
46
|
-
|
47
|
-
|
38
|
+
assert_equal %w[a-1], loaded_spec_names
|
39
|
+
assert_equal ["b (> 0)"], unresolved_names
|
48
40
|
|
49
|
-
|
41
|
+
Gem.finish_resolve
|
50
42
|
|
51
|
-
|
52
|
-
|
53
|
-
end
|
43
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
44
|
+
assert_equal [], unresolved_names
|
54
45
|
end
|
55
46
|
|
56
47
|
def test_self_finish_resolve_wtf
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d.rb" # this
|
48
|
+
a1 = util_spec "a", "1", "b" => "> 0", "d" => "> 0" # this
|
49
|
+
b1 = util_spec "b", "1", { "c" => ">= 1" }, "lib/b.rb" # this
|
50
|
+
b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/b.rb"
|
51
|
+
c1 = util_spec "c", "1" # this
|
52
|
+
c2 = util_spec "c", "2"
|
53
|
+
d1 = util_spec "d", "1", { "c" => "< 2" }, "lib/d.rb"
|
54
|
+
d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d.rb" # this
|
65
55
|
|
66
|
-
|
56
|
+
install_specs c1, c2, b1, b2, d1, d2, a1
|
67
57
|
|
68
|
-
|
58
|
+
a1.activate
|
69
59
|
|
70
|
-
|
71
|
-
|
60
|
+
assert_equal %w[a-1], loaded_spec_names
|
61
|
+
assert_equal ["b (> 0)", "d (> 0)"], unresolved_names
|
72
62
|
|
73
|
-
|
63
|
+
Gem.finish_resolve
|
74
64
|
|
75
|
-
|
76
|
-
|
77
|
-
end
|
65
|
+
assert_equal %w[a-1 b-1 c-1 d-2], loaded_spec_names
|
66
|
+
assert_equal [], unresolved_names
|
78
67
|
end
|
79
68
|
|
80
69
|
def test_self_finish_resolve_respects_loaded_specs
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
c2 = util_spec "c", "2"
|
70
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
71
|
+
b1 = util_spec "b", "1", "c" => ">= 1"
|
72
|
+
b2 = util_spec "b", "2", "c" => ">= 2"
|
73
|
+
c1 = util_spec "c", "1"
|
74
|
+
c2 = util_spec "c", "2"
|
87
75
|
|
88
|
-
|
76
|
+
install_specs c1, c2, b1, b2, a1
|
89
77
|
|
90
|
-
|
91
|
-
|
78
|
+
a1.activate
|
79
|
+
c1.activate
|
92
80
|
|
93
|
-
|
94
|
-
|
81
|
+
assert_equal %w[a-1 c-1], loaded_spec_names
|
82
|
+
assert_equal ["b (> 0)"], unresolved_names
|
95
83
|
|
96
|
-
|
84
|
+
Gem.finish_resolve
|
97
85
|
|
98
|
-
|
99
|
-
|
100
|
-
end
|
86
|
+
assert_equal %w[a-1 b-1 c-1], loaded_spec_names
|
87
|
+
assert_equal [], unresolved_names
|
101
88
|
end
|
102
89
|
|
103
90
|
def test_self_install
|
104
91
|
spec_fetcher do |f|
|
105
|
-
f.gem
|
106
|
-
f.spec
|
92
|
+
f.gem "a", 1
|
93
|
+
f.spec "a", 2
|
107
94
|
end
|
108
95
|
|
109
96
|
gemhome2 = "#{@gemhome}2"
|
110
97
|
|
111
|
-
installed = Gem.install
|
98
|
+
installed = Gem.install "a", "= 1", :install_dir => gemhome2
|
112
99
|
|
113
|
-
assert_equal %w[a-1], installed.map {
|
100
|
+
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
|
114
101
|
|
115
|
-
|
102
|
+
assert_path_exist File.join(gemhome2, "gems", "a-1")
|
116
103
|
end
|
117
104
|
|
118
105
|
def test_self_install_in_rescue
|
119
106
|
spec_fetcher do |f|
|
120
|
-
f.gem
|
121
|
-
f.spec
|
107
|
+
f.gem "a", 1
|
108
|
+
f.spec "a", 2
|
122
109
|
end
|
123
110
|
|
124
111
|
gemhome2 = "#{@gemhome}2"
|
125
112
|
|
126
113
|
installed =
|
127
114
|
begin
|
128
|
-
raise
|
115
|
+
raise "Error"
|
129
116
|
rescue StandardError
|
130
|
-
Gem.install
|
117
|
+
Gem.install "a", "= 1", :install_dir => gemhome2
|
131
118
|
end
|
132
|
-
assert_equal %w[a-1], installed.map {
|
119
|
+
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
|
133
120
|
end
|
134
121
|
|
135
122
|
def test_self_install_permissions
|
@@ -151,53 +138,60 @@ class TestGem < Gem::TestCase
|
|
151
138
|
end
|
152
139
|
|
153
140
|
def test_self_install_permissions_with_format_executable
|
154
|
-
|
155
|
-
|
141
|
+
assert_self_install_permissions(format_executable: true)
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_self_install_permissions_with_format_executable_and_non_standard_ruby_install_name
|
145
|
+
Gem::Installer.exec_format = nil
|
146
|
+
ruby_install_name "ruby27" do
|
147
|
+
assert_self_install_permissions(format_executable: true)
|
148
|
+
end
|
149
|
+
ensure
|
150
|
+
Gem::Installer.exec_format = nil
|
156
151
|
end
|
157
152
|
|
158
|
-
def assert_self_install_permissions
|
159
|
-
mask =
|
153
|
+
def assert_self_install_permissions(format_executable: false)
|
154
|
+
mask = win_platform? ? 0700 : 0777
|
160
155
|
options = {
|
161
156
|
:dir_mode => 0500,
|
162
|
-
:prog_mode => 0510,
|
157
|
+
:prog_mode => win_platform? ? 0410 : 0510,
|
163
158
|
:data_mode => 0640,
|
164
159
|
:wrappers => true,
|
165
|
-
:format_executable =>
|
160
|
+
:format_executable => format_executable,
|
166
161
|
}
|
167
162
|
Dir.chdir @tempdir do
|
168
|
-
Dir.mkdir
|
169
|
-
|
170
|
-
fp.chmod(0755)
|
171
|
-
fp.puts 'p'
|
172
|
-
end
|
163
|
+
Dir.mkdir "bin"
|
164
|
+
Dir.mkdir "data"
|
173
165
|
|
174
|
-
|
175
|
-
File.
|
176
|
-
|
177
|
-
|
166
|
+
File.write "bin/foo", "#!/usr/bin/env ruby\n"
|
167
|
+
File.chmod 0755, "bin/foo"
|
168
|
+
|
169
|
+
File.write "data/foo.txt", "blah\n"
|
178
170
|
|
179
171
|
spec_fetcher do |f|
|
180
|
-
f.gem
|
181
|
-
s.executables = [
|
182
|
-
s.files = %w[bin/foo
|
172
|
+
f.gem "foo", 1 do |s|
|
173
|
+
s.executables = ["foo"]
|
174
|
+
s.files = %w[bin/foo data/foo.txt]
|
183
175
|
end
|
184
176
|
end
|
185
|
-
Gem.install
|
177
|
+
Gem.install "foo", Gem::Requirement.default, options
|
186
178
|
end
|
187
179
|
|
188
180
|
prog_mode = (options[:prog_mode] & mask).to_s(8)
|
189
181
|
dir_mode = (options[:dir_mode] & mask).to_s(8)
|
190
182
|
data_mode = (options[:data_mode] & mask).to_s(8)
|
191
|
-
prog_name =
|
192
|
-
prog_name =
|
183
|
+
prog_name = "foo"
|
184
|
+
prog_name = RbConfig::CONFIG["ruby_install_name"].sub("ruby", "foo") if options[:format_executable]
|
193
185
|
expected = {
|
194
186
|
"bin/#{prog_name}" => prog_mode,
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
187
|
+
"gems/foo-1" => dir_mode,
|
188
|
+
"gems/foo-1/bin" => dir_mode,
|
189
|
+
"gems/foo-1/data" => dir_mode,
|
190
|
+
"gems/foo-1/bin/foo" => prog_mode,
|
191
|
+
"gems/foo-1/data/foo.txt" => data_mode,
|
200
192
|
}
|
193
|
+
# add Windows script
|
194
|
+
expected["bin/#{prog_name}.bat"] = mask.to_s(8) if win_platform?
|
201
195
|
result = {}
|
202
196
|
Dir.chdir @gemhome do
|
203
197
|
expected.each_key do |n|
|
@@ -206,75 +200,79 @@ class TestGem < Gem::TestCase
|
|
206
200
|
end
|
207
201
|
assert_equal(expected, result)
|
208
202
|
ensure
|
209
|
-
File.chmod(0755, *Dir.glob(@gemhome+
|
203
|
+
File.chmod(0755, *Dir.glob(@gemhome + "/gems/**/").map {|path| path.tap(&Gem::UNTAINT) })
|
210
204
|
end
|
211
205
|
|
212
206
|
def test_require_missing
|
213
|
-
|
214
|
-
|
215
|
-
require "q"
|
216
|
-
end
|
207
|
+
assert_raise ::LoadError do
|
208
|
+
require "test_require_missing"
|
217
209
|
end
|
218
210
|
end
|
219
211
|
|
220
212
|
def test_require_does_not_glob
|
221
|
-
|
222
|
-
a1 = util_spec "a", "1", nil, "lib/a1.rb"
|
223
|
-
|
224
|
-
install_specs a1
|
213
|
+
a1 = util_spec "a", "1", nil, "lib/a1.rb"
|
225
214
|
|
226
|
-
|
227
|
-
require "a*"
|
228
|
-
end
|
215
|
+
install_specs a1
|
229
216
|
|
230
|
-
|
217
|
+
assert_raise ::LoadError do
|
218
|
+
require "a*"
|
231
219
|
end
|
220
|
+
|
221
|
+
assert_equal [], loaded_spec_names
|
232
222
|
end
|
233
223
|
|
234
224
|
def test_self_bin_path_active
|
235
|
-
a1 = util_spec
|
236
|
-
s.executables = [
|
225
|
+
a1 = util_spec "a", "1" do |s|
|
226
|
+
s.executables = ["exec"]
|
237
227
|
end
|
238
228
|
|
239
|
-
util_spec
|
240
|
-
s.executables = [
|
229
|
+
util_spec "a", "2" do |s|
|
230
|
+
s.executables = ["exec"]
|
241
231
|
end
|
242
232
|
|
243
233
|
a1.activate
|
244
234
|
|
245
|
-
assert_match
|
235
|
+
assert_match "a-1/bin/exec", Gem.bin_path("a", "exec", ">= 0")
|
246
236
|
end
|
247
237
|
|
248
238
|
def test_self_bin_path_picking_newest
|
249
|
-
a1 = util_spec
|
250
|
-
s.executables = [
|
239
|
+
a1 = util_spec "a", "1" do |s|
|
240
|
+
s.executables = ["exec"]
|
251
241
|
end
|
252
242
|
|
253
|
-
a2 = util_spec
|
254
|
-
s.executables = [
|
243
|
+
a2 = util_spec "a", "2" do |s|
|
244
|
+
s.executables = ["exec"]
|
255
245
|
end
|
256
246
|
|
257
247
|
install_specs a1, a2
|
258
248
|
|
259
|
-
assert_match
|
249
|
+
assert_match "a-2/bin/exec", Gem.bin_path("a", "exec", ">= 0")
|
250
|
+
end
|
251
|
+
|
252
|
+
def test_self_activate_bin_path_no_exec_name
|
253
|
+
e = assert_raise ArgumentError do
|
254
|
+
Gem.activate_bin_path "a"
|
255
|
+
end
|
256
|
+
|
257
|
+
assert_equal "you must supply exec_name", e.message
|
260
258
|
end
|
261
259
|
|
262
260
|
def test_activate_bin_path_resolves_eagerly
|
263
|
-
a1 = util_spec
|
264
|
-
s.executables = [
|
265
|
-
s.add_dependency
|
261
|
+
a1 = util_spec "a", "1" do |s|
|
262
|
+
s.executables = ["exec"]
|
263
|
+
s.add_dependency "b"
|
266
264
|
end
|
267
265
|
|
268
|
-
b1 = util_spec
|
269
|
-
s.add_dependency
|
266
|
+
b1 = util_spec "b", "1" do |s|
|
267
|
+
s.add_dependency "c", "2"
|
270
268
|
end
|
271
269
|
|
272
|
-
b2 = util_spec
|
273
|
-
s.add_dependency
|
270
|
+
b2 = util_spec "b", "2" do |s|
|
271
|
+
s.add_dependency "c", "1"
|
274
272
|
end
|
275
273
|
|
276
|
-
c1 = util_spec
|
277
|
-
c2 = util_spec
|
274
|
+
c1 = util_spec "c", "1"
|
275
|
+
c2 = util_spec "c", "2"
|
278
276
|
|
279
277
|
install_specs c1, c2, b1, b2, a1
|
280
278
|
|
@@ -282,18 +280,90 @@ class TestGem < Gem::TestCase
|
|
282
280
|
|
283
281
|
# If we didn't eagerly resolve, this would activate c-2 and then the
|
284
282
|
# finish_resolve would cause a conflict
|
285
|
-
gem
|
283
|
+
gem "c"
|
286
284
|
Gem.finish_resolve
|
287
285
|
|
288
|
-
assert_equal %w
|
286
|
+
assert_equal %w[a-1 b-2 c-1], loaded_spec_names
|
287
|
+
end
|
288
|
+
|
289
|
+
def test_activate_bin_path_does_not_error_if_a_gem_thats_not_finally_activated_has_orphaned_dependencies
|
290
|
+
a1 = util_spec "a", "1" do |s|
|
291
|
+
s.executables = ["exec"]
|
292
|
+
s.add_dependency "b"
|
293
|
+
end
|
294
|
+
|
295
|
+
b1 = util_spec "b", "1" do |s|
|
296
|
+
s.add_dependency "c", "1"
|
297
|
+
end
|
298
|
+
|
299
|
+
b2 = util_spec "b", "2" do |s|
|
300
|
+
s.add_dependency "c", "2"
|
301
|
+
end
|
302
|
+
|
303
|
+
c2 = util_spec "c", "2"
|
304
|
+
|
305
|
+
install_specs c2, b1, b2, a1
|
306
|
+
|
307
|
+
# c1 is missing, but not needed for activation, so we should not get any errors here
|
308
|
+
|
309
|
+
Gem.activate_bin_path("a", "exec", ">= 0")
|
310
|
+
|
311
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
312
|
+
end
|
313
|
+
|
314
|
+
def test_activate_bin_path_raises_a_meaningful_error_if_a_gem_thats_finally_activated_has_orphaned_dependencies
|
315
|
+
a1 = util_spec "a", "1" do |s|
|
316
|
+
s.executables = ["exec"]
|
317
|
+
s.add_dependency "b"
|
318
|
+
end
|
319
|
+
|
320
|
+
b1 = util_spec "b", "1" do |s|
|
321
|
+
s.add_dependency "c", "1"
|
322
|
+
end
|
323
|
+
|
324
|
+
b2 = util_spec "b", "2" do |s|
|
325
|
+
s.add_dependency "c", "2"
|
326
|
+
end
|
327
|
+
|
328
|
+
c1 = util_spec "c", "1"
|
329
|
+
|
330
|
+
install_specs c1, b1, b2, a1
|
331
|
+
|
332
|
+
# c2 is missing, and b2 which has it as a dependency will be activated, so we should get an error about the orphaned dependency
|
333
|
+
|
334
|
+
e = assert_raise Gem::UnsatisfiableDependencyError do
|
335
|
+
load Gem.activate_bin_path("a", "exec", ">= 0")
|
336
|
+
end
|
337
|
+
|
338
|
+
assert_equal "Unable to resolve dependency: 'b (>= 0)' requires 'c (= 2)'", e.message
|
289
339
|
end
|
290
340
|
|
291
|
-
def
|
292
|
-
|
293
|
-
s.executables = [
|
341
|
+
def test_activate_bin_path_in_debug_mode
|
342
|
+
a1 = util_spec "a", "1" do |s|
|
343
|
+
s.executables = ["exec"]
|
294
344
|
end
|
295
345
|
|
296
|
-
install_specs
|
346
|
+
install_specs a1
|
347
|
+
|
348
|
+
require "open3"
|
349
|
+
output, status = Open3.capture2e(
|
350
|
+
{ "GEM_HOME" => Gem.paths.home, "DEBUG_RESOLVER" => "1" },
|
351
|
+
*ruby_with_rubygems_in_load_path, "-e", "\"Gem.activate_bin_path('a', 'exec', '>= 0')\""
|
352
|
+
)
|
353
|
+
|
354
|
+
assert status.success?, output
|
355
|
+
end
|
356
|
+
|
357
|
+
def test_activate_bin_path_selects_exact_bundler_version_if_present
|
358
|
+
bundler_latest = util_spec "bundler", "2.0.1" do |s|
|
359
|
+
s.executables = ["bundle"]
|
360
|
+
end
|
361
|
+
|
362
|
+
bundler_previous = util_spec "bundler", "2.0.0" do |s|
|
363
|
+
s.executables = ["bundle"]
|
364
|
+
end
|
365
|
+
|
366
|
+
install_specs bundler_latest, bundler_previous
|
297
367
|
|
298
368
|
File.open("Gemfile.lock", "w") do |f|
|
299
369
|
f.write <<-L.gsub(/ {8}/, "")
|
@@ -307,76 +377,130 @@ class TestGem < Gem::TestCase
|
|
307
377
|
DEPENDENCIES
|
308
378
|
|
309
379
|
BUNDLED WITH
|
310
|
-
|
380
|
+
2.0.0
|
311
381
|
L
|
312
382
|
end
|
313
383
|
|
314
|
-
File.open("Gemfile", "w") {
|
384
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
385
|
+
|
386
|
+
load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
|
387
|
+
|
388
|
+
assert_equal %w[bundler-2.0.0], loaded_spec_names
|
389
|
+
end
|
390
|
+
|
391
|
+
def test_activate_bin_path_respects_underscore_selection_if_given
|
392
|
+
bundler_latest = util_spec "bundler", "2.0.1" do |s|
|
393
|
+
s.executables = ["bundle"]
|
394
|
+
end
|
315
395
|
|
316
|
-
|
317
|
-
|
396
|
+
bundler_previous = util_spec "bundler", "1.17.3" do |s|
|
397
|
+
s.executables = ["bundle"]
|
318
398
|
end
|
319
399
|
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
400
|
+
install_specs bundler_latest, bundler_previous
|
401
|
+
|
402
|
+
File.open("Gemfile.lock", "w") do |f|
|
403
|
+
f.write <<-L.gsub(/ {8}/, "")
|
404
|
+
GEM
|
405
|
+
remote: https://rubygems.org/
|
406
|
+
specs:
|
407
|
+
|
408
|
+
PLATFORMS
|
409
|
+
ruby
|
410
|
+
|
411
|
+
DEPENDENCIES
|
412
|
+
|
413
|
+
BUNDLED WITH
|
414
|
+
2.0.1
|
415
|
+
L
|
416
|
+
end
|
417
|
+
|
418
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
419
|
+
|
420
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 1.17.3")
|
421
|
+
|
422
|
+
assert_equal %w[bundler-1.17.3], loaded_spec_names
|
423
|
+
end
|
424
|
+
|
425
|
+
def test_activate_bin_path_gives_proper_error_for_bundler_when_underscore_selection_given
|
426
|
+
File.open("Gemfile.lock", "w") do |f|
|
427
|
+
f.write <<-L.gsub(/ {8}/, "")
|
428
|
+
GEM
|
429
|
+
remote: https://rubygems.org/
|
430
|
+
specs:
|
431
|
+
|
432
|
+
PLATFORMS
|
433
|
+
ruby
|
434
|
+
|
435
|
+
DEPENDENCIES
|
436
|
+
|
437
|
+
BUNDLED WITH
|
438
|
+
2.1.4
|
439
|
+
L
|
440
|
+
end
|
441
|
+
|
442
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
443
|
+
|
444
|
+
e = assert_raise Gem::GemNotFoundException do
|
445
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 2.2.8")
|
446
|
+
end
|
447
|
+
|
448
|
+
assert_equal "can't find gem bundler (= 2.2.8) with executable bundle", e.message
|
324
449
|
end
|
325
450
|
|
326
451
|
def test_self_bin_path_no_exec_name
|
327
|
-
e =
|
328
|
-
Gem.bin_path
|
452
|
+
e = assert_raise ArgumentError do
|
453
|
+
Gem.bin_path "a"
|
329
454
|
end
|
330
455
|
|
331
|
-
assert_equal
|
456
|
+
assert_equal "you must supply exec_name", e.message
|
332
457
|
end
|
333
458
|
|
334
459
|
def test_self_bin_path_bin_name
|
335
460
|
install_specs util_exec_gem
|
336
|
-
assert_equal @abin_path, Gem.bin_path(
|
461
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin")
|
337
462
|
end
|
338
463
|
|
339
464
|
def test_self_bin_path_bin_name_version
|
340
465
|
install_specs util_exec_gem
|
341
|
-
assert_equal @abin_path, Gem.bin_path(
|
466
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin", "4")
|
342
467
|
end
|
343
468
|
|
344
469
|
def test_self_bin_path_nonexistent_binfile
|
345
|
-
util_spec
|
346
|
-
s.executables = [
|
470
|
+
util_spec "a", "2" do |s|
|
471
|
+
s.executables = ["exec"]
|
347
472
|
end
|
348
|
-
|
349
|
-
Gem.bin_path(
|
473
|
+
assert_raise(Gem::GemNotFoundException) do
|
474
|
+
Gem.bin_path("a", "other", "2")
|
350
475
|
end
|
351
476
|
end
|
352
477
|
|
353
478
|
def test_self_bin_path_no_bin_file
|
354
|
-
util_spec
|
355
|
-
|
356
|
-
Gem.bin_path(
|
479
|
+
util_spec "a", "1"
|
480
|
+
assert_raise(ArgumentError) do
|
481
|
+
Gem.bin_path("a", nil, "1")
|
357
482
|
end
|
358
483
|
end
|
359
484
|
|
360
485
|
def test_self_bin_path_not_found
|
361
|
-
|
362
|
-
Gem.bin_path(
|
486
|
+
assert_raise(Gem::GemNotFoundException) do
|
487
|
+
Gem.bin_path("non-existent", "blah")
|
363
488
|
end
|
364
489
|
end
|
365
490
|
|
366
491
|
def test_self_bin_path_bin_file_gone_in_latest
|
367
492
|
install_specs util_exec_gem
|
368
|
-
spec = util_spec
|
493
|
+
spec = util_spec "a", "10" do |s|
|
369
494
|
s.executables = []
|
370
495
|
end
|
371
496
|
install_specs spec
|
372
|
-
|
373
|
-
assert_equal @abin_path, Gem.bin_path('a', 'abin')
|
497
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin")
|
374
498
|
end
|
375
499
|
|
376
500
|
def test_self_bindir
|
377
|
-
assert_equal File.join(@gemhome,
|
378
|
-
assert_equal File.join(@gemhome,
|
379
|
-
assert_equal File.join(@gemhome,
|
501
|
+
assert_equal File.join(@gemhome, "bin"), Gem.bindir
|
502
|
+
assert_equal File.join(@gemhome, "bin"), Gem.bindir(Gem.dir)
|
503
|
+
assert_equal File.join(@gemhome, "bin"), Gem.bindir(Pathname.new(Gem.dir))
|
380
504
|
end
|
381
505
|
|
382
506
|
def test_self_bindir_default_dir
|
@@ -405,121 +529,93 @@ class TestGem < Gem::TestCase
|
|
405
529
|
foo = nil
|
406
530
|
|
407
531
|
Dir.chdir @tempdir do
|
408
|
-
FileUtils.mkdir_p
|
409
|
-
File.open File.join(
|
410
|
-
fp.puts
|
532
|
+
FileUtils.mkdir_p "data"
|
533
|
+
File.open File.join("data", "foo.txt"), "w" do |fp|
|
534
|
+
fp.puts "blah"
|
535
|
+
end
|
536
|
+
|
537
|
+
foo = util_spec "foo" do |s|
|
538
|
+
s.files = %w[data/foo.txt]
|
411
539
|
end
|
412
540
|
|
413
|
-
foo = util_spec 'foo' do |s| s.files = %w[data/foo.txt] end
|
414
541
|
install_gem foo
|
415
542
|
end
|
416
543
|
|
417
|
-
gem
|
544
|
+
gem "foo"
|
418
545
|
|
419
|
-
expected = File.join @gemhome,
|
546
|
+
expected = File.join @gemhome, "gems", foo.full_name, "data", "foo"
|
420
547
|
|
421
548
|
assert_equal expected, Gem::Specification.find_by_name("foo").datadir
|
422
549
|
end
|
423
550
|
|
424
551
|
def test_self_datadir_nonexistent_package
|
425
|
-
|
552
|
+
assert_raise(Gem::MissingSpecError) do
|
426
553
|
Gem::Specification.find_by_name("xyzzy").datadir
|
427
554
|
end
|
428
555
|
end
|
429
556
|
|
430
557
|
def test_self_default_exec_format
|
431
|
-
ruby_install_name
|
432
|
-
assert_equal
|
558
|
+
ruby_install_name "ruby" do
|
559
|
+
assert_equal "%s", Gem.default_exec_format
|
433
560
|
end
|
434
561
|
end
|
435
562
|
|
436
563
|
def test_self_default_exec_format_18
|
437
|
-
ruby_install_name
|
438
|
-
assert_equal
|
564
|
+
ruby_install_name "ruby18" do
|
565
|
+
assert_equal "%s18", Gem.default_exec_format
|
439
566
|
end
|
440
567
|
end
|
441
568
|
|
442
569
|
def test_self_default_exec_format_jruby
|
443
|
-
ruby_install_name
|
444
|
-
assert_equal
|
570
|
+
ruby_install_name "jruby" do
|
571
|
+
assert_equal "j%s", Gem.default_exec_format
|
445
572
|
end
|
446
573
|
end
|
447
574
|
|
448
575
|
def test_default_path
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
FileUtils.rm_rf Gem.user_home
|
576
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
577
|
+
FileUtils.rm_rf Gem.user_home
|
453
578
|
|
454
|
-
|
579
|
+
expected = [Gem.default_dir]
|
455
580
|
|
456
|
-
|
457
|
-
|
458
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
581
|
+
assert_equal expected, Gem.default_path
|
582
|
+
end
|
459
583
|
end
|
460
584
|
|
461
585
|
def test_default_path_missing_vendor
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
FileUtils.rm_rf Gem.user_home
|
586
|
+
vendordir(nil) do
|
587
|
+
FileUtils.rm_rf Gem.user_home
|
466
588
|
|
467
|
-
|
589
|
+
expected = [Gem.default_dir]
|
468
590
|
|
469
|
-
|
470
|
-
|
471
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
591
|
+
assert_equal expected, Gem.default_path
|
592
|
+
end
|
472
593
|
end
|
473
594
|
|
474
595
|
def test_default_path_user_home
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
expected = [Gem.user_dir, Gem.default_dir]
|
596
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
597
|
+
expected = [Gem.user_dir, Gem.default_dir]
|
479
598
|
|
480
|
-
|
481
|
-
|
482
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
599
|
+
assert_equal expected, Gem.default_path
|
600
|
+
end
|
483
601
|
end
|
484
602
|
|
485
603
|
def test_default_path_vendor_dir
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
FileUtils.mkdir_p Gem.vendor_dir
|
604
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
605
|
+
FileUtils.mkdir_p Gem.vendor_dir
|
490
606
|
|
491
|
-
|
607
|
+
FileUtils.rm_rf Gem.user_home
|
492
608
|
|
493
|
-
|
609
|
+
expected = [Gem.default_dir, Gem.vendor_dir]
|
494
610
|
|
495
|
-
|
496
|
-
|
497
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
611
|
+
assert_equal expected, Gem.default_path
|
612
|
+
end
|
498
613
|
end
|
499
614
|
|
500
615
|
def test_self_default_sources
|
501
616
|
assert_equal %w[https://rubygems.org/], Gem.default_sources
|
502
617
|
end
|
503
618
|
|
504
|
-
def test_self_use_gemdeps
|
505
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
|
506
|
-
|
507
|
-
FileUtils.mkdir_p 'detect/a/b'
|
508
|
-
FileUtils.mkdir_p 'detect/a/Isolate'
|
509
|
-
|
510
|
-
FileUtils.touch 'detect/Isolate'
|
511
|
-
|
512
|
-
begin
|
513
|
-
Dir.chdir 'detect/a/b'
|
514
|
-
|
515
|
-
assert_equal add_bundler_full_name([]), Gem.use_gemdeps.map(&:full_name)
|
516
|
-
ensure
|
517
|
-
Dir.chdir @tempdir
|
518
|
-
end
|
519
|
-
ensure
|
520
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
521
|
-
end
|
522
|
-
|
523
619
|
def test_self_dir
|
524
620
|
assert_equal @gemhome, Gem.dir
|
525
621
|
end
|
@@ -530,12 +626,12 @@ class TestGem < Gem::TestCase
|
|
530
626
|
|
531
627
|
Gem.ensure_gem_subdirectories @gemhome
|
532
628
|
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
629
|
+
assert_path_exist File.join @gemhome, "build_info"
|
630
|
+
assert_path_exist File.join @gemhome, "cache"
|
631
|
+
assert_path_exist File.join @gemhome, "doc"
|
632
|
+
assert_path_exist File.join @gemhome, "extensions"
|
633
|
+
assert_path_exist File.join @gemhome, "gems"
|
634
|
+
assert_path_exist File.join @gemhome, "specifications"
|
539
635
|
end
|
540
636
|
|
541
637
|
def test_self_ensure_gem_directories_permissions
|
@@ -544,7 +640,7 @@ class TestGem < Gem::TestCase
|
|
544
640
|
|
545
641
|
Gem.ensure_gem_subdirectories @gemhome, 0750
|
546
642
|
|
547
|
-
|
643
|
+
assert_directory_exists File.join(@gemhome, "cache")
|
548
644
|
|
549
645
|
assert_equal 0750, File::Stat.new(@gemhome).mode & 0777
|
550
646
|
assert_equal 0750, File::Stat.new(File.join(@gemhome, "cache")).mode & 0777
|
@@ -565,18 +661,18 @@ class TestGem < Gem::TestCase
|
|
565
661
|
end unless win_platform?
|
566
662
|
|
567
663
|
def test_self_ensure_gem_directories_missing_parents
|
568
|
-
gemdir = File.join @tempdir,
|
569
|
-
FileUtils.rm_rf File.join(@tempdir,
|
570
|
-
refute File.exist?(File.join(@tempdir,
|
664
|
+
gemdir = File.join @tempdir, "a/b/c/gemdir"
|
665
|
+
FileUtils.rm_rf File.join(@tempdir, "a") rescue nil
|
666
|
+
refute File.exist?(File.join(@tempdir, "a")),
|
571
667
|
"manually remove #{File.join @tempdir, 'a'}, tests are broken"
|
572
668
|
Gem.use_paths gemdir
|
573
669
|
|
574
670
|
Gem.ensure_gem_subdirectories gemdir
|
575
671
|
|
576
|
-
|
672
|
+
assert_directory_exists util_cache_dir
|
577
673
|
end
|
578
674
|
|
579
|
-
unless win_platform? || Process.uid.zero?
|
675
|
+
unless win_platform? || Process.uid.zero? # only for FS that support write protection
|
580
676
|
def test_self_ensure_gem_directories_write_protected
|
581
677
|
gemdir = File.join @tempdir, "egd"
|
582
678
|
FileUtils.rm_r gemdir rescue nil
|
@@ -608,167 +704,175 @@ class TestGem < Gem::TestCase
|
|
608
704
|
ensure
|
609
705
|
FileUtils.chmod 0600, parent
|
610
706
|
end
|
707
|
+
|
708
|
+
def test_self_ensure_gem_directories_non_existent_paths
|
709
|
+
Gem.ensure_gem_subdirectories "/proc/0123456789/bogus" # should not raise
|
710
|
+
Gem.ensure_gem_subdirectories "classpath:/bogus/x" # JRuby embed scenario
|
711
|
+
end
|
611
712
|
end
|
612
713
|
|
613
714
|
def test_self_extension_dir_shared
|
614
|
-
enable_shared
|
715
|
+
enable_shared "yes" do
|
615
716
|
assert_equal Gem.ruby_api_version, Gem.extension_api_version
|
616
717
|
end
|
617
718
|
end
|
618
719
|
|
619
720
|
def test_self_extension_dir_static
|
620
|
-
enable_shared
|
721
|
+
enable_shared "no" do
|
621
722
|
assert_equal "#{Gem.ruby_api_version}-static", Gem.extension_api_version
|
622
723
|
end
|
623
724
|
end
|
624
725
|
|
625
726
|
def test_self_find_files
|
626
|
-
cwd = File.expand_path("test/rubygems",
|
727
|
+
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
627
728
|
$LOAD_PATH.unshift cwd
|
628
729
|
|
629
|
-
discover_path = File.join
|
730
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
630
731
|
|
631
|
-
foo1, foo2 = %w
|
632
|
-
spec = quick_gem
|
732
|
+
foo1, foo2 = %w[1 2].map do |version|
|
733
|
+
spec = quick_gem "sff", version do |s|
|
633
734
|
s.files << discover_path
|
634
735
|
end
|
635
736
|
|
636
|
-
write_file(File.join
|
737
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
637
738
|
fp.puts "# #{spec.full_name}"
|
638
739
|
end
|
639
740
|
|
640
741
|
spec
|
641
|
-
|
742
|
+
end
|
642
743
|
|
643
744
|
Gem.refresh
|
644
745
|
|
645
746
|
expected = [
|
646
|
-
File.expand_path(
|
747
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
647
748
|
File.join(foo2.full_gem_path, discover_path),
|
648
749
|
File.join(foo1.full_gem_path, discover_path),
|
649
750
|
]
|
650
751
|
|
651
|
-
assert_equal expected, Gem.find_files(
|
652
|
-
assert_equal expected, Gem.find_files(
|
752
|
+
assert_equal expected, Gem.find_files("sff/discover")
|
753
|
+
assert_equal expected, Gem.find_files("sff/**.rb"), "[ruby-core:31730]"
|
653
754
|
ensure
|
654
755
|
assert_equal cwd, $LOAD_PATH.shift
|
655
756
|
end
|
656
757
|
|
657
|
-
def test_self_find_files_with_gemfile
|
658
|
-
cwd = File.expand_path("test/rubygems", @@project_dir)
|
659
|
-
actual_load_path = $LOAD_PATH.unshift(cwd).dup
|
660
|
-
|
661
|
-
discover_path = File.join 'lib', 'sff', 'discover.rb'
|
662
|
-
|
663
|
-
foo1, _ = %w(1 2).map { |version|
|
664
|
-
spec = quick_gem 'sff', version do |s|
|
665
|
-
s.files << discover_path
|
666
|
-
end
|
667
|
-
|
668
|
-
write_file(File.join 'gems', spec.full_name, discover_path) do |fp|
|
669
|
-
fp.puts "# #{spec.full_name}"
|
670
|
-
end
|
671
|
-
|
672
|
-
spec
|
673
|
-
}
|
674
|
-
Gem.refresh
|
675
|
-
|
676
|
-
write_file(File.join Dir.pwd, 'Gemfile') do |fp|
|
677
|
-
fp.puts "source 'https://rubygems.org'"
|
678
|
-
fp.puts "gem '#{foo1.name}', '#{foo1.version}'"
|
679
|
-
end
|
680
|
-
Gem.use_gemdeps(File.join Dir.pwd, 'Gemfile')
|
681
|
-
|
682
|
-
expected = [
|
683
|
-
File.expand_path('test/rubygems/sff/discover.rb', @@project_dir),
|
684
|
-
File.join(foo1.full_gem_path, discover_path)
|
685
|
-
].sort
|
686
|
-
|
687
|
-
assert_equal expected, Gem.find_files('sff/discover').sort
|
688
|
-
assert_equal expected, Gem.find_files('sff/**.rb').sort, '[ruby-core:31730]'
|
689
|
-
ensure
|
690
|
-
assert_equal cwd, actual_load_path.shift
|
691
|
-
end
|
692
|
-
|
693
758
|
def test_self_find_latest_files
|
694
|
-
cwd = File.expand_path("test/rubygems",
|
759
|
+
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
695
760
|
$LOAD_PATH.unshift cwd
|
696
761
|
|
697
|
-
discover_path = File.join
|
762
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
698
763
|
|
699
|
-
_, foo2 = %w
|
700
|
-
spec = quick_gem
|
764
|
+
_, foo2 = %w[1 2].map do |version|
|
765
|
+
spec = quick_gem "sff", version do |s|
|
701
766
|
s.files << discover_path
|
702
767
|
end
|
703
768
|
|
704
|
-
write_file(File.join
|
769
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
705
770
|
fp.puts "# #{spec.full_name}"
|
706
771
|
end
|
707
772
|
|
708
773
|
spec
|
709
|
-
|
774
|
+
end
|
710
775
|
|
711
776
|
Gem.refresh
|
712
777
|
|
713
778
|
expected = [
|
714
|
-
File.expand_path(
|
779
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
715
780
|
File.join(foo2.full_gem_path, discover_path),
|
716
781
|
]
|
717
782
|
|
718
|
-
assert_equal expected, Gem.find_latest_files(
|
719
|
-
assert_equal expected, Gem.find_latest_files(
|
783
|
+
assert_equal expected, Gem.find_latest_files("sff/discover")
|
784
|
+
assert_equal expected, Gem.find_latest_files("sff/**.rb"), "[ruby-core:31730]"
|
720
785
|
ensure
|
721
786
|
assert_equal cwd, $LOAD_PATH.shift
|
722
787
|
end
|
723
788
|
|
724
789
|
def test_self_latest_spec_for
|
725
790
|
gems = spec_fetcher do |fetcher|
|
726
|
-
fetcher.spec
|
727
|
-
fetcher.spec
|
728
|
-
fetcher.spec
|
791
|
+
fetcher.spec "a", 1
|
792
|
+
fetcher.spec "a", "3.a"
|
793
|
+
fetcher.spec "a", 2
|
729
794
|
end
|
730
795
|
|
731
|
-
spec = Gem.latest_spec_for
|
796
|
+
spec = Gem.latest_spec_for "a"
|
797
|
+
|
798
|
+
assert_equal gems["a-2"], spec
|
799
|
+
end
|
800
|
+
|
801
|
+
def test_self_latest_spec_for_multiple_sources
|
802
|
+
uri = "https://example.sample.com/"
|
803
|
+
source = Gem::Source.new(uri)
|
804
|
+
source_list = Gem::SourceList.new
|
805
|
+
source_list << Gem::Source.new(@uri)
|
806
|
+
source_list << source
|
807
|
+
Gem.sources.replace source_list
|
732
808
|
|
733
|
-
|
809
|
+
spec_fetcher(uri) do |fetcher|
|
810
|
+
fetcher.spec "a", 1.1
|
811
|
+
end
|
812
|
+
|
813
|
+
gems = spec_fetcher do |fetcher|
|
814
|
+
fetcher.spec "a", 1
|
815
|
+
fetcher.spec "a", "3.a"
|
816
|
+
fetcher.spec "a", 2
|
817
|
+
end
|
818
|
+
spec = Gem.latest_spec_for "a"
|
819
|
+
assert_equal gems["a-2"], spec
|
734
820
|
end
|
735
821
|
|
736
822
|
def test_self_latest_rubygems_version
|
737
823
|
spec_fetcher do |fetcher|
|
738
|
-
fetcher.spec
|
739
|
-
fetcher.spec
|
740
|
-
fetcher.spec
|
824
|
+
fetcher.spec "rubygems-update", "1.8.23"
|
825
|
+
fetcher.spec "rubygems-update", "1.8.24"
|
826
|
+
fetcher.spec "rubygems-update", "2.0.0.preview3"
|
741
827
|
end
|
742
828
|
|
743
829
|
version = Gem.latest_rubygems_version
|
744
830
|
|
745
|
-
assert_equal Gem::Version.new(
|
831
|
+
assert_equal Gem::Version.new("1.8.24"), version
|
746
832
|
end
|
747
833
|
|
748
834
|
def test_self_latest_version_for
|
749
835
|
spec_fetcher do |fetcher|
|
750
|
-
fetcher.spec
|
751
|
-
fetcher.spec
|
752
|
-
fetcher.spec
|
836
|
+
fetcher.spec "a", 1
|
837
|
+
fetcher.spec "a", 2
|
838
|
+
fetcher.spec "a", "3.a"
|
839
|
+
end
|
840
|
+
|
841
|
+
version = Gem.latest_version_for "a"
|
842
|
+
|
843
|
+
assert_equal Gem::Version.new(2), version
|
844
|
+
end
|
845
|
+
|
846
|
+
def test_self_latest_version_for_multiple_sources
|
847
|
+
uri = "https://example.sample.com/"
|
848
|
+
source = Gem::Source.new(uri)
|
849
|
+
source_list = Gem::SourceList.new
|
850
|
+
source_list << Gem::Source.new(@uri)
|
851
|
+
source_list << source
|
852
|
+
Gem.sources.replace source_list
|
853
|
+
|
854
|
+
spec_fetcher(uri) do |fetcher|
|
855
|
+
fetcher.spec "a", 1.1
|
856
|
+
end
|
857
|
+
|
858
|
+
spec_fetcher do |fetcher|
|
859
|
+
fetcher.spec "a", 1
|
860
|
+
fetcher.spec "a", 2
|
861
|
+
fetcher.spec "a", "3.a"
|
753
862
|
end
|
754
863
|
|
755
|
-
version = Gem.latest_version_for
|
864
|
+
version = Gem.latest_version_for "a"
|
756
865
|
|
757
866
|
assert_equal Gem::Version.new(2), version
|
758
867
|
end
|
759
868
|
|
760
869
|
def test_self_loaded_specs
|
761
|
-
foo = util_spec
|
870
|
+
foo = util_spec "foo"
|
762
871
|
install_gem foo
|
763
872
|
|
764
873
|
foo.activate
|
765
874
|
|
766
|
-
assert_equal true, Gem.loaded_specs.keys.include?(
|
767
|
-
end
|
768
|
-
|
769
|
-
def util_path
|
770
|
-
ENV.delete "GEM_HOME"
|
771
|
-
ENV.delete "GEM_PATH"
|
875
|
+
assert_equal true, Gem.loaded_specs.keys.include?("foo")
|
772
876
|
end
|
773
877
|
|
774
878
|
def test_self_path
|
@@ -776,53 +880,19 @@ class TestGem < Gem::TestCase
|
|
776
880
|
end
|
777
881
|
|
778
882
|
def test_self_path_default
|
779
|
-
|
780
|
-
|
781
|
-
if defined?(APPLE_GEM_HOME)
|
782
|
-
orig_APPLE_GEM_HOME = APPLE_GEM_HOME
|
783
|
-
Object.send :remove_const, :APPLE_GEM_HOME
|
784
|
-
end
|
883
|
+
ENV.delete "GEM_HOME"
|
884
|
+
ENV.delete "GEM_PATH"
|
785
885
|
|
786
886
|
Gem.instance_variable_set :@paths, nil
|
787
887
|
|
788
888
|
assert_equal [Gem.default_path, Gem.dir].flatten.uniq, Gem.path
|
789
|
-
ensure
|
790
|
-
Object.const_set :APPLE_GEM_HOME, orig_APPLE_GEM_HOME if orig_APPLE_GEM_HOME
|
791
|
-
end
|
792
|
-
|
793
|
-
unless win_platform?
|
794
|
-
def test_self_path_APPLE_GEM_HOME
|
795
|
-
util_path
|
796
|
-
|
797
|
-
Gem.clear_paths
|
798
|
-
apple_gem_home = File.join @tempdir, 'apple_gem_home'
|
799
|
-
|
800
|
-
old, $-w = $-w, nil
|
801
|
-
Object.const_set :APPLE_GEM_HOME, apple_gem_home
|
802
|
-
$-w = old
|
803
|
-
|
804
|
-
assert_includes Gem.path, apple_gem_home
|
805
|
-
ensure
|
806
|
-
Object.send :remove_const, :APPLE_GEM_HOME
|
807
|
-
end
|
808
|
-
|
809
|
-
def test_self_path_APPLE_GEM_HOME_GEM_PATH
|
810
|
-
Gem.clear_paths
|
811
|
-
ENV['GEM_PATH'] = @gemhome
|
812
|
-
apple_gem_home = File.join @tempdir, 'apple_gem_home'
|
813
|
-
Gem.const_set :APPLE_GEM_HOME, apple_gem_home
|
814
|
-
|
815
|
-
refute Gem.path.include?(apple_gem_home)
|
816
|
-
ensure
|
817
|
-
Gem.send :remove_const, :APPLE_GEM_HOME
|
818
|
-
end
|
819
889
|
end
|
820
890
|
|
821
891
|
def test_self_path_ENV_PATH
|
822
892
|
path_count = Gem.path.size
|
823
893
|
Gem.clear_paths
|
824
894
|
|
825
|
-
ENV[
|
895
|
+
ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
|
826
896
|
|
827
897
|
assert_equal @additional, Gem.path[0,2]
|
828
898
|
|
@@ -834,10 +904,10 @@ class TestGem < Gem::TestCase
|
|
834
904
|
def test_self_path_duplicate
|
835
905
|
Gem.clear_paths
|
836
906
|
util_ensure_gem_dirs
|
837
|
-
dirs = @additional + [@gemhome] + [File.join(@tempdir,
|
907
|
+
dirs = @additional + [@gemhome] + [File.join(@tempdir, "a")]
|
838
908
|
|
839
|
-
ENV[
|
840
|
-
ENV[
|
909
|
+
ENV["GEM_HOME"] = @gemhome
|
910
|
+
ENV["GEM_PATH"] = dirs.join File::PATH_SEPARATOR
|
841
911
|
|
842
912
|
assert_equal @gemhome, Gem.dir
|
843
913
|
|
@@ -849,8 +919,8 @@ class TestGem < Gem::TestCase
|
|
849
919
|
Gem.clear_paths
|
850
920
|
|
851
921
|
util_ensure_gem_dirs
|
852
|
-
ENV[
|
853
|
-
ENV[
|
922
|
+
ENV["GEM_HOME"] = @gemhome
|
923
|
+
ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
|
854
924
|
|
855
925
|
assert_equal @gemhome, Gem.dir
|
856
926
|
|
@@ -863,42 +933,42 @@ class TestGem < Gem::TestCase
|
|
863
933
|
end
|
864
934
|
|
865
935
|
def test_self_prefix
|
866
|
-
assert_equal
|
936
|
+
assert_equal PROJECT_DIR, Gem.prefix
|
867
937
|
end
|
868
938
|
|
869
939
|
def test_self_prefix_libdir
|
870
|
-
orig_libdir = RbConfig::CONFIG[
|
871
|
-
RbConfig::CONFIG[
|
940
|
+
orig_libdir = RbConfig::CONFIG["libdir"]
|
941
|
+
RbConfig::CONFIG["libdir"] = PROJECT_DIR
|
872
942
|
|
873
943
|
assert_nil Gem.prefix
|
874
944
|
ensure
|
875
|
-
RbConfig::CONFIG[
|
945
|
+
RbConfig::CONFIG["libdir"] = orig_libdir
|
876
946
|
end
|
877
947
|
|
878
948
|
def test_self_prefix_sitelibdir
|
879
|
-
orig_sitelibdir = RbConfig::CONFIG[
|
880
|
-
RbConfig::CONFIG[
|
949
|
+
orig_sitelibdir = RbConfig::CONFIG["sitelibdir"]
|
950
|
+
RbConfig::CONFIG["sitelibdir"] = PROJECT_DIR
|
881
951
|
|
882
952
|
assert_nil Gem.prefix
|
883
953
|
ensure
|
884
|
-
RbConfig::CONFIG[
|
954
|
+
RbConfig::CONFIG["sitelibdir"] = orig_sitelibdir
|
885
955
|
end
|
886
956
|
|
887
957
|
def test_self_read_binary
|
888
|
-
File.open
|
958
|
+
File.open "test", "w" do |io|
|
889
959
|
io.write "\xCF\x80"
|
890
960
|
end
|
891
961
|
|
892
|
-
assert_equal ["\xCF", "\x80"], Gem.read_binary(
|
962
|
+
assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
|
893
963
|
|
894
|
-
|
964
|
+
pend "chmod not supported" if Gem.win_platform?
|
895
965
|
|
896
966
|
begin
|
897
|
-
File.chmod 0444,
|
967
|
+
File.chmod 0444, "test"
|
898
968
|
|
899
|
-
assert_equal ["\xCF", "\x80"], Gem.read_binary(
|
969
|
+
assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
|
900
970
|
ensure
|
901
|
-
File.chmod 0644,
|
971
|
+
File.chmod 0644, "test"
|
902
972
|
end
|
903
973
|
end
|
904
974
|
|
@@ -936,117 +1006,95 @@ class TestGem < Gem::TestCase
|
|
936
1006
|
|
937
1007
|
Gem.refresh
|
938
1008
|
|
939
|
-
Gem::Specification.each{|spec| assert spec.activated? if spec == s}
|
1009
|
+
Gem::Specification.each {|spec| assert spec.activated? if spec == s }
|
940
1010
|
|
941
1011
|
Gem.loaded_specs.delete(s)
|
942
1012
|
Gem.refresh
|
943
1013
|
end
|
944
1014
|
|
945
1015
|
def test_self_ruby_escaping_spaces_in_path
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
RbConfig::CONFIG['bindir'] = "C:/Ruby 1.8/bin"
|
952
|
-
RbConfig::CONFIG['ruby_install_name'] = "ruby"
|
953
|
-
RbConfig::CONFIG['EXEEXT'] = ".exe"
|
954
|
-
Gem.instance_variable_set("@ruby", nil)
|
955
|
-
|
956
|
-
assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby
|
957
|
-
ensure
|
958
|
-
Gem.instance_variable_set("@ruby", orig_ruby)
|
959
|
-
RbConfig::CONFIG['bindir'] = orig_bindir
|
960
|
-
RbConfig::CONFIG['ruby_install_name'] = orig_ruby_install_name
|
961
|
-
RbConfig::CONFIG['EXEEXT'] = orig_exe_ext
|
1016
|
+
with_clean_path_to_ruby do
|
1017
|
+
with_rb_config_ruby("C:/Ruby 1.8/bin/ruby.exe") do
|
1018
|
+
assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby
|
1019
|
+
end
|
1020
|
+
end
|
962
1021
|
end
|
963
1022
|
|
964
1023
|
def test_self_ruby_path_without_spaces
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
RbConfig::CONFIG['bindir'] = "C:/Ruby18/bin"
|
971
|
-
RbConfig::CONFIG['ruby_install_name'] = "ruby"
|
972
|
-
RbConfig::CONFIG['EXEEXT'] = ".exe"
|
973
|
-
Gem.instance_variable_set("@ruby", nil)
|
974
|
-
|
975
|
-
assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby
|
976
|
-
ensure
|
977
|
-
Gem.instance_variable_set("@ruby", orig_ruby)
|
978
|
-
RbConfig::CONFIG['bindir'] = orig_bindir
|
979
|
-
RbConfig::CONFIG['ruby_install_name'] = orig_ruby_install_name
|
980
|
-
RbConfig::CONFIG['EXEEXT'] = orig_exe_ext
|
1024
|
+
with_clean_path_to_ruby do
|
1025
|
+
with_rb_config_ruby("C:/Ruby18/bin/ruby.exe") do
|
1026
|
+
assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby
|
1027
|
+
end
|
1028
|
+
end
|
981
1029
|
end
|
982
1030
|
|
983
1031
|
def test_self_ruby_api_version
|
984
|
-
orig_ruby_version, RbConfig::CONFIG[
|
1032
|
+
orig_ruby_version, RbConfig::CONFIG["ruby_version"] = RbConfig::CONFIG["ruby_version"], "1.2.3"
|
985
1033
|
|
986
1034
|
Gem.instance_variable_set :@ruby_api_version, nil
|
987
1035
|
|
988
|
-
assert_equal
|
1036
|
+
assert_equal "1.2.3", Gem.ruby_api_version
|
989
1037
|
ensure
|
990
1038
|
Gem.instance_variable_set :@ruby_api_version, nil
|
991
1039
|
|
992
|
-
RbConfig::CONFIG[
|
1040
|
+
RbConfig::CONFIG["ruby_version"] = orig_ruby_version
|
993
1041
|
end
|
994
1042
|
|
995
1043
|
def test_self_env_requirement
|
996
|
-
ENV["GEM_REQUIREMENT_FOO"] =
|
997
|
-
ENV["GEM_REQUIREMENT_BAR"] =
|
998
|
-
ENV["GEM_REQUIREMENT_BAZ"] =
|
1044
|
+
ENV["GEM_REQUIREMENT_FOO"] = ">= 1.2.3"
|
1045
|
+
ENV["GEM_REQUIREMENT_BAR"] = "1.2.3"
|
1046
|
+
ENV["GEM_REQUIREMENT_BAZ"] = "abcd"
|
999
1047
|
|
1000
|
-
assert_equal Gem::Requirement.create(
|
1001
|
-
assert_equal Gem::Requirement.create(
|
1002
|
-
|
1003
|
-
assert_equal Gem::Requirement.default, Gem.env_requirement(
|
1048
|
+
assert_equal Gem::Requirement.create(">= 1.2.3"), Gem.env_requirement("foo")
|
1049
|
+
assert_equal Gem::Requirement.create("1.2.3"), Gem.env_requirement("bAr")
|
1050
|
+
assert_raise(Gem::Requirement::BadRequirementError) { Gem.env_requirement("baz") }
|
1051
|
+
assert_equal Gem::Requirement.default, Gem.env_requirement("qux")
|
1004
1052
|
end
|
1005
1053
|
|
1006
|
-
def
|
1007
|
-
util_set_RUBY_VERSION
|
1054
|
+
def test_self_ruby_version_with_non_mri_implementations
|
1055
|
+
util_set_RUBY_VERSION "2.5.0", 0, 60928, "jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]"
|
1008
1056
|
|
1009
|
-
assert_equal Gem::Version.new(
|
1057
|
+
assert_equal Gem::Version.new("2.5.0"), Gem.ruby_version
|
1010
1058
|
ensure
|
1011
1059
|
util_restore_RUBY_VERSION
|
1012
1060
|
end
|
1013
1061
|
|
1014
|
-
def
|
1015
|
-
util_set_RUBY_VERSION
|
1062
|
+
def test_self_ruby_version_with_svn_prerelease
|
1063
|
+
util_set_RUBY_VERSION "2.6.0", -1, 63539, "ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]"
|
1016
1064
|
|
1017
|
-
assert_equal Gem::Version.new(
|
1065
|
+
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
|
1018
1066
|
ensure
|
1019
1067
|
util_restore_RUBY_VERSION
|
1020
1068
|
end
|
1021
1069
|
|
1022
|
-
def
|
1023
|
-
util_set_RUBY_VERSION
|
1070
|
+
def test_self_ruby_version_with_git_prerelease
|
1071
|
+
util_set_RUBY_VERSION "2.7.0", -1, "b563439274a402e33541f5695b1bfd4ac1085638", "ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]"
|
1024
1072
|
|
1025
|
-
assert_equal Gem::Version.new(
|
1073
|
+
assert_equal Gem::Version.new("2.7.0.preview3"), Gem.ruby_version
|
1026
1074
|
ensure
|
1027
1075
|
util_restore_RUBY_VERSION
|
1028
1076
|
end
|
1029
1077
|
|
1030
|
-
def
|
1031
|
-
util_set_RUBY_VERSION
|
1078
|
+
def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
|
1079
|
+
util_set_RUBY_VERSION "2.6.0", -1, 63539, "weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]", "weirdjruby", "9.2.0.0"
|
1032
1080
|
|
1033
|
-
assert_equal Gem::Version.new(
|
1081
|
+
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
|
1034
1082
|
ensure
|
1035
1083
|
util_restore_RUBY_VERSION
|
1036
1084
|
end
|
1037
1085
|
|
1038
|
-
def
|
1039
|
-
util_set_RUBY_VERSION
|
1086
|
+
def test_self_ruby_version_with_svn_trunk
|
1087
|
+
util_set_RUBY_VERSION "1.9.2", -1, 23493, "ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]"
|
1040
1088
|
|
1041
|
-
assert_equal Gem::Version.new(
|
1089
|
+
assert_equal Gem::Version.new("1.9.2.dev"), Gem.ruby_version
|
1042
1090
|
ensure
|
1043
1091
|
util_restore_RUBY_VERSION
|
1044
1092
|
end
|
1045
1093
|
|
1046
|
-
def
|
1047
|
-
util_set_RUBY_VERSION
|
1094
|
+
def test_self_ruby_version_with_git_master
|
1095
|
+
util_set_RUBY_VERSION "2.7.0", -1, "5de284ec78220e75643f89b454ce999da0c1c195", "ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]"
|
1048
1096
|
|
1049
|
-
assert_equal Gem::Version.new(
|
1097
|
+
assert_equal Gem::Version.new("2.7.0.dev"), Gem.ruby_version
|
1050
1098
|
ensure
|
1051
1099
|
util_restore_RUBY_VERSION
|
1052
1100
|
end
|
@@ -1056,7 +1104,7 @@ class TestGem < Gem::TestCase
|
|
1056
1104
|
end
|
1057
1105
|
|
1058
1106
|
def test_self_paths_eq
|
1059
|
-
other = File.join @tempdir,
|
1107
|
+
other = File.join @tempdir, "other"
|
1060
1108
|
path = [@userhome, other].join File::PATH_SEPARATOR
|
1061
1109
|
|
1062
1110
|
#
|
@@ -1069,12 +1117,12 @@ class TestGem < Gem::TestCase
|
|
1069
1117
|
end
|
1070
1118
|
|
1071
1119
|
def test_self_paths_eq_nonexistent_home
|
1072
|
-
ENV[
|
1120
|
+
ENV["GEM_HOME"] = @gemhome
|
1073
1121
|
Gem.clear_paths
|
1074
1122
|
|
1075
|
-
other = File.join @tempdir,
|
1123
|
+
other = File.join @tempdir, "other"
|
1076
1124
|
|
1077
|
-
ENV[
|
1125
|
+
ENV["HOME"] = other
|
1078
1126
|
|
1079
1127
|
Gem.paths = { "GEM_PATH" => other }
|
1080
1128
|
|
@@ -1084,7 +1132,7 @@ class TestGem < Gem::TestCase
|
|
1084
1132
|
def test_self_post_build
|
1085
1133
|
assert_equal 1, Gem.post_build_hooks.length
|
1086
1134
|
|
1087
|
-
Gem.post_build
|
1135
|
+
Gem.post_build {|installer| }
|
1088
1136
|
|
1089
1137
|
assert_equal 2, Gem.post_build_hooks.length
|
1090
1138
|
end
|
@@ -1092,7 +1140,7 @@ class TestGem < Gem::TestCase
|
|
1092
1140
|
def test_self_post_install
|
1093
1141
|
assert_equal 1, Gem.post_install_hooks.length
|
1094
1142
|
|
1095
|
-
Gem.post_install
|
1143
|
+
Gem.post_install {|installer| }
|
1096
1144
|
|
1097
1145
|
assert_equal 2, Gem.post_install_hooks.length
|
1098
1146
|
end
|
@@ -1100,7 +1148,7 @@ class TestGem < Gem::TestCase
|
|
1100
1148
|
def test_self_done_installing
|
1101
1149
|
assert_empty Gem.done_installing_hooks
|
1102
1150
|
|
1103
|
-
Gem.done_installing
|
1151
|
+
Gem.done_installing {|gems| }
|
1104
1152
|
|
1105
1153
|
assert_equal 1, Gem.done_installing_hooks.length
|
1106
1154
|
end
|
@@ -1108,7 +1156,7 @@ class TestGem < Gem::TestCase
|
|
1108
1156
|
def test_self_post_reset
|
1109
1157
|
assert_empty Gem.post_reset_hooks
|
1110
1158
|
|
1111
|
-
Gem.post_reset {
|
1159
|
+
Gem.post_reset {}
|
1112
1160
|
|
1113
1161
|
assert_equal 1, Gem.post_reset_hooks.length
|
1114
1162
|
end
|
@@ -1116,7 +1164,7 @@ class TestGem < Gem::TestCase
|
|
1116
1164
|
def test_self_post_uninstall
|
1117
1165
|
assert_equal 1, Gem.post_uninstall_hooks.length
|
1118
1166
|
|
1119
|
-
Gem.post_uninstall
|
1167
|
+
Gem.post_uninstall {|installer| }
|
1120
1168
|
|
1121
1169
|
assert_equal 2, Gem.post_uninstall_hooks.length
|
1122
1170
|
end
|
@@ -1124,7 +1172,7 @@ class TestGem < Gem::TestCase
|
|
1124
1172
|
def test_self_pre_install
|
1125
1173
|
assert_equal 1, Gem.pre_install_hooks.length
|
1126
1174
|
|
1127
|
-
Gem.pre_install
|
1175
|
+
Gem.pre_install {|installer| }
|
1128
1176
|
|
1129
1177
|
assert_equal 2, Gem.pre_install_hooks.length
|
1130
1178
|
end
|
@@ -1132,7 +1180,7 @@ class TestGem < Gem::TestCase
|
|
1132
1180
|
def test_self_pre_reset
|
1133
1181
|
assert_empty Gem.pre_reset_hooks
|
1134
1182
|
|
1135
|
-
Gem.pre_reset {
|
1183
|
+
Gem.pre_reset {}
|
1136
1184
|
|
1137
1185
|
assert_equal 1, Gem.pre_reset_hooks.length
|
1138
1186
|
end
|
@@ -1140,7 +1188,7 @@ class TestGem < Gem::TestCase
|
|
1140
1188
|
def test_self_pre_uninstall
|
1141
1189
|
assert_equal 1, Gem.pre_uninstall_hooks.length
|
1142
1190
|
|
1143
|
-
Gem.pre_uninstall
|
1191
|
+
Gem.pre_uninstall {|installer| }
|
1144
1192
|
|
1145
1193
|
assert_equal 2, Gem.pre_uninstall_hooks.length
|
1146
1194
|
end
|
@@ -1153,73 +1201,74 @@ class TestGem < Gem::TestCase
|
|
1153
1201
|
end
|
1154
1202
|
|
1155
1203
|
def test_try_activate_returns_true_for_activated_specs
|
1156
|
-
b = util_spec
|
1157
|
-
spec.files <<
|
1204
|
+
b = util_spec "b", "1.0" do |spec|
|
1205
|
+
spec.files << "lib/b.rb"
|
1158
1206
|
end
|
1159
1207
|
install_specs b
|
1160
1208
|
|
1161
|
-
assert Gem.try_activate(
|
1162
|
-
assert Gem.try_activate(
|
1209
|
+
assert Gem.try_activate("b"), "try_activate should return true"
|
1210
|
+
assert Gem.try_activate("b"), "try_activate should still return true"
|
1163
1211
|
end
|
1164
1212
|
|
1165
1213
|
def test_spec_order_is_consistent
|
1166
|
-
b1 = util_spec
|
1167
|
-
b2 = util_spec
|
1168
|
-
b3 = util_spec
|
1214
|
+
b1 = util_spec "b", "1.0"
|
1215
|
+
b2 = util_spec "b", "2.0"
|
1216
|
+
b3 = util_spec "b", "3.0"
|
1169
1217
|
|
1170
1218
|
install_specs b1, b2, b3
|
1171
1219
|
|
1172
|
-
specs1 = Gem::Specification.stubs.find_all {
|
1220
|
+
specs1 = Gem::Specification.stubs.find_all {|s| s.name == "b" }
|
1173
1221
|
Gem::Specification.reset
|
1174
|
-
specs2 = Gem::Specification.stubs_for(
|
1222
|
+
specs2 = Gem::Specification.stubs_for("b")
|
1175
1223
|
assert_equal specs1.map(&:version), specs2.map(&:version)
|
1176
1224
|
end
|
1177
1225
|
|
1178
1226
|
def test_self_try_activate_missing_dep
|
1179
|
-
b = util_spec
|
1180
|
-
a = util_spec
|
1227
|
+
b = util_spec "b", "1.0"
|
1228
|
+
a = util_spec "a", "1.0", "b" => ">= 1.0"
|
1181
1229
|
|
1182
1230
|
install_specs b, a
|
1183
1231
|
uninstall_gem b
|
1184
1232
|
|
1185
|
-
a_file = File.join a.gem_dir,
|
1233
|
+
a_file = File.join a.gem_dir, "lib", "a_file.rb"
|
1186
1234
|
|
1187
1235
|
write_file a_file do |io|
|
1188
|
-
io.puts
|
1236
|
+
io.puts "# a_file.rb"
|
1189
1237
|
end
|
1190
1238
|
|
1191
|
-
e =
|
1192
|
-
Gem.try_activate
|
1239
|
+
e = assert_raise Gem::MissingSpecError do
|
1240
|
+
Gem.try_activate "a_file"
|
1193
1241
|
end
|
1194
1242
|
|
1195
|
-
assert_match %r
|
1243
|
+
assert_match %r{Could not find 'b' }, e.message
|
1244
|
+
assert_match %r{at: #{a.spec_file}}, e.message
|
1196
1245
|
end
|
1197
1246
|
|
1198
1247
|
def test_self_try_activate_missing_prerelease
|
1199
|
-
b = util_spec
|
1200
|
-
a = util_spec
|
1248
|
+
b = util_spec "b", "1.0rc1"
|
1249
|
+
a = util_spec "a", "1.0rc1", "b" => "1.0rc1"
|
1201
1250
|
|
1202
1251
|
install_specs b, a
|
1203
1252
|
uninstall_gem b
|
1204
1253
|
|
1205
|
-
a_file = File.join a.gem_dir,
|
1254
|
+
a_file = File.join a.gem_dir, "lib", "a_file.rb"
|
1206
1255
|
|
1207
1256
|
write_file a_file do |io|
|
1208
|
-
io.puts
|
1257
|
+
io.puts "# a_file.rb"
|
1209
1258
|
end
|
1210
1259
|
|
1211
|
-
e =
|
1212
|
-
Gem.try_activate
|
1260
|
+
e = assert_raise Gem::MissingSpecError do
|
1261
|
+
Gem.try_activate "a_file"
|
1213
1262
|
end
|
1214
1263
|
|
1215
|
-
assert_match %r
|
1264
|
+
assert_match %r{Could not find 'b' \(= 1.0rc1\)}, e.message
|
1216
1265
|
end
|
1217
1266
|
|
1218
1267
|
def test_self_try_activate_missing_extensions
|
1219
|
-
spec = util_spec
|
1268
|
+
spec = util_spec "ext", "1" do |s|
|
1220
1269
|
s.extensions = %w[ext/extconf.rb]
|
1221
1270
|
s.mark_version
|
1222
|
-
s.installed_by_version = v(
|
1271
|
+
s.installed_by_version = v("2.2")
|
1223
1272
|
end
|
1224
1273
|
|
1225
1274
|
# write the spec without install to simulate a failed install
|
@@ -1227,8 +1276,8 @@ class TestGem < Gem::TestCase
|
|
1227
1276
|
io.write spec.to_ruby_for_cache
|
1228
1277
|
end
|
1229
1278
|
|
1230
|
-
_, err =
|
1231
|
-
refute Gem.try_activate
|
1279
|
+
_, err = capture_output do
|
1280
|
+
refute Gem.try_activate "nonexistent"
|
1232
1281
|
end
|
1233
1282
|
|
1234
1283
|
expected = "Ignoring ext-1 because its extensions are not built. " +
|
@@ -1238,43 +1287,43 @@ class TestGem < Gem::TestCase
|
|
1238
1287
|
end
|
1239
1288
|
|
1240
1289
|
def test_self_use_paths_with_nils
|
1241
|
-
orig_home = ENV.delete
|
1242
|
-
orig_path = ENV.delete
|
1290
|
+
orig_home = ENV.delete "GEM_HOME"
|
1291
|
+
orig_path = ENV.delete "GEM_PATH"
|
1243
1292
|
Gem.use_paths nil, nil
|
1244
1293
|
assert_equal Gem.default_dir, Gem.paths.home
|
1245
1294
|
path = (Gem.default_path + [Gem.paths.home]).uniq
|
1246
1295
|
assert_equal path, Gem.paths.path
|
1247
1296
|
ensure
|
1248
|
-
ENV[
|
1249
|
-
ENV[
|
1297
|
+
ENV["GEM_HOME"] = orig_home
|
1298
|
+
ENV["GEM_PATH"] = orig_path
|
1250
1299
|
end
|
1251
1300
|
|
1252
1301
|
def test_setting_paths_does_not_warn_about_unknown_keys
|
1253
|
-
stdout, stderr =
|
1254
|
-
Gem.paths = {
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1302
|
+
stdout, stderr = capture_output do
|
1303
|
+
Gem.paths = { "foo" => [],
|
1304
|
+
"bar" => Object.new,
|
1305
|
+
"GEM_HOME" => Gem.paths.home,
|
1306
|
+
"GEM_PATH" => "foo" }
|
1258
1307
|
end
|
1259
|
-
assert_equal [
|
1260
|
-
assert_equal
|
1261
|
-
assert_equal
|
1308
|
+
assert_equal ["foo", Gem.paths.home], Gem.paths.path
|
1309
|
+
assert_equal "", stderr
|
1310
|
+
assert_equal "", stdout
|
1262
1311
|
end
|
1263
1312
|
|
1264
1313
|
def test_setting_paths_does_not_mutate_parameter_object
|
1265
|
-
Gem.paths = {
|
1266
|
-
|
1267
|
-
assert_equal [
|
1314
|
+
Gem.paths = { "GEM_HOME" => Gem.paths.home,
|
1315
|
+
"GEM_PATH" => "foo" }.freeze
|
1316
|
+
assert_equal ["foo", Gem.paths.home], Gem.paths.path
|
1268
1317
|
end
|
1269
1318
|
|
1270
1319
|
def test_deprecated_paths=
|
1271
|
-
stdout, stderr =
|
1272
|
-
Gem.paths = {
|
1273
|
-
|
1320
|
+
stdout, stderr = capture_output do
|
1321
|
+
Gem.paths = { "GEM_HOME" => Gem.paths.home,
|
1322
|
+
"GEM_PATH" => [Gem.paths.home, "foo"] }
|
1274
1323
|
end
|
1275
|
-
assert_equal [Gem.paths.home,
|
1324
|
+
assert_equal [Gem.paths.home, "foo"], Gem.paths.path
|
1276
1325
|
assert_match(/Array values in the parameter to `Gem.paths=` are deprecated.\nPlease use a String or nil/m, stderr)
|
1277
|
-
assert_equal
|
1326
|
+
assert_equal "", stdout
|
1278
1327
|
end
|
1279
1328
|
|
1280
1329
|
def test_self_use_paths
|
@@ -1287,22 +1336,23 @@ class TestGem < Gem::TestCase
|
|
1287
1336
|
end
|
1288
1337
|
|
1289
1338
|
def test_self_user_dir
|
1290
|
-
parts = [@userhome,
|
1291
|
-
parts << RbConfig::CONFIG[
|
1339
|
+
parts = [@userhome, ".gem", Gem.ruby_engine]
|
1340
|
+
parts << RbConfig::CONFIG["ruby_version"] unless RbConfig::CONFIG["ruby_version"].empty?
|
1341
|
+
|
1342
|
+
FileUtils.mkdir_p File.join(parts)
|
1292
1343
|
|
1293
1344
|
assert_equal File.join(parts), Gem.user_dir
|
1294
1345
|
end
|
1295
1346
|
|
1296
1347
|
def test_self_user_home
|
1297
|
-
if ENV[
|
1298
|
-
assert_equal ENV[
|
1348
|
+
if ENV["HOME"]
|
1349
|
+
assert_equal ENV["HOME"], Gem.user_home
|
1299
1350
|
else
|
1300
|
-
assert true,
|
1351
|
+
assert true, "count this test"
|
1301
1352
|
end
|
1302
1353
|
end
|
1303
1354
|
|
1304
1355
|
def test_self_needs
|
1305
|
-
util_clear_gems
|
1306
1356
|
a = util_spec "a", "1"
|
1307
1357
|
b = util_spec "b", "1", "c" => nil
|
1308
1358
|
c = util_spec "c", "2"
|
@@ -1314,31 +1364,28 @@ class TestGem < Gem::TestCase
|
|
1314
1364
|
r.gem "b", "= 1"
|
1315
1365
|
end
|
1316
1366
|
|
1317
|
-
activated = Gem::Specification.map {
|
1367
|
+
activated = Gem::Specification.map {|x| x.full_name }
|
1318
1368
|
|
1319
|
-
assert_equal %w
|
1369
|
+
assert_equal %w[a-1 b-1 c-2], activated.sort
|
1320
1370
|
end
|
1321
1371
|
|
1322
1372
|
def test_self_needs_picks_up_unresolved_deps
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
d = util_spec "d", "1", {'e' => '= 1'}, "lib/d.rb"
|
1329
|
-
e = util_spec "e", "1"
|
1330
|
-
|
1331
|
-
install_specs a, c, b, e, d
|
1373
|
+
a = util_spec "a", "1"
|
1374
|
+
b = util_spec "b", "1", "c" => nil
|
1375
|
+
c = util_spec "c", "2"
|
1376
|
+
d = util_spec "d", "1", { "e" => "= 1" }, "lib/d#{$$}.rb"
|
1377
|
+
e = util_spec "e", "1"
|
1332
1378
|
|
1333
|
-
|
1334
|
-
r.gem "a"
|
1335
|
-
r.gem "b", "= 1"
|
1379
|
+
install_specs a, c, b, e, d
|
1336
1380
|
|
1337
|
-
|
1338
|
-
|
1381
|
+
Gem.needs do |r|
|
1382
|
+
r.gem "a"
|
1383
|
+
r.gem "b", "= 1"
|
1339
1384
|
|
1340
|
-
|
1385
|
+
require "d#{$$}"
|
1341
1386
|
end
|
1387
|
+
|
1388
|
+
assert_equal %w[a-1 b-1 c-2 d-1 e-1], loaded_spec_names
|
1342
1389
|
end
|
1343
1390
|
|
1344
1391
|
def test_self_gunzip
|
@@ -1347,71 +1394,94 @@ class TestGem < Gem::TestCase
|
|
1347
1394
|
|
1348
1395
|
output = Gem::Util.gunzip input
|
1349
1396
|
|
1350
|
-
assert_equal
|
1397
|
+
assert_equal "hello", output
|
1351
1398
|
assert_equal Encoding::BINARY, output.encoding
|
1352
1399
|
end
|
1353
1400
|
|
1354
1401
|
def test_self_gzip
|
1355
|
-
input =
|
1402
|
+
input = "hello"
|
1356
1403
|
|
1357
1404
|
output = Gem::Util.gzip input
|
1358
1405
|
|
1359
1406
|
zipped = StringIO.new output
|
1360
1407
|
|
1361
|
-
assert_equal
|
1408
|
+
assert_equal "hello", Zlib::GzipReader.new(zipped).read
|
1362
1409
|
assert_equal Encoding::BINARY, output.encoding
|
1363
1410
|
end
|
1364
1411
|
|
1365
1412
|
def test_self_vendor_dir
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1413
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
1414
|
+
expected =
|
1415
|
+
File.join RbConfig::CONFIG["vendordir"], "gems",
|
1416
|
+
RbConfig::CONFIG["ruby_version"]
|
1369
1417
|
|
1370
|
-
|
1418
|
+
assert_equal expected, Gem.vendor_dir
|
1419
|
+
end
|
1371
1420
|
end
|
1372
1421
|
|
1373
1422
|
def test_self_vendor_dir_ENV_GEM_VENDOR
|
1374
|
-
ENV[
|
1423
|
+
ENV["GEM_VENDOR"] = File.join @tempdir, "vendor", "gems"
|
1375
1424
|
|
1376
|
-
assert_equal ENV[
|
1425
|
+
assert_equal ENV["GEM_VENDOR"], Gem.vendor_dir
|
1377
1426
|
refute Gem.vendor_dir.frozen?
|
1378
1427
|
end
|
1379
1428
|
|
1380
1429
|
def test_self_vendor_dir_missing
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
assert_nil Gem.vendor_dir
|
1385
|
-
ensure
|
1386
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
1430
|
+
vendordir(nil) do
|
1431
|
+
assert_nil Gem.vendor_dir
|
1432
|
+
end
|
1387
1433
|
end
|
1388
1434
|
|
1389
1435
|
def test_load_plugins
|
1390
1436
|
plugin_path = File.join "lib", "rubygems_plugin.rb"
|
1391
1437
|
|
1392
1438
|
Dir.chdir @tempdir do
|
1393
|
-
FileUtils.mkdir_p
|
1439
|
+
FileUtils.mkdir_p "lib"
|
1394
1440
|
File.open plugin_path, "w" do |fp|
|
1395
1441
|
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
|
1396
1442
|
end
|
1397
1443
|
|
1398
|
-
foo1 = util_spec
|
1444
|
+
foo1 = util_spec "foo", "1" do |s|
|
1399
1445
|
s.files << plugin_path
|
1400
1446
|
end
|
1401
1447
|
|
1402
1448
|
install_gem foo1
|
1403
1449
|
|
1404
|
-
foo2 = util_spec
|
1450
|
+
foo2 = util_spec "foo", "2" do |s|
|
1405
1451
|
s.files << plugin_path
|
1406
1452
|
end
|
1407
1453
|
|
1408
1454
|
install_gem foo2
|
1409
1455
|
end
|
1410
1456
|
|
1411
|
-
Gem.searcher = nil
|
1412
1457
|
Gem::Specification.reset
|
1413
1458
|
|
1414
|
-
gem
|
1459
|
+
gem "foo"
|
1460
|
+
|
1461
|
+
Gem.load_plugins
|
1462
|
+
|
1463
|
+
assert_equal %w[plugin], PLUGINS_LOADED
|
1464
|
+
end
|
1465
|
+
|
1466
|
+
def test_load_user_installed_plugins
|
1467
|
+
plugin_path = File.join "lib", "rubygems_plugin.rb"
|
1468
|
+
|
1469
|
+
Dir.chdir @tempdir do
|
1470
|
+
FileUtils.mkdir_p "lib"
|
1471
|
+
File.open plugin_path, "w" do |fp|
|
1472
|
+
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
|
1473
|
+
end
|
1474
|
+
|
1475
|
+
foo = util_spec "foo", "1" do |s|
|
1476
|
+
s.files << plugin_path
|
1477
|
+
end
|
1478
|
+
|
1479
|
+
install_gem_user foo
|
1480
|
+
end
|
1481
|
+
|
1482
|
+
Gem.paths = { "GEM_PATH" => [Gem.dir, Gem.user_dir].join(File::PATH_SEPARATOR) }
|
1483
|
+
|
1484
|
+
gem "foo"
|
1415
1485
|
|
1416
1486
|
Gem.load_plugins
|
1417
1487
|
|
@@ -1419,30 +1489,30 @@ class TestGem < Gem::TestCase
|
|
1419
1489
|
end
|
1420
1490
|
|
1421
1491
|
def test_load_env_plugins
|
1422
|
-
with_plugin(
|
1492
|
+
with_plugin("load") { Gem.load_env_plugins }
|
1423
1493
|
assert_equal :loaded, TEST_PLUGIN_LOAD rescue nil
|
1424
1494
|
|
1425
1495
|
util_remove_interrupt_command
|
1426
1496
|
|
1427
1497
|
# Should attempt to cause a StandardError
|
1428
|
-
with_plugin(
|
1498
|
+
with_plugin("standarderror") { Gem.load_env_plugins }
|
1429
1499
|
assert_equal :loaded, TEST_PLUGIN_STANDARDERROR rescue nil
|
1430
1500
|
|
1431
1501
|
util_remove_interrupt_command
|
1432
1502
|
|
1433
1503
|
# Should attempt to cause an Exception
|
1434
|
-
with_plugin(
|
1504
|
+
with_plugin("exception") { Gem.load_env_plugins }
|
1435
1505
|
assert_equal :loaded, TEST_PLUGIN_EXCEPTION rescue nil
|
1436
1506
|
end
|
1437
1507
|
|
1438
1508
|
def test_gem_path_ordering
|
1439
1509
|
refute_equal Gem.dir, Gem.user_dir
|
1440
1510
|
|
1441
|
-
write_file File.join(@tempdir,
|
1442
|
-
write_file File.join(@tempdir,
|
1511
|
+
write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
|
1512
|
+
write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
|
1443
1513
|
|
1444
|
-
g = util_spec
|
1445
|
-
m = util_spec
|
1514
|
+
g = util_spec "g", "1", nil, "lib/g.rb"
|
1515
|
+
m = util_spec "m", "1", nil, "lib/m.rb"
|
1446
1516
|
|
1447
1517
|
install_gem g, :install_dir => Gem.dir
|
1448
1518
|
m0 = install_gem m, :install_dir => Gem.dir
|
@@ -1453,7 +1523,7 @@ class TestGem < Gem::TestCase
|
|
1453
1523
|
|
1454
1524
|
tests = [
|
1455
1525
|
[:dir0, [ Gem.dir, Gem.user_dir], m0],
|
1456
|
-
[:dir1, [ Gem.user_dir, Gem.dir], m1]
|
1526
|
+
[:dir1, [ Gem.user_dir, Gem.dir], m1],
|
1457
1527
|
]
|
1458
1528
|
|
1459
1529
|
tests.each do |_name, _paths, expected|
|
@@ -1461,15 +1531,15 @@ class TestGem < Gem::TestCase
|
|
1461
1531
|
Gem::Specification.reset
|
1462
1532
|
Gem.searcher = nil
|
1463
1533
|
|
1464
|
-
assert_equal Gem::Dependency.new(
|
1465
|
-
Gem::Dependency.new(
|
1534
|
+
assert_equal Gem::Dependency.new("m","1").to_specs,
|
1535
|
+
Gem::Dependency.new("m","1").to_specs.sort
|
1466
1536
|
|
1467
1537
|
assert_equal \
|
1468
1538
|
[expected.gem_dir],
|
1469
|
-
Gem::Dependency.new(
|
1539
|
+
Gem::Dependency.new("m","1").to_specs.map(&:gem_dir).sort,
|
1470
1540
|
"Wrong specs for #{_name}"
|
1471
1541
|
|
1472
|
-
spec = Gem::Dependency.new(
|
1542
|
+
spec = Gem::Dependency.new("m","1").to_spec
|
1473
1543
|
|
1474
1544
|
assert_equal \
|
1475
1545
|
File.join(_paths.first, "gems", "m-1"),
|
@@ -1479,7 +1549,7 @@ class TestGem < Gem::TestCase
|
|
1479
1549
|
|
1480
1550
|
gem "m"
|
1481
1551
|
|
1482
|
-
spec = Gem::Dependency.new(
|
1552
|
+
spec = Gem::Dependency.new("m","1").to_spec
|
1483
1553
|
assert spec.activated?, "dependency not activated for #{_name}"
|
1484
1554
|
|
1485
1555
|
assert_equal \
|
@@ -1494,11 +1564,11 @@ class TestGem < Gem::TestCase
|
|
1494
1564
|
end
|
1495
1565
|
|
1496
1566
|
def test_gem_path_ordering_short
|
1497
|
-
write_file File.join(@tempdir,
|
1498
|
-
write_file File.join(@tempdir,
|
1567
|
+
write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
|
1568
|
+
write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
|
1499
1569
|
|
1500
|
-
g = util_spec
|
1501
|
-
m = util_spec
|
1570
|
+
g = util_spec "g", "1", nil, "lib/g.rb"
|
1571
|
+
m = util_spec "m", "1", nil, "lib/m.rb"
|
1502
1572
|
|
1503
1573
|
install_gem g, :install_dir => Gem.dir
|
1504
1574
|
install_gem m, :install_dir => Gem.dir
|
@@ -1508,147 +1578,10 @@ class TestGem < Gem::TestCase
|
|
1508
1578
|
|
1509
1579
|
assert_equal \
|
1510
1580
|
File.join(Gem.dir, "gems", "m-1"),
|
1511
|
-
Gem::Dependency.new(
|
1581
|
+
Gem::Dependency.new("m","1").to_spec.gem_dir,
|
1512
1582
|
"Wrong spec selected"
|
1513
1583
|
end
|
1514
1584
|
|
1515
|
-
def test_auto_activation_of_specific_gemdeps_file
|
1516
|
-
util_clear_gems
|
1517
|
-
|
1518
|
-
a = util_spec "a", "1", nil, "lib/a.rb"
|
1519
|
-
b = util_spec "b", "1", nil, "lib/b.rb"
|
1520
|
-
c = util_spec "c", "1", nil, "lib/c.rb"
|
1521
|
-
|
1522
|
-
install_specs a, b, c
|
1523
|
-
|
1524
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1525
|
-
|
1526
|
-
File.open path, "w" do |f|
|
1527
|
-
f.puts "gem 'a'"
|
1528
|
-
f.puts "gem 'b'"
|
1529
|
-
f.puts "gem 'c'"
|
1530
|
-
end
|
1531
|
-
|
1532
|
-
ENV['RUBYGEMS_GEMDEPS'] = path
|
1533
|
-
|
1534
|
-
Gem.use_gemdeps
|
1535
|
-
|
1536
|
-
assert_equal add_bundler_full_name(%W(a-1 b-1 c-1)), loaded_spec_names
|
1537
|
-
end
|
1538
|
-
|
1539
|
-
def test_auto_activation_of_used_gemdeps_file
|
1540
|
-
util_clear_gems
|
1541
|
-
|
1542
|
-
a = util_spec "a", "1", nil, "lib/a.rb"
|
1543
|
-
b = util_spec "b", "1", nil, "lib/b.rb"
|
1544
|
-
c = util_spec "c", "1", nil, "lib/c.rb"
|
1545
|
-
|
1546
|
-
install_specs a, b, c
|
1547
|
-
|
1548
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1549
|
-
|
1550
|
-
File.open path, "w" do |f|
|
1551
|
-
f.puts "gem 'a'"
|
1552
|
-
f.puts "gem 'b'"
|
1553
|
-
f.puts "gem 'c'"
|
1554
|
-
end
|
1555
|
-
|
1556
|
-
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
1557
|
-
|
1558
|
-
expected_specs = [a, b, (Gem::USE_BUNDLER_FOR_GEMDEPS || nil) && util_spec("bundler", Bundler::VERSION), c].compact
|
1559
|
-
assert_equal expected_specs, Gem.use_gemdeps.sort_by { |s| s.name }
|
1560
|
-
end
|
1561
|
-
|
1562
|
-
LIB_PATH = File.expand_path "../../../lib".dup.untaint, __FILE__.dup.untaint
|
1563
|
-
|
1564
|
-
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1565
|
-
BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }.dup.untaint
|
1566
|
-
BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}".freeze
|
1567
|
-
end
|
1568
|
-
|
1569
|
-
def add_bundler_full_name(names)
|
1570
|
-
return names unless Gem::USE_BUNDLER_FOR_GEMDEPS
|
1571
|
-
names << BUNDLER_FULL_NAME
|
1572
|
-
names.sort!
|
1573
|
-
names
|
1574
|
-
end
|
1575
|
-
|
1576
|
-
def test_looks_for_gemdeps_files_automatically_on_start
|
1577
|
-
util_clear_gems
|
1578
|
-
|
1579
|
-
a = util_spec "a", "1", nil, "lib/a.rb"
|
1580
|
-
b = util_spec "b", "1", nil, "lib/b.rb"
|
1581
|
-
c = util_spec "c", "1", nil, "lib/c.rb"
|
1582
|
-
|
1583
|
-
install_specs a, b, c
|
1584
|
-
|
1585
|
-
path = File.join(@tempdir, "gd-tmp")
|
1586
|
-
install_gem a, :install_dir => path
|
1587
|
-
install_gem b, :install_dir => path
|
1588
|
-
install_gem c, :install_dir => path
|
1589
|
-
|
1590
|
-
ENV['GEM_PATH'] = path
|
1591
|
-
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
1592
|
-
|
1593
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1594
|
-
cmd = [Gem.ruby.dup.untaint, "-I#{LIB_PATH.untaint}",
|
1595
|
-
"-I#{BUNDLER_LIB_PATH.untaint}", "-rrubygems"]
|
1596
|
-
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1597
|
-
|
1598
|
-
File.open path, "w" do |f|
|
1599
|
-
f.puts "gem 'a'"
|
1600
|
-
end
|
1601
|
-
out0 = IO.popen(cmd, &:read).split(/\n/)
|
1602
|
-
|
1603
|
-
File.open path, "a" do |f|
|
1604
|
-
f.puts "gem 'b'"
|
1605
|
-
f.puts "gem 'c'"
|
1606
|
-
end
|
1607
|
-
out = IO.popen(cmd, &:read).split(/\n/)
|
1608
|
-
|
1609
|
-
assert_equal ["b-1", "c-1"], out - out0
|
1610
|
-
end if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1611
|
-
|
1612
|
-
def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
|
1613
|
-
util_clear_gems
|
1614
|
-
|
1615
|
-
a = util_spec "a", "1", nil, "lib/a.rb"
|
1616
|
-
b = util_spec "b", "1", nil, "lib/b.rb"
|
1617
|
-
c = util_spec "c", "1", nil, "lib/c.rb"
|
1618
|
-
|
1619
|
-
install_specs a, b, c
|
1620
|
-
|
1621
|
-
path = File.join(@tempdir, "gd-tmp")
|
1622
|
-
install_gem a, :install_dir => path
|
1623
|
-
install_gem b, :install_dir => path
|
1624
|
-
install_gem c, :install_dir => path
|
1625
|
-
|
1626
|
-
ENV['GEM_PATH'] = path
|
1627
|
-
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
1628
|
-
|
1629
|
-
Dir.mkdir "sub1"
|
1630
|
-
|
1631
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1632
|
-
cmd = [Gem.ruby.dup.untaint, "-Csub1", "-I#{LIB_PATH.untaint}",
|
1633
|
-
"-I#{BUNDLER_LIB_PATH.untaint}", "-rrubygems"]
|
1634
|
-
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1635
|
-
|
1636
|
-
File.open path, "w" do |f|
|
1637
|
-
f.puts "gem 'a'"
|
1638
|
-
end
|
1639
|
-
out0 = IO.popen(cmd, &:read).split(/\n/)
|
1640
|
-
|
1641
|
-
File.open path, "a" do |f|
|
1642
|
-
f.puts "gem 'b'"
|
1643
|
-
f.puts "gem 'c'"
|
1644
|
-
end
|
1645
|
-
out = IO.popen(cmd, &:read).split(/\n/)
|
1646
|
-
|
1647
|
-
Dir.rmdir "sub1"
|
1648
|
-
|
1649
|
-
assert_equal ["b-1", "c-1"], out - out0
|
1650
|
-
end if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1651
|
-
|
1652
1585
|
def test_register_default_spec
|
1653
1586
|
Gem.clear_default_specs
|
1654
1587
|
|
@@ -1677,234 +1610,95 @@ class TestGem < Gem::TestCase
|
|
1677
1610
|
assert_nil Gem.find_unresolved_default_spec("README")
|
1678
1611
|
end
|
1679
1612
|
|
1680
|
-
def
|
1681
|
-
|
1682
|
-
if defined?(RUBY_ENGINE)
|
1683
|
-
engine = RUBY_ENGINE
|
1684
|
-
Object.send :remove_const, :RUBY_ENGINE
|
1685
|
-
end
|
1686
|
-
Object.const_set :RUBY_ENGINE, 'ruby'
|
1687
|
-
|
1688
|
-
refute Gem.default_gems_use_full_paths?
|
1689
|
-
ensure
|
1690
|
-
Object.send :remove_const, :RUBY_ENGINE
|
1691
|
-
Object.const_set :RUBY_ENGINE, engine if engine
|
1692
|
-
end
|
1693
|
-
|
1694
|
-
begin
|
1695
|
-
if defined?(RUBY_ENGINE)
|
1696
|
-
engine = RUBY_ENGINE
|
1697
|
-
Object.send :remove_const, :RUBY_ENGINE
|
1698
|
-
end
|
1699
|
-
Object.const_set :RUBY_ENGINE, 'jruby'
|
1700
|
-
assert Gem.default_gems_use_full_paths?
|
1701
|
-
ensure
|
1702
|
-
Object.send :remove_const, :RUBY_ENGINE
|
1703
|
-
Object.const_set :RUBY_ENGINE, engine if engine
|
1704
|
-
end
|
1705
|
-
end
|
1706
|
-
|
1707
|
-
def test_use_gemdeps
|
1708
|
-
gem_deps_file = 'gem.deps.rb'.untaint
|
1709
|
-
spec = util_spec 'a', 1
|
1710
|
-
install_specs spec
|
1711
|
-
|
1712
|
-
spec = Gem::Specification.find { |s| s == spec }
|
1713
|
-
refute spec.activated?
|
1714
|
-
|
1715
|
-
File.open gem_deps_file, 'w' do |io|
|
1716
|
-
io.write 'gem "a"'
|
1717
|
-
end
|
1718
|
-
|
1719
|
-
assert_nil Gem.gemdeps
|
1720
|
-
|
1721
|
-
Gem.use_gemdeps gem_deps_file
|
1722
|
-
|
1723
|
-
assert_equal add_bundler_full_name(%W(a-1)), loaded_spec_names
|
1724
|
-
refute_nil Gem.gemdeps
|
1725
|
-
end
|
1726
|
-
|
1727
|
-
def test_use_gemdeps_ENV
|
1728
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
|
1729
|
-
|
1730
|
-
spec = util_spec 'a', 1
|
1731
|
-
|
1732
|
-
refute spec.activated?
|
1733
|
-
|
1734
|
-
File.open 'gem.deps.rb', 'w' do |io|
|
1735
|
-
io.write 'gem "a"'
|
1736
|
-
end
|
1737
|
-
|
1738
|
-
Gem.use_gemdeps
|
1739
|
-
|
1740
|
-
refute spec.activated?
|
1741
|
-
ensure
|
1742
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1743
|
-
end
|
1613
|
+
def test_register_default_spec_old_style_with_folder_starting_with_lib
|
1614
|
+
Gem.clear_default_specs
|
1744
1615
|
|
1745
|
-
|
1746
|
-
|
1747
|
-
Gem.use_gemdeps 'gem.deps.rb'
|
1616
|
+
old_style = Gem::Specification.new do |spec|
|
1617
|
+
spec.files = ["libexec/bundle", "foo.rb", "bar.rb"]
|
1748
1618
|
end
|
1749
1619
|
|
1750
|
-
|
1751
|
-
e.message
|
1752
|
-
end
|
1753
|
-
|
1754
|
-
def test_use_gemdeps_argument_missing_match_ENV
|
1755
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] =
|
1756
|
-
ENV['RUBYGEMS_GEMDEPS'], 'gem.deps.rb'
|
1757
|
-
|
1758
|
-
e = assert_raises ArgumentError do
|
1759
|
-
Gem.use_gemdeps 'gem.deps.rb'
|
1760
|
-
end
|
1620
|
+
Gem.register_default_spec old_style
|
1761
1621
|
|
1762
|
-
assert_equal
|
1763
|
-
e.message
|
1764
|
-
ensure
|
1765
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1622
|
+
assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
|
1766
1623
|
end
|
1767
1624
|
|
1768
|
-
def
|
1769
|
-
|
1770
|
-
|
1771
|
-
spec = util_spec 'a', 1
|
1772
|
-
install_specs spec
|
1773
|
-
spec = Gem::Specification.find { |s| s == spec }
|
1774
|
-
|
1775
|
-
refute spec.activated?
|
1776
|
-
|
1777
|
-
File.open 'Gemfile', 'w' do |io|
|
1778
|
-
io.write 'gem "a"'
|
1779
|
-
end
|
1780
|
-
|
1781
|
-
Gem.use_gemdeps
|
1625
|
+
def test_operating_system_defaults
|
1626
|
+
operating_system_defaults = Gem.operating_system_defaults
|
1782
1627
|
|
1783
|
-
|
1784
|
-
|
1785
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1628
|
+
assert operating_system_defaults != nil
|
1629
|
+
assert operating_system_defaults.is_a? Hash
|
1786
1630
|
end
|
1787
1631
|
|
1788
|
-
def
|
1789
|
-
|
1790
|
-
|
1791
|
-
Gem.use_gemdeps
|
1632
|
+
def test_platform_defaults
|
1633
|
+
platform_defaults = Gem.platform_defaults
|
1792
1634
|
|
1793
|
-
assert
|
1794
|
-
|
1795
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1635
|
+
assert platform_defaults != nil
|
1636
|
+
assert platform_defaults.is_a? Hash
|
1796
1637
|
end
|
1797
1638
|
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1639
|
+
# Ensure that `Gem.source_date_epoch` is consistent even if
|
1640
|
+
# $SOURCE_DATE_EPOCH has not been set.
|
1641
|
+
def test_default_source_date_epoch_doesnt_change
|
1642
|
+
old_epoch = ENV["SOURCE_DATE_EPOCH"]
|
1643
|
+
ENV["SOURCE_DATE_EPOCH"] = nil
|
1802
1644
|
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
Gem.
|
1810
|
-
|
1811
|
-
refute spec.activated?
|
1645
|
+
# Unfortunately, there is no real way to test this aside from waiting
|
1646
|
+
# enough for `Time.now.to_i` to change -- which is a whole second.
|
1647
|
+
#
|
1648
|
+
# Fortunately, we only need to do this once.
|
1649
|
+
a = Gem.source_date_epoch
|
1650
|
+
sleep 1
|
1651
|
+
b = Gem.source_date_epoch
|
1652
|
+
assert_equal a, b
|
1812
1653
|
ensure
|
1813
|
-
ENV[
|
1654
|
+
ENV["SOURCE_DATE_EPOCH"] = old_epoch
|
1814
1655
|
end
|
1815
1656
|
|
1816
|
-
|
1817
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
|
1818
|
-
|
1819
|
-
File.open 'x', 'w' do |io|
|
1820
|
-
io.write 'gem "a"'
|
1821
|
-
end
|
1822
|
-
|
1823
|
-
platform = Bundler::GemHelpers.generic_local_platform
|
1824
|
-
if platform == Gem::Platform::RUBY
|
1825
|
-
platform = ''
|
1826
|
-
else
|
1827
|
-
platform = " #{platform}"
|
1828
|
-
end
|
1829
|
-
expected =
|
1830
|
-
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1831
|
-
<<-EXPECTED
|
1832
|
-
Could not find gem 'a#{platform}' in any of the gem sources listed in your Gemfile.
|
1833
|
-
You may need to `gem install -g` to install missing gems
|
1657
|
+
private
|
1834
1658
|
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
You may need to `gem install -g` to install missing gems
|
1659
|
+
def ruby_install_name(name)
|
1660
|
+
with_clean_path_to_ruby do
|
1661
|
+
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG["ruby_install_name"]
|
1662
|
+
RbConfig::CONFIG["ruby_install_name"] = name
|
1840
1663
|
|
1841
|
-
|
1664
|
+
begin
|
1665
|
+
yield
|
1666
|
+
ensure
|
1667
|
+
if orig_RUBY_INSTALL_NAME
|
1668
|
+
RbConfig::CONFIG["ruby_install_name"] = orig_RUBY_INSTALL_NAME
|
1669
|
+
else
|
1670
|
+
RbConfig::CONFIG.delete "ruby_install_name"
|
1671
|
+
end
|
1842
1672
|
end
|
1843
|
-
|
1844
|
-
assert_output nil, expected do
|
1845
|
-
Gem.use_gemdeps
|
1846
|
-
end
|
1847
|
-
ensure
|
1848
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1849
|
-
end if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1850
|
-
|
1851
|
-
def test_use_gemdeps_specific
|
1852
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
|
1853
|
-
|
1854
|
-
spec = util_spec 'a', 1
|
1855
|
-
install_specs spec
|
1856
|
-
|
1857
|
-
spec = Gem::Specification.find { |s| s == spec }
|
1858
|
-
refute spec.activated?
|
1859
|
-
|
1860
|
-
File.open 'x', 'w' do |io|
|
1861
|
-
io.write 'gem "a"'
|
1862
1673
|
end
|
1863
|
-
|
1864
|
-
Gem.use_gemdeps
|
1865
|
-
|
1866
|
-
assert_equal add_bundler_full_name(%W(a-1)), loaded_spec_names
|
1867
|
-
ensure
|
1868
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1869
|
-
end
|
1870
|
-
|
1871
|
-
def test_operating_system_defaults
|
1872
|
-
operating_system_defaults = Gem.operating_system_defaults
|
1873
|
-
|
1874
|
-
assert operating_system_defaults != nil
|
1875
|
-
assert operating_system_defaults.is_a? Hash
|
1876
1674
|
end
|
1877
1675
|
|
1878
|
-
def
|
1879
|
-
|
1880
|
-
|
1881
|
-
assert platform_defaults != nil
|
1882
|
-
assert platform_defaults.is_a? Hash
|
1883
|
-
end
|
1676
|
+
def with_rb_config_ruby(path)
|
1677
|
+
rb_config_singleton_class = class << RbConfig; self; end
|
1678
|
+
orig_path = RbConfig.ruby
|
1884
1679
|
|
1885
|
-
|
1886
|
-
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
|
1887
|
-
RbConfig::CONFIG['ruby_install_name'] = name
|
1680
|
+
redefine_method(rb_config_singleton_class, :ruby, path)
|
1888
1681
|
|
1889
1682
|
yield
|
1890
1683
|
ensure
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1684
|
+
redefine_method(rb_config_singleton_class, :ruby, orig_path)
|
1685
|
+
end
|
1686
|
+
|
1687
|
+
def redefine_method(base, method, new_result)
|
1688
|
+
base.alias_method(method, method)
|
1689
|
+
base.define_method(method) { new_result }
|
1896
1690
|
end
|
1897
1691
|
|
1898
1692
|
def with_plugin(path)
|
1899
1693
|
test_plugin_path = File.expand_path("test/rubygems/plugin/#{path}",
|
1900
|
-
|
1694
|
+
PROJECT_DIR)
|
1901
1695
|
|
1902
1696
|
# A single test plugin should get loaded once only, in order to preserve
|
1903
1697
|
# sane test semantics.
|
1904
1698
|
refute_includes $LOAD_PATH, test_plugin_path
|
1905
1699
|
$LOAD_PATH.unshift test_plugin_path
|
1906
1700
|
|
1907
|
-
|
1701
|
+
capture_output do
|
1908
1702
|
yield
|
1909
1703
|
end
|
1910
1704
|
ensure
|
@@ -1923,12 +1717,12 @@ You may need to `gem install -g` to install missing gems
|
|
1923
1717
|
end
|
1924
1718
|
|
1925
1719
|
def util_exec_gem
|
1926
|
-
spec, _ = util_spec
|
1927
|
-
s.executables = [
|
1720
|
+
spec, _ = util_spec "a", "4" do |s|
|
1721
|
+
s.executables = ["exec", "abin"]
|
1928
1722
|
end
|
1929
1723
|
|
1930
|
-
@exec_path = File.join spec.full_gem_path, spec.bindir,
|
1931
|
-
@abin_path = File.join spec.full_gem_path, spec.bindir,
|
1724
|
+
@exec_path = File.join spec.full_gem_path, spec.bindir, "exec"
|
1725
|
+
@abin_path = File.join spec.full_gem_path, spec.bindir, "abin"
|
1932
1726
|
spec
|
1933
1727
|
end
|
1934
1728
|
|