rubygems-update 3.0.6 → 3.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{History.txt → CHANGELOG.md} +1100 -436
- data/CODE_OF_CONDUCT.md +55 -19
- data/CONTRIBUTING.md +37 -10
- data/MAINTAINERS.txt +1 -6
- data/Manifest.txt +104 -64
- data/POLICIES.md +6 -12
- data/README.md +6 -6
- data/Rakefile +121 -111
- data/bin/gem +0 -6
- data/bin/update_rubygems +2 -2
- data/bundler/CHANGELOG.md +1788 -1251
- data/bundler/LICENSE.md +18 -19
- data/bundler/README.md +9 -10
- data/bundler/UPGRADING.md +215 -0
- data/bundler/bundler.gemspec +9 -26
- data/bundler/exe/bundle +22 -3
- data/bundler/lib/bundler.rb +233 -94
- data/bundler/lib/bundler/build_metadata.rb +5 -13
- data/bundler/lib/bundler/capistrano.rb +4 -4
- data/bundler/lib/bundler/cli.rb +221 -148
- data/bundler/lib/bundler/cli/add.rb +28 -16
- data/bundler/lib/bundler/cli/binstubs.rb +6 -2
- data/bundler/lib/bundler/cli/cache.rb +24 -17
- data/bundler/lib/bundler/cli/clean.rb +1 -1
- data/bundler/lib/bundler/cli/common.rb +25 -12
- data/bundler/lib/bundler/cli/config.rb +161 -86
- data/bundler/lib/bundler/cli/console.rb +1 -1
- data/bundler/lib/bundler/cli/doctor.rb +5 -5
- data/bundler/lib/bundler/cli/exec.rb +8 -20
- data/bundler/lib/bundler/cli/fund.rb +36 -0
- data/bundler/lib/bundler/cli/gem.rb +125 -32
- data/bundler/lib/bundler/cli/info.rb +29 -6
- data/bundler/lib/bundler/cli/init.rb +2 -2
- data/bundler/lib/bundler/cli/inject.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +27 -23
- data/bundler/lib/bundler/cli/issue.rb +5 -5
- data/bundler/lib/bundler/cli/list.rb +12 -10
- data/bundler/lib/bundler/cli/open.rb +10 -6
- data/bundler/lib/bundler/cli/outdated.rb +134 -109
- data/bundler/lib/bundler/cli/plugin.rb +19 -2
- data/bundler/lib/bundler/cli/pristine.rb +6 -1
- data/bundler/lib/bundler/cli/show.rb +2 -2
- data/bundler/lib/bundler/cli/update.rb +34 -12
- data/bundler/lib/bundler/compact_index_client.rb +26 -10
- data/bundler/lib/bundler/compact_index_client/cache.rb +6 -14
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +8 -20
- data/bundler/lib/bundler/current_ruby.rb +9 -7
- data/bundler/lib/bundler/definition.rb +133 -132
- data/bundler/lib/bundler/dep_proxy.rb +16 -9
- data/bundler/lib/bundler/dependency.rb +19 -14
- data/bundler/lib/bundler/deployment.rb +1 -1
- data/bundler/lib/bundler/dsl.rb +54 -71
- data/bundler/lib/bundler/endpoint_specification.rb +1 -1
- data/bundler/lib/bundler/env.rb +9 -14
- data/bundler/lib/bundler/environment_preserver.rb +26 -3
- data/bundler/lib/bundler/errors.rb +1 -0
- data/bundler/lib/bundler/feature_flag.rb +19 -34
- data/bundler/lib/bundler/fetcher.rb +19 -16
- data/bundler/lib/bundler/fetcher/base.rb +1 -1
- data/bundler/lib/bundler/fetcher/compact_index.rb +27 -13
- data/bundler/lib/bundler/fetcher/dependency.rb +1 -1
- data/bundler/lib/bundler/fetcher/downloader.rb +6 -3
- data/bundler/lib/bundler/fetcher/index.rb +8 -7
- data/bundler/lib/bundler/friendly_errors.rb +27 -19
- data/bundler/lib/bundler/gem_helper.rb +68 -37
- data/bundler/lib/bundler/gem_helpers.rb +38 -29
- data/bundler/lib/bundler/gem_tasks.rb +1 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +5 -5
- data/bundler/lib/bundler/graph.rb +3 -3
- data/bundler/lib/bundler/index.rb +12 -7
- data/bundler/lib/bundler/injector.rb +32 -12
- data/bundler/lib/bundler/inline.rb +41 -30
- data/bundler/lib/bundler/installer.rb +41 -60
- data/bundler/lib/bundler/installer/gem_installer.rb +8 -4
- data/bundler/lib/bundler/installer/parallel_installer.rb +20 -26
- data/bundler/lib/bundler/installer/standalone.rb +18 -4
- data/bundler/lib/bundler/lazy_specification.rb +41 -27
- data/bundler/lib/bundler/lockfile_generator.rb +1 -1
- data/bundler/lib/bundler/lockfile_parser.rb +16 -33
- data/bundler/lib/bundler/{ssl_certs → man}/.document +0 -0
- data/bundler/lib/bundler/man/bundle-add.1 +66 -0
- data/bundler/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +42 -0
- data/bundler/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
- data/bundler/lib/bundler/man/bundle-cache.1 +55 -0
- data/bundler/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +15 -15
- data/bundler/lib/bundler/man/bundle-check.1 +31 -0
- data/bundler/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-clean.1 +24 -0
- data/bundler/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-config.1 +488 -0
- data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +59 -67
- data/bundler/lib/bundler/man/bundle-doctor.1 +44 -0
- data/bundler/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-exec.1 +165 -0
- data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +102 -0
- data/bundler/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +30 -7
- data/bundler/lib/bundler/man/bundle-info.1 +20 -0
- data/bundler/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-init.1 +25 -0
- data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +33 -0
- data/bundler/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-install.1 +338 -0
- data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +34 -7
- data/bundler/lib/bundler/man/bundle-list.1 +50 -0
- data/bundler/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
- data/bundler/lib/bundler/man/bundle-lock.1 +84 -0
- data/bundler/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-open.1 +32 -0
- data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-outdated.1 +155 -0
- data/bundler/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-platform.1 +61 -0
- data/bundler/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-pristine.1 +34 -0
- data/bundler/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-remove.1 +31 -0
- data/bundler/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-show.1 +23 -0
- data/bundler/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-update.1 +394 -0
- data/bundler/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +3 -3
- data/bundler/lib/bundler/man/bundle-viz.1 +39 -0
- data/bundler/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle.1 +136 -0
- data/bundler/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +2 -2
- data/bundler/lib/bundler/man/gemfile.5 +686 -0
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +16 -20
- data/bundler/lib/bundler/man/index.txt +25 -0
- data/bundler/lib/bundler/match_platform.rb +1 -1
- data/bundler/lib/bundler/mirror.rb +5 -5
- data/bundler/lib/bundler/plugin.rb +75 -36
- data/bundler/lib/bundler/plugin/api.rb +1 -1
- data/bundler/lib/bundler/plugin/api/source.rb +12 -7
- data/bundler/lib/bundler/plugin/dsl.rb +1 -1
- data/bundler/lib/bundler/plugin/index.rb +24 -4
- data/bundler/lib/bundler/plugin/installer.rb +33 -22
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -1
- data/bundler/lib/bundler/plugin/source_list.rb +5 -1
- data/bundler/lib/bundler/psyched_yaml.rb +0 -15
- data/bundler/lib/bundler/remote_specification.rb +5 -4
- data/bundler/lib/bundler/resolver.rb +191 -87
- data/bundler/lib/bundler/resolver/spec_group.rb +76 -48
- data/bundler/lib/bundler/retry.rb +3 -3
- data/bundler/lib/bundler/ruby_version.rb +5 -20
- data/bundler/lib/bundler/rubygems_ext.rb +76 -72
- data/bundler/lib/bundler/rubygems_gem_installer.rb +47 -13
- data/bundler/lib/bundler/rubygems_integration.rb +159 -444
- data/bundler/lib/bundler/runtime.rb +6 -23
- data/bundler/lib/bundler/settings.rb +67 -93
- data/bundler/lib/bundler/setup.rb +11 -12
- data/bundler/lib/bundler/shared_helpers.rb +54 -80
- data/bundler/lib/bundler/similarity_detector.rb +3 -3
- data/bundler/lib/bundler/source.rb +12 -6
- data/bundler/lib/bundler/source/git.rb +47 -38
- data/bundler/lib/bundler/source/git/git_proxy.rb +101 -102
- data/bundler/lib/bundler/source/metadata.rb +7 -6
- data/bundler/lib/bundler/source/path.rb +20 -11
- data/bundler/lib/bundler/source/path/installer.rb +10 -10
- data/bundler/lib/bundler/source/rubygems.rb +56 -29
- data/bundler/lib/bundler/source/rubygems/remote.rb +3 -4
- data/bundler/lib/bundler/source_list.rb +32 -30
- data/bundler/lib/bundler/spec_set.rb +37 -25
- data/bundler/lib/bundler/stub_specification.rb +40 -34
- data/bundler/lib/bundler/templates/Executable.bundler +23 -14
- 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/Gemfile.tt +16 -2
- data/bundler/lib/bundler/templates/newgem/README.md.tt +7 -5
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +19 -5
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +18 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +18 -31
- data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +13 -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/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
- data/bundler/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -1
- data/bundler/lib/bundler/ui.rb +3 -3
- data/bundler/lib/bundler/ui/rg_proxy.rb +1 -1
- data/bundler/lib/bundler/ui/shell.rb +7 -11
- data/bundler/lib/bundler/uri_credentials_filter.rb +10 -4
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +36 -4
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -3
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +39 -11
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +4 -4
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +53 -51
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +16 -9
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +28 -13
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +20 -9
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +21 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +65 -8
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/bundler/lib/bundler/vendored_fileutils.rb +1 -6
- data/bundler/lib/bundler/vendored_molinillo.rb +1 -1
- data/bundler/lib/bundler/vendored_persistent.rb +7 -12
- data/bundler/lib/bundler/vendored_thor.rb +2 -2
- data/bundler/lib/bundler/vendored_tmpdir.rb +4 -0
- data/bundler/lib/bundler/vendored_uri.rb +4 -0
- data/bundler/lib/bundler/version.rb +1 -20
- data/bundler/lib/bundler/version_ranges.rb +51 -5
- data/bundler/lib/bundler/vlad.rb +2 -2
- data/bundler/lib/bundler/worker.rb +2 -4
- data/bundler/lib/bundler/yaml_serializer.rb +3 -4
- data/lib/rubygems.rb +198 -222
- data/lib/rubygems/available_set.rb +4 -5
- data/lib/rubygems/basic_specification.rb +32 -19
- data/lib/rubygems/bundler_version_finder.rb +19 -9
- data/lib/rubygems/command.rb +73 -21
- data/lib/rubygems/command_manager.rb +5 -12
- data/lib/rubygems/commands/build_command.rb +51 -18
- data/lib/rubygems/commands/cert_command.rb +2 -11
- data/lib/rubygems/commands/check_command.rb +0 -2
- data/lib/rubygems/commands/cleanup_command.rb +17 -13
- data/lib/rubygems/commands/contents_command.rb +7 -9
- data/lib/rubygems/commands/dependency_command.rb +9 -10
- data/lib/rubygems/commands/environment_command.rb +1 -6
- data/lib/rubygems/commands/fetch_command.rb +2 -4
- data/lib/rubygems/commands/generate_index_command.rb +3 -2
- data/lib/rubygems/commands/help_command.rb +4 -4
- data/lib/rubygems/commands/info_command.rb +9 -4
- data/lib/rubygems/commands/install_command.rb +12 -54
- data/lib/rubygems/commands/list_command.rb +8 -7
- data/lib/rubygems/commands/lock_command.rb +3 -5
- data/lib/rubygems/commands/mirror_command.rb +0 -1
- data/lib/rubygems/commands/open_command.rb +1 -4
- data/lib/rubygems/commands/outdated_command.rb +0 -1
- data/lib/rubygems/commands/owner_command.rb +10 -10
- data/lib/rubygems/commands/pristine_command.rb +13 -9
- data/lib/rubygems/commands/push_command.rb +12 -51
- data/lib/rubygems/commands/query_command.rb +14 -330
- data/lib/rubygems/commands/rdoc_command.rb +0 -1
- data/lib/rubygems/commands/search_command.rb +7 -7
- data/lib/rubygems/commands/server_command.rb +3 -1
- data/lib/rubygems/commands/setup_command.rb +143 -101
- data/lib/rubygems/commands/signin_command.rb +0 -1
- data/lib/rubygems/commands/signout_command.rb +0 -2
- data/lib/rubygems/commands/sources_command.rb +22 -6
- data/lib/rubygems/commands/specification_command.rb +8 -3
- data/lib/rubygems/commands/stale_command.rb +1 -1
- data/lib/rubygems/commands/uninstall_command.rb +2 -3
- data/lib/rubygems/commands/unpack_command.rb +3 -32
- data/lib/rubygems/commands/update_command.rb +73 -28
- data/lib/rubygems/commands/which_command.rb +0 -1
- data/lib/rubygems/commands/yank_command.rb +10 -7
- data/lib/rubygems/compatibility.rb +4 -4
- data/lib/rubygems/config_file.rb +48 -27
- data/lib/rubygems/core_ext/kernel_gem.rb +7 -6
- data/lib/rubygems/core_ext/kernel_require.rb +44 -6
- data/lib/rubygems/core_ext/kernel_warn.rb +22 -13
- data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
- data/lib/rubygems/defaults.rb +110 -23
- data/lib/rubygems/dependency.rb +28 -14
- data/lib/rubygems/dependency_installer.rb +11 -166
- data/lib/rubygems/dependency_list.rb +17 -18
- data/lib/rubygems/deprecate.rb +51 -6
- data/lib/rubygems/doctor.rb +4 -4
- data/lib/rubygems/errors.rb +5 -7
- data/lib/rubygems/exceptions.rb +2 -24
- data/lib/rubygems/ext.rb +6 -6
- data/lib/rubygems/ext/build_error.rb +2 -0
- data/lib/rubygems/ext/builder.rb +45 -82
- data/lib/rubygems/ext/cmake_builder.rb +6 -7
- data/lib/rubygems/ext/configure_builder.rb +5 -8
- data/lib/rubygems/ext/ext_conf_builder.rb +27 -23
- data/lib/rubygems/ext/rake_builder.rb +4 -6
- data/lib/rubygems/gem_runner.rb +3 -10
- data/lib/rubygems/gemcutter_utilities.rb +111 -37
- data/lib/rubygems/indexer.rb +9 -26
- data/lib/rubygems/install_update_options.rb +7 -7
- data/lib/rubygems/installer.rb +91 -98
- data/lib/rubygems/installer_test_case.rb +104 -42
- data/lib/rubygems/installer_uninstaller_utils.rb +29 -0
- data/lib/rubygems/local_remote_options.rb +1 -1
- data/lib/rubygems/mock_gem_ui.rb +1 -4
- data/lib/rubygems/name_tuple.rb +4 -7
- data/lib/rubygems/openssl.rb +7 -0
- data/lib/rubygems/package.rb +49 -32
- data/lib/rubygems/package/digest_io.rb +0 -2
- data/lib/rubygems/package/file_source.rb +0 -2
- data/lib/rubygems/package/io_source.rb +0 -2
- data/lib/rubygems/package/old.rb +1 -3
- data/lib/rubygems/package/tar_header.rb +4 -6
- data/lib/rubygems/package/tar_reader.rb +15 -12
- data/lib/rubygems/package/tar_reader/entry.rb +0 -3
- data/lib/rubygems/package/tar_test_case.rb +2 -4
- data/lib/rubygems/package/tar_writer.rb +6 -16
- data/lib/rubygems/package_task.rb +1 -7
- data/lib/rubygems/path_support.rb +2 -2
- data/lib/rubygems/platform.rb +22 -16
- data/lib/rubygems/query_utils.rb +353 -0
- data/lib/rubygems/rdoc.rb +0 -12
- data/lib/rubygems/remote_fetcher.rb +33 -59
- data/lib/rubygems/request.rb +11 -14
- data/lib/rubygems/request/connection_pools.rb +3 -7
- data/lib/rubygems/request/http_pool.rb +0 -1
- data/lib/rubygems/request_set.rb +10 -23
- data/lib/rubygems/request_set/gem_dependency_api.rb +9 -11
- data/lib/rubygems/request_set/lockfile.rb +13 -12
- data/lib/rubygems/request_set/lockfile/parser.rb +2 -2
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +1 -1
- data/lib/rubygems/requirement.rb +36 -35
- data/lib/rubygems/resolver.rb +20 -16
- data/lib/rubygems/resolver/activation_request.rb +27 -51
- data/lib/rubygems/resolver/api_set.rb +31 -24
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_specification.rb +24 -10
- data/lib/rubygems/resolver/best_set.rb +4 -6
- data/lib/rubygems/resolver/composed_set.rb +3 -5
- data/lib/rubygems/resolver/conflict.rb +2 -9
- data/lib/rubygems/resolver/current_set.rb +0 -2
- data/lib/rubygems/resolver/dependency_request.rb +1 -3
- data/lib/rubygems/resolver/git_set.rb +0 -2
- data/lib/rubygems/resolver/git_specification.rb +0 -2
- data/lib/rubygems/resolver/index_set.rb +1 -3
- data/lib/rubygems/resolver/index_specification.rb +32 -2
- data/lib/rubygems/resolver/installed_specification.rb +0 -2
- data/lib/rubygems/resolver/installer_set.rb +63 -16
- data/lib/rubygems/resolver/local_specification.rb +0 -2
- data/lib/rubygems/resolver/lock_set.rb +3 -5
- data/lib/rubygems/resolver/lock_specification.rb +2 -4
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- 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.rb +39 -6
- 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/errors.rb +76 -8
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +12 -0
- 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/requirement_list.rb +0 -1
- data/lib/rubygems/resolver/set.rb +0 -2
- data/lib/rubygems/resolver/source_set.rb +0 -2
- data/lib/rubygems/resolver/spec_specification.rb +14 -2
- data/lib/rubygems/resolver/specification.rb +13 -2
- data/lib/rubygems/resolver/vendor_set.rb +0 -2
- data/lib/rubygems/resolver/vendor_specification.rb +0 -2
- data/lib/rubygems/s3_uri_signer.rb +15 -13
- data/lib/rubygems/safe_yaml.rb +4 -4
- data/lib/rubygems/security.rb +27 -34
- data/lib/rubygems/security/policy.rb +4 -8
- data/lib/rubygems/security/signer.rb +8 -9
- data/lib/rubygems/security/trust_dir.rb +1 -3
- data/lib/rubygems/server.rb +20 -16
- data/lib/rubygems/source.rb +30 -13
- data/lib/rubygems/source/git.rb +7 -8
- data/lib/rubygems/source/installed.rb +0 -2
- data/lib/rubygems/source/local.rb +2 -4
- data/lib/rubygems/source/lock.rb +0 -2
- data/lib/rubygems/source/specific_file.rb +0 -2
- data/lib/rubygems/source/vendor.rb +0 -2
- data/lib/rubygems/source_list.rb +6 -6
- data/lib/rubygems/spec_fetcher.rb +22 -34
- data/lib/rubygems/specification.rb +207 -278
- data/lib/rubygems/specification_policy.rb +135 -57
- data/{bundler/lib/bundler/ssl_certs/index.rubygems.org → lib/rubygems/ssl_certs/rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +4 -5
- data/lib/rubygems/test_case.rb +221 -341
- data/lib/rubygems/test_utilities.rb +22 -18
- data/lib/rubygems/text.rb +2 -3
- data/lib/rubygems/uninstaller.rb +49 -30
- data/lib/rubygems/uri_formatter.rb +2 -4
- data/lib/rubygems/uri_parser.rb +34 -0
- data/lib/rubygems/uri_parsing.rb +23 -0
- data/lib/rubygems/user_interaction.rb +3 -20
- data/lib/rubygems/util.rb +20 -44
- data/lib/rubygems/util/licenses.rb +400 -400
- data/lib/rubygems/validator.rb +9 -31
- data/lib/rubygems/version.rb +29 -21
- data/lib/rubygems/version_option.rb +6 -0
- data/rubygems-update.gemspec +4 -11
- data/setup.rb +2 -7
- 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/rubygems/commands/crash_command.rb +0 -2
- data/test/rubygems/rubygems_plugin.rb +0 -2
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +12 -0
- data/test/rubygems/test_bundled_ca.rb +42 -45
- data/test/rubygems/test_config.rb +0 -2
- data/test/rubygems/test_deprecate.rb +41 -5
- data/test/rubygems/test_gem.rb +405 -236
- data/test/rubygems/test_gem_available_set.rb +5 -6
- data/test/rubygems/test_gem_bundler_version_finder.rb +20 -2
- data/test/rubygems/test_gem_command.rb +144 -9
- data/test/rubygems/test_gem_command_manager.rb +40 -17
- data/test/rubygems/test_gem_commands_build_command.rb +386 -13
- data/test/rubygems/test_gem_commands_cert_command.rb +18 -6
- data/test/rubygems/test_gem_commands_check_command.rb +0 -2
- data/test/rubygems/test_gem_commands_cleanup_command.rb +35 -10
- data/test/rubygems/test_gem_commands_contents_command.rb +50 -19
- data/test/rubygems/test_gem_commands_dependency_command.rb +1 -3
- data/test/rubygems/test_gem_commands_environment_command.rb +21 -33
- data/test/rubygems/test_gem_commands_fetch_command.rb +0 -2
- data/test/rubygems/test_gem_commands_generate_index_command.rb +32 -2
- data/test/rubygems/test_gem_commands_help_command.rb +16 -8
- data/test/rubygems/test_gem_commands_info_command.rb +6 -7
- data/test/rubygems/test_gem_commands_install_command.rb +368 -34
- data/test/rubygems/test_gem_commands_list_command.rb +0 -2
- data/test/rubygems/test_gem_commands_lock_command.rb +0 -2
- data/test/rubygems/test_gem_commands_mirror.rb +1 -2
- data/test/rubygems/test_gem_commands_open_command.rb +4 -6
- data/test/rubygems/test_gem_commands_outdated_command.rb +18 -1
- data/test/rubygems/test_gem_commands_owner_command.rb +62 -9
- data/test/rubygems/test_gem_commands_pristine_command.rb +148 -16
- data/test/rubygems/test_gem_commands_push_command.rb +94 -21
- data/test/rubygems/test_gem_commands_query_command.rb +35 -10
- data/test/rubygems/test_gem_commands_search_command.rb +0 -2
- data/test/rubygems/test_gem_commands_server_command.rb +6 -4
- data/test/rubygems/test_gem_commands_setup_command.rb +228 -128
- data/test/rubygems/test_gem_commands_signin_command.rb +36 -11
- data/test/rubygems/test_gem_commands_signout_command.rb +0 -7
- data/test/rubygems/test_gem_commands_sources_command.rb +193 -9
- data/test/rubygems/test_gem_commands_specification_command.rb +46 -20
- data/test/rubygems/test_gem_commands_stale_command.rb +0 -2
- data/test/rubygems/test_gem_commands_uninstall_command.rb +108 -52
- data/test/rubygems/test_gem_commands_unpack_command.rb +0 -2
- data/test/rubygems/test_gem_commands_update_command.rb +201 -29
- data/test/rubygems/test_gem_commands_which_command.rb +3 -5
- data/test/rubygems/test_gem_commands_yank_command.rb +86 -5
- data/test/rubygems/test_gem_config_file.rb +25 -13
- data/test/rubygems/test_gem_dependency.rb +6 -2
- data/test/rubygems/test_gem_dependency_installer.rb +169 -252
- data/test/rubygems/test_gem_dependency_list.rb +31 -26
- data/test/rubygems/test_gem_dependency_resolution_error.rb +1 -3
- data/test/rubygems/test_gem_doctor.rb +28 -2
- data/test/rubygems/test_gem_ext_builder.rb +51 -44
- data/test/rubygems/test_gem_ext_cmake_builder.rb +16 -23
- data/test/rubygems/test_gem_ext_configure_builder.rb +6 -14
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +21 -29
- data/test/rubygems/test_gem_ext_rake_builder.rb +39 -22
- data/test/rubygems/test_gem_gem_runner.rb +47 -2
- data/test/rubygems/test_gem_gemcutter_utilities.rb +16 -13
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -2
- data/test/rubygems/test_gem_indexer.rb +40 -55
- data/test/rubygems/test_gem_install_update_options.rb +45 -21
- data/test/rubygems/test_gem_installer.rb +661 -338
- data/test/rubygems/test_gem_local_remote_options.rb +0 -2
- data/test/rubygems/test_gem_name_tuple.rb +0 -2
- data/test/rubygems/test_gem_package.rb +132 -45
- data/test/rubygems/test_gem_package_old.rb +56 -55
- data/test/rubygems/test_gem_package_tar_header.rb +18 -1
- data/test/rubygems/test_gem_package_tar_reader.rb +0 -2
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +6 -7
- data/test/rubygems/test_gem_package_tar_writer.rb +20 -12
- data/test/rubygems/test_gem_package_task.rb +46 -13
- data/test/rubygems/test_gem_path_support.rb +17 -13
- data/test/rubygems/test_gem_platform.rb +74 -7
- data/test/rubygems/test_gem_rdoc.rb +0 -1
- data/test/rubygems/test_gem_remote_fetcher.rb +223 -209
- data/test/rubygems/test_gem_request.rb +30 -19
- data/test/rubygems/test_gem_request_connection_pools.rb +2 -2
- data/test/rubygems/test_gem_request_set.rb +104 -29
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +4 -6
- data/test/rubygems/test_gem_request_set_lockfile.rb +4 -5
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +9 -10
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +118 -118
- data/test/rubygems/test_gem_requirement.rb +50 -4
- data/test/rubygems/test_gem_resolver.rb +73 -31
- data/test/rubygems/test_gem_resolver_activation_request.rb +3 -34
- data/test/rubygems/test_gem_resolver_api_set.rb +60 -59
- data/test/rubygems/test_gem_resolver_api_specification.rb +3 -5
- data/test/rubygems/test_gem_resolver_best_set.rb +27 -6
- data/test/rubygems/test_gem_resolver_composed_set.rb +0 -2
- data/test/rubygems/test_gem_resolver_conflict.rb +1 -7
- data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -2
- data/test/rubygems/test_gem_resolver_git_set.rb +0 -2
- data/test/rubygems/test_gem_resolver_git_specification.rb +1 -2
- data/test/rubygems/test_gem_resolver_index_set.rb +2 -4
- data/test/rubygems/test_gem_resolver_index_specification.rb +7 -4
- data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -3
- data/test/rubygems/test_gem_resolver_installer_set.rb +10 -10
- data/test/rubygems/test_gem_resolver_local_specification.rb +0 -2
- data/test/rubygems/test_gem_resolver_lock_set.rb +3 -5
- data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -2
- data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -2
- data/test/rubygems/test_gem_resolver_specification.rb +0 -2
- data/test/rubygems/test_gem_resolver_vendor_set.rb +1 -3
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -2
- data/test/rubygems/test_gem_security.rb +27 -25
- data/test/rubygems/test_gem_security_policy.rb +7 -12
- data/test/rubygems/test_gem_security_signer.rb +11 -12
- data/test/rubygems/test_gem_security_trust_dir.rb +4 -6
- data/test/rubygems/test_gem_server.rb +13 -12
- data/test/rubygems/test_gem_silent_ui.rb +0 -1
- data/test/rubygems/test_gem_source.rb +32 -17
- data/test/rubygems/test_gem_source_fetch_problem.rb +0 -1
- data/test/rubygems/test_gem_source_git.rb +12 -18
- data/test/rubygems/test_gem_source_installed.rb +11 -13
- data/test/rubygems/test_gem_source_list.rb +1 -1
- data/test/rubygems/test_gem_source_local.rb +8 -9
- data/test/rubygems/test_gem_source_lock.rb +17 -19
- data/test/rubygems/test_gem_source_specific_file.rb +9 -10
- data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
- data/test/rubygems/test_gem_source_vendor.rb +7 -9
- data/test/rubygems/test_gem_spec_fetcher.rb +11 -4
- data/test/rubygems/test_gem_specification.rb +363 -245
- data/test/rubygems/test_gem_stream_ui.rb +3 -1
- data/test/rubygems/test_gem_stub_specification.rb +6 -7
- data/test/rubygems/test_gem_text.rb +1 -2
- data/test/rubygems/test_gem_uninstaller.rb +165 -22
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -2
- data/test/rubygems/test_gem_uri_formatter.rb +0 -2
- data/test/rubygems/test_gem_util.rb +17 -15
- data/test/rubygems/test_gem_validator.rb +4 -7
- data/test/rubygems/test_gem_version.rb +23 -10
- data/test/rubygems/test_gem_version_option.rb +1 -3
- data/test/rubygems/test_kernel.rb +25 -9
- data/test/rubygems/test_project_sanity.rb +20 -0
- data/test/rubygems/test_remote_fetch_error.rb +1 -2
- data/test/rubygems/test_require.rb +394 -56
- data/test/test_changelog_generator.rb +17 -0
- metadata +109 -155
- data/.rubocop.yml +0 -67
- data/.travis.yml +0 -38
- data/appveyor.yml +0 -43
- data/bundler/CODE_OF_CONDUCT.md +0 -42
- data/bundler/CONTRIBUTING.md +0 -17
- data/bundler/exe/bundle_ruby +0 -60
- data/bundler/lib/bundler/cli/package.rb +0 -49
- data/bundler/lib/bundler/compatibility_guard.rb +0 -14
- data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/lib/rubygems/source_local.rb +0 -7
- data/lib/rubygems/source_specific_file.rb +0 -6
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/ubygems.rb +0 -14
- data/util/CL2notes +0 -55
- data/util/ci +0 -82
- 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 -61
- data/util/patch_with_prs.rb +0 -77
- data/util/rubocop +0 -8
- data/util/update_bundled_ca_certificates.rb +0 -139
- data/util/update_changelog.rb +0 -67
data/test/rubygems/test_gem.rb
CHANGED
@@ -7,17 +7,11 @@ require 'pathname'
|
|
7
7
|
require 'tmpdir'
|
8
8
|
require 'rbconfig'
|
9
9
|
|
10
|
-
# TODO: push this up to test_case.rb once battle tested
|
11
|
-
|
12
|
-
$LOAD_PATH.map! do |path|
|
13
|
-
path.dup.untaint
|
14
|
-
end
|
15
|
-
|
16
10
|
class TestGem < Gem::TestCase
|
17
|
-
RUBY_INSTALL_NAME = RbConfig::CONFIG['RUBY_INSTALL_NAME']
|
18
|
-
|
19
11
|
PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
|
20
12
|
|
13
|
+
PROJECT_DIR = File.expand_path('../../..', __FILE__).tap(&Gem::UNTAINT)
|
14
|
+
|
21
15
|
def setup
|
22
16
|
super
|
23
17
|
|
@@ -26,7 +20,7 @@ class TestGem < Gem::TestCase
|
|
26
20
|
common_installer_setup
|
27
21
|
|
28
22
|
ENV.delete 'RUBYGEMS_GEMDEPS'
|
29
|
-
@additional = %w[a b].map {
|
23
|
+
@additional = %w[a b].map {|d| File.join @tempdir, d }
|
30
24
|
|
31
25
|
util_remove_interrupt_command
|
32
26
|
end
|
@@ -43,12 +37,12 @@ class TestGem < Gem::TestCase
|
|
43
37
|
|
44
38
|
a1.activate
|
45
39
|
|
46
|
-
assert_equal %w
|
40
|
+
assert_equal %w[a-1], loaded_spec_names
|
47
41
|
assert_equal ["b (> 0)"], unresolved_names
|
48
42
|
|
49
43
|
Gem.finish_resolve
|
50
44
|
|
51
|
-
assert_equal %w
|
45
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
52
46
|
assert_equal [], unresolved_names
|
53
47
|
end
|
54
48
|
end
|
@@ -67,12 +61,12 @@ class TestGem < Gem::TestCase
|
|
67
61
|
|
68
62
|
a1.activate
|
69
63
|
|
70
|
-
assert_equal %w
|
64
|
+
assert_equal %w[a-1], loaded_spec_names
|
71
65
|
assert_equal ["b (> 0)", "d (> 0)"], unresolved_names
|
72
66
|
|
73
67
|
Gem.finish_resolve
|
74
68
|
|
75
|
-
assert_equal %w
|
69
|
+
assert_equal %w[a-1 b-1 c-1 d-2], loaded_spec_names
|
76
70
|
assert_equal [], unresolved_names
|
77
71
|
end
|
78
72
|
end
|
@@ -90,12 +84,12 @@ class TestGem < Gem::TestCase
|
|
90
84
|
a1.activate
|
91
85
|
c1.activate
|
92
86
|
|
93
|
-
assert_equal %w
|
87
|
+
assert_equal %w[a-1 c-1], loaded_spec_names
|
94
88
|
assert_equal ["b (> 0)"], unresolved_names
|
95
89
|
|
96
90
|
Gem.finish_resolve
|
97
91
|
|
98
|
-
assert_equal %w
|
92
|
+
assert_equal %w[a-1 b-1 c-1], loaded_spec_names
|
99
93
|
assert_equal [], unresolved_names
|
100
94
|
end
|
101
95
|
end
|
@@ -110,7 +104,7 @@ class TestGem < Gem::TestCase
|
|
110
104
|
|
111
105
|
installed = Gem.install 'a', '= 1', :install_dir => gemhome2
|
112
106
|
|
113
|
-
assert_equal %w[a-1], installed.map {
|
107
|
+
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
|
114
108
|
|
115
109
|
assert_path_exists File.join(gemhome2, 'gems', 'a-1')
|
116
110
|
end
|
@@ -129,7 +123,7 @@ class TestGem < Gem::TestCase
|
|
129
123
|
rescue StandardError
|
130
124
|
Gem.install 'a', '= 1', :install_dir => gemhome2
|
131
125
|
end
|
132
|
-
assert_equal %w[a-1], installed.map {
|
126
|
+
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
|
133
127
|
end
|
134
128
|
|
135
129
|
def test_self_install_permissions
|
@@ -151,32 +145,40 @@ class TestGem < Gem::TestCase
|
|
151
145
|
end
|
152
146
|
|
153
147
|
def test_self_install_permissions_with_format_executable
|
154
|
-
|
155
|
-
assert_self_install_permissions
|
148
|
+
assert_self_install_permissions(format_executable: true)
|
156
149
|
end
|
157
150
|
|
158
|
-
def
|
151
|
+
def test_self_install_permissions_with_format_executable_and_non_standard_ruby_install_name
|
152
|
+
Gem::Installer.exec_format = nil
|
153
|
+
ruby_install_name 'ruby27' do
|
154
|
+
assert_self_install_permissions(format_executable: true)
|
155
|
+
end
|
156
|
+
ensure
|
157
|
+
Gem::Installer.exec_format = nil
|
158
|
+
end
|
159
|
+
|
160
|
+
def assert_self_install_permissions(format_executable: false)
|
159
161
|
mask = win_platform? ? 0700 : 0777
|
160
162
|
options = {
|
161
163
|
:dir_mode => 0500,
|
162
|
-
:prog_mode => 0510,
|
164
|
+
:prog_mode => win_platform? ? 0410 : 0510,
|
163
165
|
:data_mode => 0640,
|
164
166
|
:wrappers => true,
|
165
|
-
:format_executable =>
|
167
|
+
:format_executable => format_executable,
|
166
168
|
}
|
167
169
|
Dir.chdir @tempdir do
|
168
170
|
Dir.mkdir 'bin'
|
169
171
|
Dir.mkdir 'data'
|
170
172
|
|
171
|
-
File.write 'bin/foo
|
172
|
-
File.chmod 0755, 'bin/foo
|
173
|
+
File.write 'bin/foo', "#!/usr/bin/env ruby\n"
|
174
|
+
File.chmod 0755, 'bin/foo'
|
173
175
|
|
174
176
|
File.write 'data/foo.txt', "blah\n"
|
175
177
|
|
176
178
|
spec_fetcher do |f|
|
177
179
|
f.gem 'foo', 1 do |s|
|
178
|
-
s.executables = ['foo
|
179
|
-
s.files = %w[bin/foo
|
180
|
+
s.executables = ['foo']
|
181
|
+
s.files = %w[bin/foo data/foo.txt]
|
180
182
|
end
|
181
183
|
end
|
182
184
|
Gem.install 'foo', Gem::Requirement.default, options
|
@@ -185,19 +187,18 @@ class TestGem < Gem::TestCase
|
|
185
187
|
prog_mode = (options[:prog_mode] & mask).to_s(8)
|
186
188
|
dir_mode = (options[:dir_mode] & mask).to_s(8)
|
187
189
|
data_mode = (options[:data_mode] & mask).to_s(8)
|
188
|
-
prog_name = 'foo
|
189
|
-
prog_name =
|
190
|
+
prog_name = 'foo'
|
191
|
+
prog_name = RbConfig::CONFIG['ruby_install_name'].sub('ruby', 'foo') if options[:format_executable]
|
190
192
|
expected = {
|
191
193
|
"bin/#{prog_name}" => prog_mode,
|
192
194
|
'gems/foo-1' => dir_mode,
|
193
195
|
'gems/foo-1/bin' => dir_mode,
|
194
196
|
'gems/foo-1/data' => dir_mode,
|
195
|
-
'gems/foo-1/bin/foo
|
197
|
+
'gems/foo-1/bin/foo' => prog_mode,
|
196
198
|
'gems/foo-1/data/foo.txt' => data_mode,
|
197
199
|
}
|
198
|
-
#
|
199
|
-
|
200
|
-
sleep 0.2
|
200
|
+
# add Windows script
|
201
|
+
expected["bin/#{prog_name}.bat"] = mask.to_s(8) if win_platform?
|
201
202
|
result = {}
|
202
203
|
Dir.chdir @gemhome do
|
203
204
|
expected.each_key do |n|
|
@@ -206,13 +207,13 @@ class TestGem < Gem::TestCase
|
|
206
207
|
end
|
207
208
|
assert_equal(expected, result)
|
208
209
|
ensure
|
209
|
-
File.chmod(0755, *Dir.glob(@gemhome+'/gems/**/').map {|path| path.
|
210
|
+
File.chmod(0755, *Dir.glob(@gemhome + '/gems/**/').map {|path| path.tap(&Gem::UNTAINT) })
|
210
211
|
end
|
211
212
|
|
212
213
|
def test_require_missing
|
213
214
|
save_loaded_features do
|
214
215
|
assert_raises ::LoadError do
|
215
|
-
require "
|
216
|
+
require "test_require_missing"
|
216
217
|
end
|
217
218
|
end
|
218
219
|
end
|
@@ -259,6 +260,14 @@ class TestGem < Gem::TestCase
|
|
259
260
|
assert_match 'a-2/bin/exec', Gem.bin_path('a', 'exec', '>= 0')
|
260
261
|
end
|
261
262
|
|
263
|
+
def test_self_activate_bin_path_no_exec_name
|
264
|
+
e = assert_raises ArgumentError do
|
265
|
+
Gem.activate_bin_path 'a'
|
266
|
+
end
|
267
|
+
|
268
|
+
assert_equal 'you must supply exec_name', e.message
|
269
|
+
end
|
270
|
+
|
262
271
|
def test_activate_bin_path_resolves_eagerly
|
263
272
|
a1 = util_spec 'a', '1' do |s|
|
264
273
|
s.executables = ['exec']
|
@@ -285,7 +294,75 @@ class TestGem < Gem::TestCase
|
|
285
294
|
gem 'c'
|
286
295
|
Gem.finish_resolve
|
287
296
|
|
288
|
-
assert_equal %w
|
297
|
+
assert_equal %w[a-1 b-2 c-1], loaded_spec_names
|
298
|
+
end
|
299
|
+
|
300
|
+
def test_activate_bin_path_does_not_error_if_a_gem_thats_not_finally_activated_has_orphaned_dependencies
|
301
|
+
a1 = util_spec 'a', '1' do |s|
|
302
|
+
s.executables = ['exec']
|
303
|
+
s.add_dependency 'b'
|
304
|
+
end
|
305
|
+
|
306
|
+
b1 = util_spec 'b', '1' do |s|
|
307
|
+
s.add_dependency 'c', '1'
|
308
|
+
end
|
309
|
+
|
310
|
+
b2 = util_spec 'b', '2' do |s|
|
311
|
+
s.add_dependency 'c', '2'
|
312
|
+
end
|
313
|
+
|
314
|
+
c2 = util_spec 'c', '2'
|
315
|
+
|
316
|
+
install_specs c2, b1, b2, a1
|
317
|
+
|
318
|
+
# c1 is missing, but not needed for activation, so we should not get any errors here
|
319
|
+
|
320
|
+
Gem.activate_bin_path("a", "exec", ">= 0")
|
321
|
+
|
322
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
323
|
+
end
|
324
|
+
|
325
|
+
def test_activate_bin_path_raises_a_meaningful_error_if_a_gem_thats_finally_activated_has_orphaned_dependencies
|
326
|
+
a1 = util_spec 'a', '1' do |s|
|
327
|
+
s.executables = ['exec']
|
328
|
+
s.add_dependency 'b'
|
329
|
+
end
|
330
|
+
|
331
|
+
b1 = util_spec 'b', '1' do |s|
|
332
|
+
s.add_dependency 'c', '1'
|
333
|
+
end
|
334
|
+
|
335
|
+
b2 = util_spec 'b', '2' do |s|
|
336
|
+
s.add_dependency 'c', '2'
|
337
|
+
end
|
338
|
+
|
339
|
+
c1 = util_spec 'c', '1'
|
340
|
+
|
341
|
+
install_specs c1, b1, b2, a1
|
342
|
+
|
343
|
+
# c2 is missing, and b2 which has it as a dependency will be activated, so we should get an error about the orphaned dependency
|
344
|
+
|
345
|
+
e = assert_raises Gem::UnsatisfiableDependencyError do
|
346
|
+
load Gem.activate_bin_path("a", "exec", ">= 0")
|
347
|
+
end
|
348
|
+
|
349
|
+
assert_equal "Unable to resolve dependency: 'b (>= 0)' requires 'c (= 2)'", e.message
|
350
|
+
end
|
351
|
+
|
352
|
+
def test_activate_bin_path_in_debug_mode
|
353
|
+
a1 = util_spec 'a', '1' do |s|
|
354
|
+
s.executables = ['exec']
|
355
|
+
end
|
356
|
+
|
357
|
+
install_specs a1
|
358
|
+
|
359
|
+
require "open3"
|
360
|
+
output, status = Open3.capture2e(
|
361
|
+
{ "GEM_HOME" => Gem.paths.home, "DEBUG_RESOLVER" => "1" },
|
362
|
+
*ruby_with_rubygems_in_load_path, "-e", "\"Gem.activate_bin_path('a', 'exec', '>= 0')\""
|
363
|
+
)
|
364
|
+
|
365
|
+
assert status.success?, output
|
289
366
|
end
|
290
367
|
|
291
368
|
def test_activate_bin_path_gives_proper_error_for_bundler
|
@@ -311,7 +388,7 @@ class TestGem < Gem::TestCase
|
|
311
388
|
L
|
312
389
|
end
|
313
390
|
|
314
|
-
File.open("Gemfile", "w") {
|
391
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
315
392
|
|
316
393
|
e = assert_raises Gem::GemNotFoundException do
|
317
394
|
load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
|
@@ -323,6 +400,100 @@ class TestGem < Gem::TestCase
|
|
323
400
|
refute_includes e.message, "can't find gem bundler (>= 0.a) with executable bundle"
|
324
401
|
end
|
325
402
|
|
403
|
+
def test_activate_bin_path_selects_exact_bundler_version_if_present
|
404
|
+
bundler_latest = util_spec 'bundler', '2.0.1' do |s|
|
405
|
+
s.executables = ['bundle']
|
406
|
+
end
|
407
|
+
|
408
|
+
bundler_previous = util_spec 'bundler', '2.0.0' do |s|
|
409
|
+
s.executables = ['bundle']
|
410
|
+
end
|
411
|
+
|
412
|
+
install_specs bundler_latest, bundler_previous
|
413
|
+
|
414
|
+
File.open("Gemfile.lock", "w") do |f|
|
415
|
+
f.write <<-L.gsub(/ {8}/, "")
|
416
|
+
GEM
|
417
|
+
remote: https://rubygems.org/
|
418
|
+
specs:
|
419
|
+
|
420
|
+
PLATFORMS
|
421
|
+
ruby
|
422
|
+
|
423
|
+
DEPENDENCIES
|
424
|
+
|
425
|
+
BUNDLED WITH
|
426
|
+
2.0.0
|
427
|
+
L
|
428
|
+
end
|
429
|
+
|
430
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
431
|
+
|
432
|
+
load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
|
433
|
+
|
434
|
+
assert_equal %w[bundler-2.0.0], loaded_spec_names
|
435
|
+
end
|
436
|
+
|
437
|
+
def test_activate_bin_path_respects_underscore_selection_if_given
|
438
|
+
bundler_latest = util_spec 'bundler', '2.0.1' do |s|
|
439
|
+
s.executables = ['bundle']
|
440
|
+
end
|
441
|
+
|
442
|
+
bundler_previous = util_spec 'bundler', '1.17.3' do |s|
|
443
|
+
s.executables = ['bundle']
|
444
|
+
end
|
445
|
+
|
446
|
+
install_specs bundler_latest, bundler_previous
|
447
|
+
|
448
|
+
File.open("Gemfile.lock", "w") do |f|
|
449
|
+
f.write <<-L.gsub(/ {8}/, "")
|
450
|
+
GEM
|
451
|
+
remote: https://rubygems.org/
|
452
|
+
specs:
|
453
|
+
|
454
|
+
PLATFORMS
|
455
|
+
ruby
|
456
|
+
|
457
|
+
DEPENDENCIES
|
458
|
+
|
459
|
+
BUNDLED WITH
|
460
|
+
2.0.1
|
461
|
+
L
|
462
|
+
end
|
463
|
+
|
464
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
465
|
+
|
466
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 1.17.3")
|
467
|
+
|
468
|
+
assert_equal %w[bundler-1.17.3], loaded_spec_names
|
469
|
+
end
|
470
|
+
|
471
|
+
def test_activate_bin_path_gives_proper_error_for_bundler_when_underscore_selection_given
|
472
|
+
File.open("Gemfile.lock", "w") do |f|
|
473
|
+
f.write <<-L.gsub(/ {8}/, "")
|
474
|
+
GEM
|
475
|
+
remote: https://rubygems.org/
|
476
|
+
specs:
|
477
|
+
|
478
|
+
PLATFORMS
|
479
|
+
ruby
|
480
|
+
|
481
|
+
DEPENDENCIES
|
482
|
+
|
483
|
+
BUNDLED WITH
|
484
|
+
2.1.4
|
485
|
+
L
|
486
|
+
end
|
487
|
+
|
488
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
489
|
+
|
490
|
+
e = assert_raises Gem::GemNotFoundException do
|
491
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 2.2.8")
|
492
|
+
end
|
493
|
+
|
494
|
+
assert_equal "can't find gem bundler (= 2.2.8) with executable bundle", e.message
|
495
|
+
end
|
496
|
+
|
326
497
|
def test_self_bin_path_no_exec_name
|
327
498
|
e = assert_raises ArgumentError do
|
328
499
|
Gem.bin_path 'a'
|
@@ -410,7 +581,10 @@ class TestGem < Gem::TestCase
|
|
410
581
|
fp.puts 'blah'
|
411
582
|
end
|
412
583
|
|
413
|
-
foo = util_spec 'foo' do |s|
|
584
|
+
foo = util_spec 'foo' do |s|
|
585
|
+
s.files = %w[data/foo.txt]
|
586
|
+
end
|
587
|
+
|
414
588
|
install_gem foo
|
415
589
|
end
|
416
590
|
|
@@ -446,55 +620,43 @@ class TestGem < Gem::TestCase
|
|
446
620
|
end
|
447
621
|
|
448
622
|
def test_default_path
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
FileUtils.rm_rf Gem.user_home
|
623
|
+
vendordir(File.join(@tempdir, 'vendor')) do
|
624
|
+
FileUtils.rm_rf Gem.user_home
|
453
625
|
|
454
|
-
|
626
|
+
expected = [Gem.default_dir]
|
455
627
|
|
456
|
-
|
457
|
-
|
458
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
628
|
+
assert_equal expected, Gem.default_path
|
629
|
+
end
|
459
630
|
end
|
460
631
|
|
461
632
|
def test_default_path_missing_vendor
|
462
|
-
|
463
|
-
|
633
|
+
vendordir(nil) do
|
634
|
+
FileUtils.rm_rf Gem.user_home
|
464
635
|
|
465
|
-
|
636
|
+
expected = [Gem.default_dir]
|
466
637
|
|
467
|
-
|
468
|
-
|
469
|
-
assert_equal expected, Gem.default_path
|
470
|
-
ensure
|
471
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
638
|
+
assert_equal expected, Gem.default_path
|
639
|
+
end
|
472
640
|
end
|
473
641
|
|
474
642
|
def test_default_path_user_home
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
expected = [Gem.user_dir, Gem.default_dir]
|
643
|
+
vendordir(File.join(@tempdir, 'vendor')) do
|
644
|
+
expected = [Gem.user_dir, Gem.default_dir]
|
479
645
|
|
480
|
-
|
481
|
-
|
482
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
646
|
+
assert_equal expected, Gem.default_path
|
647
|
+
end
|
483
648
|
end
|
484
649
|
|
485
650
|
def test_default_path_vendor_dir
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
FileUtils.mkdir_p Gem.vendor_dir
|
651
|
+
vendordir(File.join(@tempdir, 'vendor')) do
|
652
|
+
FileUtils.mkdir_p Gem.vendor_dir
|
490
653
|
|
491
|
-
|
654
|
+
FileUtils.rm_rf Gem.user_home
|
492
655
|
|
493
|
-
|
656
|
+
expected = [Gem.default_dir, Gem.vendor_dir]
|
494
657
|
|
495
|
-
|
496
|
-
|
497
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
658
|
+
assert_equal expected, Gem.default_path
|
659
|
+
end
|
498
660
|
end
|
499
661
|
|
500
662
|
def test_self_default_sources
|
@@ -576,7 +738,7 @@ class TestGem < Gem::TestCase
|
|
576
738
|
assert_directory_exists util_cache_dir
|
577
739
|
end
|
578
740
|
|
579
|
-
unless win_platform? || Process.uid.zero?
|
741
|
+
unless win_platform? || Process.uid.zero? # only for FS that support write protection
|
580
742
|
def test_self_ensure_gem_directories_write_protected
|
581
743
|
gemdir = File.join @tempdir, "egd"
|
582
744
|
FileUtils.rm_r gemdir rescue nil
|
@@ -608,6 +770,11 @@ class TestGem < Gem::TestCase
|
|
608
770
|
ensure
|
609
771
|
FileUtils.chmod 0600, parent
|
610
772
|
end
|
773
|
+
|
774
|
+
def test_self_ensure_gem_directories_non_existent_paths
|
775
|
+
Gem.ensure_gem_subdirectories '/proc/0123456789/bogus' # should not raise
|
776
|
+
Gem.ensure_gem_subdirectories 'classpath:/bogus/x' # JRuby embed scenario
|
777
|
+
end
|
611
778
|
end
|
612
779
|
|
613
780
|
def test_self_extension_dir_shared
|
@@ -623,12 +790,12 @@ class TestGem < Gem::TestCase
|
|
623
790
|
end
|
624
791
|
|
625
792
|
def test_self_find_files
|
626
|
-
cwd = File.expand_path("test/rubygems",
|
793
|
+
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
627
794
|
$LOAD_PATH.unshift cwd
|
628
795
|
|
629
796
|
discover_path = File.join 'lib', 'sff', 'discover.rb'
|
630
797
|
|
631
|
-
foo1, foo2 = %w
|
798
|
+
foo1, foo2 = %w[1 2].map do |version|
|
632
799
|
spec = quick_gem 'sff', version do |s|
|
633
800
|
s.files << discover_path
|
634
801
|
end
|
@@ -638,12 +805,12 @@ class TestGem < Gem::TestCase
|
|
638
805
|
end
|
639
806
|
|
640
807
|
spec
|
641
|
-
|
808
|
+
end
|
642
809
|
|
643
810
|
Gem.refresh
|
644
811
|
|
645
812
|
expected = [
|
646
|
-
File.expand_path('test/rubygems/sff/discover.rb',
|
813
|
+
File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
|
647
814
|
File.join(foo2.full_gem_path, discover_path),
|
648
815
|
File.join(foo1.full_gem_path, discover_path),
|
649
816
|
]
|
@@ -655,12 +822,12 @@ class TestGem < Gem::TestCase
|
|
655
822
|
end
|
656
823
|
|
657
824
|
def test_self_find_files_with_gemfile
|
658
|
-
cwd = File.expand_path("test/rubygems",
|
825
|
+
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
659
826
|
actual_load_path = $LOAD_PATH.unshift(cwd).dup
|
660
827
|
|
661
828
|
discover_path = File.join 'lib', 'sff', 'discover.rb'
|
662
829
|
|
663
|
-
foo1, _ = %w
|
830
|
+
foo1, _ = %w[1 2].map do |version|
|
664
831
|
spec = quick_gem 'sff', version do |s|
|
665
832
|
s.files << discover_path
|
666
833
|
end
|
@@ -670,7 +837,7 @@ class TestGem < Gem::TestCase
|
|
670
837
|
end
|
671
838
|
|
672
839
|
spec
|
673
|
-
|
840
|
+
end
|
674
841
|
Gem.refresh
|
675
842
|
|
676
843
|
write_file(File.join Dir.pwd, 'Gemfile') do |fp|
|
@@ -680,23 +847,23 @@ class TestGem < Gem::TestCase
|
|
680
847
|
Gem.use_gemdeps(File.join Dir.pwd, 'Gemfile')
|
681
848
|
|
682
849
|
expected = [
|
683
|
-
File.expand_path('test/rubygems/sff/discover.rb',
|
684
|
-
File.join(foo1.full_gem_path, discover_path)
|
850
|
+
File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
|
851
|
+
File.join(foo1.full_gem_path, discover_path),
|
685
852
|
].sort
|
686
853
|
|
687
854
|
assert_equal expected, Gem.find_files('sff/discover').sort
|
688
855
|
assert_equal expected, Gem.find_files('sff/**.rb').sort, '[ruby-core:31730]'
|
689
856
|
ensure
|
690
|
-
assert_equal cwd, actual_load_path.shift
|
857
|
+
assert_equal cwd, actual_load_path.shift unless Gem.java_platform?
|
691
858
|
end
|
692
859
|
|
693
860
|
def test_self_find_latest_files
|
694
|
-
cwd = File.expand_path("test/rubygems",
|
861
|
+
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
695
862
|
$LOAD_PATH.unshift cwd
|
696
863
|
|
697
864
|
discover_path = File.join 'lib', 'sff', 'discover.rb'
|
698
865
|
|
699
|
-
_, foo2 = %w
|
866
|
+
_, foo2 = %w[1 2].map do |version|
|
700
867
|
spec = quick_gem 'sff', version do |s|
|
701
868
|
s.files << discover_path
|
702
869
|
end
|
@@ -706,12 +873,12 @@ class TestGem < Gem::TestCase
|
|
706
873
|
end
|
707
874
|
|
708
875
|
spec
|
709
|
-
|
876
|
+
end
|
710
877
|
|
711
878
|
Gem.refresh
|
712
879
|
|
713
880
|
expected = [
|
714
|
-
File.expand_path('test/rubygems/sff/discover.rb',
|
881
|
+
File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
|
715
882
|
File.join(foo2.full_gem_path, discover_path),
|
716
883
|
]
|
717
884
|
|
@@ -863,12 +1030,12 @@ class TestGem < Gem::TestCase
|
|
863
1030
|
end
|
864
1031
|
|
865
1032
|
def test_self_prefix
|
866
|
-
assert_equal
|
1033
|
+
assert_equal PROJECT_DIR, Gem.prefix
|
867
1034
|
end
|
868
1035
|
|
869
1036
|
def test_self_prefix_libdir
|
870
1037
|
orig_libdir = RbConfig::CONFIG['libdir']
|
871
|
-
RbConfig::CONFIG['libdir'] =
|
1038
|
+
RbConfig::CONFIG['libdir'] = PROJECT_DIR
|
872
1039
|
|
873
1040
|
assert_nil Gem.prefix
|
874
1041
|
ensure
|
@@ -877,7 +1044,7 @@ class TestGem < Gem::TestCase
|
|
877
1044
|
|
878
1045
|
def test_self_prefix_sitelibdir
|
879
1046
|
orig_sitelibdir = RbConfig::CONFIG['sitelibdir']
|
880
|
-
RbConfig::CONFIG['sitelibdir'] =
|
1047
|
+
RbConfig::CONFIG['sitelibdir'] = PROJECT_DIR
|
881
1048
|
|
882
1049
|
assert_nil Gem.prefix
|
883
1050
|
ensure
|
@@ -936,48 +1103,26 @@ class TestGem < Gem::TestCase
|
|
936
1103
|
|
937
1104
|
Gem.refresh
|
938
1105
|
|
939
|
-
Gem::Specification.each{|spec| assert spec.activated? if spec == s}
|
1106
|
+
Gem::Specification.each{|spec| assert spec.activated? if spec == s }
|
940
1107
|
|
941
1108
|
Gem.loaded_specs.delete(s)
|
942
1109
|
Gem.refresh
|
943
1110
|
end
|
944
1111
|
|
945
1112
|
def test_self_ruby_escaping_spaces_in_path
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
RbConfig::CONFIG['bindir'] = "C:/Ruby 1.8/bin"
|
952
|
-
RbConfig::CONFIG['ruby_install_name'] = "ruby"
|
953
|
-
RbConfig::CONFIG['EXEEXT'] = ".exe"
|
954
|
-
Gem.instance_variable_set("@ruby", nil)
|
955
|
-
|
956
|
-
assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby
|
957
|
-
ensure
|
958
|
-
Gem.instance_variable_set("@ruby", orig_ruby)
|
959
|
-
RbConfig::CONFIG['bindir'] = orig_bindir
|
960
|
-
RbConfig::CONFIG['ruby_install_name'] = orig_ruby_install_name
|
961
|
-
RbConfig::CONFIG['EXEEXT'] = orig_exe_ext
|
1113
|
+
with_clean_path_to_ruby do
|
1114
|
+
with_rb_config_ruby("C:/Ruby 1.8/bin/ruby.exe") do
|
1115
|
+
assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby
|
1116
|
+
end
|
1117
|
+
end
|
962
1118
|
end
|
963
1119
|
|
964
1120
|
def test_self_ruby_path_without_spaces
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
RbConfig::CONFIG['bindir'] = "C:/Ruby18/bin"
|
971
|
-
RbConfig::CONFIG['ruby_install_name'] = "ruby"
|
972
|
-
RbConfig::CONFIG['EXEEXT'] = ".exe"
|
973
|
-
Gem.instance_variable_set("@ruby", nil)
|
974
|
-
|
975
|
-
assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby
|
976
|
-
ensure
|
977
|
-
Gem.instance_variable_set("@ruby", orig_ruby)
|
978
|
-
RbConfig::CONFIG['bindir'] = orig_bindir
|
979
|
-
RbConfig::CONFIG['ruby_install_name'] = orig_ruby_install_name
|
980
|
-
RbConfig::CONFIG['EXEEXT'] = orig_exe_ext
|
1121
|
+
with_clean_path_to_ruby do
|
1122
|
+
with_rb_config_ruby("C:/Ruby18/bin/ruby.exe") do
|
1123
|
+
assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby
|
1124
|
+
end
|
1125
|
+
end
|
981
1126
|
end
|
982
1127
|
|
983
1128
|
def test_self_ruby_api_version
|
@@ -1027,7 +1172,7 @@ class TestGem < Gem::TestCase
|
|
1027
1172
|
util_restore_RUBY_VERSION
|
1028
1173
|
end
|
1029
1174
|
|
1030
|
-
def
|
1175
|
+
def test_self_ruby_version_with_svn_prerelease
|
1031
1176
|
util_set_RUBY_VERSION '2.6.0', -1, 63539, 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]'
|
1032
1177
|
|
1033
1178
|
assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
|
@@ -1035,6 +1180,14 @@ class TestGem < Gem::TestCase
|
|
1035
1180
|
util_restore_RUBY_VERSION
|
1036
1181
|
end
|
1037
1182
|
|
1183
|
+
def test_self_ruby_version_with_git_prerelease
|
1184
|
+
util_set_RUBY_VERSION '2.7.0', -1, 'b563439274a402e33541f5695b1bfd4ac1085638', 'ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]'
|
1185
|
+
|
1186
|
+
assert_equal Gem::Version.new('2.7.0.preview3'), Gem.ruby_version
|
1187
|
+
ensure
|
1188
|
+
util_restore_RUBY_VERSION
|
1189
|
+
end
|
1190
|
+
|
1038
1191
|
def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
|
1039
1192
|
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'
|
1040
1193
|
|
@@ -1043,7 +1196,7 @@ class TestGem < Gem::TestCase
|
|
1043
1196
|
util_restore_RUBY_VERSION
|
1044
1197
|
end
|
1045
1198
|
|
1046
|
-
def
|
1199
|
+
def test_self_ruby_version_with_svn_trunk
|
1047
1200
|
util_set_RUBY_VERSION '1.9.2', -1, 23493, 'ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]'
|
1048
1201
|
|
1049
1202
|
assert_equal Gem::Version.new('1.9.2.dev'), Gem.ruby_version
|
@@ -1051,6 +1204,14 @@ class TestGem < Gem::TestCase
|
|
1051
1204
|
util_restore_RUBY_VERSION
|
1052
1205
|
end
|
1053
1206
|
|
1207
|
+
def test_self_ruby_version_with_git_master
|
1208
|
+
util_set_RUBY_VERSION '2.7.0', -1, '5de284ec78220e75643f89b454ce999da0c1c195', 'ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]'
|
1209
|
+
|
1210
|
+
assert_equal Gem::Version.new('2.7.0.dev'), Gem.ruby_version
|
1211
|
+
ensure
|
1212
|
+
util_restore_RUBY_VERSION
|
1213
|
+
end
|
1214
|
+
|
1054
1215
|
def test_self_rubygems_version
|
1055
1216
|
assert_equal Gem::Version.new(Gem::VERSION), Gem.rubygems_version
|
1056
1217
|
end
|
@@ -1084,7 +1245,7 @@ class TestGem < Gem::TestCase
|
|
1084
1245
|
def test_self_post_build
|
1085
1246
|
assert_equal 1, Gem.post_build_hooks.length
|
1086
1247
|
|
1087
|
-
Gem.post_build
|
1248
|
+
Gem.post_build {|installer| }
|
1088
1249
|
|
1089
1250
|
assert_equal 2, Gem.post_build_hooks.length
|
1090
1251
|
end
|
@@ -1092,7 +1253,7 @@ class TestGem < Gem::TestCase
|
|
1092
1253
|
def test_self_post_install
|
1093
1254
|
assert_equal 1, Gem.post_install_hooks.length
|
1094
1255
|
|
1095
|
-
Gem.post_install
|
1256
|
+
Gem.post_install {|installer| }
|
1096
1257
|
|
1097
1258
|
assert_equal 2, Gem.post_install_hooks.length
|
1098
1259
|
end
|
@@ -1100,7 +1261,7 @@ class TestGem < Gem::TestCase
|
|
1100
1261
|
def test_self_done_installing
|
1101
1262
|
assert_empty Gem.done_installing_hooks
|
1102
1263
|
|
1103
|
-
Gem.done_installing
|
1264
|
+
Gem.done_installing {|gems| }
|
1104
1265
|
|
1105
1266
|
assert_equal 1, Gem.done_installing_hooks.length
|
1106
1267
|
end
|
@@ -1108,7 +1269,7 @@ class TestGem < Gem::TestCase
|
|
1108
1269
|
def test_self_post_reset
|
1109
1270
|
assert_empty Gem.post_reset_hooks
|
1110
1271
|
|
1111
|
-
Gem.post_reset {
|
1272
|
+
Gem.post_reset {}
|
1112
1273
|
|
1113
1274
|
assert_equal 1, Gem.post_reset_hooks.length
|
1114
1275
|
end
|
@@ -1116,7 +1277,7 @@ class TestGem < Gem::TestCase
|
|
1116
1277
|
def test_self_post_uninstall
|
1117
1278
|
assert_equal 1, Gem.post_uninstall_hooks.length
|
1118
1279
|
|
1119
|
-
Gem.post_uninstall
|
1280
|
+
Gem.post_uninstall {|installer| }
|
1120
1281
|
|
1121
1282
|
assert_equal 2, Gem.post_uninstall_hooks.length
|
1122
1283
|
end
|
@@ -1124,7 +1285,7 @@ class TestGem < Gem::TestCase
|
|
1124
1285
|
def test_self_pre_install
|
1125
1286
|
assert_equal 1, Gem.pre_install_hooks.length
|
1126
1287
|
|
1127
|
-
Gem.pre_install
|
1288
|
+
Gem.pre_install {|installer| }
|
1128
1289
|
|
1129
1290
|
assert_equal 2, Gem.pre_install_hooks.length
|
1130
1291
|
end
|
@@ -1132,7 +1293,7 @@ class TestGem < Gem::TestCase
|
|
1132
1293
|
def test_self_pre_reset
|
1133
1294
|
assert_empty Gem.pre_reset_hooks
|
1134
1295
|
|
1135
|
-
Gem.pre_reset {
|
1296
|
+
Gem.pre_reset {}
|
1136
1297
|
|
1137
1298
|
assert_equal 1, Gem.pre_reset_hooks.length
|
1138
1299
|
end
|
@@ -1140,7 +1301,7 @@ class TestGem < Gem::TestCase
|
|
1140
1301
|
def test_self_pre_uninstall
|
1141
1302
|
assert_equal 1, Gem.pre_uninstall_hooks.length
|
1142
1303
|
|
1143
|
-
Gem.pre_uninstall
|
1304
|
+
Gem.pre_uninstall {|installer| }
|
1144
1305
|
|
1145
1306
|
assert_equal 2, Gem.pre_uninstall_hooks.length
|
1146
1307
|
end
|
@@ -1169,7 +1330,7 @@ class TestGem < Gem::TestCase
|
|
1169
1330
|
|
1170
1331
|
install_specs b1, b2, b3
|
1171
1332
|
|
1172
|
-
specs1 = Gem::Specification.stubs.find_all {
|
1333
|
+
specs1 = Gem::Specification.stubs.find_all {|s| s.name == 'b' }
|
1173
1334
|
Gem::Specification.reset
|
1174
1335
|
specs2 = Gem::Specification.stubs_for('b')
|
1175
1336
|
assert_equal specs1.map(&:version), specs2.map(&:version)
|
@@ -1192,7 +1353,8 @@ class TestGem < Gem::TestCase
|
|
1192
1353
|
Gem.try_activate 'a_file'
|
1193
1354
|
end
|
1194
1355
|
|
1195
|
-
assert_match %r
|
1356
|
+
assert_match %r{Could not find 'b' }, e.message
|
1357
|
+
assert_match %r{at: #{a.spec_file}}, e.message
|
1196
1358
|
end
|
1197
1359
|
|
1198
1360
|
def test_self_try_activate_missing_prerelease
|
@@ -1212,7 +1374,7 @@ class TestGem < Gem::TestCase
|
|
1212
1374
|
Gem.try_activate 'a_file'
|
1213
1375
|
end
|
1214
1376
|
|
1215
|
-
assert_match %r
|
1377
|
+
assert_match %r{Could not find 'b' \(= 1.0rc1\)}, e.message
|
1216
1378
|
end
|
1217
1379
|
|
1218
1380
|
def test_self_try_activate_missing_extensions
|
@@ -1231,10 +1393,12 @@ class TestGem < Gem::TestCase
|
|
1231
1393
|
refute Gem.try_activate 'nonexistent'
|
1232
1394
|
end
|
1233
1395
|
|
1234
|
-
|
1235
|
-
|
1396
|
+
unless Gem.java_platform?
|
1397
|
+
expected = "Ignoring ext-1 because its extensions are not built. " +
|
1398
|
+
"Try: gem pristine ext --version 1\n"
|
1236
1399
|
|
1237
|
-
|
1400
|
+
assert_equal expected, err
|
1401
|
+
end
|
1238
1402
|
end
|
1239
1403
|
|
1240
1404
|
def test_self_use_paths_with_nils
|
@@ -1290,6 +1454,8 @@ class TestGem < Gem::TestCase
|
|
1290
1454
|
parts = [@userhome, '.gem', Gem.ruby_engine]
|
1291
1455
|
parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
|
1292
1456
|
|
1457
|
+
FileUtils.mkdir_p File.join(parts)
|
1458
|
+
|
1293
1459
|
assert_equal File.join(parts), Gem.user_dir
|
1294
1460
|
end
|
1295
1461
|
|
@@ -1302,7 +1468,6 @@ class TestGem < Gem::TestCase
|
|
1302
1468
|
end
|
1303
1469
|
|
1304
1470
|
def test_self_needs
|
1305
|
-
util_clear_gems
|
1306
1471
|
a = util_spec "a", "1"
|
1307
1472
|
b = util_spec "b", "1", "c" => nil
|
1308
1473
|
c = util_spec "c", "2"
|
@@ -1314,18 +1479,17 @@ class TestGem < Gem::TestCase
|
|
1314
1479
|
r.gem "b", "= 1"
|
1315
1480
|
end
|
1316
1481
|
|
1317
|
-
activated = Gem::Specification.map {
|
1482
|
+
activated = Gem::Specification.map {|x| x.full_name }
|
1318
1483
|
|
1319
|
-
assert_equal %w
|
1484
|
+
assert_equal %w[a-1 b-1 c-2], activated.sort
|
1320
1485
|
end
|
1321
1486
|
|
1322
1487
|
def test_self_needs_picks_up_unresolved_deps
|
1323
1488
|
save_loaded_features do
|
1324
|
-
util_clear_gems
|
1325
1489
|
a = util_spec "a", "1"
|
1326
1490
|
b = util_spec "b", "1", "c" => nil
|
1327
1491
|
c = util_spec "c", "2"
|
1328
|
-
d =
|
1492
|
+
d = util_spec "d", "1", {'e' => '= 1'}, "lib/d#{$$}.rb"
|
1329
1493
|
e = util_spec "e", "1"
|
1330
1494
|
|
1331
1495
|
install_specs a, c, b, e, d
|
@@ -1334,10 +1498,10 @@ class TestGem < Gem::TestCase
|
|
1334
1498
|
r.gem "a"
|
1335
1499
|
r.gem "b", "= 1"
|
1336
1500
|
|
1337
|
-
require
|
1501
|
+
require "d#{$$}"
|
1338
1502
|
end
|
1339
1503
|
|
1340
|
-
assert_equal %w
|
1504
|
+
assert_equal %w[a-1 b-1 c-2 d-1 e-1], loaded_spec_names
|
1341
1505
|
end
|
1342
1506
|
end
|
1343
1507
|
|
@@ -1363,11 +1527,13 @@ class TestGem < Gem::TestCase
|
|
1363
1527
|
end
|
1364
1528
|
|
1365
1529
|
def test_self_vendor_dir
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1530
|
+
vendordir(File.join(@tempdir, 'vendor')) do
|
1531
|
+
expected =
|
1532
|
+
File.join RbConfig::CONFIG['vendordir'], 'gems',
|
1533
|
+
RbConfig::CONFIG['ruby_version']
|
1369
1534
|
|
1370
|
-
|
1535
|
+
assert_equal expected, Gem.vendor_dir
|
1536
|
+
end
|
1371
1537
|
end
|
1372
1538
|
|
1373
1539
|
def test_self_vendor_dir_ENV_GEM_VENDOR
|
@@ -1378,12 +1544,9 @@ class TestGem < Gem::TestCase
|
|
1378
1544
|
end
|
1379
1545
|
|
1380
1546
|
def test_self_vendor_dir_missing
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
assert_nil Gem.vendor_dir
|
1385
|
-
ensure
|
1386
|
-
RbConfig::CONFIG['vendordir'] = orig_vendordir
|
1547
|
+
vendordir(nil) do
|
1548
|
+
assert_nil Gem.vendor_dir
|
1549
|
+
end
|
1387
1550
|
end
|
1388
1551
|
|
1389
1552
|
def test_load_plugins
|
@@ -1408,7 +1571,6 @@ class TestGem < Gem::TestCase
|
|
1408
1571
|
install_gem foo2
|
1409
1572
|
end
|
1410
1573
|
|
1411
|
-
Gem.searcher = nil
|
1412
1574
|
Gem::Specification.reset
|
1413
1575
|
|
1414
1576
|
gem 'foo'
|
@@ -1438,8 +1600,8 @@ class TestGem < Gem::TestCase
|
|
1438
1600
|
def test_gem_path_ordering
|
1439
1601
|
refute_equal Gem.dir, Gem.user_dir
|
1440
1602
|
|
1441
|
-
write_file File.join(@tempdir, 'lib', "g.rb") {
|
1442
|
-
write_file File.join(@tempdir, 'lib', 'm.rb') {
|
1603
|
+
write_file File.join(@tempdir, 'lib', "g.rb") {|fp| fp.puts "" }
|
1604
|
+
write_file File.join(@tempdir, 'lib', 'm.rb') {|fp| fp.puts "" }
|
1443
1605
|
|
1444
1606
|
g = util_spec 'g', '1', nil, "lib/g.rb"
|
1445
1607
|
m = util_spec 'm', '1', nil, "lib/m.rb"
|
@@ -1453,7 +1615,7 @@ class TestGem < Gem::TestCase
|
|
1453
1615
|
|
1454
1616
|
tests = [
|
1455
1617
|
[:dir0, [ Gem.dir, Gem.user_dir], m0],
|
1456
|
-
[:dir1, [ Gem.user_dir, Gem.dir], m1]
|
1618
|
+
[:dir1, [ Gem.user_dir, Gem.dir], m1],
|
1457
1619
|
]
|
1458
1620
|
|
1459
1621
|
tests.each do |_name, _paths, expected|
|
@@ -1494,8 +1656,8 @@ class TestGem < Gem::TestCase
|
|
1494
1656
|
end
|
1495
1657
|
|
1496
1658
|
def test_gem_path_ordering_short
|
1497
|
-
write_file File.join(@tempdir, 'lib', "g.rb") {
|
1498
|
-
write_file File.join(@tempdir, 'lib', 'm.rb') {
|
1659
|
+
write_file File.join(@tempdir, 'lib', "g.rb") {|fp| fp.puts "" }
|
1660
|
+
write_file File.join(@tempdir, 'lib', 'm.rb') {|fp| fp.puts "" }
|
1499
1661
|
|
1500
1662
|
g = util_spec 'g', '1', nil, "lib/g.rb"
|
1501
1663
|
m = util_spec 'm', '1', nil, "lib/m.rb"
|
@@ -1513,8 +1675,6 @@ class TestGem < Gem::TestCase
|
|
1513
1675
|
end
|
1514
1676
|
|
1515
1677
|
def test_auto_activation_of_specific_gemdeps_file
|
1516
|
-
util_clear_gems
|
1517
|
-
|
1518
1678
|
a = util_spec "a", "1", nil, "lib/a.rb"
|
1519
1679
|
b = util_spec "b", "1", nil, "lib/b.rb"
|
1520
1680
|
c = util_spec "c", "1", nil, "lib/c.rb"
|
@@ -1533,12 +1693,10 @@ class TestGem < Gem::TestCase
|
|
1533
1693
|
|
1534
1694
|
Gem.use_gemdeps
|
1535
1695
|
|
1536
|
-
assert_equal add_bundler_full_name(%W
|
1696
|
+
assert_equal add_bundler_full_name(%W[a-1 b-1 c-1]), loaded_spec_names
|
1537
1697
|
end
|
1538
1698
|
|
1539
1699
|
def test_auto_activation_of_used_gemdeps_file
|
1540
|
-
util_clear_gems
|
1541
|
-
|
1542
1700
|
a = util_spec "a", "1", nil, "lib/a.rb"
|
1543
1701
|
b = util_spec "b", "1", nil, "lib/b.rb"
|
1544
1702
|
c = util_spec "c", "1", nil, "lib/c.rb"
|
@@ -1555,26 +1713,21 @@ class TestGem < Gem::TestCase
|
|
1555
1713
|
|
1556
1714
|
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
1557
1715
|
|
1558
|
-
expected_specs = [a, b,
|
1559
|
-
assert_equal expected_specs, Gem.use_gemdeps.sort_by {
|
1716
|
+
expected_specs = [a, b, util_spec("bundler", Bundler::VERSION), c].compact
|
1717
|
+
assert_equal expected_specs, Gem.use_gemdeps.sort_by {|s| s.name }
|
1560
1718
|
end
|
1561
1719
|
|
1562
|
-
|
1563
|
-
|
1564
|
-
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1565
|
-
BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }.dup.untaint
|
1566
|
-
BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}".freeze
|
1567
|
-
end
|
1720
|
+
BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }
|
1721
|
+
BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}".freeze
|
1568
1722
|
|
1569
1723
|
def add_bundler_full_name(names)
|
1570
|
-
return names unless Gem::USE_BUNDLER_FOR_GEMDEPS
|
1571
1724
|
names << BUNDLER_FULL_NAME
|
1572
1725
|
names.sort!
|
1573
1726
|
names
|
1574
1727
|
end
|
1575
1728
|
|
1576
1729
|
def test_looks_for_gemdeps_files_automatically_on_start
|
1577
|
-
|
1730
|
+
skip "Requiring bundler messes things up" if Gem.java_platform?
|
1578
1731
|
|
1579
1732
|
a = util_spec "a", "1", nil, "lib/a.rb"
|
1580
1733
|
b = util_spec "b", "1", nil, "lib/b.rb"
|
@@ -1591,8 +1744,8 @@ class TestGem < Gem::TestCase
|
|
1591
1744
|
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
1592
1745
|
|
1593
1746
|
path = File.join @tempdir, "gem.deps.rb"
|
1594
|
-
cmd = [
|
1595
|
-
"-I#{BUNDLER_LIB_PATH
|
1747
|
+
cmd = [*ruby_with_rubygems_in_load_path,
|
1748
|
+
"-I#{BUNDLER_LIB_PATH}"]
|
1596
1749
|
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1597
1750
|
|
1598
1751
|
File.open path, "w" do |f|
|
@@ -1607,10 +1760,10 @@ class TestGem < Gem::TestCase
|
|
1607
1760
|
out = IO.popen(cmd, &:read).split(/\n/)
|
1608
1761
|
|
1609
1762
|
assert_equal ["b-1", "c-1"], out - out0
|
1610
|
-
end
|
1763
|
+
end
|
1611
1764
|
|
1612
1765
|
def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
|
1613
|
-
|
1766
|
+
skip "Requiring bundler messes things up" if Gem.java_platform?
|
1614
1767
|
|
1615
1768
|
a = util_spec "a", "1", nil, "lib/a.rb"
|
1616
1769
|
b = util_spec "b", "1", nil, "lib/b.rb"
|
@@ -1629,8 +1782,8 @@ class TestGem < Gem::TestCase
|
|
1629
1782
|
Dir.mkdir "sub1"
|
1630
1783
|
|
1631
1784
|
path = File.join @tempdir, "gem.deps.rb"
|
1632
|
-
cmd = [
|
1633
|
-
"-I#{BUNDLER_LIB_PATH
|
1785
|
+
cmd = [*ruby_with_rubygems_in_load_path, "-Csub1",
|
1786
|
+
"-I#{BUNDLER_LIB_PATH}"]
|
1634
1787
|
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1635
1788
|
|
1636
1789
|
File.open path, "w" do |f|
|
@@ -1647,7 +1800,7 @@ class TestGem < Gem::TestCase
|
|
1647
1800
|
Dir.rmdir "sub1"
|
1648
1801
|
|
1649
1802
|
assert_equal ["b-1", "c-1"], out - out0
|
1650
|
-
end
|
1803
|
+
end
|
1651
1804
|
|
1652
1805
|
def test_register_default_spec
|
1653
1806
|
Gem.clear_default_specs
|
@@ -1677,39 +1830,24 @@ class TestGem < Gem::TestCase
|
|
1677
1830
|
assert_nil Gem.find_unresolved_default_spec("README")
|
1678
1831
|
end
|
1679
1832
|
|
1680
|
-
def
|
1681
|
-
|
1682
|
-
if defined?(RUBY_ENGINE)
|
1683
|
-
engine = RUBY_ENGINE
|
1684
|
-
Object.send :remove_const, :RUBY_ENGINE
|
1685
|
-
end
|
1686
|
-
Object.const_set :RUBY_ENGINE, 'ruby'
|
1833
|
+
def test_register_default_spec_old_style_with_folder_starting_with_lib
|
1834
|
+
Gem.clear_default_specs
|
1687
1835
|
|
1688
|
-
|
1689
|
-
|
1690
|
-
Object.send :remove_const, :RUBY_ENGINE
|
1691
|
-
Object.const_set :RUBY_ENGINE, engine if engine
|
1836
|
+
old_style = Gem::Specification.new do |spec|
|
1837
|
+
spec.files = ["libexec/bundle", "foo.rb", "bar.rb"]
|
1692
1838
|
end
|
1693
1839
|
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
Object.send :remove_const, :RUBY_ENGINE
|
1698
|
-
end
|
1699
|
-
Object.const_set :RUBY_ENGINE, 'jruby'
|
1700
|
-
assert Gem.default_gems_use_full_paths?
|
1701
|
-
ensure
|
1702
|
-
Object.send :remove_const, :RUBY_ENGINE
|
1703
|
-
Object.const_set :RUBY_ENGINE, engine if engine
|
1704
|
-
end
|
1840
|
+
Gem.register_default_spec old_style
|
1841
|
+
|
1842
|
+
assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
|
1705
1843
|
end
|
1706
1844
|
|
1707
1845
|
def test_use_gemdeps
|
1708
|
-
gem_deps_file = 'gem.deps.rb'.
|
1846
|
+
gem_deps_file = 'gem.deps.rb'.tap(&Gem::UNTAINT)
|
1709
1847
|
spec = util_spec 'a', 1
|
1710
1848
|
install_specs spec
|
1711
1849
|
|
1712
|
-
spec = Gem::Specification.find {
|
1850
|
+
spec = Gem::Specification.find {|s| s == spec }
|
1713
1851
|
refute spec.activated?
|
1714
1852
|
|
1715
1853
|
File.open gem_deps_file, 'w' do |io|
|
@@ -1720,7 +1858,7 @@ class TestGem < Gem::TestCase
|
|
1720
1858
|
|
1721
1859
|
Gem.use_gemdeps gem_deps_file
|
1722
1860
|
|
1723
|
-
assert_equal add_bundler_full_name(%W
|
1861
|
+
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1724
1862
|
refute_nil Gem.gemdeps
|
1725
1863
|
end
|
1726
1864
|
|
@@ -1770,7 +1908,7 @@ class TestGem < Gem::TestCase
|
|
1770
1908
|
|
1771
1909
|
spec = util_spec 'a', 1
|
1772
1910
|
install_specs spec
|
1773
|
-
spec = Gem::Specification.find {
|
1911
|
+
spec = Gem::Specification.find {|s| s == spec }
|
1774
1912
|
|
1775
1913
|
refute spec.activated?
|
1776
1914
|
|
@@ -1780,7 +1918,7 @@ class TestGem < Gem::TestCase
|
|
1780
1918
|
|
1781
1919
|
Gem.use_gemdeps
|
1782
1920
|
|
1783
|
-
assert_equal add_bundler_full_name(%W
|
1921
|
+
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1784
1922
|
ensure
|
1785
1923
|
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1786
1924
|
end
|
@@ -1820,33 +1958,21 @@ class TestGem < Gem::TestCase
|
|
1820
1958
|
io.write 'gem "a"'
|
1821
1959
|
end
|
1822
1960
|
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
else
|
1827
|
-
platform = " #{platform}"
|
1828
|
-
end
|
1829
|
-
expected =
|
1830
|
-
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1831
|
-
<<-EXPECTED
|
1832
|
-
Could not find gem 'a#{platform}' in any of the gem sources listed in your Gemfile.
|
1961
|
+
expected = <<-EXPECTED
|
1962
|
+
Could not find gem 'a' in locally installed gems.
|
1963
|
+
The source does not contain any versions of 'a'
|
1833
1964
|
You may need to `gem install -g` to install missing gems
|
1834
1965
|
|
1835
|
-
|
1836
|
-
else
|
1837
|
-
<<-EXPECTED
|
1838
|
-
Unable to resolve dependency: user requested 'a (>= 0)'
|
1839
|
-
You may need to `gem install -g` to install missing gems
|
1966
|
+
EXPECTED
|
1840
1967
|
|
1841
|
-
|
1968
|
+
Gem::Deprecate.skip_during do
|
1969
|
+
assert_output nil, expected do
|
1970
|
+
Gem.use_gemdeps
|
1842
1971
|
end
|
1843
|
-
|
1844
|
-
assert_output nil, expected do
|
1845
|
-
Gem.use_gemdeps
|
1846
1972
|
end
|
1847
1973
|
ensure
|
1848
1974
|
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1849
|
-
end
|
1975
|
+
end
|
1850
1976
|
|
1851
1977
|
def test_use_gemdeps_specific
|
1852
1978
|
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
|
@@ -1854,7 +1980,7 @@ You may need to `gem install -g` to install missing gems
|
|
1854
1980
|
spec = util_spec 'a', 1
|
1855
1981
|
install_specs spec
|
1856
1982
|
|
1857
|
-
spec = Gem::Specification.find {
|
1983
|
+
spec = Gem::Specification.find {|s| s == spec }
|
1858
1984
|
refute spec.activated?
|
1859
1985
|
|
1860
1986
|
File.open 'x', 'w' do |io|
|
@@ -1863,7 +1989,7 @@ You may need to `gem install -g` to install missing gems
|
|
1863
1989
|
|
1864
1990
|
Gem.use_gemdeps
|
1865
1991
|
|
1866
|
-
assert_equal add_bundler_full_name(%W
|
1992
|
+
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1867
1993
|
ensure
|
1868
1994
|
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1869
1995
|
end
|
@@ -1882,22 +2008,65 @@ You may need to `gem install -g` to install missing gems
|
|
1882
2008
|
assert platform_defaults.is_a? Hash
|
1883
2009
|
end
|
1884
2010
|
|
2011
|
+
# Ensure that `Gem.source_date_epoch` is consistent even if
|
2012
|
+
# $SOURCE_DATE_EPOCH has not been set.
|
2013
|
+
def test_default_source_date_epoch_doesnt_change
|
2014
|
+
old_epoch = ENV['SOURCE_DATE_EPOCH']
|
2015
|
+
ENV['SOURCE_DATE_EPOCH'] = nil
|
2016
|
+
|
2017
|
+
# Unfortunately, there is no real way to test this aside from waiting
|
2018
|
+
# enough for `Time.now.to_i` to change -- which is a whole second.
|
2019
|
+
#
|
2020
|
+
# Fortunately, we only need to do this once.
|
2021
|
+
a = Gem.source_date_epoch
|
2022
|
+
sleep 1
|
2023
|
+
b = Gem.source_date_epoch
|
2024
|
+
assert_equal a, b
|
2025
|
+
ensure
|
2026
|
+
ENV['SOURCE_DATE_EPOCH'] = old_epoch
|
2027
|
+
end
|
2028
|
+
|
1885
2029
|
def ruby_install_name(name)
|
1886
|
-
|
1887
|
-
|
2030
|
+
with_clean_path_to_ruby do
|
2031
|
+
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
|
2032
|
+
RbConfig::CONFIG['ruby_install_name'] = name
|
2033
|
+
|
2034
|
+
begin
|
2035
|
+
yield
|
2036
|
+
ensure
|
2037
|
+
if orig_RUBY_INSTALL_NAME
|
2038
|
+
RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
|
2039
|
+
else
|
2040
|
+
RbConfig::CONFIG.delete 'ruby_install_name'
|
2041
|
+
end
|
2042
|
+
end
|
2043
|
+
end
|
2044
|
+
end
|
2045
|
+
|
2046
|
+
def with_rb_config_ruby(path)
|
2047
|
+
rb_config_singleton_class = class << RbConfig; self; end
|
2048
|
+
orig_path = RbConfig.ruby
|
2049
|
+
|
2050
|
+
redefine_method(rb_config_singleton_class, :ruby, path)
|
1888
2051
|
|
1889
2052
|
yield
|
1890
2053
|
ensure
|
1891
|
-
|
1892
|
-
|
2054
|
+
redefine_method(rb_config_singleton_class, :ruby, orig_path)
|
2055
|
+
end
|
2056
|
+
|
2057
|
+
def redefine_method(base, method, new_result)
|
2058
|
+
if RUBY_VERSION >= "2.5"
|
2059
|
+
base.alias_method(method, method)
|
2060
|
+
base.define_method(method) { new_result }
|
1893
2061
|
else
|
1894
|
-
|
2062
|
+
base.send(:alias_method, method, method)
|
2063
|
+
base.send(:define_method, method) { new_result }
|
1895
2064
|
end
|
1896
2065
|
end
|
1897
2066
|
|
1898
2067
|
def with_plugin(path)
|
1899
2068
|
test_plugin_path = File.expand_path("test/rubygems/plugin/#{path}",
|
1900
|
-
|
2069
|
+
PROJECT_DIR)
|
1901
2070
|
|
1902
2071
|
# A single test plugin should get loaded once only, in order to preserve
|
1903
2072
|
# sane test semantics.
|