rubygems-update 3.1.6 → 3.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5619 -0
- data/CODE_OF_CONDUCT.md +55 -19
- data/CONTRIBUTING.md +97 -27
- data/Manifest.txt +185 -143
- data/POLICIES.md +70 -27
- data/README.md +29 -14
- data/UPGRADING.md +5 -81
- data/bin/gem +2 -10
- data/bin/update_rubygems +5 -5
- data/bundler/CHANGELOG.md +2605 -1431
- data/bundler/README.md +9 -14
- data/bundler/UPGRADING.md +27 -34
- data/bundler/bundler.gemspec +10 -13
- data/bundler/exe/bundle +7 -8
- data/bundler/exe/bundler +1 -1
- data/bundler/lib/bundler/.document +1 -0
- data/bundler/lib/bundler/build_metadata.rb +4 -12
- data/bundler/lib/bundler/cli/add.rb +2 -2
- data/bundler/lib/bundler/cli/binstubs.rb +11 -3
- data/bundler/lib/bundler/cli/cache.rb +3 -8
- 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 +32 -3
- data/bundler/lib/bundler/cli/config.rb +10 -1
- data/bundler/lib/bundler/cli/console.rb +3 -3
- data/bundler/lib/bundler/cli/doctor.rb +23 -6
- data/bundler/lib/bundler/cli/exec.rb +5 -10
- data/bundler/lib/bundler/cli/fund.rb +36 -0
- data/bundler/lib/bundler/cli/gem.rb +258 -45
- data/bundler/lib/bundler/cli/info.rb +38 -6
- 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 +27 -57
- data/bundler/lib/bundler/cli/issue.rb +5 -4
- 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 +7 -6
- data/bundler/lib/bundler/cli/outdated.rb +106 -79
- data/bundler/lib/bundler/cli/platform.rb +2 -2
- data/bundler/lib/bundler/cli/plugin.rb +10 -0
- data/bundler/lib/bundler/cli/pristine.rb +5 -0
- data/bundler/lib/bundler/cli/remove.rb +1 -2
- data/bundler/lib/bundler/cli/show.rb +2 -2
- data/bundler/lib/bundler/cli/update.rb +20 -9
- data/bundler/lib/bundler/cli/viz.rb +1 -1
- data/bundler/lib/bundler/cli.rb +151 -85
- 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 +56 -51
- data/bundler/lib/bundler/compact_index_client.rb +3 -9
- data/bundler/lib/bundler/constants.rb +1 -1
- data/bundler/lib/bundler/current_ruby.rb +19 -6
- data/bundler/lib/bundler/definition.rb +353 -440
- data/bundler/lib/bundler/dependency.rb +23 -77
- data/bundler/lib/bundler/digest.rb +71 -0
- data/bundler/lib/bundler/dsl.rb +77 -85
- data/bundler/lib/bundler/endpoint_specification.rb +16 -14
- data/bundler/lib/bundler/env.rb +3 -3
- data/bundler/lib/bundler/environment_preserver.rb +32 -4
- data/bundler/lib/bundler/errors.rb +31 -14
- data/bundler/lib/bundler/feature_flag.rb +0 -9
- data/bundler/lib/bundler/fetcher/base.rb +7 -9
- data/bundler/lib/bundler/fetcher/compact_index.rb +20 -27
- data/bundler/lib/bundler/fetcher/dependency.rb +2 -6
- data/bundler/lib/bundler/fetcher/downloader.rb +11 -11
- data/bundler/lib/bundler/fetcher/index.rb +2 -30
- data/bundler/lib/bundler/fetcher.rb +26 -31
- data/bundler/lib/bundler/force_platform.rb +18 -0
- data/bundler/lib/bundler/friendly_errors.rb +45 -49
- data/bundler/lib/bundler/gem_helper.rb +53 -31
- data/bundler/lib/bundler/gem_helpers.rb +42 -24
- data/bundler/lib/bundler/gem_version_promoter.rb +54 -99
- data/bundler/lib/bundler/graph.rb +4 -4
- data/bundler/lib/bundler/index.rb +16 -54
- data/bundler/lib/bundler/injector.rb +41 -9
- data/bundler/lib/bundler/inline.rb +11 -22
- data/bundler/lib/bundler/installer/gem_installer.rb +19 -24
- data/bundler/lib/bundler/installer/parallel_installer.rb +34 -43
- data/bundler/lib/bundler/installer/standalone.rb +62 -11
- data/bundler/lib/bundler/installer.rb +43 -87
- data/bundler/lib/bundler/lazy_specification.rb +88 -51
- data/bundler/lib/bundler/lockfile_generator.rb +4 -4
- data/bundler/lib/bundler/lockfile_parser.rb +34 -59
- data/bundler/lib/bundler/man/.document +1 -0
- data/bundler/{man → lib/bundler/man}/bundle-add.1 +21 -5
- data/bundler/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +16 -4
- data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +5 -3
- data/bundler/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +2 -4
- data/bundler/{man → lib/bundler/man}/bundle-cache.1 +7 -1
- data/bundler/{man/bundle-cache.ronn → lib/bundler/man/bundle-cache.1.ronn} +7 -0
- 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 +66 -48
- data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +75 -66
- 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 +5 -1
- data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +2 -0
- 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 +35 -33
- data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +33 -34
- 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 +5 -5
- data/bundler/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +5 -4
- 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 +15 -10
- data/bundler/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +12 -7
- data/bundler/{man → lib/bundler/man}/gemfile.5 +120 -83
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +109 -88
- data/bundler/{man → lib/bundler/man}/index.txt +4 -0
- data/bundler/lib/bundler/match_metadata.rb +13 -0
- data/bundler/lib/bundler/match_platform.rb +0 -1
- data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
- data/bundler/lib/bundler/mirror.rb +7 -9
- data/bundler/lib/bundler/plugin/api/source.rb +25 -9
- data/bundler/lib/bundler/plugin/dsl.rb +1 -1
- data/bundler/lib/bundler/plugin/index.rb +17 -5
- 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 +16 -13
- data/bundler/lib/bundler/plugin/source_list.rb +5 -1
- data/bundler/lib/bundler/plugin.rb +59 -12
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/remote_specification.rb +12 -7
- data/bundler/lib/bundler/resolver/base.rb +109 -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 -74
- data/bundler/lib/bundler/resolver.rb +336 -344
- data/bundler/lib/bundler/retry.rb +2 -2
- data/bundler/lib/bundler/ruby_dsl.rb +1 -1
- data/bundler/lib/bundler/ruby_version.rb +6 -19
- data/bundler/lib/bundler/rubygems_ext.rb +231 -32
- data/bundler/lib/bundler/rubygems_gem_installer.rb +89 -16
- data/bundler/lib/bundler/rubygems_integration.rb +81 -167
- data/bundler/lib/bundler/runtime.rb +23 -31
- data/bundler/lib/bundler/self_manager.rb +168 -0
- data/bundler/lib/bundler/settings.rb +146 -73
- data/bundler/lib/bundler/setup.rb +5 -2
- data/bundler/lib/bundler/shared_helpers.rb +20 -35
- data/bundler/lib/bundler/similarity_detector.rb +1 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +263 -114
- data/bundler/lib/bundler/source/git.rb +64 -47
- data/bundler/lib/bundler/source/metadata.rb +3 -8
- data/bundler/lib/bundler/source/path/installer.rb +11 -32
- data/bundler/lib/bundler/source/path.rb +16 -10
- data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
- data/bundler/lib/bundler/source/rubygems.rb +167 -200
- data/bundler/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/bundler/lib/bundler/source.rb +25 -5
- data/bundler/lib/bundler/source_list.rb +112 -64
- data/bundler/lib/bundler/source_map.rb +71 -0
- data/bundler/lib/bundler/spec_set.rb +74 -61
- data/bundler/lib/bundler/stub_specification.rb +30 -10
- data/bundler/lib/bundler/templates/Executable +3 -5
- data/bundler/lib/bundler/templates/Executable.bundler +11 -16
- 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 +15 -1
- data/bundler/lib/bundler/templates/newgem/README.md.tt +13 -16
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +43 -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 +34 -18
- 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/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -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/shell.rb +37 -14
- data/bundler/lib/bundler/ui/silent.rb +21 -5
- data/bundler/lib/bundler/uri_credentials_filter.rb +3 -1
- data/bundler/lib/bundler/uri_normalizer.rb +23 -0
- data/bundler/lib/bundler/vendor/.document +1 -0
- data/bundler/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- 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 +41 -74
- data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
- data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +82 -189
- data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +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_link.rb +2 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +9 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
- 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 +10 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +28 -9
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +28 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +5 -13
- 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 +76 -91
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +32 -13
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +14 -21
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +11 -17
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- 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 +3 -3
- data/bundler/lib/bundler/vendored_persistent.rb +1 -40
- data/bundler/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/version.rb +5 -1
- data/bundler/lib/bundler/worker.rb +25 -12
- data/bundler/lib/bundler/yaml_serializer.rb +1 -1
- data/bundler/lib/bundler.rb +98 -110
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/available_set.rb +7 -9
- data/lib/rubygems/basic_specification.rb +23 -21
- data/lib/rubygems/bundler_version_finder.rb +27 -54
- data/lib/rubygems/command.rb +63 -52
- data/lib/rubygems/command_manager.rb +36 -16
- data/lib/rubygems/commands/build_command.rb +50 -27
- data/lib/rubygems/commands/cert_command.rb +78 -75
- data/lib/rubygems/commands/check_command.rb +20 -22
- data/lib/rubygems/commands/cleanup_command.rb +30 -26
- data/lib/rubygems/commands/contents_command.rb +16 -18
- data/lib/rubygems/commands/dependency_command.rb +39 -51
- data/lib/rubygems/commands/environment_command.rb +11 -10
- data/lib/rubygems/commands/exec_command.rb +248 -0
- data/lib/rubygems/commands/fetch_command.rb +33 -16
- data/lib/rubygems/commands/generate_index_command.rb +17 -19
- data/lib/rubygems/commands/help_command.rb +9 -9
- data/lib/rubygems/commands/info_command.rb +10 -7
- data/lib/rubygems/commands/install_command.rb +36 -30
- data/lib/rubygems/commands/list_command.rb +9 -8
- data/lib/rubygems/commands/lock_command.rb +5 -7
- data/lib/rubygems/commands/mirror_command.rb +3 -5
- data/lib/rubygems/commands/open_command.rb +10 -14
- data/lib/rubygems/commands/outdated_command.rb +5 -7
- data/lib/rubygems/commands/owner_command.rb +26 -16
- data/lib/rubygems/commands/pristine_command.rb +70 -49
- data/lib/rubygems/commands/push_command.rb +22 -59
- data/lib/rubygems/commands/query_command.rb +21 -351
- data/lib/rubygems/commands/rdoc_command.rb +26 -27
- 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 +255 -229
- data/lib/rubygems/commands/signin_command.rb +9 -11
- data/lib/rubygems/commands/signout_command.rb +7 -9
- data/lib/rubygems/commands/sources_command.rb +27 -25
- data/lib/rubygems/commands/specification_command.rb +25 -21
- data/lib/rubygems/commands/stale_command.rb +3 -5
- data/lib/rubygems/commands/uninstall_command.rb +44 -43
- data/lib/rubygems/commands/unpack_command.rb +14 -16
- data/lib/rubygems/commands/update_command.rb +126 -74
- data/lib/rubygems/commands/which_command.rb +7 -9
- data/lib/rubygems/commands/yank_command.rb +16 -19
- data/lib/rubygems/compatibility.rb +4 -2
- data/lib/rubygems/config_file.rb +75 -26
- data/lib/rubygems/core_ext/kernel_gem.rb +1 -6
- data/lib/rubygems/core_ext/kernel_require.rb +108 -112
- data/lib/rubygems/core_ext/kernel_warn.rb +31 -36
- data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
- data/lib/rubygems/defaults.rb +124 -34
- data/lib/rubygems/dependency.rb +24 -22
- data/lib/rubygems/dependency_installer.rb +43 -115
- data/lib/rubygems/dependency_list.rb +13 -15
- data/lib/rubygems/deprecate.rb +102 -8
- data/lib/rubygems/doctor.rb +22 -22
- data/lib/rubygems/errors.rb +6 -21
- data/lib/rubygems/exceptions.rb +34 -37
- data/lib/rubygems/ext/build_error.rb +2 -0
- data/lib/rubygems/ext/builder.rb +64 -54
- 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 -9
- data/lib/rubygems/ext/configure_builder.rb +5 -8
- data/lib/rubygems/ext/ext_conf_builder.rb +43 -66
- 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 +161 -33
- data/lib/rubygems/indexer.rb +31 -50
- 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 +199 -156
- 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 -8
- data/lib/rubygems/name_tuple.rb +9 -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 +65 -67
- data/lib/rubygems/package/tar_reader/entry.rb +89 -11
- data/lib/rubygems/package/tar_reader.rb +1 -32
- data/lib/rubygems/package/tar_writer.rb +8 -18
- data/lib/rubygems/package.rb +109 -120
- data/lib/rubygems/package_task.rb +5 -11
- data/lib/rubygems/path_support.rb +2 -9
- data/lib/rubygems/platform.rb +113 -74
- data/lib/rubygems/psych_tree.rb +1 -3
- data/lib/rubygems/query_utils.rb +351 -0
- data/lib/rubygems/rdoc.rb +2 -14
- data/lib/rubygems/remote_fetcher.rb +48 -74
- data/lib/rubygems/request/connection_pools.rb +6 -10
- data/lib/rubygems/request/http_pool.rb +2 -4
- data/lib/rubygems/request/https_pool.rb +0 -2
- data/lib/rubygems/request.rb +26 -31
- data/lib/rubygems/request_set/gem_dependency_api.rb +127 -130
- data/lib/rubygems/request_set/lockfile/parser.rb +26 -28
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +5 -7
- data/lib/rubygems/request_set/lockfile.rb +17 -21
- data/lib/rubygems/request_set.rb +27 -40
- data/lib/rubygems/requirement.rb +29 -49
- data/lib/rubygems/resolver/activation_request.rb +12 -6
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_set.rb +32 -25
- data/lib/rubygems/resolver/api_specification.rb +29 -15
- data/lib/rubygems/resolver/best_set.rb +7 -9
- data/lib/rubygems/resolver/composed_set.rb +3 -5
- data/lib/rubygems/resolver/conflict.rb +12 -14
- 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 +66 -24
- data/lib/rubygems/resolver/local_specification.rb +2 -4
- data/lib/rubygems/resolver/lock_set.rb +6 -8
- data/lib/rubygems/resolver/lock_specification.rb +4 -6
- 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 -2
- 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 -4
- data/lib/rubygems/resolver/stats.rb +1 -3
- data/lib/rubygems/resolver/vendor_set.rb +1 -3
- data/lib/rubygems/resolver/vendor_specification.rb +3 -5
- data/lib/rubygems/resolver.rb +53 -51
- data/lib/rubygems/s3_uri_signer.rb +7 -15
- 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 +13 -16
- data/lib/rubygems/security/trust_dir.rb +5 -6
- data/lib/rubygems/security.rb +90 -69
- data/lib/rubygems/security_option.rb +7 -7
- data/lib/rubygems/source/git.rb +31 -31
- 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 +44 -38
- data/lib/rubygems/source_list.rb +9 -16
- data/lib/rubygems/spec_fetcher.rb +49 -48
- data/lib/rubygems/specification.rb +382 -343
- data/lib/rubygems/specification_policy.rb +131 -61
- data/lib/rubygems/stub_specification.rb +24 -31
- data/lib/rubygems/text.rb +22 -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 +98 -45
- 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 -3
- data/lib/rubygems/user_interaction.rb +43 -54
- data/lib/rubygems/util/licenses.rb +115 -10
- data/lib/rubygems/util/list.rb +0 -2
- data/lib/rubygems/util.rb +19 -17
- data/lib/rubygems/validator.rb +7 -9
- data/lib/rubygems/version.rb +31 -22
- data/lib/rubygems/version_option.rb +11 -5
- data/lib/rubygems.rb +213 -290
- data/rubygems-update.gemspec +5 -5
- 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/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/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} +402 -327
- data/{lib → test}/rubygems/installer_test_case.rb +38 -24
- 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 +51 -18
- 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/load/rubygems_plugin.rb +0 -2
- 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/simple_gem.rb +1 -1
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +4 -6
- data/test/rubygems/test_bundled_ca.rb +43 -50
- data/test/rubygems/test_config.rb +5 -7
- data/test/rubygems/test_deprecate.rb +87 -10
- data/test/rubygems/test_exit.rb +17 -0
- data/test/rubygems/test_gem.rb +560 -826
- data/test/rubygems/test_gem_available_set.rb +24 -26
- data/test/rubygems/test_gem_bundler_version_finder.rb +40 -46
- data/test/rubygems/test_gem_command.rb +78 -49
- data/test/rubygems/test_gem_command_manager.rb +163 -35
- data/test/rubygems/test_gem_commands_build_command.rb +285 -57
- data/test/rubygems/test_gem_commands_cert_command.rb +180 -125
- data/test/rubygems/test_gem_commands_check_command.rb +9 -11
- data/test/rubygems/test_gem_commands_cleanup_command.rb +78 -69
- data/test/rubygems/test_gem_commands_contents_command.rb +73 -42
- data/test/rubygems/test_gem_commands_dependency_command.rb +38 -40
- data/test/rubygems/test_gem_commands_environment_command.rb +60 -38
- data/test/rubygems/test_gem_commands_exec_command.rb +851 -0
- data/test/rubygems/test_gem_commands_fetch_command.rb +163 -32
- data/test/rubygems/test_gem_commands_generate_index_command.rb +8 -14
- data/test/rubygems/test_gem_commands_help_command.rb +34 -16
- data/test/rubygems/test_gem_commands_info_command.rb +33 -9
- data/test/rubygems/test_gem_commands_install_command.rb +420 -198
- 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 -5
- data/test/rubygems/test_gem_commands_open_command.rb +16 -19
- data/test/rubygems/test_gem_commands_outdated_command.rb +23 -7
- data/test/rubygems/test_gem_commands_owner_command.rb +181 -46
- data/test/rubygems/test_gem_commands_pristine_command.rb +179 -99
- data/test/rubygems/test_gem_commands_push_command.rb +156 -67
- data/test/rubygems/test_gem_commands_query_command.rb +91 -91
- data/test/rubygems/test_gem_commands_search_command.rb +2 -4
- data/test/rubygems/test_gem_commands_server_command.rb +6 -50
- data/test/rubygems/test_gem_commands_setup_command.rb +285 -183
- data/test/rubygems/test_gem_commands_signin_command.rb +187 -28
- data/test/rubygems/test_gem_commands_signout_command.rb +3 -10
- data/test/rubygems/test_gem_commands_sources_command.rb +139 -32
- 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 +102 -87
- data/test/rubygems/test_gem_commands_unpack_command.rb +32 -34
- data/test/rubygems/test_gem_commands_update_command.rb +341 -94
- data/test/rubygems/test_gem_commands_which_command.rb +12 -14
- data/test/rubygems/test_gem_commands_yank_command.rb +80 -44
- data/test/rubygems/test_gem_config_file.rb +114 -97
- data/test/rubygems/test_gem_dependency.rb +88 -86
- data/test/rubygems/test_gem_dependency_installer.rb +277 -391
- data/test/rubygems/test_gem_dependency_list.rb +57 -59
- 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 +115 -111
- 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 +247 -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 +31 -38
- data/test/rubygems/test_gem_ext_configure_builder.rb +23 -39
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +66 -82
- data/test/rubygems/test_gem_ext_rake_builder.rb +49 -32
- data/test/rubygems/test_gem_gem_runner.rb +57 -9
- 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 +100 -83
- data/test/rubygems/test_gem_install_update_options.rb +31 -21
- data/test/rubygems/test_gem_installer.rb +857 -484
- 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 +330 -305
- data/test/rubygems/test_gem_package_old.rb +18 -20
- data/test/rubygems/test_gem_package_tar_header.rb +69 -52
- data/test/rubygems/test_gem_package_tar_reader.rb +54 -9
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +168 -25
- data/test/rubygems/test_gem_package_tar_writer.rb +96 -100
- data/test/rubygems/test_gem_package_task.rb +58 -25
- data/test/rubygems/test_gem_path_support.rb +15 -21
- data/test/rubygems/test_gem_platform.rb +388 -201
- data/test/rubygems/test_gem_rdoc.rb +19 -21
- data/test/rubygems/test_gem_remote_fetcher.rb +377 -338
- data/test/rubygems/test_gem_request.rb +114 -86
- data/test/rubygems/test_gem_request_connection_pools.rb +30 -34
- data/test/rubygems/test_gem_request_set.rb +124 -125
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +227 -231
- data/test/rubygems/test_gem_request_set_lockfile.rb +93 -95
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +69 -71
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +136 -138
- data/test/rubygems/test_gem_requirement.rb +133 -54
- data/test/rubygems/test_gem_resolver.rb +182 -117
- data/test/rubygems/test_gem_resolver_activation_request.rb +6 -8
- 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 -14
- 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 -23
- data/test/rubygems/test_gem_resolver_index_set.rb +14 -16
- data/test/rubygems/test_gem_resolver_index_specification.rb +16 -18
- data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -7
- data/test/rubygems/test_gem_resolver_installer_set.rb +104 -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 -12
- 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 +105 -79
- data/test/rubygems/test_gem_security_policy.rb +102 -107
- data/test/rubygems/test_gem_security_signer.rb +51 -53
- data/test/rubygems/test_gem_security_trust_dir.rb +14 -16
- data/test/rubygems/test_gem_silent_ui.rb +46 -42
- data/test/rubygems/test_gem_source.rb +53 -52
- data/test/rubygems/test_gem_source_fetch_problem.rb +16 -8
- data/test/rubygems/test_gem_source_git.rb +78 -72
- data/test/rubygems/test_gem_source_installed.rb +16 -18
- data/test/rubygems/test_gem_source_list.rb +5 -6
- data/test/rubygems/test_gem_source_local.rb +15 -17
- data/test/rubygems/test_gem_source_lock.rb +31 -33
- data/test/rubygems/test_gem_source_specific_file.rb +18 -20
- 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 +967 -1056
- data/test/rubygems/test_gem_stream_ui.rb +23 -23
- data/test/rubygems/test_gem_stub_specification.rb +39 -57
- data/test/rubygems/test_gem_text.rb +8 -4
- data/test/rubygems/test_gem_uninstaller.rb +234 -105
- 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 +37 -35
- data/test/rubygems/test_gem_validator.rb +10 -12
- data/test/rubygems/test_gem_version.rb +32 -32
- data/test/rubygems/test_gem_version_option.rb +16 -18
- data/test/rubygems/test_kernel.rb +47 -67
- data/test/rubygems/test_project_sanity.rb +8 -3
- data/test/rubygems/test_remote_fetch_error.rb +7 -9
- data/test/rubygems/test_require.rb +269 -182
- data/test/rubygems/test_rubygems.rb +74 -0
- data/{lib/rubygems/test_utilities.rb → test/rubygems/utilities.rb} +63 -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 +190 -173
- data/.bundle/config +0 -2
- data/.rubocop.yml +0 -91
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -43
- data/History.txt +0 -4473
- data/Rakefile +0 -428
- data/bundler/CODE_OF_CONDUCT.md +0 -136
- data/bundler/lib/bundler/dep_proxy.rb +0 -48
- data/bundler/lib/bundler/gemdeps.rb +0 -29
- data/bundler/lib/bundler/psyched_yaml.rb +0 -37
- data/bundler/lib/bundler/templates/gems.rb +0 -8
- data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -6
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
- 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 -158
- 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/version_ranges.rb +0 -122
- data/bundler/man/bundle-add.1.txt +0 -58
- data/bundler/man/bundle-binstubs.1.txt +0 -48
- data/bundler/man/bundle-cache.1.txt +0 -78
- data/bundler/man/bundle-check.1.txt +0 -33
- data/bundler/man/bundle-clean.1.txt +0 -26
- data/bundler/man/bundle-config.1.txt +0 -528
- data/bundler/man/bundle-doctor.1.txt +0 -44
- data/bundler/man/bundle-exec.1.txt +0 -178
- data/bundler/man/bundle-gem.1 +0 -80
- data/bundler/man/bundle-gem.1.txt +0 -91
- data/bundler/man/bundle-gem.ronn +0 -78
- data/bundler/man/bundle-info.1.txt +0 -21
- data/bundler/man/bundle-init.1.txt +0 -34
- data/bundler/man/bundle-inject.1.txt +0 -32
- data/bundler/man/bundle-install.1.txt +0 -401
- data/bundler/man/bundle-list.1.txt +0 -43
- data/bundler/man/bundle-lock.1.txt +0 -93
- data/bundler/man/bundle-open.1.txt +0 -29
- data/bundler/man/bundle-outdated.1.txt +0 -131
- data/bundler/man/bundle-platform.1.txt +0 -57
- data/bundler/man/bundle-pristine.1.txt +0 -44
- data/bundler/man/bundle-remove.1.txt +0 -34
- data/bundler/man/bundle-show.1.txt +0 -27
- data/bundler/man/bundle-update.1.txt +0 -390
- data/bundler/man/bundle-viz.1.txt +0 -39
- data/bundler/man/bundle.1.txt +0 -116
- data/bundler/man/gemfile.5.txt +0 -649
- data/lib/rubygems/psych_additions.rb +0 -10
- data/lib/rubygems/server.rb +0 -879
- data/lib/rubygems/source_local.rb +0 -7
- data/lib/rubygems/source_specific_file.rb +0 -6
- data/lib/rubygems/syck_hack.rb +0 -79
- data/lib/rubygems/uri_parser.rb +0 -36
- data/lib/rubygems/uri_parsing.rb +0 -23
- 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 -612
- data/tmp/.keep +0 -0
- data/util/CL2notes +0 -55
- data/util/bisect +0 -10
- data/util/ci.sh +0 -62
- data/util/cops/deprecations.rb +0 -52
- data/util/create_certs.rb +0 -171
- data/util/create_certs.sh +0 -27
- data/util/create_encrypted_key.rb +0 -16
- data/util/generate_spdx_license_list.rb +0 -63
- data/util/patch_with_prs.rb +0 -77
- data/util/rubocop +0 -8
- data/util/update_bundled_ca_certificates.rb +0 -137
- data/util/update_changelog.rb +0 -64
- /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/test/rubygems/test_gem.rb
CHANGED
@@ -1,27 +1,16 @@
|
|
1
1
|
# coding: US-ASCII
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
|
10
|
-
if File.exist?(File.join(Dir.tmpdir, "Gemfile"))
|
11
|
-
raise "rubygems/bundler tests do not work correctly if there is #{ File.join(Dir.tmpdir, "Gemfile") }"
|
12
|
-
end
|
13
|
-
|
14
|
-
# TODO: push this up to test_case.rb once battle tested
|
15
|
-
|
16
|
-
$LOAD_PATH.map! do |path|
|
17
|
-
path.dup.tap(&Gem::UNTAINT)
|
18
|
-
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"
|
19
9
|
|
20
10
|
class TestGem < Gem::TestCase
|
21
|
-
|
22
11
|
PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
|
23
12
|
|
24
|
-
PROJECT_DIR = File.expand_path(
|
13
|
+
PROJECT_DIR = File.expand_path("../..", __dir__).tap(&Gem::UNTAINT)
|
25
14
|
|
26
15
|
def setup
|
27
16
|
super
|
@@ -30,111 +19,104 @@ class TestGem < Gem::TestCase
|
|
30
19
|
|
31
20
|
common_installer_setup
|
32
21
|
|
33
|
-
|
34
|
-
@additional = %w[a b].map { |d| File.join @tempdir, d }
|
22
|
+
@additional = %w[a b].map {|d| File.join @tempdir, d }
|
35
23
|
|
36
24
|
util_remove_interrupt_command
|
37
25
|
end
|
38
26
|
|
39
27
|
def test_self_finish_resolve
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
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"
|
46
33
|
|
47
|
-
|
34
|
+
install_specs c1, c2, b1, b2, a1
|
48
35
|
|
49
|
-
|
36
|
+
a1.activate
|
50
37
|
|
51
|
-
|
52
|
-
|
38
|
+
assert_equal %w[a-1], loaded_spec_names
|
39
|
+
assert_equal ["b (> 0)"], unresolved_names
|
53
40
|
|
54
|
-
|
41
|
+
Gem.finish_resolve
|
55
42
|
|
56
|
-
|
57
|
-
|
58
|
-
end
|
43
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
44
|
+
assert_equal [], unresolved_names
|
59
45
|
end
|
60
46
|
|
61
47
|
def test_self_finish_resolve_wtf
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
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
|
70
55
|
|
71
|
-
|
56
|
+
install_specs c1, c2, b1, b2, d1, d2, a1
|
72
57
|
|
73
|
-
|
58
|
+
a1.activate
|
74
59
|
|
75
|
-
|
76
|
-
|
60
|
+
assert_equal %w[a-1], loaded_spec_names
|
61
|
+
assert_equal ["b (> 0)", "d (> 0)"], unresolved_names
|
77
62
|
|
78
|
-
|
63
|
+
Gem.finish_resolve
|
79
64
|
|
80
|
-
|
81
|
-
|
82
|
-
end
|
65
|
+
assert_equal %w[a-1 b-1 c-1 d-2], loaded_spec_names
|
66
|
+
assert_equal [], unresolved_names
|
83
67
|
end
|
84
68
|
|
85
69
|
def test_self_finish_resolve_respects_loaded_specs
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
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"
|
92
75
|
|
93
|
-
|
76
|
+
install_specs c1, c2, b1, b2, a1
|
94
77
|
|
95
|
-
|
96
|
-
|
78
|
+
a1.activate
|
79
|
+
c1.activate
|
97
80
|
|
98
|
-
|
99
|
-
|
81
|
+
assert_equal %w[a-1 c-1], loaded_spec_names
|
82
|
+
assert_equal ["b (> 0)"], unresolved_names
|
100
83
|
|
101
|
-
|
84
|
+
Gem.finish_resolve
|
102
85
|
|
103
|
-
|
104
|
-
|
105
|
-
end
|
86
|
+
assert_equal %w[a-1 b-1 c-1], loaded_spec_names
|
87
|
+
assert_equal [], unresolved_names
|
106
88
|
end
|
107
89
|
|
108
90
|
def test_self_install
|
109
91
|
spec_fetcher do |f|
|
110
|
-
f.gem
|
111
|
-
f.spec
|
92
|
+
f.gem "a", 1
|
93
|
+
f.spec "a", 2
|
112
94
|
end
|
113
95
|
|
114
96
|
gemhome2 = "#{@gemhome}2"
|
115
97
|
|
116
|
-
installed = Gem.install
|
98
|
+
installed = Gem.install "a", "= 1", :install_dir => gemhome2
|
117
99
|
|
118
|
-
assert_equal %w[a-1], installed.map {
|
100
|
+
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
|
119
101
|
|
120
|
-
|
102
|
+
assert_path_exist File.join(gemhome2, "gems", "a-1")
|
121
103
|
end
|
122
104
|
|
123
105
|
def test_self_install_in_rescue
|
124
106
|
spec_fetcher do |f|
|
125
|
-
f.gem
|
126
|
-
f.spec
|
107
|
+
f.gem "a", 1
|
108
|
+
f.spec "a", 2
|
127
109
|
end
|
128
110
|
|
129
111
|
gemhome2 = "#{@gemhome}2"
|
130
112
|
|
131
113
|
installed =
|
132
114
|
begin
|
133
|
-
raise
|
115
|
+
raise "Error"
|
134
116
|
rescue StandardError
|
135
|
-
Gem.install
|
117
|
+
Gem.install "a", "= 1", :install_dir => gemhome2
|
136
118
|
end
|
137
|
-
assert_equal %w[a-1], installed.map {
|
119
|
+
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
|
138
120
|
end
|
139
121
|
|
140
122
|
def test_self_install_permissions
|
@@ -161,7 +143,7 @@ class TestGem < Gem::TestCase
|
|
161
143
|
|
162
144
|
def test_self_install_permissions_with_format_executable_and_non_standard_ruby_install_name
|
163
145
|
Gem::Installer.exec_format = nil
|
164
|
-
ruby_install_name
|
146
|
+
ruby_install_name "ruby27" do
|
165
147
|
assert_self_install_permissions(format_executable: true)
|
166
148
|
end
|
167
149
|
ensure
|
@@ -175,38 +157,38 @@ class TestGem < Gem::TestCase
|
|
175
157
|
:prog_mode => win_platform? ? 0410 : 0510,
|
176
158
|
:data_mode => 0640,
|
177
159
|
:wrappers => true,
|
178
|
-
:format_executable => format_executable
|
160
|
+
:format_executable => format_executable,
|
179
161
|
}
|
180
162
|
Dir.chdir @tempdir do
|
181
|
-
Dir.mkdir
|
182
|
-
Dir.mkdir
|
163
|
+
Dir.mkdir "bin"
|
164
|
+
Dir.mkdir "data"
|
183
165
|
|
184
|
-
File.write
|
185
|
-
File.chmod 0755,
|
166
|
+
File.write "bin/foo", "#!/usr/bin/env ruby\n"
|
167
|
+
File.chmod 0755, "bin/foo"
|
186
168
|
|
187
|
-
File.write
|
169
|
+
File.write "data/foo.txt", "blah\n"
|
188
170
|
|
189
171
|
spec_fetcher do |f|
|
190
|
-
f.gem
|
191
|
-
s.executables = [
|
172
|
+
f.gem "foo", 1 do |s|
|
173
|
+
s.executables = ["foo"]
|
192
174
|
s.files = %w[bin/foo data/foo.txt]
|
193
175
|
end
|
194
176
|
end
|
195
|
-
Gem.install
|
177
|
+
Gem.install "foo", Gem::Requirement.default, options
|
196
178
|
end
|
197
179
|
|
198
180
|
prog_mode = (options[:prog_mode] & mask).to_s(8)
|
199
181
|
dir_mode = (options[:dir_mode] & mask).to_s(8)
|
200
182
|
data_mode = (options[:data_mode] & mask).to_s(8)
|
201
|
-
prog_name =
|
202
|
-
prog_name = RbConfig::CONFIG[
|
183
|
+
prog_name = "foo"
|
184
|
+
prog_name = RbConfig::CONFIG["ruby_install_name"].sub("ruby", "foo") if options[:format_executable]
|
203
185
|
expected = {
|
204
186
|
"bin/#{prog_name}" => prog_mode,
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
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,
|
210
192
|
}
|
211
193
|
# add Windows script
|
212
194
|
expected["bin/#{prog_name}.bat"] = mask.to_s(8) if win_platform?
|
@@ -218,83 +200,79 @@ class TestGem < Gem::TestCase
|
|
218
200
|
end
|
219
201
|
assert_equal(expected, result)
|
220
202
|
ensure
|
221
|
-
File.chmod(0755, *Dir.glob(@gemhome +
|
203
|
+
File.chmod(0755, *Dir.glob(@gemhome + "/gems/**/").map {|path| path.tap(&Gem::UNTAINT) })
|
222
204
|
end
|
223
205
|
|
224
206
|
def test_require_missing
|
225
|
-
|
226
|
-
|
227
|
-
require "test_require_missing"
|
228
|
-
end
|
207
|
+
assert_raise ::LoadError do
|
208
|
+
require "test_require_missing"
|
229
209
|
end
|
230
210
|
end
|
231
211
|
|
232
212
|
def test_require_does_not_glob
|
233
|
-
|
234
|
-
a1 = util_spec "a", "1", nil, "lib/a1.rb"
|
235
|
-
|
236
|
-
install_specs a1
|
213
|
+
a1 = util_spec "a", "1", nil, "lib/a1.rb"
|
237
214
|
|
238
|
-
|
239
|
-
require "a*"
|
240
|
-
end
|
215
|
+
install_specs a1
|
241
216
|
|
242
|
-
|
217
|
+
assert_raise ::LoadError do
|
218
|
+
require "a*"
|
243
219
|
end
|
220
|
+
|
221
|
+
assert_equal [], loaded_spec_names
|
244
222
|
end
|
245
223
|
|
246
224
|
def test_self_bin_path_active
|
247
|
-
a1 = util_spec
|
248
|
-
s.executables = [
|
225
|
+
a1 = util_spec "a", "1" do |s|
|
226
|
+
s.executables = ["exec"]
|
249
227
|
end
|
250
228
|
|
251
|
-
util_spec
|
252
|
-
s.executables = [
|
229
|
+
util_spec "a", "2" do |s|
|
230
|
+
s.executables = ["exec"]
|
253
231
|
end
|
254
232
|
|
255
233
|
a1.activate
|
256
234
|
|
257
|
-
assert_match
|
235
|
+
assert_match "a-1/bin/exec", Gem.bin_path("a", "exec", ">= 0")
|
258
236
|
end
|
259
237
|
|
260
238
|
def test_self_bin_path_picking_newest
|
261
|
-
a1 = util_spec
|
262
|
-
s.executables = [
|
239
|
+
a1 = util_spec "a", "1" do |s|
|
240
|
+
s.executables = ["exec"]
|
263
241
|
end
|
264
242
|
|
265
|
-
a2 = util_spec
|
266
|
-
s.executables = [
|
243
|
+
a2 = util_spec "a", "2" do |s|
|
244
|
+
s.executables = ["exec"]
|
267
245
|
end
|
268
246
|
|
269
247
|
install_specs a1, a2
|
270
248
|
|
271
|
-
assert_match
|
249
|
+
assert_match "a-2/bin/exec", Gem.bin_path("a", "exec", ">= 0")
|
272
250
|
end
|
273
251
|
|
274
252
|
def test_self_activate_bin_path_no_exec_name
|
275
|
-
e =
|
276
|
-
Gem.activate_bin_path
|
253
|
+
e = assert_raise ArgumentError do
|
254
|
+
Gem.activate_bin_path "a"
|
277
255
|
end
|
278
256
|
|
279
|
-
assert_equal
|
257
|
+
assert_equal "you must supply exec_name", e.message
|
280
258
|
end
|
281
259
|
|
282
260
|
def test_activate_bin_path_resolves_eagerly
|
283
|
-
a1 = util_spec
|
284
|
-
s.executables = [
|
285
|
-
s.add_dependency
|
261
|
+
a1 = util_spec "a", "1" do |s|
|
262
|
+
s.executables = ["exec"]
|
263
|
+
s.add_dependency "b"
|
286
264
|
end
|
287
265
|
|
288
|
-
b1 = util_spec
|
289
|
-
s.add_dependency
|
266
|
+
b1 = util_spec "b", "1" do |s|
|
267
|
+
s.add_dependency "c", "2"
|
290
268
|
end
|
291
269
|
|
292
|
-
b2 = util_spec
|
293
|
-
s.add_dependency
|
270
|
+
b2 = util_spec "b", "2" do |s|
|
271
|
+
s.add_dependency "c", "1"
|
294
272
|
end
|
295
273
|
|
296
|
-
c1 = util_spec
|
297
|
-
c2 = util_spec
|
274
|
+
c1 = util_spec "c", "1"
|
275
|
+
c2 = util_spec "c", "2"
|
298
276
|
|
299
277
|
install_specs c1, c2, b1, b2, a1
|
300
278
|
|
@@ -302,33 +280,90 @@ class TestGem < Gem::TestCase
|
|
302
280
|
|
303
281
|
# If we didn't eagerly resolve, this would activate c-2 and then the
|
304
282
|
# finish_resolve would cause a conflict
|
305
|
-
gem
|
283
|
+
gem "c"
|
306
284
|
Gem.finish_resolve
|
307
285
|
|
308
|
-
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
|
309
339
|
end
|
310
340
|
|
311
341
|
def test_activate_bin_path_in_debug_mode
|
312
|
-
a1 = util_spec
|
313
|
-
s.executables = [
|
342
|
+
a1 = util_spec "a", "1" do |s|
|
343
|
+
s.executables = ["exec"]
|
314
344
|
end
|
315
345
|
|
316
346
|
install_specs a1
|
317
347
|
|
348
|
+
require "open3"
|
318
349
|
output, status = Open3.capture2e(
|
319
350
|
{ "GEM_HOME" => Gem.paths.home, "DEBUG_RESOLVER" => "1" },
|
320
|
-
|
351
|
+
*ruby_with_rubygems_in_load_path, "-e", "\"Gem.activate_bin_path('a', 'exec', '>= 0')\""
|
321
352
|
)
|
322
353
|
|
323
354
|
assert status.success?, output
|
324
355
|
end
|
325
356
|
|
326
|
-
def
|
327
|
-
|
328
|
-
s.executables = [
|
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"]
|
329
360
|
end
|
330
361
|
|
331
|
-
|
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
|
332
367
|
|
333
368
|
File.open("Gemfile.lock", "w") do |f|
|
334
369
|
f.write <<-L.gsub(/ {8}/, "")
|
@@ -342,29 +377,24 @@ class TestGem < Gem::TestCase
|
|
342
377
|
DEPENDENCIES
|
343
378
|
|
344
379
|
BUNDLED WITH
|
345
|
-
|
380
|
+
2.0.0
|
346
381
|
L
|
347
382
|
end
|
348
383
|
|
349
|
-
File.open("Gemfile", "w") {
|
384
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
350
385
|
|
351
|
-
|
352
|
-
load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
|
353
|
-
end
|
386
|
+
load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
|
354
387
|
|
355
|
-
|
356
|
-
assert_includes e.message, "To update to the latest version installed on your system, run `bundle update --bundler`."
|
357
|
-
assert_includes e.message, "To install the missing version, run `gem install bundler:9999`"
|
358
|
-
refute_includes e.message, "can't find gem bundler (>= 0.a) with executable bundle"
|
388
|
+
assert_equal %w[bundler-2.0.0], loaded_spec_names
|
359
389
|
end
|
360
390
|
|
361
|
-
def
|
362
|
-
bundler_latest = util_spec
|
363
|
-
s.executables = [
|
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"]
|
364
394
|
end
|
365
395
|
|
366
|
-
bundler_previous = util_spec
|
367
|
-
s.executables = [
|
396
|
+
bundler_previous = util_spec "bundler", "1.17.3" do |s|
|
397
|
+
s.executables = ["bundle"]
|
368
398
|
end
|
369
399
|
|
370
400
|
install_specs bundler_latest, bundler_previous
|
@@ -381,28 +411,18 @@ class TestGem < Gem::TestCase
|
|
381
411
|
DEPENDENCIES
|
382
412
|
|
383
413
|
BUNDLED WITH
|
384
|
-
2.0.
|
414
|
+
2.0.1
|
385
415
|
L
|
386
416
|
end
|
387
417
|
|
388
|
-
File.open("Gemfile", "w") {
|
418
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
389
419
|
|
390
|
-
load Gem.activate_bin_path("bundler", "bundle", "
|
420
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 1.17.3")
|
391
421
|
|
392
|
-
assert_equal %w
|
422
|
+
assert_equal %w[bundler-1.17.3], loaded_spec_names
|
393
423
|
end
|
394
424
|
|
395
|
-
def
|
396
|
-
bundler_latest = util_spec 'bundler', '2.0.1' do |s|
|
397
|
-
s.executables = ['bundle']
|
398
|
-
end
|
399
|
-
|
400
|
-
bundler_previous = util_spec 'bundler', '1.17.3' do |s|
|
401
|
-
s.executables = ['bundle']
|
402
|
-
end
|
403
|
-
|
404
|
-
install_specs bundler_latest, bundler_previous
|
405
|
-
|
425
|
+
def test_activate_bin_path_gives_proper_error_for_bundler_when_underscore_selection_given
|
406
426
|
File.open("Gemfile.lock", "w") do |f|
|
407
427
|
f.write <<-L.gsub(/ {8}/, "")
|
408
428
|
GEM
|
@@ -415,71 +435,72 @@ class TestGem < Gem::TestCase
|
|
415
435
|
DEPENDENCIES
|
416
436
|
|
417
437
|
BUNDLED WITH
|
418
|
-
2.
|
438
|
+
2.1.4
|
419
439
|
L
|
420
440
|
end
|
421
441
|
|
422
|
-
File.open("Gemfile", "w") {
|
442
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
423
443
|
|
424
|
-
|
444
|
+
e = assert_raise Gem::GemNotFoundException do
|
445
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 2.2.8")
|
446
|
+
end
|
425
447
|
|
426
|
-
assert_equal
|
448
|
+
assert_equal "can't find gem bundler (= 2.2.8) with executable bundle", e.message
|
427
449
|
end
|
428
450
|
|
429
451
|
def test_self_bin_path_no_exec_name
|
430
|
-
e =
|
431
|
-
Gem.bin_path
|
452
|
+
e = assert_raise ArgumentError do
|
453
|
+
Gem.bin_path "a"
|
432
454
|
end
|
433
455
|
|
434
|
-
assert_equal
|
456
|
+
assert_equal "you must supply exec_name", e.message
|
435
457
|
end
|
436
458
|
|
437
459
|
def test_self_bin_path_bin_name
|
438
460
|
install_specs util_exec_gem
|
439
|
-
assert_equal @abin_path, Gem.bin_path(
|
461
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin")
|
440
462
|
end
|
441
463
|
|
442
464
|
def test_self_bin_path_bin_name_version
|
443
465
|
install_specs util_exec_gem
|
444
|
-
assert_equal @abin_path, Gem.bin_path(
|
466
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin", "4")
|
445
467
|
end
|
446
468
|
|
447
469
|
def test_self_bin_path_nonexistent_binfile
|
448
|
-
util_spec
|
449
|
-
s.executables = [
|
470
|
+
util_spec "a", "2" do |s|
|
471
|
+
s.executables = ["exec"]
|
450
472
|
end
|
451
|
-
|
452
|
-
Gem.bin_path(
|
473
|
+
assert_raise(Gem::GemNotFoundException) do
|
474
|
+
Gem.bin_path("a", "other", "2")
|
453
475
|
end
|
454
476
|
end
|
455
477
|
|
456
478
|
def test_self_bin_path_no_bin_file
|
457
|
-
util_spec
|
458
|
-
|
459
|
-
Gem.bin_path(
|
479
|
+
util_spec "a", "1"
|
480
|
+
assert_raise(ArgumentError) do
|
481
|
+
Gem.bin_path("a", nil, "1")
|
460
482
|
end
|
461
483
|
end
|
462
484
|
|
463
485
|
def test_self_bin_path_not_found
|
464
|
-
|
465
|
-
Gem.bin_path(
|
486
|
+
assert_raise(Gem::GemNotFoundException) do
|
487
|
+
Gem.bin_path("non-existent", "blah")
|
466
488
|
end
|
467
489
|
end
|
468
490
|
|
469
491
|
def test_self_bin_path_bin_file_gone_in_latest
|
470
492
|
install_specs util_exec_gem
|
471
|
-
spec = util_spec
|
493
|
+
spec = util_spec "a", "10" do |s|
|
472
494
|
s.executables = []
|
473
495
|
end
|
474
496
|
install_specs spec
|
475
|
-
|
476
|
-
assert_equal @abin_path, Gem.bin_path('a', 'abin')
|
497
|
+
assert_equal @abin_path, Gem.bin_path("a", "abin")
|
477
498
|
end
|
478
499
|
|
479
500
|
def test_self_bindir
|
480
|
-
assert_equal File.join(@gemhome,
|
481
|
-
assert_equal File.join(@gemhome,
|
482
|
-
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))
|
483
504
|
end
|
484
505
|
|
485
506
|
def test_self_bindir_default_dir
|
@@ -508,51 +529,51 @@ class TestGem < Gem::TestCase
|
|
508
529
|
foo = nil
|
509
530
|
|
510
531
|
Dir.chdir @tempdir do
|
511
|
-
FileUtils.mkdir_p
|
512
|
-
File.open File.join(
|
513
|
-
fp.puts
|
532
|
+
FileUtils.mkdir_p "data"
|
533
|
+
File.open File.join("data", "foo.txt"), "w" do |fp|
|
534
|
+
fp.puts "blah"
|
514
535
|
end
|
515
536
|
|
516
|
-
foo = util_spec
|
537
|
+
foo = util_spec "foo" do |s|
|
517
538
|
s.files = %w[data/foo.txt]
|
518
539
|
end
|
519
540
|
|
520
541
|
install_gem foo
|
521
542
|
end
|
522
543
|
|
523
|
-
gem
|
544
|
+
gem "foo"
|
524
545
|
|
525
|
-
expected = File.join @gemhome,
|
546
|
+
expected = File.join @gemhome, "gems", foo.full_name, "data", "foo"
|
526
547
|
|
527
548
|
assert_equal expected, Gem::Specification.find_by_name("foo").datadir
|
528
549
|
end
|
529
550
|
|
530
551
|
def test_self_datadir_nonexistent_package
|
531
|
-
|
552
|
+
assert_raise(Gem::MissingSpecError) do
|
532
553
|
Gem::Specification.find_by_name("xyzzy").datadir
|
533
554
|
end
|
534
555
|
end
|
535
556
|
|
536
557
|
def test_self_default_exec_format
|
537
|
-
ruby_install_name
|
538
|
-
assert_equal
|
558
|
+
ruby_install_name "ruby" do
|
559
|
+
assert_equal "%s", Gem.default_exec_format
|
539
560
|
end
|
540
561
|
end
|
541
562
|
|
542
563
|
def test_self_default_exec_format_18
|
543
|
-
ruby_install_name
|
544
|
-
assert_equal
|
564
|
+
ruby_install_name "ruby18" do
|
565
|
+
assert_equal "%s18", Gem.default_exec_format
|
545
566
|
end
|
546
567
|
end
|
547
568
|
|
548
569
|
def test_self_default_exec_format_jruby
|
549
|
-
ruby_install_name
|
550
|
-
assert_equal
|
570
|
+
ruby_install_name "jruby" do
|
571
|
+
assert_equal "j%s", Gem.default_exec_format
|
551
572
|
end
|
552
573
|
end
|
553
574
|
|
554
575
|
def test_default_path
|
555
|
-
vendordir(File.join(@tempdir,
|
576
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
556
577
|
FileUtils.rm_rf Gem.user_home
|
557
578
|
|
558
579
|
expected = [Gem.default_dir]
|
@@ -572,7 +593,7 @@ class TestGem < Gem::TestCase
|
|
572
593
|
end
|
573
594
|
|
574
595
|
def test_default_path_user_home
|
575
|
-
vendordir(File.join(@tempdir,
|
596
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
576
597
|
expected = [Gem.user_dir, Gem.default_dir]
|
577
598
|
|
578
599
|
assert_equal expected, Gem.default_path
|
@@ -580,7 +601,7 @@ class TestGem < Gem::TestCase
|
|
580
601
|
end
|
581
602
|
|
582
603
|
def test_default_path_vendor_dir
|
583
|
-
vendordir(File.join(@tempdir,
|
604
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
584
605
|
FileUtils.mkdir_p Gem.vendor_dir
|
585
606
|
|
586
607
|
FileUtils.rm_rf Gem.user_home
|
@@ -595,25 +616,6 @@ class TestGem < Gem::TestCase
|
|
595
616
|
assert_equal %w[https://rubygems.org/], Gem.default_sources
|
596
617
|
end
|
597
618
|
|
598
|
-
def test_self_use_gemdeps
|
599
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
|
600
|
-
|
601
|
-
FileUtils.mkdir_p 'detect/a/b'
|
602
|
-
FileUtils.mkdir_p 'detect/a/Isolate'
|
603
|
-
|
604
|
-
FileUtils.touch 'detect/Isolate'
|
605
|
-
|
606
|
-
begin
|
607
|
-
Dir.chdir 'detect/a/b'
|
608
|
-
|
609
|
-
assert_equal add_bundler_full_name([]), Gem.use_gemdeps.map(&:full_name)
|
610
|
-
ensure
|
611
|
-
Dir.chdir @tempdir
|
612
|
-
end
|
613
|
-
ensure
|
614
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
615
|
-
end
|
616
|
-
|
617
619
|
def test_self_dir
|
618
620
|
assert_equal @gemhome, Gem.dir
|
619
621
|
end
|
@@ -624,12 +626,12 @@ class TestGem < Gem::TestCase
|
|
624
626
|
|
625
627
|
Gem.ensure_gem_subdirectories @gemhome
|
626
628
|
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
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"
|
633
635
|
end
|
634
636
|
|
635
637
|
def test_self_ensure_gem_directories_permissions
|
@@ -659,9 +661,9 @@ class TestGem < Gem::TestCase
|
|
659
661
|
end unless win_platform?
|
660
662
|
|
661
663
|
def test_self_ensure_gem_directories_missing_parents
|
662
|
-
gemdir = File.join @tempdir,
|
663
|
-
FileUtils.rm_rf File.join(@tempdir,
|
664
|
-
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")),
|
665
667
|
"manually remove #{File.join @tempdir, 'a'}, tests are broken"
|
666
668
|
Gem.use_paths gemdir
|
667
669
|
|
@@ -670,7 +672,7 @@ class TestGem < Gem::TestCase
|
|
670
672
|
assert_directory_exists util_cache_dir
|
671
673
|
end
|
672
674
|
|
673
|
-
unless win_platform? || Process.uid.zero?
|
675
|
+
unless win_platform? || Process.uid.zero? # only for FS that support write protection
|
674
676
|
def test_self_ensure_gem_directories_write_protected
|
675
677
|
gemdir = File.join @tempdir, "egd"
|
676
678
|
FileUtils.rm_r gemdir rescue nil
|
@@ -702,16 +704,21 @@ class TestGem < Gem::TestCase
|
|
702
704
|
ensure
|
703
705
|
FileUtils.chmod 0600, parent
|
704
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
|
705
712
|
end
|
706
713
|
|
707
714
|
def test_self_extension_dir_shared
|
708
|
-
enable_shared
|
715
|
+
enable_shared "yes" do
|
709
716
|
assert_equal Gem.ruby_api_version, Gem.extension_api_version
|
710
717
|
end
|
711
718
|
end
|
712
719
|
|
713
720
|
def test_self_extension_dir_static
|
714
|
-
enable_shared
|
721
|
+
enable_shared "no" do
|
715
722
|
assert_equal "#{Gem.ruby_api_version}-static", Gem.extension_api_version
|
716
723
|
end
|
717
724
|
end
|
@@ -720,14 +727,14 @@ class TestGem < Gem::TestCase
|
|
720
727
|
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
721
728
|
$LOAD_PATH.unshift cwd
|
722
729
|
|
723
|
-
discover_path = File.join
|
730
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
724
731
|
|
725
|
-
foo1, foo2 = %w
|
726
|
-
spec = quick_gem
|
732
|
+
foo1, foo2 = %w[1 2].map do |version|
|
733
|
+
spec = quick_gem "sff", version do |s|
|
727
734
|
s.files << discover_path
|
728
735
|
end
|
729
736
|
|
730
|
-
write_file(File.join
|
737
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
731
738
|
fp.puts "# #{spec.full_name}"
|
732
739
|
end
|
733
740
|
|
@@ -737,65 +744,29 @@ class TestGem < Gem::TestCase
|
|
737
744
|
Gem.refresh
|
738
745
|
|
739
746
|
expected = [
|
740
|
-
File.expand_path(
|
747
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
741
748
|
File.join(foo2.full_gem_path, discover_path),
|
742
749
|
File.join(foo1.full_gem_path, discover_path),
|
743
750
|
]
|
744
751
|
|
745
|
-
assert_equal expected, Gem.find_files(
|
746
|
-
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]"
|
747
754
|
ensure
|
748
755
|
assert_equal cwd, $LOAD_PATH.shift
|
749
756
|
end
|
750
757
|
|
751
|
-
def test_self_find_files_with_gemfile
|
752
|
-
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
753
|
-
actual_load_path = $LOAD_PATH.unshift(cwd).dup
|
754
|
-
|
755
|
-
discover_path = File.join 'lib', 'sff', 'discover.rb'
|
756
|
-
|
757
|
-
foo1, _ = %w(1 2).map do |version|
|
758
|
-
spec = quick_gem 'sff', version do |s|
|
759
|
-
s.files << discover_path
|
760
|
-
end
|
761
|
-
|
762
|
-
write_file(File.join 'gems', spec.full_name, discover_path) do |fp|
|
763
|
-
fp.puts "# #{spec.full_name}"
|
764
|
-
end
|
765
|
-
|
766
|
-
spec
|
767
|
-
end
|
768
|
-
Gem.refresh
|
769
|
-
|
770
|
-
write_file(File.join Dir.pwd, 'Gemfile') do |fp|
|
771
|
-
fp.puts "source 'https://rubygems.org'"
|
772
|
-
fp.puts "gem '#{foo1.name}', '#{foo1.version}'"
|
773
|
-
end
|
774
|
-
Gem.use_gemdeps(File.join Dir.pwd, 'Gemfile')
|
775
|
-
|
776
|
-
expected = [
|
777
|
-
File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
|
778
|
-
File.join(foo1.full_gem_path, discover_path)
|
779
|
-
].sort
|
780
|
-
|
781
|
-
assert_equal expected, Gem.find_files('sff/discover').sort
|
782
|
-
assert_equal expected, Gem.find_files('sff/**.rb').sort, '[ruby-core:31730]'
|
783
|
-
ensure
|
784
|
-
assert_equal cwd, actual_load_path.shift unless Gem.java_platform?
|
785
|
-
end
|
786
|
-
|
787
758
|
def test_self_find_latest_files
|
788
759
|
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
789
760
|
$LOAD_PATH.unshift cwd
|
790
761
|
|
791
|
-
discover_path = File.join
|
762
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
792
763
|
|
793
|
-
_, foo2 = %w
|
794
|
-
spec = quick_gem
|
764
|
+
_, foo2 = %w[1 2].map do |version|
|
765
|
+
spec = quick_gem "sff", version do |s|
|
795
766
|
s.files << discover_path
|
796
767
|
end
|
797
768
|
|
798
|
-
write_file(File.join
|
769
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
799
770
|
fp.puts "# #{spec.full_name}"
|
800
771
|
end
|
801
772
|
|
@@ -805,64 +776,103 @@ class TestGem < Gem::TestCase
|
|
805
776
|
Gem.refresh
|
806
777
|
|
807
778
|
expected = [
|
808
|
-
File.expand_path(
|
779
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
809
780
|
File.join(foo2.full_gem_path, discover_path),
|
810
781
|
]
|
811
782
|
|
812
|
-
assert_equal expected, Gem.find_latest_files(
|
813
|
-
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]"
|
814
785
|
ensure
|
815
786
|
assert_equal cwd, $LOAD_PATH.shift
|
816
787
|
end
|
817
788
|
|
818
789
|
def test_self_latest_spec_for
|
819
790
|
gems = spec_fetcher do |fetcher|
|
820
|
-
fetcher.spec
|
821
|
-
fetcher.spec
|
822
|
-
fetcher.spec
|
791
|
+
fetcher.spec "a", 1
|
792
|
+
fetcher.spec "a", "3.a"
|
793
|
+
fetcher.spec "a", 2
|
823
794
|
end
|
824
795
|
|
825
|
-
spec = Gem.latest_spec_for
|
796
|
+
spec = Gem.latest_spec_for "a"
|
826
797
|
|
827
|
-
assert_equal gems[
|
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
|
808
|
+
|
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
|
828
820
|
end
|
829
821
|
|
830
822
|
def test_self_latest_rubygems_version
|
831
823
|
spec_fetcher do |fetcher|
|
832
|
-
fetcher.spec
|
833
|
-
fetcher.spec
|
834
|
-
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"
|
835
827
|
end
|
836
828
|
|
837
829
|
version = Gem.latest_rubygems_version
|
838
830
|
|
839
|
-
assert_equal Gem::Version.new(
|
831
|
+
assert_equal Gem::Version.new("1.8.24"), version
|
840
832
|
end
|
841
833
|
|
842
834
|
def test_self_latest_version_for
|
843
835
|
spec_fetcher do |fetcher|
|
844
|
-
fetcher.spec
|
845
|
-
fetcher.spec
|
846
|
-
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"
|
847
862
|
end
|
848
863
|
|
849
|
-
version = Gem.latest_version_for
|
864
|
+
version = Gem.latest_version_for "a"
|
850
865
|
|
851
866
|
assert_equal Gem::Version.new(2), version
|
852
867
|
end
|
853
868
|
|
854
869
|
def test_self_loaded_specs
|
855
|
-
foo = util_spec
|
870
|
+
foo = util_spec "foo"
|
856
871
|
install_gem foo
|
857
872
|
|
858
873
|
foo.activate
|
859
874
|
|
860
|
-
assert_equal true, Gem.loaded_specs.keys.include?(
|
861
|
-
end
|
862
|
-
|
863
|
-
def util_path
|
864
|
-
ENV.delete "GEM_HOME"
|
865
|
-
ENV.delete "GEM_PATH"
|
875
|
+
assert_equal true, Gem.loaded_specs.keys.include?("foo")
|
866
876
|
end
|
867
877
|
|
868
878
|
def test_self_path
|
@@ -870,53 +880,19 @@ class TestGem < Gem::TestCase
|
|
870
880
|
end
|
871
881
|
|
872
882
|
def test_self_path_default
|
873
|
-
|
874
|
-
|
875
|
-
if defined?(APPLE_GEM_HOME)
|
876
|
-
orig_APPLE_GEM_HOME = APPLE_GEM_HOME
|
877
|
-
Object.send :remove_const, :APPLE_GEM_HOME
|
878
|
-
end
|
883
|
+
ENV.delete "GEM_HOME"
|
884
|
+
ENV.delete "GEM_PATH"
|
879
885
|
|
880
886
|
Gem.instance_variable_set :@paths, nil
|
881
887
|
|
882
888
|
assert_equal [Gem.default_path, Gem.dir].flatten.uniq, Gem.path
|
883
|
-
ensure
|
884
|
-
Object.const_set :APPLE_GEM_HOME, orig_APPLE_GEM_HOME if orig_APPLE_GEM_HOME
|
885
|
-
end
|
886
|
-
|
887
|
-
unless win_platform?
|
888
|
-
def test_self_path_APPLE_GEM_HOME
|
889
|
-
util_path
|
890
|
-
|
891
|
-
Gem.clear_paths
|
892
|
-
apple_gem_home = File.join @tempdir, 'apple_gem_home'
|
893
|
-
|
894
|
-
old, $-w = $-w, nil
|
895
|
-
Object.const_set :APPLE_GEM_HOME, apple_gem_home
|
896
|
-
$-w = old
|
897
|
-
|
898
|
-
assert_includes Gem.path, apple_gem_home
|
899
|
-
ensure
|
900
|
-
Object.send :remove_const, :APPLE_GEM_HOME
|
901
|
-
end
|
902
|
-
|
903
|
-
def test_self_path_APPLE_GEM_HOME_GEM_PATH
|
904
|
-
Gem.clear_paths
|
905
|
-
ENV['GEM_PATH'] = @gemhome
|
906
|
-
apple_gem_home = File.join @tempdir, 'apple_gem_home'
|
907
|
-
Gem.const_set :APPLE_GEM_HOME, apple_gem_home
|
908
|
-
|
909
|
-
refute Gem.path.include?(apple_gem_home)
|
910
|
-
ensure
|
911
|
-
Gem.send :remove_const, :APPLE_GEM_HOME
|
912
|
-
end
|
913
889
|
end
|
914
890
|
|
915
891
|
def test_self_path_ENV_PATH
|
916
892
|
path_count = Gem.path.size
|
917
893
|
Gem.clear_paths
|
918
894
|
|
919
|
-
ENV[
|
895
|
+
ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
|
920
896
|
|
921
897
|
assert_equal @additional, Gem.path[0,2]
|
922
898
|
|
@@ -928,10 +904,10 @@ class TestGem < Gem::TestCase
|
|
928
904
|
def test_self_path_duplicate
|
929
905
|
Gem.clear_paths
|
930
906
|
util_ensure_gem_dirs
|
931
|
-
dirs = @additional + [@gemhome] + [File.join(@tempdir,
|
907
|
+
dirs = @additional + [@gemhome] + [File.join(@tempdir, "a")]
|
932
908
|
|
933
|
-
ENV[
|
934
|
-
ENV[
|
909
|
+
ENV["GEM_HOME"] = @gemhome
|
910
|
+
ENV["GEM_PATH"] = dirs.join File::PATH_SEPARATOR
|
935
911
|
|
936
912
|
assert_equal @gemhome, Gem.dir
|
937
913
|
|
@@ -943,8 +919,8 @@ class TestGem < Gem::TestCase
|
|
943
919
|
Gem.clear_paths
|
944
920
|
|
945
921
|
util_ensure_gem_dirs
|
946
|
-
ENV[
|
947
|
-
ENV[
|
922
|
+
ENV["GEM_HOME"] = @gemhome
|
923
|
+
ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
|
948
924
|
|
949
925
|
assert_equal @gemhome, Gem.dir
|
950
926
|
|
@@ -961,38 +937,38 @@ class TestGem < Gem::TestCase
|
|
961
937
|
end
|
962
938
|
|
963
939
|
def test_self_prefix_libdir
|
964
|
-
orig_libdir = RbConfig::CONFIG[
|
965
|
-
RbConfig::CONFIG[
|
940
|
+
orig_libdir = RbConfig::CONFIG["libdir"]
|
941
|
+
RbConfig::CONFIG["libdir"] = PROJECT_DIR
|
966
942
|
|
967
943
|
assert_nil Gem.prefix
|
968
944
|
ensure
|
969
|
-
RbConfig::CONFIG[
|
945
|
+
RbConfig::CONFIG["libdir"] = orig_libdir
|
970
946
|
end
|
971
947
|
|
972
948
|
def test_self_prefix_sitelibdir
|
973
|
-
orig_sitelibdir = RbConfig::CONFIG[
|
974
|
-
RbConfig::CONFIG[
|
949
|
+
orig_sitelibdir = RbConfig::CONFIG["sitelibdir"]
|
950
|
+
RbConfig::CONFIG["sitelibdir"] = PROJECT_DIR
|
975
951
|
|
976
952
|
assert_nil Gem.prefix
|
977
953
|
ensure
|
978
|
-
RbConfig::CONFIG[
|
954
|
+
RbConfig::CONFIG["sitelibdir"] = orig_sitelibdir
|
979
955
|
end
|
980
956
|
|
981
957
|
def test_self_read_binary
|
982
|
-
File.open
|
958
|
+
File.open "test", "w" do |io|
|
983
959
|
io.write "\xCF\x80"
|
984
960
|
end
|
985
961
|
|
986
|
-
assert_equal ["\xCF", "\x80"], Gem.read_binary(
|
962
|
+
assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
|
987
963
|
|
988
|
-
|
964
|
+
pend "chmod not supported" if Gem.win_platform?
|
989
965
|
|
990
966
|
begin
|
991
|
-
File.chmod 0444,
|
967
|
+
File.chmod 0444, "test"
|
992
968
|
|
993
|
-
assert_equal ["\xCF", "\x80"], Gem.read_binary(
|
969
|
+
assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
|
994
970
|
ensure
|
995
|
-
File.chmod 0644,
|
971
|
+
File.chmod 0644, "test"
|
996
972
|
end
|
997
973
|
end
|
998
974
|
|
@@ -1030,111 +1006,95 @@ class TestGem < Gem::TestCase
|
|
1030
1006
|
|
1031
1007
|
Gem.refresh
|
1032
1008
|
|
1033
|
-
Gem::Specification.each{|spec| assert spec.activated? if spec == s}
|
1009
|
+
Gem::Specification.each {|spec| assert spec.activated? if spec == s }
|
1034
1010
|
|
1035
1011
|
Gem.loaded_specs.delete(s)
|
1036
1012
|
Gem.refresh
|
1037
1013
|
end
|
1038
1014
|
|
1039
1015
|
def test_self_ruby_escaping_spaces_in_path
|
1040
|
-
|
1041
|
-
|
1016
|
+
with_clean_path_to_ruby do
|
1017
|
+
with_rb_config_ruby("C:/Ruby 1.8/bin/ruby.exe") do
|
1042
1018
|
assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby
|
1043
1019
|
end
|
1044
1020
|
end
|
1045
1021
|
end
|
1046
1022
|
|
1047
1023
|
def test_self_ruby_path_without_spaces
|
1048
|
-
|
1049
|
-
|
1024
|
+
with_clean_path_to_ruby do
|
1025
|
+
with_rb_config_ruby("C:/Ruby18/bin/ruby.exe") do
|
1050
1026
|
assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby
|
1051
1027
|
end
|
1052
1028
|
end
|
1053
1029
|
end
|
1054
1030
|
|
1055
1031
|
def test_self_ruby_api_version
|
1056
|
-
orig_ruby_version, RbConfig::CONFIG[
|
1032
|
+
orig_ruby_version, RbConfig::CONFIG["ruby_version"] = RbConfig::CONFIG["ruby_version"], "1.2.3"
|
1057
1033
|
|
1058
1034
|
Gem.instance_variable_set :@ruby_api_version, nil
|
1059
1035
|
|
1060
|
-
assert_equal
|
1036
|
+
assert_equal "1.2.3", Gem.ruby_api_version
|
1061
1037
|
ensure
|
1062
1038
|
Gem.instance_variable_set :@ruby_api_version, nil
|
1063
1039
|
|
1064
|
-
RbConfig::CONFIG[
|
1040
|
+
RbConfig::CONFIG["ruby_version"] = orig_ruby_version
|
1065
1041
|
end
|
1066
1042
|
|
1067
1043
|
def test_self_env_requirement
|
1068
|
-
ENV["GEM_REQUIREMENT_FOO"] =
|
1069
|
-
ENV["GEM_REQUIREMENT_BAR"] =
|
1070
|
-
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"
|
1071
1047
|
|
1072
|
-
assert_equal Gem::Requirement.create(
|
1073
|
-
assert_equal Gem::Requirement.create(
|
1074
|
-
|
1075
|
-
assert_equal Gem::Requirement.default, Gem.env_requirement(
|
1076
|
-
end
|
1077
|
-
|
1078
|
-
def test_self_ruby_version_with_patchlevel_less_ancient_rubies
|
1079
|
-
util_set_RUBY_VERSION '1.8.5'
|
1080
|
-
|
1081
|
-
assert_equal Gem::Version.new('1.8.5'), Gem.ruby_version
|
1082
|
-
ensure
|
1083
|
-
util_restore_RUBY_VERSION
|
1084
|
-
end
|
1085
|
-
|
1086
|
-
def test_self_ruby_version_with_release
|
1087
|
-
util_set_RUBY_VERSION '1.8.6', 287
|
1088
|
-
|
1089
|
-
assert_equal Gem::Version.new('1.8.6.287'), Gem.ruby_version
|
1090
|
-
ensure
|
1091
|
-
util_restore_RUBY_VERSION
|
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")
|
1092
1052
|
end
|
1093
1053
|
|
1094
1054
|
def test_self_ruby_version_with_non_mri_implementations
|
1095
|
-
util_set_RUBY_VERSION
|
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]"
|
1096
1056
|
|
1097
|
-
assert_equal Gem::Version.new(
|
1057
|
+
assert_equal Gem::Version.new("2.5.0"), Gem.ruby_version
|
1098
1058
|
ensure
|
1099
1059
|
util_restore_RUBY_VERSION
|
1100
1060
|
end
|
1101
1061
|
|
1102
1062
|
def test_self_ruby_version_with_svn_prerelease
|
1103
|
-
util_set_RUBY_VERSION
|
1063
|
+
util_set_RUBY_VERSION "2.6.0", -1, 63539, "ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]"
|
1104
1064
|
|
1105
|
-
assert_equal Gem::Version.new(
|
1065
|
+
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
|
1106
1066
|
ensure
|
1107
1067
|
util_restore_RUBY_VERSION
|
1108
1068
|
end
|
1109
1069
|
|
1110
1070
|
def test_self_ruby_version_with_git_prerelease
|
1111
|
-
util_set_RUBY_VERSION
|
1071
|
+
util_set_RUBY_VERSION "2.7.0", -1, "b563439274a402e33541f5695b1bfd4ac1085638", "ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]"
|
1112
1072
|
|
1113
|
-
assert_equal Gem::Version.new(
|
1073
|
+
assert_equal Gem::Version.new("2.7.0.preview3"), Gem.ruby_version
|
1114
1074
|
ensure
|
1115
1075
|
util_restore_RUBY_VERSION
|
1116
1076
|
end
|
1117
1077
|
|
1118
1078
|
def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
|
1119
|
-
util_set_RUBY_VERSION
|
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"
|
1120
1080
|
|
1121
|
-
assert_equal Gem::Version.new(
|
1081
|
+
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
|
1122
1082
|
ensure
|
1123
1083
|
util_restore_RUBY_VERSION
|
1124
1084
|
end
|
1125
1085
|
|
1126
1086
|
def test_self_ruby_version_with_svn_trunk
|
1127
|
-
util_set_RUBY_VERSION
|
1087
|
+
util_set_RUBY_VERSION "1.9.2", -1, 23493, "ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]"
|
1128
1088
|
|
1129
|
-
assert_equal Gem::Version.new(
|
1089
|
+
assert_equal Gem::Version.new("1.9.2.dev"), Gem.ruby_version
|
1130
1090
|
ensure
|
1131
1091
|
util_restore_RUBY_VERSION
|
1132
1092
|
end
|
1133
1093
|
|
1134
1094
|
def test_self_ruby_version_with_git_master
|
1135
|
-
util_set_RUBY_VERSION
|
1095
|
+
util_set_RUBY_VERSION "2.7.0", -1, "5de284ec78220e75643f89b454ce999da0c1c195", "ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]"
|
1136
1096
|
|
1137
|
-
assert_equal Gem::Version.new(
|
1097
|
+
assert_equal Gem::Version.new("2.7.0.dev"), Gem.ruby_version
|
1138
1098
|
ensure
|
1139
1099
|
util_restore_RUBY_VERSION
|
1140
1100
|
end
|
@@ -1144,7 +1104,7 @@ class TestGem < Gem::TestCase
|
|
1144
1104
|
end
|
1145
1105
|
|
1146
1106
|
def test_self_paths_eq
|
1147
|
-
other = File.join @tempdir,
|
1107
|
+
other = File.join @tempdir, "other"
|
1148
1108
|
path = [@userhome, other].join File::PATH_SEPARATOR
|
1149
1109
|
|
1150
1110
|
#
|
@@ -1157,12 +1117,12 @@ class TestGem < Gem::TestCase
|
|
1157
1117
|
end
|
1158
1118
|
|
1159
1119
|
def test_self_paths_eq_nonexistent_home
|
1160
|
-
ENV[
|
1120
|
+
ENV["GEM_HOME"] = @gemhome
|
1161
1121
|
Gem.clear_paths
|
1162
1122
|
|
1163
|
-
other = File.join @tempdir,
|
1123
|
+
other = File.join @tempdir, "other"
|
1164
1124
|
|
1165
|
-
ENV[
|
1125
|
+
ENV["HOME"] = other
|
1166
1126
|
|
1167
1127
|
Gem.paths = { "GEM_PATH" => other }
|
1168
1128
|
|
@@ -1172,7 +1132,7 @@ class TestGem < Gem::TestCase
|
|
1172
1132
|
def test_self_post_build
|
1173
1133
|
assert_equal 1, Gem.post_build_hooks.length
|
1174
1134
|
|
1175
|
-
Gem.post_build {
|
1135
|
+
Gem.post_build {|installer| }
|
1176
1136
|
|
1177
1137
|
assert_equal 2, Gem.post_build_hooks.length
|
1178
1138
|
end
|
@@ -1180,7 +1140,7 @@ class TestGem < Gem::TestCase
|
|
1180
1140
|
def test_self_post_install
|
1181
1141
|
assert_equal 1, Gem.post_install_hooks.length
|
1182
1142
|
|
1183
|
-
Gem.post_install {
|
1143
|
+
Gem.post_install {|installer| }
|
1184
1144
|
|
1185
1145
|
assert_equal 2, Gem.post_install_hooks.length
|
1186
1146
|
end
|
@@ -1188,7 +1148,7 @@ class TestGem < Gem::TestCase
|
|
1188
1148
|
def test_self_done_installing
|
1189
1149
|
assert_empty Gem.done_installing_hooks
|
1190
1150
|
|
1191
|
-
Gem.done_installing {
|
1151
|
+
Gem.done_installing {|gems| }
|
1192
1152
|
|
1193
1153
|
assert_equal 1, Gem.done_installing_hooks.length
|
1194
1154
|
end
|
@@ -1196,7 +1156,7 @@ class TestGem < Gem::TestCase
|
|
1196
1156
|
def test_self_post_reset
|
1197
1157
|
assert_empty Gem.post_reset_hooks
|
1198
1158
|
|
1199
|
-
Gem.post_reset {
|
1159
|
+
Gem.post_reset {}
|
1200
1160
|
|
1201
1161
|
assert_equal 1, Gem.post_reset_hooks.length
|
1202
1162
|
end
|
@@ -1204,7 +1164,7 @@ class TestGem < Gem::TestCase
|
|
1204
1164
|
def test_self_post_uninstall
|
1205
1165
|
assert_equal 1, Gem.post_uninstall_hooks.length
|
1206
1166
|
|
1207
|
-
Gem.post_uninstall {
|
1167
|
+
Gem.post_uninstall {|installer| }
|
1208
1168
|
|
1209
1169
|
assert_equal 2, Gem.post_uninstall_hooks.length
|
1210
1170
|
end
|
@@ -1212,7 +1172,7 @@ class TestGem < Gem::TestCase
|
|
1212
1172
|
def test_self_pre_install
|
1213
1173
|
assert_equal 1, Gem.pre_install_hooks.length
|
1214
1174
|
|
1215
|
-
Gem.pre_install {
|
1175
|
+
Gem.pre_install {|installer| }
|
1216
1176
|
|
1217
1177
|
assert_equal 2, Gem.pre_install_hooks.length
|
1218
1178
|
end
|
@@ -1220,7 +1180,7 @@ class TestGem < Gem::TestCase
|
|
1220
1180
|
def test_self_pre_reset
|
1221
1181
|
assert_empty Gem.pre_reset_hooks
|
1222
1182
|
|
1223
|
-
Gem.pre_reset {
|
1183
|
+
Gem.pre_reset {}
|
1224
1184
|
|
1225
1185
|
assert_equal 1, Gem.pre_reset_hooks.length
|
1226
1186
|
end
|
@@ -1228,7 +1188,7 @@ class TestGem < Gem::TestCase
|
|
1228
1188
|
def test_self_pre_uninstall
|
1229
1189
|
assert_equal 1, Gem.pre_uninstall_hooks.length
|
1230
1190
|
|
1231
|
-
Gem.pre_uninstall {
|
1191
|
+
Gem.pre_uninstall {|installer| }
|
1232
1192
|
|
1233
1193
|
assert_equal 2, Gem.pre_uninstall_hooks.length
|
1234
1194
|
end
|
@@ -1241,73 +1201,74 @@ class TestGem < Gem::TestCase
|
|
1241
1201
|
end
|
1242
1202
|
|
1243
1203
|
def test_try_activate_returns_true_for_activated_specs
|
1244
|
-
b = util_spec
|
1245
|
-
spec.files <<
|
1204
|
+
b = util_spec "b", "1.0" do |spec|
|
1205
|
+
spec.files << "lib/b.rb"
|
1246
1206
|
end
|
1247
1207
|
install_specs b
|
1248
1208
|
|
1249
|
-
assert Gem.try_activate(
|
1250
|
-
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"
|
1251
1211
|
end
|
1252
1212
|
|
1253
1213
|
def test_spec_order_is_consistent
|
1254
|
-
b1 = util_spec
|
1255
|
-
b2 = util_spec
|
1256
|
-
b3 = util_spec
|
1214
|
+
b1 = util_spec "b", "1.0"
|
1215
|
+
b2 = util_spec "b", "2.0"
|
1216
|
+
b3 = util_spec "b", "3.0"
|
1257
1217
|
|
1258
1218
|
install_specs b1, b2, b3
|
1259
1219
|
|
1260
|
-
specs1 = Gem::Specification.stubs.find_all {
|
1220
|
+
specs1 = Gem::Specification.stubs.find_all {|s| s.name == "b" }
|
1261
1221
|
Gem::Specification.reset
|
1262
|
-
specs2 = Gem::Specification.stubs_for(
|
1222
|
+
specs2 = Gem::Specification.stubs_for("b")
|
1263
1223
|
assert_equal specs1.map(&:version), specs2.map(&:version)
|
1264
1224
|
end
|
1265
1225
|
|
1266
1226
|
def test_self_try_activate_missing_dep
|
1267
|
-
b = util_spec
|
1268
|
-
a = util_spec
|
1227
|
+
b = util_spec "b", "1.0"
|
1228
|
+
a = util_spec "a", "1.0", "b" => ">= 1.0"
|
1269
1229
|
|
1270
1230
|
install_specs b, a
|
1271
1231
|
uninstall_gem b
|
1272
1232
|
|
1273
|
-
a_file = File.join a.gem_dir,
|
1233
|
+
a_file = File.join a.gem_dir, "lib", "a_file.rb"
|
1274
1234
|
|
1275
1235
|
write_file a_file do |io|
|
1276
|
-
io.puts
|
1236
|
+
io.puts "# a_file.rb"
|
1277
1237
|
end
|
1278
1238
|
|
1279
|
-
e =
|
1280
|
-
Gem.try_activate
|
1239
|
+
e = assert_raise Gem::MissingSpecError do
|
1240
|
+
Gem.try_activate "a_file"
|
1281
1241
|
end
|
1282
1242
|
|
1283
|
-
assert_match %r
|
1243
|
+
assert_match %r{Could not find 'b' }, e.message
|
1244
|
+
assert_match %r{at: #{a.spec_file}}, e.message
|
1284
1245
|
end
|
1285
1246
|
|
1286
1247
|
def test_self_try_activate_missing_prerelease
|
1287
|
-
b = util_spec
|
1288
|
-
a = util_spec
|
1248
|
+
b = util_spec "b", "1.0rc1"
|
1249
|
+
a = util_spec "a", "1.0rc1", "b" => "1.0rc1"
|
1289
1250
|
|
1290
1251
|
install_specs b, a
|
1291
1252
|
uninstall_gem b
|
1292
1253
|
|
1293
|
-
a_file = File.join a.gem_dir,
|
1254
|
+
a_file = File.join a.gem_dir, "lib", "a_file.rb"
|
1294
1255
|
|
1295
1256
|
write_file a_file do |io|
|
1296
|
-
io.puts
|
1257
|
+
io.puts "# a_file.rb"
|
1297
1258
|
end
|
1298
1259
|
|
1299
|
-
e =
|
1300
|
-
Gem.try_activate
|
1260
|
+
e = assert_raise Gem::MissingSpecError do
|
1261
|
+
Gem.try_activate "a_file"
|
1301
1262
|
end
|
1302
1263
|
|
1303
|
-
assert_match %r
|
1264
|
+
assert_match %r{Could not find 'b' \(= 1.0rc1\)}, e.message
|
1304
1265
|
end
|
1305
1266
|
|
1306
1267
|
def test_self_try_activate_missing_extensions
|
1307
|
-
spec = util_spec
|
1268
|
+
spec = util_spec "ext", "1" do |s|
|
1308
1269
|
s.extensions = %w[ext/extconf.rb]
|
1309
1270
|
s.mark_version
|
1310
|
-
s.installed_by_version = v(
|
1271
|
+
s.installed_by_version = v("2.2")
|
1311
1272
|
end
|
1312
1273
|
|
1313
1274
|
# write the spec without install to simulate a failed install
|
@@ -1315,56 +1276,54 @@ class TestGem < Gem::TestCase
|
|
1315
1276
|
io.write spec.to_ruby_for_cache
|
1316
1277
|
end
|
1317
1278
|
|
1318
|
-
_, err =
|
1319
|
-
refute Gem.try_activate
|
1279
|
+
_, err = capture_output do
|
1280
|
+
refute Gem.try_activate "nonexistent"
|
1320
1281
|
end
|
1321
1282
|
|
1322
|
-
|
1323
|
-
|
1324
|
-
"Try: gem pristine ext --version 1\n"
|
1283
|
+
expected = "Ignoring ext-1 because its extensions are not built. " +
|
1284
|
+
"Try: gem pristine ext --version 1\n"
|
1325
1285
|
|
1326
|
-
|
1327
|
-
end
|
1286
|
+
assert_equal expected, err
|
1328
1287
|
end
|
1329
1288
|
|
1330
1289
|
def test_self_use_paths_with_nils
|
1331
|
-
orig_home = ENV.delete
|
1332
|
-
orig_path = ENV.delete
|
1290
|
+
orig_home = ENV.delete "GEM_HOME"
|
1291
|
+
orig_path = ENV.delete "GEM_PATH"
|
1333
1292
|
Gem.use_paths nil, nil
|
1334
1293
|
assert_equal Gem.default_dir, Gem.paths.home
|
1335
1294
|
path = (Gem.default_path + [Gem.paths.home]).uniq
|
1336
1295
|
assert_equal path, Gem.paths.path
|
1337
1296
|
ensure
|
1338
|
-
ENV[
|
1339
|
-
ENV[
|
1297
|
+
ENV["GEM_HOME"] = orig_home
|
1298
|
+
ENV["GEM_PATH"] = orig_path
|
1340
1299
|
end
|
1341
1300
|
|
1342
1301
|
def test_setting_paths_does_not_warn_about_unknown_keys
|
1343
|
-
stdout, stderr =
|
1344
|
-
Gem.paths = {
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1302
|
+
stdout, stderr = capture_output do
|
1303
|
+
Gem.paths = { "foo" => [],
|
1304
|
+
"bar" => Object.new,
|
1305
|
+
"GEM_HOME" => Gem.paths.home,
|
1306
|
+
"GEM_PATH" => "foo" }
|
1348
1307
|
end
|
1349
|
-
assert_equal [
|
1350
|
-
assert_equal
|
1351
|
-
assert_equal
|
1308
|
+
assert_equal ["foo", Gem.paths.home], Gem.paths.path
|
1309
|
+
assert_equal "", stderr
|
1310
|
+
assert_equal "", stdout
|
1352
1311
|
end
|
1353
1312
|
|
1354
1313
|
def test_setting_paths_does_not_mutate_parameter_object
|
1355
|
-
Gem.paths = {
|
1356
|
-
|
1357
|
-
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
|
1358
1317
|
end
|
1359
1318
|
|
1360
1319
|
def test_deprecated_paths=
|
1361
|
-
stdout, stderr =
|
1362
|
-
Gem.paths = {
|
1363
|
-
|
1320
|
+
stdout, stderr = capture_output do
|
1321
|
+
Gem.paths = { "GEM_HOME" => Gem.paths.home,
|
1322
|
+
"GEM_PATH" => [Gem.paths.home, "foo"] }
|
1364
1323
|
end
|
1365
|
-
assert_equal [Gem.paths.home,
|
1324
|
+
assert_equal [Gem.paths.home, "foo"], Gem.paths.path
|
1366
1325
|
assert_match(/Array values in the parameter to `Gem.paths=` are deprecated.\nPlease use a String or nil/m, stderr)
|
1367
|
-
assert_equal
|
1326
|
+
assert_equal "", stdout
|
1368
1327
|
end
|
1369
1328
|
|
1370
1329
|
def test_self_use_paths
|
@@ -1377,17 +1336,19 @@ class TestGem < Gem::TestCase
|
|
1377
1336
|
end
|
1378
1337
|
|
1379
1338
|
def test_self_user_dir
|
1380
|
-
parts = [@userhome,
|
1381
|
-
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)
|
1382
1343
|
|
1383
1344
|
assert_equal File.join(parts), Gem.user_dir
|
1384
1345
|
end
|
1385
1346
|
|
1386
1347
|
def test_self_user_home
|
1387
|
-
if ENV[
|
1388
|
-
assert_equal ENV[
|
1348
|
+
if ENV["HOME"]
|
1349
|
+
assert_equal ENV["HOME"], Gem.user_home
|
1389
1350
|
else
|
1390
|
-
assert true,
|
1351
|
+
assert true, "count this test"
|
1391
1352
|
end
|
1392
1353
|
end
|
1393
1354
|
|
@@ -1403,30 +1364,28 @@ class TestGem < Gem::TestCase
|
|
1403
1364
|
r.gem "b", "= 1"
|
1404
1365
|
end
|
1405
1366
|
|
1406
|
-
activated = Gem::Specification.map {
|
1367
|
+
activated = Gem::Specification.map {|x| x.full_name }
|
1407
1368
|
|
1408
|
-
assert_equal %w
|
1369
|
+
assert_equal %w[a-1 b-1 c-2], activated.sort
|
1409
1370
|
end
|
1410
1371
|
|
1411
1372
|
def test_self_needs_picks_up_unresolved_deps
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
e = util_spec "e", "1"
|
1418
|
-
|
1419
|
-
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"
|
1420
1378
|
|
1421
|
-
|
1422
|
-
r.gem "a"
|
1423
|
-
r.gem "b", "= 1"
|
1379
|
+
install_specs a, c, b, e, d
|
1424
1380
|
|
1425
|
-
|
1426
|
-
|
1381
|
+
Gem.needs do |r|
|
1382
|
+
r.gem "a"
|
1383
|
+
r.gem "b", "= 1"
|
1427
1384
|
|
1428
|
-
|
1385
|
+
require "d#{$$}"
|
1429
1386
|
end
|
1387
|
+
|
1388
|
+
assert_equal %w[a-1 b-1 c-2 d-1 e-1], loaded_spec_names
|
1430
1389
|
end
|
1431
1390
|
|
1432
1391
|
def test_self_gunzip
|
@@ -1435,35 +1394,35 @@ class TestGem < Gem::TestCase
|
|
1435
1394
|
|
1436
1395
|
output = Gem::Util.gunzip input
|
1437
1396
|
|
1438
|
-
assert_equal
|
1397
|
+
assert_equal "hello", output
|
1439
1398
|
assert_equal Encoding::BINARY, output.encoding
|
1440
1399
|
end
|
1441
1400
|
|
1442
1401
|
def test_self_gzip
|
1443
|
-
input =
|
1402
|
+
input = "hello"
|
1444
1403
|
|
1445
1404
|
output = Gem::Util.gzip input
|
1446
1405
|
|
1447
1406
|
zipped = StringIO.new output
|
1448
1407
|
|
1449
|
-
assert_equal
|
1408
|
+
assert_equal "hello", Zlib::GzipReader.new(zipped).read
|
1450
1409
|
assert_equal Encoding::BINARY, output.encoding
|
1451
1410
|
end
|
1452
1411
|
|
1453
1412
|
def test_self_vendor_dir
|
1454
|
-
vendordir(File.join(@tempdir,
|
1413
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
1455
1414
|
expected =
|
1456
|
-
File.join RbConfig::CONFIG[
|
1457
|
-
RbConfig::CONFIG[
|
1415
|
+
File.join RbConfig::CONFIG["vendordir"], "gems",
|
1416
|
+
RbConfig::CONFIG["ruby_version"]
|
1458
1417
|
|
1459
1418
|
assert_equal expected, Gem.vendor_dir
|
1460
1419
|
end
|
1461
1420
|
end
|
1462
1421
|
|
1463
1422
|
def test_self_vendor_dir_ENV_GEM_VENDOR
|
1464
|
-
ENV[
|
1423
|
+
ENV["GEM_VENDOR"] = File.join @tempdir, "vendor", "gems"
|
1465
1424
|
|
1466
|
-
assert_equal ENV[
|
1425
|
+
assert_equal ENV["GEM_VENDOR"], Gem.vendor_dir
|
1467
1426
|
refute Gem.vendor_dir.frozen?
|
1468
1427
|
end
|
1469
1428
|
|
@@ -1477,59 +1436,88 @@ class TestGem < Gem::TestCase
|
|
1477
1436
|
plugin_path = File.join "lib", "rubygems_plugin.rb"
|
1478
1437
|
|
1479
1438
|
Dir.chdir @tempdir do
|
1480
|
-
FileUtils.mkdir_p
|
1439
|
+
FileUtils.mkdir_p "lib"
|
1481
1440
|
File.open plugin_path, "w" do |fp|
|
1482
1441
|
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
|
1483
1442
|
end
|
1484
1443
|
|
1485
|
-
foo1 = util_spec
|
1444
|
+
foo1 = util_spec "foo", "1" do |s|
|
1486
1445
|
s.files << plugin_path
|
1487
1446
|
end
|
1488
1447
|
|
1489
1448
|
install_gem foo1
|
1490
1449
|
|
1491
|
-
foo2 = util_spec
|
1450
|
+
foo2 = util_spec "foo", "2" do |s|
|
1492
1451
|
s.files << plugin_path
|
1493
1452
|
end
|
1494
1453
|
|
1495
1454
|
install_gem foo2
|
1496
1455
|
end
|
1497
1456
|
|
1498
|
-
Gem.searcher = nil
|
1499
1457
|
Gem::Specification.reset
|
1500
1458
|
|
1501
|
-
gem
|
1459
|
+
gem "foo"
|
1502
1460
|
|
1503
1461
|
Gem.load_plugins
|
1504
1462
|
|
1505
1463
|
assert_equal %w[plugin], PLUGINS_LOADED
|
1506
1464
|
end
|
1507
1465
|
|
1466
|
+
def test_load_user_installed_plugins
|
1467
|
+
@orig_gem_home = ENV["GEM_HOME"]
|
1468
|
+
ENV["GEM_HOME"] = @gemhome
|
1469
|
+
|
1470
|
+
plugin_path = File.join "lib", "rubygems_plugin.rb"
|
1471
|
+
|
1472
|
+
Dir.chdir @tempdir do
|
1473
|
+
FileUtils.mkdir_p "lib"
|
1474
|
+
File.open plugin_path, "w" do |fp|
|
1475
|
+
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
|
1476
|
+
end
|
1477
|
+
|
1478
|
+
foo = util_spec "foo", "1" do |s|
|
1479
|
+
s.files << plugin_path
|
1480
|
+
end
|
1481
|
+
|
1482
|
+
install_gem_user foo
|
1483
|
+
end
|
1484
|
+
|
1485
|
+
Gem.paths = { "GEM_PATH" => [Gem.dir, Gem.user_dir].join(File::PATH_SEPARATOR) }
|
1486
|
+
|
1487
|
+
gem "foo"
|
1488
|
+
|
1489
|
+
Gem.load_plugins
|
1490
|
+
|
1491
|
+
assert_equal %w[plugin], PLUGINS_LOADED
|
1492
|
+
ensure
|
1493
|
+
ENV["GEM_HOME"] = @orig_gem_home
|
1494
|
+
end
|
1495
|
+
|
1508
1496
|
def test_load_env_plugins
|
1509
|
-
with_plugin(
|
1497
|
+
with_plugin("load") { Gem.load_env_plugins }
|
1510
1498
|
assert_equal :loaded, TEST_PLUGIN_LOAD rescue nil
|
1511
1499
|
|
1512
1500
|
util_remove_interrupt_command
|
1513
1501
|
|
1514
1502
|
# Should attempt to cause a StandardError
|
1515
|
-
with_plugin(
|
1503
|
+
with_plugin("standarderror") { Gem.load_env_plugins }
|
1516
1504
|
assert_equal :loaded, TEST_PLUGIN_STANDARDERROR rescue nil
|
1517
1505
|
|
1518
1506
|
util_remove_interrupt_command
|
1519
1507
|
|
1520
1508
|
# Should attempt to cause an Exception
|
1521
|
-
with_plugin(
|
1509
|
+
with_plugin("exception") { Gem.load_env_plugins }
|
1522
1510
|
assert_equal :loaded, TEST_PLUGIN_EXCEPTION rescue nil
|
1523
1511
|
end
|
1524
1512
|
|
1525
1513
|
def test_gem_path_ordering
|
1526
1514
|
refute_equal Gem.dir, Gem.user_dir
|
1527
1515
|
|
1528
|
-
write_file File.join(@tempdir,
|
1529
|
-
write_file File.join(@tempdir,
|
1516
|
+
write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
|
1517
|
+
write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
|
1530
1518
|
|
1531
|
-
g = util_spec
|
1532
|
-
m = util_spec
|
1519
|
+
g = util_spec "g", "1", nil, "lib/g.rb"
|
1520
|
+
m = util_spec "m", "1", nil, "lib/m.rb"
|
1533
1521
|
|
1534
1522
|
install_gem g, :install_dir => Gem.dir
|
1535
1523
|
m0 = install_gem m, :install_dir => Gem.dir
|
@@ -1540,7 +1528,7 @@ class TestGem < Gem::TestCase
|
|
1540
1528
|
|
1541
1529
|
tests = [
|
1542
1530
|
[:dir0, [ Gem.dir, Gem.user_dir], m0],
|
1543
|
-
[:dir1, [ Gem.user_dir, Gem.dir], m1]
|
1531
|
+
[:dir1, [ Gem.user_dir, Gem.dir], m1],
|
1544
1532
|
]
|
1545
1533
|
|
1546
1534
|
tests.each do |_name, _paths, expected|
|
@@ -1548,15 +1536,15 @@ class TestGem < Gem::TestCase
|
|
1548
1536
|
Gem::Specification.reset
|
1549
1537
|
Gem.searcher = nil
|
1550
1538
|
|
1551
|
-
assert_equal Gem::Dependency.new(
|
1552
|
-
Gem::Dependency.new(
|
1539
|
+
assert_equal Gem::Dependency.new("m","1").to_specs,
|
1540
|
+
Gem::Dependency.new("m","1").to_specs.sort
|
1553
1541
|
|
1554
1542
|
assert_equal \
|
1555
1543
|
[expected.gem_dir],
|
1556
|
-
Gem::Dependency.new(
|
1544
|
+
Gem::Dependency.new("m","1").to_specs.map(&:gem_dir).sort,
|
1557
1545
|
"Wrong specs for #{_name}"
|
1558
1546
|
|
1559
|
-
spec = Gem::Dependency.new(
|
1547
|
+
spec = Gem::Dependency.new("m","1").to_spec
|
1560
1548
|
|
1561
1549
|
assert_equal \
|
1562
1550
|
File.join(_paths.first, "gems", "m-1"),
|
@@ -1566,7 +1554,7 @@ class TestGem < Gem::TestCase
|
|
1566
1554
|
|
1567
1555
|
gem "m"
|
1568
1556
|
|
1569
|
-
spec = Gem::Dependency.new(
|
1557
|
+
spec = Gem::Dependency.new("m","1").to_spec
|
1570
1558
|
assert spec.activated?, "dependency not activated for #{_name}"
|
1571
1559
|
|
1572
1560
|
assert_equal \
|
@@ -1581,11 +1569,11 @@ class TestGem < Gem::TestCase
|
|
1581
1569
|
end
|
1582
1570
|
|
1583
1571
|
def test_gem_path_ordering_short
|
1584
|
-
write_file File.join(@tempdir,
|
1585
|
-
write_file File.join(@tempdir,
|
1572
|
+
write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
|
1573
|
+
write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
|
1586
1574
|
|
1587
|
-
g = util_spec
|
1588
|
-
m = util_spec
|
1575
|
+
g = util_spec "g", "1", nil, "lib/g.rb"
|
1576
|
+
m = util_spec "m", "1", nil, "lib/m.rb"
|
1589
1577
|
|
1590
1578
|
install_gem g, :install_dir => Gem.dir
|
1591
1579
|
install_gem m, :install_dir => Gem.dir
|
@@ -1595,139 +1583,10 @@ class TestGem < Gem::TestCase
|
|
1595
1583
|
|
1596
1584
|
assert_equal \
|
1597
1585
|
File.join(Gem.dir, "gems", "m-1"),
|
1598
|
-
Gem::Dependency.new(
|
1586
|
+
Gem::Dependency.new("m","1").to_spec.gem_dir,
|
1599
1587
|
"Wrong spec selected"
|
1600
1588
|
end
|
1601
1589
|
|
1602
|
-
def test_auto_activation_of_specific_gemdeps_file
|
1603
|
-
a = util_spec "a", "1", nil, "lib/a.rb"
|
1604
|
-
b = util_spec "b", "1", nil, "lib/b.rb"
|
1605
|
-
c = util_spec "c", "1", nil, "lib/c.rb"
|
1606
|
-
|
1607
|
-
install_specs a, b, c
|
1608
|
-
|
1609
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1610
|
-
|
1611
|
-
File.open path, "w" do |f|
|
1612
|
-
f.puts "gem 'a'"
|
1613
|
-
f.puts "gem 'b'"
|
1614
|
-
f.puts "gem 'c'"
|
1615
|
-
end
|
1616
|
-
|
1617
|
-
ENV['RUBYGEMS_GEMDEPS'] = path
|
1618
|
-
|
1619
|
-
Gem.use_gemdeps
|
1620
|
-
|
1621
|
-
assert_equal add_bundler_full_name(%W(a-1 b-1 c-1)), loaded_spec_names
|
1622
|
-
end
|
1623
|
-
|
1624
|
-
def test_auto_activation_of_used_gemdeps_file
|
1625
|
-
a = util_spec "a", "1", nil, "lib/a.rb"
|
1626
|
-
b = util_spec "b", "1", nil, "lib/b.rb"
|
1627
|
-
c = util_spec "c", "1", nil, "lib/c.rb"
|
1628
|
-
|
1629
|
-
install_specs a, b, c
|
1630
|
-
|
1631
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1632
|
-
|
1633
|
-
File.open path, "w" do |f|
|
1634
|
-
f.puts "gem 'a'"
|
1635
|
-
f.puts "gem 'b'"
|
1636
|
-
f.puts "gem 'c'"
|
1637
|
-
end
|
1638
|
-
|
1639
|
-
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
1640
|
-
|
1641
|
-
expected_specs = [a, b, util_spec("bundler", Bundler::VERSION), c].compact
|
1642
|
-
assert_equal expected_specs, Gem.use_gemdeps.sort_by { |s| s.name }
|
1643
|
-
end
|
1644
|
-
|
1645
|
-
LIB_PATH = File.expand_path "../../../lib".dup.tap(&Gem::UNTAINT), __FILE__.dup.tap(&Gem::UNTAINT)
|
1646
|
-
BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }.dup.tap(&Gem::UNTAINT)
|
1647
|
-
BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}".freeze
|
1648
|
-
|
1649
|
-
def add_bundler_full_name(names)
|
1650
|
-
names << BUNDLER_FULL_NAME
|
1651
|
-
names.sort!
|
1652
|
-
names
|
1653
|
-
end
|
1654
|
-
|
1655
|
-
def test_looks_for_gemdeps_files_automatically_on_start
|
1656
|
-
skip "Requiring bundler messes things up" if Gem.java_platform?
|
1657
|
-
|
1658
|
-
a = util_spec "a", "1", nil, "lib/a.rb"
|
1659
|
-
b = util_spec "b", "1", nil, "lib/b.rb"
|
1660
|
-
c = util_spec "c", "1", nil, "lib/c.rb"
|
1661
|
-
|
1662
|
-
install_specs a, b, c
|
1663
|
-
|
1664
|
-
path = File.join(@tempdir, "gd-tmp")
|
1665
|
-
install_gem a, :install_dir => path
|
1666
|
-
install_gem b, :install_dir => path
|
1667
|
-
install_gem c, :install_dir => path
|
1668
|
-
|
1669
|
-
ENV['GEM_PATH'] = path
|
1670
|
-
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
1671
|
-
|
1672
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1673
|
-
cmd = [Gem.ruby.dup.tap(&Gem::UNTAINT), "-I#{LIB_PATH.tap(&Gem::UNTAINT)}",
|
1674
|
-
"-I#{BUNDLER_LIB_PATH.tap(&Gem::UNTAINT)}", "-rrubygems"]
|
1675
|
-
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1676
|
-
|
1677
|
-
File.open path, "w" do |f|
|
1678
|
-
f.puts "gem 'a'"
|
1679
|
-
end
|
1680
|
-
out0 = IO.popen(cmd, &:read).split(/\n/)
|
1681
|
-
|
1682
|
-
File.open path, "a" do |f|
|
1683
|
-
f.puts "gem 'b'"
|
1684
|
-
f.puts "gem 'c'"
|
1685
|
-
end
|
1686
|
-
out = IO.popen(cmd, &:read).split(/\n/)
|
1687
|
-
|
1688
|
-
assert_equal ["b-1", "c-1"], out - out0
|
1689
|
-
end
|
1690
|
-
|
1691
|
-
def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
|
1692
|
-
skip "Requiring bundler messes things up" if Gem.java_platform?
|
1693
|
-
|
1694
|
-
a = util_spec "a", "1", nil, "lib/a.rb"
|
1695
|
-
b = util_spec "b", "1", nil, "lib/b.rb"
|
1696
|
-
c = util_spec "c", "1", nil, "lib/c.rb"
|
1697
|
-
|
1698
|
-
install_specs a, b, c
|
1699
|
-
|
1700
|
-
path = File.join(@tempdir, "gd-tmp")
|
1701
|
-
install_gem a, :install_dir => path
|
1702
|
-
install_gem b, :install_dir => path
|
1703
|
-
install_gem c, :install_dir => path
|
1704
|
-
|
1705
|
-
ENV['GEM_PATH'] = path
|
1706
|
-
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
1707
|
-
|
1708
|
-
Dir.mkdir "sub1"
|
1709
|
-
|
1710
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1711
|
-
cmd = [Gem.ruby.dup.tap(&Gem::UNTAINT), "-Csub1", "-I#{LIB_PATH.tap(&Gem::UNTAINT)}",
|
1712
|
-
"-I#{BUNDLER_LIB_PATH.tap(&Gem::UNTAINT)}", "-rrubygems"]
|
1713
|
-
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1714
|
-
|
1715
|
-
File.open path, "w" do |f|
|
1716
|
-
f.puts "gem 'a'"
|
1717
|
-
end
|
1718
|
-
out0 = IO.popen(cmd, &:read).split(/\n/)
|
1719
|
-
|
1720
|
-
File.open path, "a" do |f|
|
1721
|
-
f.puts "gem 'b'"
|
1722
|
-
f.puts "gem 'c'"
|
1723
|
-
end
|
1724
|
-
out = IO.popen(cmd, &:read).split(/\n/)
|
1725
|
-
|
1726
|
-
Dir.rmdir "sub1"
|
1727
|
-
|
1728
|
-
assert_equal ["b-1", "c-1"], out - out0
|
1729
|
-
end
|
1730
|
-
|
1731
1590
|
def test_register_default_spec
|
1732
1591
|
Gem.clear_default_specs
|
1733
1592
|
|
@@ -1768,164 +1627,6 @@ class TestGem < Gem::TestCase
|
|
1768
1627
|
assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
|
1769
1628
|
end
|
1770
1629
|
|
1771
|
-
def test_use_gemdeps
|
1772
|
-
gem_deps_file = 'gem.deps.rb'.tap(&Gem::UNTAINT)
|
1773
|
-
spec = util_spec 'a', 1
|
1774
|
-
install_specs spec
|
1775
|
-
|
1776
|
-
spec = Gem::Specification.find { |s| s == spec }
|
1777
|
-
refute spec.activated?
|
1778
|
-
|
1779
|
-
File.open gem_deps_file, 'w' do |io|
|
1780
|
-
io.write 'gem "a"'
|
1781
|
-
end
|
1782
|
-
|
1783
|
-
assert_nil Gem.gemdeps
|
1784
|
-
|
1785
|
-
Gem.use_gemdeps gem_deps_file
|
1786
|
-
|
1787
|
-
assert_equal add_bundler_full_name(%W(a-1)), loaded_spec_names
|
1788
|
-
refute_nil Gem.gemdeps
|
1789
|
-
end
|
1790
|
-
|
1791
|
-
def test_use_gemdeps_ENV
|
1792
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
|
1793
|
-
|
1794
|
-
spec = util_spec 'a', 1
|
1795
|
-
|
1796
|
-
refute spec.activated?
|
1797
|
-
|
1798
|
-
File.open 'gem.deps.rb', 'w' do |io|
|
1799
|
-
io.write 'gem "a"'
|
1800
|
-
end
|
1801
|
-
|
1802
|
-
Gem.use_gemdeps
|
1803
|
-
|
1804
|
-
refute spec.activated?
|
1805
|
-
ensure
|
1806
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1807
|
-
end
|
1808
|
-
|
1809
|
-
def test_use_gemdeps_argument_missing
|
1810
|
-
e = assert_raises ArgumentError do
|
1811
|
-
Gem.use_gemdeps 'gem.deps.rb'
|
1812
|
-
end
|
1813
|
-
|
1814
|
-
assert_equal 'Unable to find gem dependencies file at gem.deps.rb',
|
1815
|
-
e.message
|
1816
|
-
end
|
1817
|
-
|
1818
|
-
def test_use_gemdeps_argument_missing_match_ENV
|
1819
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] =
|
1820
|
-
ENV['RUBYGEMS_GEMDEPS'], 'gem.deps.rb'
|
1821
|
-
|
1822
|
-
e = assert_raises ArgumentError do
|
1823
|
-
Gem.use_gemdeps 'gem.deps.rb'
|
1824
|
-
end
|
1825
|
-
|
1826
|
-
assert_equal 'Unable to find gem dependencies file at gem.deps.rb',
|
1827
|
-
e.message
|
1828
|
-
ensure
|
1829
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1830
|
-
end
|
1831
|
-
|
1832
|
-
def test_use_gemdeps_automatic
|
1833
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
|
1834
|
-
|
1835
|
-
spec = util_spec 'a', 1
|
1836
|
-
install_specs spec
|
1837
|
-
spec = Gem::Specification.find { |s| s == spec }
|
1838
|
-
|
1839
|
-
refute spec.activated?
|
1840
|
-
|
1841
|
-
File.open 'Gemfile', 'w' do |io|
|
1842
|
-
io.write 'gem "a"'
|
1843
|
-
end
|
1844
|
-
|
1845
|
-
Gem.use_gemdeps
|
1846
|
-
|
1847
|
-
assert_equal add_bundler_full_name(%W(a-1)), loaded_spec_names
|
1848
|
-
ensure
|
1849
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1850
|
-
end
|
1851
|
-
|
1852
|
-
def test_use_gemdeps_automatic_missing
|
1853
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
|
1854
|
-
|
1855
|
-
Gem.use_gemdeps
|
1856
|
-
|
1857
|
-
assert true # count
|
1858
|
-
ensure
|
1859
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1860
|
-
end
|
1861
|
-
|
1862
|
-
def test_use_gemdeps_disabled
|
1863
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], ''
|
1864
|
-
|
1865
|
-
spec = util_spec 'a', 1
|
1866
|
-
|
1867
|
-
refute spec.activated?
|
1868
|
-
|
1869
|
-
File.open 'gem.deps.rb', 'w' do |io|
|
1870
|
-
io.write 'gem "a"'
|
1871
|
-
end
|
1872
|
-
|
1873
|
-
Gem.use_gemdeps
|
1874
|
-
|
1875
|
-
refute spec.activated?
|
1876
|
-
ensure
|
1877
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1878
|
-
end
|
1879
|
-
|
1880
|
-
def test_use_gemdeps_missing_gem
|
1881
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
|
1882
|
-
|
1883
|
-
File.open 'x', 'w' do |io|
|
1884
|
-
io.write 'gem "a"'
|
1885
|
-
end
|
1886
|
-
|
1887
|
-
platform = Bundler::GemHelpers.generic_local_platform
|
1888
|
-
if platform == Gem::Platform::RUBY
|
1889
|
-
platform = ''
|
1890
|
-
else
|
1891
|
-
platform = " #{platform}"
|
1892
|
-
end
|
1893
|
-
|
1894
|
-
expected = <<-EXPECTED
|
1895
|
-
Could not find gem 'a#{platform}' in any of the gem sources listed in your Gemfile.
|
1896
|
-
You may need to `gem install -g` to install missing gems
|
1897
|
-
|
1898
|
-
EXPECTED
|
1899
|
-
|
1900
|
-
Gem::Deprecate.skip_during do
|
1901
|
-
assert_output nil, expected do
|
1902
|
-
Gem.use_gemdeps
|
1903
|
-
end
|
1904
|
-
end
|
1905
|
-
ensure
|
1906
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1907
|
-
end
|
1908
|
-
|
1909
|
-
def test_use_gemdeps_specific
|
1910
|
-
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
|
1911
|
-
|
1912
|
-
spec = util_spec 'a', 1
|
1913
|
-
install_specs spec
|
1914
|
-
|
1915
|
-
spec = Gem::Specification.find { |s| s == spec }
|
1916
|
-
refute spec.activated?
|
1917
|
-
|
1918
|
-
File.open 'x', 'w' do |io|
|
1919
|
-
io.write 'gem "a"'
|
1920
|
-
end
|
1921
|
-
|
1922
|
-
Gem.use_gemdeps
|
1923
|
-
|
1924
|
-
assert_equal add_bundler_full_name(%W(a-1)), loaded_spec_names
|
1925
|
-
ensure
|
1926
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1927
|
-
end
|
1928
|
-
|
1929
1630
|
def test_operating_system_defaults
|
1930
1631
|
operating_system_defaults = Gem.operating_system_defaults
|
1931
1632
|
|
@@ -1943,8 +1644,8 @@ You may need to `gem install -g` to install missing gems
|
|
1943
1644
|
# Ensure that `Gem.source_date_epoch` is consistent even if
|
1944
1645
|
# $SOURCE_DATE_EPOCH has not been set.
|
1945
1646
|
def test_default_source_date_epoch_doesnt_change
|
1946
|
-
old_epoch = ENV[
|
1947
|
-
ENV[
|
1647
|
+
old_epoch = ENV["SOURCE_DATE_EPOCH"]
|
1648
|
+
ENV["SOURCE_DATE_EPOCH"] = nil
|
1948
1649
|
|
1949
1650
|
# Unfortunately, there is no real way to test this aside from waiting
|
1950
1651
|
# enough for `Time.now.to_i` to change -- which is a whole second.
|
@@ -1955,32 +1656,66 @@ You may need to `gem install -g` to install missing gems
|
|
1955
1656
|
b = Gem.source_date_epoch
|
1956
1657
|
assert_equal a, b
|
1957
1658
|
ensure
|
1958
|
-
ENV[
|
1659
|
+
ENV["SOURCE_DATE_EPOCH"] = old_epoch
|
1660
|
+
end
|
1661
|
+
|
1662
|
+
def test_data_home_default
|
1663
|
+
expected = File.join(@userhome, ".local", "share")
|
1664
|
+
assert_equal expected, Gem.data_home
|
1665
|
+
end
|
1666
|
+
|
1667
|
+
def test_data_home_from_env
|
1668
|
+
ENV["XDG_DATA_HOME"] = expected = "/test/data/home"
|
1669
|
+
assert_equal expected, Gem.data_home
|
1670
|
+
end
|
1671
|
+
|
1672
|
+
def test_state_home_default
|
1673
|
+
Gem.instance_variable_set :@state_home, nil
|
1674
|
+
Gem.data_home # memoize @data_home, to demonstrate GH-6418
|
1675
|
+
expected = File.join(@userhome, ".local", "state")
|
1676
|
+
assert_equal expected, Gem.state_home
|
1677
|
+
end
|
1678
|
+
|
1679
|
+
def test_state_home_from_env
|
1680
|
+
Gem.instance_variable_set :@state_home, nil
|
1681
|
+
Gem.data_home # memoize @data_home, to demonstrate GH-6418
|
1682
|
+
ENV["XDG_STATE_HOME"] = expected = "/test/state/home"
|
1683
|
+
assert_equal expected, Gem.state_home
|
1959
1684
|
end
|
1960
1685
|
|
1686
|
+
private
|
1687
|
+
|
1961
1688
|
def ruby_install_name(name)
|
1962
1689
|
with_clean_path_to_ruby do
|
1963
|
-
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG[
|
1964
|
-
RbConfig::CONFIG[
|
1690
|
+
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG["ruby_install_name"]
|
1691
|
+
RbConfig::CONFIG["ruby_install_name"] = name
|
1965
1692
|
|
1966
1693
|
begin
|
1967
1694
|
yield
|
1968
1695
|
ensure
|
1969
1696
|
if orig_RUBY_INSTALL_NAME
|
1970
|
-
RbConfig::CONFIG[
|
1697
|
+
RbConfig::CONFIG["ruby_install_name"] = orig_RUBY_INSTALL_NAME
|
1971
1698
|
else
|
1972
|
-
RbConfig::CONFIG.delete
|
1699
|
+
RbConfig::CONFIG.delete "ruby_install_name"
|
1973
1700
|
end
|
1974
1701
|
end
|
1975
1702
|
end
|
1976
1703
|
end
|
1977
1704
|
|
1978
|
-
def
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1705
|
+
def with_rb_config_ruby(path)
|
1706
|
+
rb_config_singleton_class = class << RbConfig; self; end
|
1707
|
+
orig_path = RbConfig.ruby
|
1708
|
+
|
1709
|
+
redefine_method(rb_config_singleton_class, :ruby, path)
|
1710
|
+
|
1711
|
+
yield
|
1712
|
+
ensure
|
1713
|
+
redefine_method(rb_config_singleton_class, :ruby, orig_path)
|
1714
|
+
end
|
1715
|
+
|
1716
|
+
def redefine_method(base, method, new_result)
|
1717
|
+
base.alias_method(method, method)
|
1718
|
+
base.define_method(method) { new_result }
|
1984
1719
|
end
|
1985
1720
|
|
1986
1721
|
def with_plugin(path)
|
@@ -1992,7 +1727,7 @@ You may need to `gem install -g` to install missing gems
|
|
1992
1727
|
refute_includes $LOAD_PATH, test_plugin_path
|
1993
1728
|
$LOAD_PATH.unshift test_plugin_path
|
1994
1729
|
|
1995
|
-
|
1730
|
+
capture_output do
|
1996
1731
|
yield
|
1997
1732
|
end
|
1998
1733
|
ensure
|
@@ -2011,12 +1746,12 @@ You may need to `gem install -g` to install missing gems
|
|
2011
1746
|
end
|
2012
1747
|
|
2013
1748
|
def util_exec_gem
|
2014
|
-
spec, _ = util_spec
|
2015
|
-
s.executables = [
|
1749
|
+
spec, _ = util_spec "a", "4" do |s|
|
1750
|
+
s.executables = ["exec", "abin"]
|
2016
1751
|
end
|
2017
1752
|
|
2018
|
-
@exec_path = File.join spec.full_gem_path, spec.bindir,
|
2019
|
-
@abin_path = File.join spec.full_gem_path, spec.bindir,
|
1753
|
+
@exec_path = File.join spec.full_gem_path, spec.bindir, "exec"
|
1754
|
+
@abin_path = File.join spec.full_gem_path, spec.bindir, "abin"
|
2020
1755
|
spec
|
2021
1756
|
end
|
2022
1757
|
|
@@ -2028,5 +1763,4 @@ You may need to `gem install -g` to install missing gems
|
|
2028
1763
|
def util_cache_dir
|
2029
1764
|
File.join Gem.dir, "cache"
|
2030
1765
|
end
|
2031
|
-
|
2032
1766
|
end
|