rubygems-update 3.1.6 → 3.3.22
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} +1452 -514
- data/CODE_OF_CONDUCT.md +55 -19
- data/CONTRIBUTING.md +74 -27
- data/Manifest.txt +154 -117
- data/POLICIES.md +27 -19
- data/README.md +10 -8
- data/UPGRADING.md +5 -81
- data/bin/gem +3 -8
- data/bin/update_rubygems +5 -5
- data/bundler/CHANGELOG.md +2358 -1430
- data/bundler/README.md +7 -9
- data/bundler/UPGRADING.md +27 -34
- data/bundler/bundler.gemspec +8 -11
- data/bundler/exe/bundle +10 -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 +1 -1
- data/bundler/lib/bundler/cli/binstubs.rb +6 -2
- data/bundler/lib/bundler/cli/cache.rb +3 -8
- data/bundler/lib/bundler/cli/check.rb +4 -2
- data/bundler/lib/bundler/cli/clean.rb +1 -1
- data/bundler/lib/bundler/cli/common.rb +31 -3
- data/bundler/lib/bundler/cli/config.rb +10 -1
- data/bundler/lib/bundler/cli/console.rb +1 -1
- data/bundler/lib/bundler/cli/doctor.rb +25 -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 +219 -28
- data/bundler/lib/bundler/cli/info.rb +38 -6
- data/bundler/lib/bundler/cli/init.rb +3 -3
- data/bundler/lib/bundler/cli/inject.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +25 -54
- 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 +5 -1
- data/bundler/lib/bundler/cli/open.rb +1 -2
- data/bundler/lib/bundler/cli/outdated.rb +105 -76
- 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.rb +106 -83
- data/bundler/lib/bundler/compact_index_client/cache.rb +6 -23
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +29 -25
- data/bundler/lib/bundler/compact_index_client.rb +3 -9
- data/bundler/lib/bundler/current_ruby.rb +17 -6
- data/bundler/lib/bundler/definition.rb +297 -396
- data/bundler/lib/bundler/dep_proxy.rb +16 -9
- data/bundler/lib/bundler/dependency.rb +22 -77
- data/bundler/lib/bundler/digest.rb +71 -0
- data/bundler/lib/bundler/dsl.rb +76 -83
- data/bundler/lib/bundler/endpoint_specification.rb +16 -14
- data/bundler/lib/bundler/env.rb +2 -2
- data/bundler/lib/bundler/environment_preserver.rb +29 -2
- data/bundler/lib/bundler/errors.rb +30 -3
- 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 +11 -16
- data/bundler/lib/bundler/fetcher/downloader.rb +10 -7
- data/bundler/lib/bundler/fetcher/index.rb +2 -30
- data/bundler/lib/bundler/fetcher.rb +24 -25
- data/bundler/lib/bundler/friendly_errors.rb +46 -47
- data/bundler/lib/bundler/gem_helper.rb +53 -31
- data/bundler/lib/bundler/gem_helpers.rb +43 -24
- data/bundler/lib/bundler/gem_version_promoter.rb +10 -20
- data/bundler/lib/bundler/graph.rb +1 -1
- data/bundler/lib/bundler/index.rb +19 -25
- data/bundler/lib/bundler/injector.rb +38 -6
- data/bundler/lib/bundler/inline.rb +4 -13
- data/bundler/lib/bundler/installer/gem_installer.rb +19 -24
- data/bundler/lib/bundler/installer/parallel_installer.rb +46 -25
- data/bundler/lib/bundler/installer/standalone.rb +58 -11
- data/bundler/lib/bundler/installer.rb +51 -81
- data/bundler/lib/bundler/lazy_specification.rb +79 -36
- data/bundler/lib/bundler/lockfile_generator.rb +3 -3
- data/bundler/lib/bundler/lockfile_parser.rb +19 -44
- 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 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-config.1 +65 -47
- data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +74 -65
- 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 +2 -2
- data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-gem.1 +38 -3
- data/bundler/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +46 -7
- 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 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-inject.1 +5 -2
- data/bundler/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
- data/bundler/{man → lib/bundler/man}/bundle-install.1 +35 -4
- data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +33 -5
- 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 +1 -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 +106 -80
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +94 -83
- 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 +2 -2
- 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 +13 -1
- data/bundler/lib/bundler/plugin/installer/git.rb +0 -4
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -5
- data/bundler/lib/bundler/plugin/installer.rb +11 -11
- data/bundler/lib/bundler/plugin/source_list.rb +5 -1
- data/bundler/lib/bundler/plugin.rb +58 -11
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/remote_specification.rb +11 -6
- data/bundler/lib/bundler/resolver/base.rb +50 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +64 -57
- data/bundler/lib/bundler/resolver.rb +234 -230
- 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 +194 -33
- data/bundler/lib/bundler/rubygems_gem_installer.rb +87 -16
- data/bundler/lib/bundler/rubygems_integration.rb +71 -153
- data/bundler/lib/bundler/runtime.rb +22 -26
- data/bundler/lib/bundler/self_manager.rb +168 -0
- data/bundler/lib/bundler/settings.rb +145 -66
- data/bundler/lib/bundler/setup.rb +2 -2
- data/bundler/lib/bundler/shared_helpers.rb +17 -32
- data/bundler/lib/bundler/similarity_detector.rb +1 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +88 -84
- data/bundler/lib/bundler/source/git.rb +50 -32
- data/bundler/lib/bundler/source/metadata.rb +3 -7
- data/bundler/lib/bundler/source/path/installer.rb +10 -10
- data/bundler/lib/bundler/source/path.rb +10 -4
- data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
- data/bundler/lib/bundler/source/rubygems.rb +201 -179
- 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 +105 -63
- data/bundler/lib/bundler/source_map.rb +71 -0
- data/bundler/lib/bundler/spec_set.rb +62 -57
- data/bundler/lib/bundler/stub_specification.rb +30 -10
- data/bundler/lib/bundler/templates/Executable +2 -4
- data/bundler/lib/bundler/templates/Executable.bundler +8 -8
- data/bundler/lib/bundler/templates/Executable.standalone +2 -4
- data/bundler/lib/bundler/templates/Gemfile +0 -2
- data/bundler/lib/bundler/templates/gems.rb +0 -3
- 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 +12 -1
- data/bundler/lib/bundler/templates/newgem/README.md.tt +9 -14
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +32 -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 +27 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -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 +27 -17
- 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 +6 -6
- data/bundler/lib/bundler/uri_credentials_filter.rb +3 -1
- 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 +57 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
- data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +37 -5
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +34 -28
- 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 +12 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +49 -47
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -1
- 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/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 +27 -6
- 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/tmpdir/lib/tmpdir.rb +154 -0
- data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
- data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +0 -1
- data/bundler/lib/bundler/vendored_persistent.rb +0 -7
- data/bundler/lib/bundler/vendored_tmpdir.rb +4 -0
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler/worker.rb +20 -5
- data/bundler/lib/bundler/yaml_serializer.rb +1 -1
- data/bundler/lib/bundler.rb +79 -47
- 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 +26 -53
- data/lib/rubygems/command.rb +48 -45
- data/lib/rubygems/command_manager.rb +20 -14
- data/lib/rubygems/commands/build_command.rb +47 -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/fetch_command.rb +33 -16
- data/lib/rubygems/commands/generate_index_command.rb +17 -19
- data/lib/rubygems/commands/help_command.rb +6 -6
- data/lib/rubygems/commands/info_command.rb +10 -7
- data/lib/rubygems/commands/install_command.rb +29 -27
- 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 +61 -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 +23 -25
- 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 +41 -43
- data/lib/rubygems/commands/unpack_command.rb +13 -15
- data/lib/rubygems/commands/update_command.rb +132 -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 +42 -26
- data/lib/rubygems/core_ext/kernel_gem.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +6 -3
- data/lib/rubygems/core_ext/kernel_warn.rb +12 -13
- data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
- data/lib/rubygems/defaults.rb +108 -32
- data/lib/rubygems/dependency.rb +21 -22
- data/lib/rubygems/dependency_installer.rb +19 -91
- 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 +33 -34
- data/lib/rubygems/ext/build_error.rb +2 -0
- data/lib/rubygems/ext/builder.rb +48 -54
- data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +23 -0
- data/lib/rubygems/ext/cargo_builder.rb +321 -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 +42 -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 +153 -32
- data/lib/rubygems/indexer.rb +30 -49
- 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 +194 -151
- 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 +2303 -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 +54 -56
- data/lib/rubygems/package/tar_reader/entry.rb +2 -5
- data/lib/rubygems/package/tar_reader.rb +1 -4
- data/lib/rubygems/package/tar_writer.rb +8 -18
- data/lib/rubygems/package.rb +101 -117
- data/lib/rubygems/package_task.rb +5 -11
- data/lib/rubygems/path_support.rb +2 -9
- data/lib/rubygems/platform.rb +101 -76
- 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 +23 -25
- 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 +28 -48
- 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 +41 -8
- 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 +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 +0 -2
- 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 +11 -11
- data/lib/rubygems/security/policy.rb +25 -29
- data/lib/rubygems/security/signer.rb +13 -16
- data/lib/rubygems/security/trust_dir.rb +4 -5
- data/lib/rubygems/security.rb +103 -69
- data/lib/rubygems/security_option.rb +7 -7
- data/lib/rubygems/source/git.rb +30 -30
- data/lib/rubygems/source/installed.rb +1 -3
- data/lib/rubygems/source/local.rb +4 -6
- data/lib/rubygems/source/lock.rb +0 -2
- data/lib/rubygems/source/specific_file.rb +1 -3
- data/lib/rubygems/source/vendor.rb +0 -2
- data/lib/rubygems/source.rb +44 -38
- data/lib/rubygems/source_list.rb +9 -16
- data/lib/rubygems/spec_fetcher.rb +49 -48
- data/lib/rubygems/specification.rb +338 -295
- data/lib/rubygems/specification_policy.rb +112 -61
- data/lib/rubygems/stub_specification.rb +21 -28
- data/lib/rubygems/text.rb +21 -20
- data/lib/rubygems/tsort/.document +1 -0
- data/lib/rubygems/tsort/LICENSE.txt +22 -0
- data/lib/rubygems/tsort/lib/tsort.rb +454 -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/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 +18 -12
- data/lib/rubygems/validator.rb +6 -8
- data/lib/rubygems/version.rb +29 -20
- data/lib/rubygems/version_option.rb +11 -5
- data/lib/rubygems.rb +192 -289
- data/rubygems-update.gemspec +4 -4
- data/setup.rb +11 -22
- 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/{lib/rubygems/test_case.rb → test/rubygems/helper.rb} +380 -314
- data/{lib → test}/rubygems/installer_test_case.rb +38 -24
- data/{lib → test}/rubygems/package/tar_test_case.rb +4 -6
- 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/rubygems/commands/crash_command.rb +0 -2
- data/test/rubygems/rubygems_plugin.rb +2 -4
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +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 +11 -0
- data/test/rubygems/test_gem.rb +719 -639
- data/test/rubygems/test_gem_available_set.rb +24 -26
- data/test/rubygems/test_gem_bundler_version_finder.rb +37 -44
- data/test/rubygems/test_gem_command.rb +78 -49
- data/test/rubygems/test_gem_command_manager.rb +98 -35
- data/test/rubygems/test_gem_commands_build_command.rb +275 -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_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 +401 -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 +100 -46
- data/test/rubygems/test_gem_commands_pristine_command.rb +131 -99
- data/test/rubygems/test_gem_commands_push_command.rb +134 -66
- 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 +288 -179
- data/test/rubygems/test_gem_commands_signin_command.rb +162 -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 +80 -82
- data/test/rubygems/test_gem_commands_unpack_command.rb +32 -34
- data/test/rubygems/test_gem_commands_update_command.rb +335 -88
- 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 +87 -87
- 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 -109
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +243 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +21 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/src/lib.rs +27 -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 +243 -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/build.rb +21 -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 +39 -0
- data/test/rubygems/test_gem_ext_cargo_builder.rb +178 -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 +75 -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 +51 -8
- data/test/rubygems/test_gem_gemcutter_utilities.rb +87 -76
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -6
- data/test/rubygems/test_gem_indexer.rb +62 -64
- data/test/rubygems/test_gem_install_update_options.rb +31 -21
- data/test/rubygems/test_gem_installer.rb +798 -491
- 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 +318 -283
- data/test/rubygems/test_gem_package_old.rb +18 -20
- data/test/rubygems/test_gem_package_tar_header.rb +64 -47
- data/test/rubygems/test_gem_package_tar_reader.rb +8 -10
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +18 -20
- 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 +354 -201
- data/test/rubygems/test_gem_rdoc.rb +19 -21
- data/test/rubygems/test_gem_remote_fetcher.rb +376 -337
- 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 +123 -124
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +222 -226
- data/test/rubygems/test_gem_request_set_lockfile.rb +93 -95
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +68 -70
- 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 +149 -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 +104 -78
- data/test/rubygems/test_gem_security_policy.rb +92 -97
- data/test/rubygems/test_gem_security_signer.rb +45 -47
- data/test/rubygems/test_gem_security_trust_dir.rb +12 -14
- 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 +69 -69
- 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 +888 -1024
- 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 +233 -104
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -5
- 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 +31 -31
- data/test/rubygems/test_gem_version_option.rb +16 -18
- data/test/rubygems/test_kernel.rb +46 -60
- 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 +240 -167
- data/test/rubygems/test_rubygems.rb +74 -0
- data/{lib/rubygems/test_utilities.rb → test/rubygems/utilities.rb} +30 -39
- data/test/test_changelog_generator.rb +17 -0
- metadata +158 -146
- data/.bundle/config +0 -2
- data/.rubocop.yml +0 -91
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -43
- data/Rakefile +0 -428
- data/bundler/CODE_OF_CONDUCT.md +0 -136
- data/bundler/lib/bundler/gemdeps.rb +0 -29
- data/bundler/lib/bundler/psyched_yaml.rb +0 -37
- 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/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.txt +0 -91
- 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-clean.ronn → lib/bundler/man/bundle-clean.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-init.ronn → lib/bundler/man/bundle-init.1.ronn} +0 -0
- /data/bundler/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- /data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.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"
|
213
|
+
a1 = util_spec "a", "1", nil, "lib/a1.rb"
|
235
214
|
|
236
|
-
|
237
|
-
|
238
|
-
assert_raises ::LoadError do
|
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"]
|
360
|
+
end
|
361
|
+
|
362
|
+
bundler_previous = util_spec "bundler", "2.0.0" do |s|
|
363
|
+
s.executables = ["bundle"]
|
329
364
|
end
|
330
365
|
|
331
|
-
install_specs
|
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
|
@@ -596,22 +617,22 @@ class TestGem < Gem::TestCase
|
|
596
617
|
end
|
597
618
|
|
598
619
|
def test_self_use_gemdeps
|
599
|
-
|
620
|
+
with_rubygems_gemdeps("-") do
|
621
|
+
FileUtils.mkdir_p "detect/a/b"
|
622
|
+
FileUtils.mkdir_p "detect/a/Isolate"
|
600
623
|
|
601
|
-
|
602
|
-
FileUtils.mkdir_p 'detect/a/Isolate'
|
624
|
+
FileUtils.touch "detect/Isolate"
|
603
625
|
|
604
|
-
|
626
|
+
begin
|
627
|
+
Dir.chdir "detect/a/b"
|
605
628
|
|
606
|
-
|
607
|
-
Dir.chdir 'detect/a/b'
|
629
|
+
Gem.use_gemdeps
|
608
630
|
|
609
|
-
|
610
|
-
|
611
|
-
|
631
|
+
assert_equal add_bundler_full_name([]), loaded_spec_names
|
632
|
+
ensure
|
633
|
+
Dir.chdir @tempdir
|
634
|
+
end
|
612
635
|
end
|
613
|
-
ensure
|
614
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
615
636
|
end
|
616
637
|
|
617
638
|
def test_self_dir
|
@@ -624,12 +645,12 @@ class TestGem < Gem::TestCase
|
|
624
645
|
|
625
646
|
Gem.ensure_gem_subdirectories @gemhome
|
626
647
|
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
648
|
+
assert_path_exist File.join @gemhome, "build_info"
|
649
|
+
assert_path_exist File.join @gemhome, "cache"
|
650
|
+
assert_path_exist File.join @gemhome, "doc"
|
651
|
+
assert_path_exist File.join @gemhome, "extensions"
|
652
|
+
assert_path_exist File.join @gemhome, "gems"
|
653
|
+
assert_path_exist File.join @gemhome, "specifications"
|
633
654
|
end
|
634
655
|
|
635
656
|
def test_self_ensure_gem_directories_permissions
|
@@ -659,9 +680,9 @@ class TestGem < Gem::TestCase
|
|
659
680
|
end unless win_platform?
|
660
681
|
|
661
682
|
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,
|
683
|
+
gemdir = File.join @tempdir, "a/b/c/gemdir"
|
684
|
+
FileUtils.rm_rf File.join(@tempdir, "a") rescue nil
|
685
|
+
refute File.exist?(File.join(@tempdir, "a")),
|
665
686
|
"manually remove #{File.join @tempdir, 'a'}, tests are broken"
|
666
687
|
Gem.use_paths gemdir
|
667
688
|
|
@@ -670,7 +691,7 @@ class TestGem < Gem::TestCase
|
|
670
691
|
assert_directory_exists util_cache_dir
|
671
692
|
end
|
672
693
|
|
673
|
-
unless win_platform? || Process.uid.zero?
|
694
|
+
unless win_platform? || Process.uid.zero? # only for FS that support write protection
|
674
695
|
def test_self_ensure_gem_directories_write_protected
|
675
696
|
gemdir = File.join @tempdir, "egd"
|
676
697
|
FileUtils.rm_r gemdir rescue nil
|
@@ -702,16 +723,21 @@ class TestGem < Gem::TestCase
|
|
702
723
|
ensure
|
703
724
|
FileUtils.chmod 0600, parent
|
704
725
|
end
|
726
|
+
|
727
|
+
def test_self_ensure_gem_directories_non_existent_paths
|
728
|
+
Gem.ensure_gem_subdirectories "/proc/0123456789/bogus" # should not raise
|
729
|
+
Gem.ensure_gem_subdirectories "classpath:/bogus/x" # JRuby embed scenario
|
730
|
+
end
|
705
731
|
end
|
706
732
|
|
707
733
|
def test_self_extension_dir_shared
|
708
|
-
enable_shared
|
734
|
+
enable_shared "yes" do
|
709
735
|
assert_equal Gem.ruby_api_version, Gem.extension_api_version
|
710
736
|
end
|
711
737
|
end
|
712
738
|
|
713
739
|
def test_self_extension_dir_static
|
714
|
-
enable_shared
|
740
|
+
enable_shared "no" do
|
715
741
|
assert_equal "#{Gem.ruby_api_version}-static", Gem.extension_api_version
|
716
742
|
end
|
717
743
|
end
|
@@ -720,14 +746,14 @@ class TestGem < Gem::TestCase
|
|
720
746
|
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
721
747
|
$LOAD_PATH.unshift cwd
|
722
748
|
|
723
|
-
discover_path = File.join
|
749
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
724
750
|
|
725
|
-
foo1, foo2 = %w
|
726
|
-
spec = quick_gem
|
751
|
+
foo1, foo2 = %w[1 2].map do |version|
|
752
|
+
spec = quick_gem "sff", version do |s|
|
727
753
|
s.files << discover_path
|
728
754
|
end
|
729
755
|
|
730
|
-
write_file(File.join
|
756
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
731
757
|
fp.puts "# #{spec.full_name}"
|
732
758
|
end
|
733
759
|
|
@@ -737,13 +763,13 @@ class TestGem < Gem::TestCase
|
|
737
763
|
Gem.refresh
|
738
764
|
|
739
765
|
expected = [
|
740
|
-
File.expand_path(
|
766
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
741
767
|
File.join(foo2.full_gem_path, discover_path),
|
742
768
|
File.join(foo1.full_gem_path, discover_path),
|
743
769
|
]
|
744
770
|
|
745
|
-
assert_equal expected, Gem.find_files(
|
746
|
-
assert_equal expected, Gem.find_files(
|
771
|
+
assert_equal expected, Gem.find_files("sff/discover")
|
772
|
+
assert_equal expected, Gem.find_files("sff/**.rb"), "[ruby-core:31730]"
|
747
773
|
ensure
|
748
774
|
assert_equal cwd, $LOAD_PATH.shift
|
749
775
|
end
|
@@ -752,14 +778,14 @@ class TestGem < Gem::TestCase
|
|
752
778
|
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
753
779
|
actual_load_path = $LOAD_PATH.unshift(cwd).dup
|
754
780
|
|
755
|
-
discover_path = File.join
|
781
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
756
782
|
|
757
|
-
foo1, _ = %w
|
758
|
-
spec = quick_gem
|
783
|
+
foo1, _ = %w[1 2].map do |version|
|
784
|
+
spec = quick_gem "sff", version do |s|
|
759
785
|
s.files << discover_path
|
760
786
|
end
|
761
787
|
|
762
|
-
write_file(File.join
|
788
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
763
789
|
fp.puts "# #{spec.full_name}"
|
764
790
|
end
|
765
791
|
|
@@ -767,19 +793,19 @@ class TestGem < Gem::TestCase
|
|
767
793
|
end
|
768
794
|
Gem.refresh
|
769
795
|
|
770
|
-
write_file(File.join Dir.pwd,
|
796
|
+
write_file(File.join Dir.pwd, "Gemfile") do |fp|
|
771
797
|
fp.puts "source 'https://rubygems.org'"
|
772
798
|
fp.puts "gem '#{foo1.name}', '#{foo1.version}'"
|
773
799
|
end
|
774
|
-
Gem.use_gemdeps(File.join Dir.pwd,
|
800
|
+
Gem.use_gemdeps(File.join Dir.pwd, "Gemfile")
|
775
801
|
|
776
802
|
expected = [
|
777
|
-
File.expand_path(
|
778
|
-
File.join(foo1.full_gem_path, discover_path)
|
803
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
804
|
+
File.join(foo1.full_gem_path, discover_path),
|
779
805
|
].sort
|
780
806
|
|
781
|
-
assert_equal expected, Gem.find_files(
|
782
|
-
assert_equal expected, Gem.find_files(
|
807
|
+
assert_equal expected, Gem.find_files("sff/discover").sort
|
808
|
+
assert_equal expected, Gem.find_files("sff/**.rb").sort, "[ruby-core:31730]"
|
783
809
|
ensure
|
784
810
|
assert_equal cwd, actual_load_path.shift unless Gem.java_platform?
|
785
811
|
end
|
@@ -788,14 +814,14 @@ class TestGem < Gem::TestCase
|
|
788
814
|
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
789
815
|
$LOAD_PATH.unshift cwd
|
790
816
|
|
791
|
-
discover_path = File.join
|
817
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
792
818
|
|
793
|
-
_, foo2 = %w
|
794
|
-
spec = quick_gem
|
819
|
+
_, foo2 = %w[1 2].map do |version|
|
820
|
+
spec = quick_gem "sff", version do |s|
|
795
821
|
s.files << discover_path
|
796
822
|
end
|
797
823
|
|
798
|
-
write_file(File.join
|
824
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
799
825
|
fp.puts "# #{spec.full_name}"
|
800
826
|
end
|
801
827
|
|
@@ -805,64 +831,103 @@ class TestGem < Gem::TestCase
|
|
805
831
|
Gem.refresh
|
806
832
|
|
807
833
|
expected = [
|
808
|
-
File.expand_path(
|
834
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
809
835
|
File.join(foo2.full_gem_path, discover_path),
|
810
836
|
]
|
811
837
|
|
812
|
-
assert_equal expected, Gem.find_latest_files(
|
813
|
-
assert_equal expected, Gem.find_latest_files(
|
838
|
+
assert_equal expected, Gem.find_latest_files("sff/discover")
|
839
|
+
assert_equal expected, Gem.find_latest_files("sff/**.rb"), "[ruby-core:31730]"
|
814
840
|
ensure
|
815
841
|
assert_equal cwd, $LOAD_PATH.shift
|
816
842
|
end
|
817
843
|
|
818
844
|
def test_self_latest_spec_for
|
819
845
|
gems = spec_fetcher do |fetcher|
|
820
|
-
fetcher.spec
|
821
|
-
fetcher.spec
|
822
|
-
fetcher.spec
|
846
|
+
fetcher.spec "a", 1
|
847
|
+
fetcher.spec "a", "3.a"
|
848
|
+
fetcher.spec "a", 2
|
823
849
|
end
|
824
850
|
|
825
|
-
spec = Gem.latest_spec_for
|
851
|
+
spec = Gem.latest_spec_for "a"
|
826
852
|
|
827
|
-
assert_equal gems[
|
853
|
+
assert_equal gems["a-2"], spec
|
854
|
+
end
|
855
|
+
|
856
|
+
def test_self_latest_spec_for_multiple_sources
|
857
|
+
uri = "https://example.sample.com/"
|
858
|
+
source = Gem::Source.new(uri)
|
859
|
+
source_list = Gem::SourceList.new
|
860
|
+
source_list << Gem::Source.new(@uri)
|
861
|
+
source_list << source
|
862
|
+
Gem.sources.replace source_list
|
863
|
+
|
864
|
+
spec_fetcher(uri) do |fetcher|
|
865
|
+
fetcher.spec "a", 1.1
|
866
|
+
end
|
867
|
+
|
868
|
+
gems = spec_fetcher do |fetcher|
|
869
|
+
fetcher.spec "a", 1
|
870
|
+
fetcher.spec "a", "3.a"
|
871
|
+
fetcher.spec "a", 2
|
872
|
+
end
|
873
|
+
spec = Gem.latest_spec_for "a"
|
874
|
+
assert_equal gems["a-2"], spec
|
828
875
|
end
|
829
876
|
|
830
877
|
def test_self_latest_rubygems_version
|
831
878
|
spec_fetcher do |fetcher|
|
832
|
-
fetcher.spec
|
833
|
-
fetcher.spec
|
834
|
-
fetcher.spec
|
879
|
+
fetcher.spec "rubygems-update", "1.8.23"
|
880
|
+
fetcher.spec "rubygems-update", "1.8.24"
|
881
|
+
fetcher.spec "rubygems-update", "2.0.0.preview3"
|
835
882
|
end
|
836
883
|
|
837
884
|
version = Gem.latest_rubygems_version
|
838
885
|
|
839
|
-
assert_equal Gem::Version.new(
|
886
|
+
assert_equal Gem::Version.new("1.8.24"), version
|
840
887
|
end
|
841
888
|
|
842
889
|
def test_self_latest_version_for
|
843
890
|
spec_fetcher do |fetcher|
|
844
|
-
fetcher.spec
|
845
|
-
fetcher.spec
|
846
|
-
fetcher.spec
|
891
|
+
fetcher.spec "a", 1
|
892
|
+
fetcher.spec "a", 2
|
893
|
+
fetcher.spec "a", "3.a"
|
894
|
+
end
|
895
|
+
|
896
|
+
version = Gem.latest_version_for "a"
|
897
|
+
|
898
|
+
assert_equal Gem::Version.new(2), version
|
899
|
+
end
|
900
|
+
|
901
|
+
def test_self_latest_version_for_multiple_sources
|
902
|
+
uri = "https://example.sample.com/"
|
903
|
+
source = Gem::Source.new(uri)
|
904
|
+
source_list = Gem::SourceList.new
|
905
|
+
source_list << Gem::Source.new(@uri)
|
906
|
+
source_list << source
|
907
|
+
Gem.sources.replace source_list
|
908
|
+
|
909
|
+
spec_fetcher(uri) do |fetcher|
|
910
|
+
fetcher.spec "a", 1.1
|
911
|
+
end
|
912
|
+
|
913
|
+
spec_fetcher do |fetcher|
|
914
|
+
fetcher.spec "a", 1
|
915
|
+
fetcher.spec "a", 2
|
916
|
+
fetcher.spec "a", "3.a"
|
847
917
|
end
|
848
918
|
|
849
|
-
version = Gem.latest_version_for
|
919
|
+
version = Gem.latest_version_for "a"
|
850
920
|
|
851
921
|
assert_equal Gem::Version.new(2), version
|
852
922
|
end
|
853
923
|
|
854
924
|
def test_self_loaded_specs
|
855
|
-
foo = util_spec
|
925
|
+
foo = util_spec "foo"
|
856
926
|
install_gem foo
|
857
927
|
|
858
928
|
foo.activate
|
859
929
|
|
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"
|
930
|
+
assert_equal true, Gem.loaded_specs.keys.include?("foo")
|
866
931
|
end
|
867
932
|
|
868
933
|
def test_self_path
|
@@ -870,53 +935,19 @@ class TestGem < Gem::TestCase
|
|
870
935
|
end
|
871
936
|
|
872
937
|
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
|
938
|
+
ENV.delete "GEM_HOME"
|
939
|
+
ENV.delete "GEM_PATH"
|
879
940
|
|
880
941
|
Gem.instance_variable_set :@paths, nil
|
881
942
|
|
882
943
|
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
944
|
end
|
914
945
|
|
915
946
|
def test_self_path_ENV_PATH
|
916
947
|
path_count = Gem.path.size
|
917
948
|
Gem.clear_paths
|
918
949
|
|
919
|
-
ENV[
|
950
|
+
ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
|
920
951
|
|
921
952
|
assert_equal @additional, Gem.path[0,2]
|
922
953
|
|
@@ -928,10 +959,10 @@ class TestGem < Gem::TestCase
|
|
928
959
|
def test_self_path_duplicate
|
929
960
|
Gem.clear_paths
|
930
961
|
util_ensure_gem_dirs
|
931
|
-
dirs = @additional + [@gemhome] + [File.join(@tempdir,
|
962
|
+
dirs = @additional + [@gemhome] + [File.join(@tempdir, "a")]
|
932
963
|
|
933
|
-
ENV[
|
934
|
-
ENV[
|
964
|
+
ENV["GEM_HOME"] = @gemhome
|
965
|
+
ENV["GEM_PATH"] = dirs.join File::PATH_SEPARATOR
|
935
966
|
|
936
967
|
assert_equal @gemhome, Gem.dir
|
937
968
|
|
@@ -943,8 +974,8 @@ class TestGem < Gem::TestCase
|
|
943
974
|
Gem.clear_paths
|
944
975
|
|
945
976
|
util_ensure_gem_dirs
|
946
|
-
ENV[
|
947
|
-
ENV[
|
977
|
+
ENV["GEM_HOME"] = @gemhome
|
978
|
+
ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
|
948
979
|
|
949
980
|
assert_equal @gemhome, Gem.dir
|
950
981
|
|
@@ -961,38 +992,38 @@ class TestGem < Gem::TestCase
|
|
961
992
|
end
|
962
993
|
|
963
994
|
def test_self_prefix_libdir
|
964
|
-
orig_libdir = RbConfig::CONFIG[
|
965
|
-
RbConfig::CONFIG[
|
995
|
+
orig_libdir = RbConfig::CONFIG["libdir"]
|
996
|
+
RbConfig::CONFIG["libdir"] = PROJECT_DIR
|
966
997
|
|
967
998
|
assert_nil Gem.prefix
|
968
999
|
ensure
|
969
|
-
RbConfig::CONFIG[
|
1000
|
+
RbConfig::CONFIG["libdir"] = orig_libdir
|
970
1001
|
end
|
971
1002
|
|
972
1003
|
def test_self_prefix_sitelibdir
|
973
|
-
orig_sitelibdir = RbConfig::CONFIG[
|
974
|
-
RbConfig::CONFIG[
|
1004
|
+
orig_sitelibdir = RbConfig::CONFIG["sitelibdir"]
|
1005
|
+
RbConfig::CONFIG["sitelibdir"] = PROJECT_DIR
|
975
1006
|
|
976
1007
|
assert_nil Gem.prefix
|
977
1008
|
ensure
|
978
|
-
RbConfig::CONFIG[
|
1009
|
+
RbConfig::CONFIG["sitelibdir"] = orig_sitelibdir
|
979
1010
|
end
|
980
1011
|
|
981
1012
|
def test_self_read_binary
|
982
|
-
File.open
|
1013
|
+
File.open "test", "w" do |io|
|
983
1014
|
io.write "\xCF\x80"
|
984
1015
|
end
|
985
1016
|
|
986
|
-
assert_equal ["\xCF", "\x80"], Gem.read_binary(
|
1017
|
+
assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
|
987
1018
|
|
988
|
-
|
1019
|
+
pend "chmod not supported" if Gem.win_platform?
|
989
1020
|
|
990
1021
|
begin
|
991
|
-
File.chmod 0444,
|
1022
|
+
File.chmod 0444, "test"
|
992
1023
|
|
993
|
-
assert_equal ["\xCF", "\x80"], Gem.read_binary(
|
1024
|
+
assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
|
994
1025
|
ensure
|
995
|
-
File.chmod 0644,
|
1026
|
+
File.chmod 0644, "test"
|
996
1027
|
end
|
997
1028
|
end
|
998
1029
|
|
@@ -1030,111 +1061,95 @@ class TestGem < Gem::TestCase
|
|
1030
1061
|
|
1031
1062
|
Gem.refresh
|
1032
1063
|
|
1033
|
-
Gem::Specification.each{|spec| assert spec.activated? if spec == s}
|
1064
|
+
Gem::Specification.each {|spec| assert spec.activated? if spec == s }
|
1034
1065
|
|
1035
1066
|
Gem.loaded_specs.delete(s)
|
1036
1067
|
Gem.refresh
|
1037
1068
|
end
|
1038
1069
|
|
1039
1070
|
def test_self_ruby_escaping_spaces_in_path
|
1040
|
-
|
1041
|
-
|
1071
|
+
with_clean_path_to_ruby do
|
1072
|
+
with_rb_config_ruby("C:/Ruby 1.8/bin/ruby.exe") do
|
1042
1073
|
assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby
|
1043
1074
|
end
|
1044
1075
|
end
|
1045
1076
|
end
|
1046
1077
|
|
1047
1078
|
def test_self_ruby_path_without_spaces
|
1048
|
-
|
1049
|
-
|
1079
|
+
with_clean_path_to_ruby do
|
1080
|
+
with_rb_config_ruby("C:/Ruby18/bin/ruby.exe") do
|
1050
1081
|
assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby
|
1051
1082
|
end
|
1052
1083
|
end
|
1053
1084
|
end
|
1054
1085
|
|
1055
1086
|
def test_self_ruby_api_version
|
1056
|
-
orig_ruby_version, RbConfig::CONFIG[
|
1087
|
+
orig_ruby_version, RbConfig::CONFIG["ruby_version"] = RbConfig::CONFIG["ruby_version"], "1.2.3"
|
1057
1088
|
|
1058
1089
|
Gem.instance_variable_set :@ruby_api_version, nil
|
1059
1090
|
|
1060
|
-
assert_equal
|
1091
|
+
assert_equal "1.2.3", Gem.ruby_api_version
|
1061
1092
|
ensure
|
1062
1093
|
Gem.instance_variable_set :@ruby_api_version, nil
|
1063
1094
|
|
1064
|
-
RbConfig::CONFIG[
|
1095
|
+
RbConfig::CONFIG["ruby_version"] = orig_ruby_version
|
1065
1096
|
end
|
1066
1097
|
|
1067
1098
|
def test_self_env_requirement
|
1068
|
-
ENV["GEM_REQUIREMENT_FOO"] =
|
1069
|
-
ENV["GEM_REQUIREMENT_BAR"] =
|
1070
|
-
ENV["GEM_REQUIREMENT_BAZ"] =
|
1071
|
-
|
1072
|
-
assert_equal Gem::Requirement.create('>= 1.2.3'), Gem.env_requirement('foo')
|
1073
|
-
assert_equal Gem::Requirement.create('1.2.3'), Gem.env_requirement('bAr')
|
1074
|
-
assert_raises(Gem::Requirement::BadRequirementError) { Gem.env_requirement('baz') }
|
1075
|
-
assert_equal Gem::Requirement.default, Gem.env_requirement('qux')
|
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
|
1099
|
+
ENV["GEM_REQUIREMENT_FOO"] = ">= 1.2.3"
|
1100
|
+
ENV["GEM_REQUIREMENT_BAR"] = "1.2.3"
|
1101
|
+
ENV["GEM_REQUIREMENT_BAZ"] = "abcd"
|
1088
1102
|
|
1089
|
-
assert_equal Gem::
|
1090
|
-
|
1091
|
-
|
1103
|
+
assert_equal Gem::Requirement.create(">= 1.2.3"), Gem.env_requirement("foo")
|
1104
|
+
assert_equal Gem::Requirement.create("1.2.3"), Gem.env_requirement("bAr")
|
1105
|
+
assert_raise(Gem::Requirement::BadRequirementError) { Gem.env_requirement("baz") }
|
1106
|
+
assert_equal Gem::Requirement.default, Gem.env_requirement("qux")
|
1092
1107
|
end
|
1093
1108
|
|
1094
1109
|
def test_self_ruby_version_with_non_mri_implementations
|
1095
|
-
util_set_RUBY_VERSION
|
1110
|
+
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
1111
|
|
1097
|
-
assert_equal Gem::Version.new(
|
1112
|
+
assert_equal Gem::Version.new("2.5.0"), Gem.ruby_version
|
1098
1113
|
ensure
|
1099
1114
|
util_restore_RUBY_VERSION
|
1100
1115
|
end
|
1101
1116
|
|
1102
1117
|
def test_self_ruby_version_with_svn_prerelease
|
1103
|
-
util_set_RUBY_VERSION
|
1118
|
+
util_set_RUBY_VERSION "2.6.0", -1, 63539, "ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]"
|
1104
1119
|
|
1105
|
-
assert_equal Gem::Version.new(
|
1120
|
+
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
|
1106
1121
|
ensure
|
1107
1122
|
util_restore_RUBY_VERSION
|
1108
1123
|
end
|
1109
1124
|
|
1110
1125
|
def test_self_ruby_version_with_git_prerelease
|
1111
|
-
util_set_RUBY_VERSION
|
1126
|
+
util_set_RUBY_VERSION "2.7.0", -1, "b563439274a402e33541f5695b1bfd4ac1085638", "ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]"
|
1112
1127
|
|
1113
|
-
assert_equal Gem::Version.new(
|
1128
|
+
assert_equal Gem::Version.new("2.7.0.preview3"), Gem.ruby_version
|
1114
1129
|
ensure
|
1115
1130
|
util_restore_RUBY_VERSION
|
1116
1131
|
end
|
1117
1132
|
|
1118
1133
|
def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
|
1119
|
-
util_set_RUBY_VERSION
|
1134
|
+
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
1135
|
|
1121
|
-
assert_equal Gem::Version.new(
|
1136
|
+
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
|
1122
1137
|
ensure
|
1123
1138
|
util_restore_RUBY_VERSION
|
1124
1139
|
end
|
1125
1140
|
|
1126
1141
|
def test_self_ruby_version_with_svn_trunk
|
1127
|
-
util_set_RUBY_VERSION
|
1142
|
+
util_set_RUBY_VERSION "1.9.2", -1, 23493, "ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]"
|
1128
1143
|
|
1129
|
-
assert_equal Gem::Version.new(
|
1144
|
+
assert_equal Gem::Version.new("1.9.2.dev"), Gem.ruby_version
|
1130
1145
|
ensure
|
1131
1146
|
util_restore_RUBY_VERSION
|
1132
1147
|
end
|
1133
1148
|
|
1134
1149
|
def test_self_ruby_version_with_git_master
|
1135
|
-
util_set_RUBY_VERSION
|
1150
|
+
util_set_RUBY_VERSION "2.7.0", -1, "5de284ec78220e75643f89b454ce999da0c1c195", "ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]"
|
1136
1151
|
|
1137
|
-
assert_equal Gem::Version.new(
|
1152
|
+
assert_equal Gem::Version.new("2.7.0.dev"), Gem.ruby_version
|
1138
1153
|
ensure
|
1139
1154
|
util_restore_RUBY_VERSION
|
1140
1155
|
end
|
@@ -1144,7 +1159,7 @@ class TestGem < Gem::TestCase
|
|
1144
1159
|
end
|
1145
1160
|
|
1146
1161
|
def test_self_paths_eq
|
1147
|
-
other = File.join @tempdir,
|
1162
|
+
other = File.join @tempdir, "other"
|
1148
1163
|
path = [@userhome, other].join File::PATH_SEPARATOR
|
1149
1164
|
|
1150
1165
|
#
|
@@ -1157,12 +1172,12 @@ class TestGem < Gem::TestCase
|
|
1157
1172
|
end
|
1158
1173
|
|
1159
1174
|
def test_self_paths_eq_nonexistent_home
|
1160
|
-
ENV[
|
1175
|
+
ENV["GEM_HOME"] = @gemhome
|
1161
1176
|
Gem.clear_paths
|
1162
1177
|
|
1163
|
-
other = File.join @tempdir,
|
1178
|
+
other = File.join @tempdir, "other"
|
1164
1179
|
|
1165
|
-
ENV[
|
1180
|
+
ENV["HOME"] = other
|
1166
1181
|
|
1167
1182
|
Gem.paths = { "GEM_PATH" => other }
|
1168
1183
|
|
@@ -1172,7 +1187,7 @@ class TestGem < Gem::TestCase
|
|
1172
1187
|
def test_self_post_build
|
1173
1188
|
assert_equal 1, Gem.post_build_hooks.length
|
1174
1189
|
|
1175
|
-
Gem.post_build {
|
1190
|
+
Gem.post_build {|installer| }
|
1176
1191
|
|
1177
1192
|
assert_equal 2, Gem.post_build_hooks.length
|
1178
1193
|
end
|
@@ -1180,7 +1195,7 @@ class TestGem < Gem::TestCase
|
|
1180
1195
|
def test_self_post_install
|
1181
1196
|
assert_equal 1, Gem.post_install_hooks.length
|
1182
1197
|
|
1183
|
-
Gem.post_install {
|
1198
|
+
Gem.post_install {|installer| }
|
1184
1199
|
|
1185
1200
|
assert_equal 2, Gem.post_install_hooks.length
|
1186
1201
|
end
|
@@ -1188,7 +1203,7 @@ class TestGem < Gem::TestCase
|
|
1188
1203
|
def test_self_done_installing
|
1189
1204
|
assert_empty Gem.done_installing_hooks
|
1190
1205
|
|
1191
|
-
Gem.done_installing {
|
1206
|
+
Gem.done_installing {|gems| }
|
1192
1207
|
|
1193
1208
|
assert_equal 1, Gem.done_installing_hooks.length
|
1194
1209
|
end
|
@@ -1196,7 +1211,7 @@ class TestGem < Gem::TestCase
|
|
1196
1211
|
def test_self_post_reset
|
1197
1212
|
assert_empty Gem.post_reset_hooks
|
1198
1213
|
|
1199
|
-
Gem.post_reset {
|
1214
|
+
Gem.post_reset {}
|
1200
1215
|
|
1201
1216
|
assert_equal 1, Gem.post_reset_hooks.length
|
1202
1217
|
end
|
@@ -1204,7 +1219,7 @@ class TestGem < Gem::TestCase
|
|
1204
1219
|
def test_self_post_uninstall
|
1205
1220
|
assert_equal 1, Gem.post_uninstall_hooks.length
|
1206
1221
|
|
1207
|
-
Gem.post_uninstall {
|
1222
|
+
Gem.post_uninstall {|installer| }
|
1208
1223
|
|
1209
1224
|
assert_equal 2, Gem.post_uninstall_hooks.length
|
1210
1225
|
end
|
@@ -1212,7 +1227,7 @@ class TestGem < Gem::TestCase
|
|
1212
1227
|
def test_self_pre_install
|
1213
1228
|
assert_equal 1, Gem.pre_install_hooks.length
|
1214
1229
|
|
1215
|
-
Gem.pre_install {
|
1230
|
+
Gem.pre_install {|installer| }
|
1216
1231
|
|
1217
1232
|
assert_equal 2, Gem.pre_install_hooks.length
|
1218
1233
|
end
|
@@ -1220,7 +1235,7 @@ class TestGem < Gem::TestCase
|
|
1220
1235
|
def test_self_pre_reset
|
1221
1236
|
assert_empty Gem.pre_reset_hooks
|
1222
1237
|
|
1223
|
-
Gem.pre_reset {
|
1238
|
+
Gem.pre_reset {}
|
1224
1239
|
|
1225
1240
|
assert_equal 1, Gem.pre_reset_hooks.length
|
1226
1241
|
end
|
@@ -1228,7 +1243,7 @@ class TestGem < Gem::TestCase
|
|
1228
1243
|
def test_self_pre_uninstall
|
1229
1244
|
assert_equal 1, Gem.pre_uninstall_hooks.length
|
1230
1245
|
|
1231
|
-
Gem.pre_uninstall {
|
1246
|
+
Gem.pre_uninstall {|installer| }
|
1232
1247
|
|
1233
1248
|
assert_equal 2, Gem.pre_uninstall_hooks.length
|
1234
1249
|
end
|
@@ -1241,73 +1256,74 @@ class TestGem < Gem::TestCase
|
|
1241
1256
|
end
|
1242
1257
|
|
1243
1258
|
def test_try_activate_returns_true_for_activated_specs
|
1244
|
-
b = util_spec
|
1245
|
-
spec.files <<
|
1259
|
+
b = util_spec "b", "1.0" do |spec|
|
1260
|
+
spec.files << "lib/b.rb"
|
1246
1261
|
end
|
1247
1262
|
install_specs b
|
1248
1263
|
|
1249
|
-
assert Gem.try_activate(
|
1250
|
-
assert Gem.try_activate(
|
1264
|
+
assert Gem.try_activate("b"), "try_activate should return true"
|
1265
|
+
assert Gem.try_activate("b"), "try_activate should still return true"
|
1251
1266
|
end
|
1252
1267
|
|
1253
1268
|
def test_spec_order_is_consistent
|
1254
|
-
b1 = util_spec
|
1255
|
-
b2 = util_spec
|
1256
|
-
b3 = util_spec
|
1269
|
+
b1 = util_spec "b", "1.0"
|
1270
|
+
b2 = util_spec "b", "2.0"
|
1271
|
+
b3 = util_spec "b", "3.0"
|
1257
1272
|
|
1258
1273
|
install_specs b1, b2, b3
|
1259
1274
|
|
1260
|
-
specs1 = Gem::Specification.stubs.find_all {
|
1275
|
+
specs1 = Gem::Specification.stubs.find_all {|s| s.name == "b" }
|
1261
1276
|
Gem::Specification.reset
|
1262
|
-
specs2 = Gem::Specification.stubs_for(
|
1277
|
+
specs2 = Gem::Specification.stubs_for("b")
|
1263
1278
|
assert_equal specs1.map(&:version), specs2.map(&:version)
|
1264
1279
|
end
|
1265
1280
|
|
1266
1281
|
def test_self_try_activate_missing_dep
|
1267
|
-
b = util_spec
|
1268
|
-
a = util_spec
|
1282
|
+
b = util_spec "b", "1.0"
|
1283
|
+
a = util_spec "a", "1.0", "b" => ">= 1.0"
|
1269
1284
|
|
1270
1285
|
install_specs b, a
|
1271
1286
|
uninstall_gem b
|
1272
1287
|
|
1273
|
-
a_file = File.join a.gem_dir,
|
1288
|
+
a_file = File.join a.gem_dir, "lib", "a_file.rb"
|
1274
1289
|
|
1275
1290
|
write_file a_file do |io|
|
1276
|
-
io.puts
|
1291
|
+
io.puts "# a_file.rb"
|
1277
1292
|
end
|
1278
1293
|
|
1279
|
-
e =
|
1280
|
-
Gem.try_activate
|
1294
|
+
e = assert_raise Gem::MissingSpecError do
|
1295
|
+
Gem.try_activate "a_file"
|
1281
1296
|
end
|
1282
1297
|
|
1283
|
-
assert_match %r
|
1298
|
+
assert_match %r{Could not find 'b' }, e.message
|
1299
|
+
assert_match %r{at: #{a.spec_file}}, e.message
|
1284
1300
|
end
|
1285
1301
|
|
1286
1302
|
def test_self_try_activate_missing_prerelease
|
1287
|
-
b = util_spec
|
1288
|
-
a = util_spec
|
1303
|
+
b = util_spec "b", "1.0rc1"
|
1304
|
+
a = util_spec "a", "1.0rc1", "b" => "1.0rc1"
|
1289
1305
|
|
1290
1306
|
install_specs b, a
|
1291
1307
|
uninstall_gem b
|
1292
1308
|
|
1293
|
-
a_file = File.join a.gem_dir,
|
1309
|
+
a_file = File.join a.gem_dir, "lib", "a_file.rb"
|
1294
1310
|
|
1295
1311
|
write_file a_file do |io|
|
1296
|
-
io.puts
|
1312
|
+
io.puts "# a_file.rb"
|
1297
1313
|
end
|
1298
1314
|
|
1299
|
-
e =
|
1300
|
-
Gem.try_activate
|
1315
|
+
e = assert_raise Gem::MissingSpecError do
|
1316
|
+
Gem.try_activate "a_file"
|
1301
1317
|
end
|
1302
1318
|
|
1303
|
-
assert_match %r
|
1319
|
+
assert_match %r{Could not find 'b' \(= 1.0rc1\)}, e.message
|
1304
1320
|
end
|
1305
1321
|
|
1306
1322
|
def test_self_try_activate_missing_extensions
|
1307
|
-
spec = util_spec
|
1323
|
+
spec = util_spec "ext", "1" do |s|
|
1308
1324
|
s.extensions = %w[ext/extconf.rb]
|
1309
1325
|
s.mark_version
|
1310
|
-
s.installed_by_version = v(
|
1326
|
+
s.installed_by_version = v("2.2")
|
1311
1327
|
end
|
1312
1328
|
|
1313
1329
|
# write the spec without install to simulate a failed install
|
@@ -1315,8 +1331,8 @@ class TestGem < Gem::TestCase
|
|
1315
1331
|
io.write spec.to_ruby_for_cache
|
1316
1332
|
end
|
1317
1333
|
|
1318
|
-
_, err =
|
1319
|
-
refute Gem.try_activate
|
1334
|
+
_, err = capture_output do
|
1335
|
+
refute Gem.try_activate "nonexistent"
|
1320
1336
|
end
|
1321
1337
|
|
1322
1338
|
unless Gem.java_platform?
|
@@ -1328,43 +1344,43 @@ class TestGem < Gem::TestCase
|
|
1328
1344
|
end
|
1329
1345
|
|
1330
1346
|
def test_self_use_paths_with_nils
|
1331
|
-
orig_home = ENV.delete
|
1332
|
-
orig_path = ENV.delete
|
1347
|
+
orig_home = ENV.delete "GEM_HOME"
|
1348
|
+
orig_path = ENV.delete "GEM_PATH"
|
1333
1349
|
Gem.use_paths nil, nil
|
1334
1350
|
assert_equal Gem.default_dir, Gem.paths.home
|
1335
1351
|
path = (Gem.default_path + [Gem.paths.home]).uniq
|
1336
1352
|
assert_equal path, Gem.paths.path
|
1337
1353
|
ensure
|
1338
|
-
ENV[
|
1339
|
-
ENV[
|
1354
|
+
ENV["GEM_HOME"] = orig_home
|
1355
|
+
ENV["GEM_PATH"] = orig_path
|
1340
1356
|
end
|
1341
1357
|
|
1342
1358
|
def test_setting_paths_does_not_warn_about_unknown_keys
|
1343
|
-
stdout, stderr =
|
1344
|
-
Gem.paths = {
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1359
|
+
stdout, stderr = capture_output do
|
1360
|
+
Gem.paths = { "foo" => [],
|
1361
|
+
"bar" => Object.new,
|
1362
|
+
"GEM_HOME" => Gem.paths.home,
|
1363
|
+
"GEM_PATH" => "foo" }
|
1348
1364
|
end
|
1349
|
-
assert_equal [
|
1350
|
-
assert_equal
|
1351
|
-
assert_equal
|
1365
|
+
assert_equal ["foo", Gem.paths.home], Gem.paths.path
|
1366
|
+
assert_equal "", stderr
|
1367
|
+
assert_equal "", stdout
|
1352
1368
|
end
|
1353
1369
|
|
1354
1370
|
def test_setting_paths_does_not_mutate_parameter_object
|
1355
|
-
Gem.paths = {
|
1356
|
-
|
1357
|
-
assert_equal [
|
1371
|
+
Gem.paths = { "GEM_HOME" => Gem.paths.home,
|
1372
|
+
"GEM_PATH" => "foo" }.freeze
|
1373
|
+
assert_equal ["foo", Gem.paths.home], Gem.paths.path
|
1358
1374
|
end
|
1359
1375
|
|
1360
1376
|
def test_deprecated_paths=
|
1361
|
-
stdout, stderr =
|
1362
|
-
Gem.paths = {
|
1363
|
-
|
1377
|
+
stdout, stderr = capture_output do
|
1378
|
+
Gem.paths = { "GEM_HOME" => Gem.paths.home,
|
1379
|
+
"GEM_PATH" => [Gem.paths.home, "foo"] }
|
1364
1380
|
end
|
1365
|
-
assert_equal [Gem.paths.home,
|
1381
|
+
assert_equal [Gem.paths.home, "foo"], Gem.paths.path
|
1366
1382
|
assert_match(/Array values in the parameter to `Gem.paths=` are deprecated.\nPlease use a String or nil/m, stderr)
|
1367
|
-
assert_equal
|
1383
|
+
assert_equal "", stdout
|
1368
1384
|
end
|
1369
1385
|
|
1370
1386
|
def test_self_use_paths
|
@@ -1377,17 +1393,19 @@ class TestGem < Gem::TestCase
|
|
1377
1393
|
end
|
1378
1394
|
|
1379
1395
|
def test_self_user_dir
|
1380
|
-
parts = [@userhome,
|
1381
|
-
parts << RbConfig::CONFIG[
|
1396
|
+
parts = [@userhome, ".gem", Gem.ruby_engine]
|
1397
|
+
parts << RbConfig::CONFIG["ruby_version"] unless RbConfig::CONFIG["ruby_version"].empty?
|
1398
|
+
|
1399
|
+
FileUtils.mkdir_p File.join(parts)
|
1382
1400
|
|
1383
1401
|
assert_equal File.join(parts), Gem.user_dir
|
1384
1402
|
end
|
1385
1403
|
|
1386
1404
|
def test_self_user_home
|
1387
|
-
if ENV[
|
1388
|
-
assert_equal ENV[
|
1405
|
+
if ENV["HOME"]
|
1406
|
+
assert_equal ENV["HOME"], Gem.user_home
|
1389
1407
|
else
|
1390
|
-
assert true,
|
1408
|
+
assert true, "count this test"
|
1391
1409
|
end
|
1392
1410
|
end
|
1393
1411
|
|
@@ -1403,30 +1421,28 @@ class TestGem < Gem::TestCase
|
|
1403
1421
|
r.gem "b", "= 1"
|
1404
1422
|
end
|
1405
1423
|
|
1406
|
-
activated = Gem::Specification.map {
|
1424
|
+
activated = Gem::Specification.map {|x| x.full_name }
|
1407
1425
|
|
1408
|
-
assert_equal %w
|
1426
|
+
assert_equal %w[a-1 b-1 c-2], activated.sort
|
1409
1427
|
end
|
1410
1428
|
|
1411
1429
|
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
|
1430
|
+
a = util_spec "a", "1"
|
1431
|
+
b = util_spec "b", "1", "c" => nil
|
1432
|
+
c = util_spec "c", "2"
|
1433
|
+
d = util_spec "d", "1", { "e" => "= 1" }, "lib/d#{$$}.rb"
|
1434
|
+
e = util_spec "e", "1"
|
1420
1435
|
|
1421
|
-
|
1422
|
-
r.gem "a"
|
1423
|
-
r.gem "b", "= 1"
|
1436
|
+
install_specs a, c, b, e, d
|
1424
1437
|
|
1425
|
-
|
1426
|
-
|
1438
|
+
Gem.needs do |r|
|
1439
|
+
r.gem "a"
|
1440
|
+
r.gem "b", "= 1"
|
1427
1441
|
|
1428
|
-
|
1442
|
+
require "d#{$$}"
|
1429
1443
|
end
|
1444
|
+
|
1445
|
+
assert_equal %w[a-1 b-1 c-2 d-1 e-1], loaded_spec_names
|
1430
1446
|
end
|
1431
1447
|
|
1432
1448
|
def test_self_gunzip
|
@@ -1435,35 +1451,35 @@ class TestGem < Gem::TestCase
|
|
1435
1451
|
|
1436
1452
|
output = Gem::Util.gunzip input
|
1437
1453
|
|
1438
|
-
assert_equal
|
1454
|
+
assert_equal "hello", output
|
1439
1455
|
assert_equal Encoding::BINARY, output.encoding
|
1440
1456
|
end
|
1441
1457
|
|
1442
1458
|
def test_self_gzip
|
1443
|
-
input =
|
1459
|
+
input = "hello"
|
1444
1460
|
|
1445
1461
|
output = Gem::Util.gzip input
|
1446
1462
|
|
1447
1463
|
zipped = StringIO.new output
|
1448
1464
|
|
1449
|
-
assert_equal
|
1465
|
+
assert_equal "hello", Zlib::GzipReader.new(zipped).read
|
1450
1466
|
assert_equal Encoding::BINARY, output.encoding
|
1451
1467
|
end
|
1452
1468
|
|
1453
1469
|
def test_self_vendor_dir
|
1454
|
-
vendordir(File.join(@tempdir,
|
1470
|
+
vendordir(File.join(@tempdir, "vendor")) do
|
1455
1471
|
expected =
|
1456
|
-
File.join RbConfig::CONFIG[
|
1457
|
-
RbConfig::CONFIG[
|
1472
|
+
File.join RbConfig::CONFIG["vendordir"], "gems",
|
1473
|
+
RbConfig::CONFIG["ruby_version"]
|
1458
1474
|
|
1459
1475
|
assert_equal expected, Gem.vendor_dir
|
1460
1476
|
end
|
1461
1477
|
end
|
1462
1478
|
|
1463
1479
|
def test_self_vendor_dir_ENV_GEM_VENDOR
|
1464
|
-
ENV[
|
1480
|
+
ENV["GEM_VENDOR"] = File.join @tempdir, "vendor", "gems"
|
1465
1481
|
|
1466
|
-
assert_equal ENV[
|
1482
|
+
assert_equal ENV["GEM_VENDOR"], Gem.vendor_dir
|
1467
1483
|
refute Gem.vendor_dir.frozen?
|
1468
1484
|
end
|
1469
1485
|
|
@@ -1477,28 +1493,52 @@ class TestGem < Gem::TestCase
|
|
1477
1493
|
plugin_path = File.join "lib", "rubygems_plugin.rb"
|
1478
1494
|
|
1479
1495
|
Dir.chdir @tempdir do
|
1480
|
-
FileUtils.mkdir_p
|
1496
|
+
FileUtils.mkdir_p "lib"
|
1481
1497
|
File.open plugin_path, "w" do |fp|
|
1482
1498
|
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
|
1483
1499
|
end
|
1484
1500
|
|
1485
|
-
foo1 = util_spec
|
1501
|
+
foo1 = util_spec "foo", "1" do |s|
|
1486
1502
|
s.files << plugin_path
|
1487
1503
|
end
|
1488
1504
|
|
1489
1505
|
install_gem foo1
|
1490
1506
|
|
1491
|
-
foo2 = util_spec
|
1507
|
+
foo2 = util_spec "foo", "2" do |s|
|
1492
1508
|
s.files << plugin_path
|
1493
1509
|
end
|
1494
1510
|
|
1495
1511
|
install_gem foo2
|
1496
1512
|
end
|
1497
1513
|
|
1498
|
-
Gem.searcher = nil
|
1499
1514
|
Gem::Specification.reset
|
1500
1515
|
|
1501
|
-
gem
|
1516
|
+
gem "foo"
|
1517
|
+
|
1518
|
+
Gem.load_plugins
|
1519
|
+
|
1520
|
+
assert_equal %w[plugin], PLUGINS_LOADED
|
1521
|
+
end
|
1522
|
+
|
1523
|
+
def test_load_user_installed_plugins
|
1524
|
+
plugin_path = File.join "lib", "rubygems_plugin.rb"
|
1525
|
+
|
1526
|
+
Dir.chdir @tempdir do
|
1527
|
+
FileUtils.mkdir_p "lib"
|
1528
|
+
File.open plugin_path, "w" do |fp|
|
1529
|
+
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
|
1530
|
+
end
|
1531
|
+
|
1532
|
+
foo = util_spec "foo", "1" do |s|
|
1533
|
+
s.files << plugin_path
|
1534
|
+
end
|
1535
|
+
|
1536
|
+
install_gem_user foo
|
1537
|
+
end
|
1538
|
+
|
1539
|
+
Gem.paths = { "GEM_PATH" => [Gem.dir, Gem.user_dir].join(File::PATH_SEPARATOR) }
|
1540
|
+
|
1541
|
+
gem "foo"
|
1502
1542
|
|
1503
1543
|
Gem.load_plugins
|
1504
1544
|
|
@@ -1506,30 +1546,30 @@ class TestGem < Gem::TestCase
|
|
1506
1546
|
end
|
1507
1547
|
|
1508
1548
|
def test_load_env_plugins
|
1509
|
-
with_plugin(
|
1549
|
+
with_plugin("load") { Gem.load_env_plugins }
|
1510
1550
|
assert_equal :loaded, TEST_PLUGIN_LOAD rescue nil
|
1511
1551
|
|
1512
1552
|
util_remove_interrupt_command
|
1513
1553
|
|
1514
1554
|
# Should attempt to cause a StandardError
|
1515
|
-
with_plugin(
|
1555
|
+
with_plugin("standarderror") { Gem.load_env_plugins }
|
1516
1556
|
assert_equal :loaded, TEST_PLUGIN_STANDARDERROR rescue nil
|
1517
1557
|
|
1518
1558
|
util_remove_interrupt_command
|
1519
1559
|
|
1520
1560
|
# Should attempt to cause an Exception
|
1521
|
-
with_plugin(
|
1561
|
+
with_plugin("exception") { Gem.load_env_plugins }
|
1522
1562
|
assert_equal :loaded, TEST_PLUGIN_EXCEPTION rescue nil
|
1523
1563
|
end
|
1524
1564
|
|
1525
1565
|
def test_gem_path_ordering
|
1526
1566
|
refute_equal Gem.dir, Gem.user_dir
|
1527
1567
|
|
1528
|
-
write_file File.join(@tempdir,
|
1529
|
-
write_file File.join(@tempdir,
|
1568
|
+
write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
|
1569
|
+
write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
|
1530
1570
|
|
1531
|
-
g = util_spec
|
1532
|
-
m = util_spec
|
1571
|
+
g = util_spec "g", "1", nil, "lib/g.rb"
|
1572
|
+
m = util_spec "m", "1", nil, "lib/m.rb"
|
1533
1573
|
|
1534
1574
|
install_gem g, :install_dir => Gem.dir
|
1535
1575
|
m0 = install_gem m, :install_dir => Gem.dir
|
@@ -1540,7 +1580,7 @@ class TestGem < Gem::TestCase
|
|
1540
1580
|
|
1541
1581
|
tests = [
|
1542
1582
|
[:dir0, [ Gem.dir, Gem.user_dir], m0],
|
1543
|
-
[:dir1, [ Gem.user_dir, Gem.dir], m1]
|
1583
|
+
[:dir1, [ Gem.user_dir, Gem.dir], m1],
|
1544
1584
|
]
|
1545
1585
|
|
1546
1586
|
tests.each do |_name, _paths, expected|
|
@@ -1548,15 +1588,15 @@ class TestGem < Gem::TestCase
|
|
1548
1588
|
Gem::Specification.reset
|
1549
1589
|
Gem.searcher = nil
|
1550
1590
|
|
1551
|
-
assert_equal Gem::Dependency.new(
|
1552
|
-
Gem::Dependency.new(
|
1591
|
+
assert_equal Gem::Dependency.new("m","1").to_specs,
|
1592
|
+
Gem::Dependency.new("m","1").to_specs.sort
|
1553
1593
|
|
1554
1594
|
assert_equal \
|
1555
1595
|
[expected.gem_dir],
|
1556
|
-
Gem::Dependency.new(
|
1596
|
+
Gem::Dependency.new("m","1").to_specs.map(&:gem_dir).sort,
|
1557
1597
|
"Wrong specs for #{_name}"
|
1558
1598
|
|
1559
|
-
spec = Gem::Dependency.new(
|
1599
|
+
spec = Gem::Dependency.new("m","1").to_spec
|
1560
1600
|
|
1561
1601
|
assert_equal \
|
1562
1602
|
File.join(_paths.first, "gems", "m-1"),
|
@@ -1566,7 +1606,7 @@ class TestGem < Gem::TestCase
|
|
1566
1606
|
|
1567
1607
|
gem "m"
|
1568
1608
|
|
1569
|
-
spec = Gem::Dependency.new(
|
1609
|
+
spec = Gem::Dependency.new("m","1").to_spec
|
1570
1610
|
assert spec.activated?, "dependency not activated for #{_name}"
|
1571
1611
|
|
1572
1612
|
assert_equal \
|
@@ -1581,11 +1621,11 @@ class TestGem < Gem::TestCase
|
|
1581
1621
|
end
|
1582
1622
|
|
1583
1623
|
def test_gem_path_ordering_short
|
1584
|
-
write_file File.join(@tempdir,
|
1585
|
-
write_file File.join(@tempdir,
|
1624
|
+
write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
|
1625
|
+
write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
|
1586
1626
|
|
1587
|
-
g = util_spec
|
1588
|
-
m = util_spec
|
1627
|
+
g = util_spec "g", "1", nil, "lib/g.rb"
|
1628
|
+
m = util_spec "m", "1", nil, "lib/m.rb"
|
1589
1629
|
|
1590
1630
|
install_gem g, :install_dir => Gem.dir
|
1591
1631
|
install_gem m, :install_dir => Gem.dir
|
@@ -1595,7 +1635,7 @@ class TestGem < Gem::TestCase
|
|
1595
1635
|
|
1596
1636
|
assert_equal \
|
1597
1637
|
File.join(Gem.dir, "gems", "m-1"),
|
1598
|
-
Gem::Dependency.new(
|
1638
|
+
Gem::Dependency.new("m","1").to_spec.gem_dir,
|
1599
1639
|
"Wrong spec selected"
|
1600
1640
|
end
|
1601
1641
|
|
@@ -1614,11 +1654,11 @@ class TestGem < Gem::TestCase
|
|
1614
1654
|
f.puts "gem 'c'"
|
1615
1655
|
end
|
1616
1656
|
|
1617
|
-
|
1657
|
+
with_rubygems_gemdeps(path) do
|
1658
|
+
Gem.use_gemdeps
|
1618
1659
|
|
1619
|
-
|
1620
|
-
|
1621
|
-
assert_equal add_bundler_full_name(%W(a-1 b-1 c-1)), loaded_spec_names
|
1660
|
+
assert_equal add_bundler_full_name(%W[a-1 b-1 c-1]), loaded_spec_names
|
1661
|
+
end
|
1622
1662
|
end
|
1623
1663
|
|
1624
1664
|
def test_auto_activation_of_used_gemdeps_file
|
@@ -1636,14 +1676,16 @@ class TestGem < Gem::TestCase
|
|
1636
1676
|
f.puts "gem 'c'"
|
1637
1677
|
end
|
1638
1678
|
|
1639
|
-
|
1679
|
+
with_rubygems_gemdeps("-") do
|
1680
|
+
expected_specs = [a, b, util_spec("bundler", Bundler::VERSION), c].compact.map(&:full_name)
|
1640
1681
|
|
1641
|
-
|
1642
|
-
|
1682
|
+
Gem.use_gemdeps
|
1683
|
+
|
1684
|
+
assert_equal expected_specs, loaded_spec_names
|
1685
|
+
end
|
1643
1686
|
end
|
1644
1687
|
|
1645
|
-
|
1646
|
-
BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }.dup.tap(&Gem::UNTAINT)
|
1688
|
+
BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }
|
1647
1689
|
BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}".freeze
|
1648
1690
|
|
1649
1691
|
def add_bundler_full_name(names)
|
@@ -1652,10 +1694,18 @@ class TestGem < Gem::TestCase
|
|
1652
1694
|
names
|
1653
1695
|
end
|
1654
1696
|
|
1655
|
-
def
|
1656
|
-
|
1697
|
+
def test_looks_for_gemdeps_files_automatically_from_binstubs
|
1698
|
+
pend "Requiring bundler messes things up" if Gem.java_platform?
|
1699
|
+
|
1700
|
+
a = util_spec "a", "1" do |s|
|
1701
|
+
s.executables = %w[foo]
|
1702
|
+
s.bindir = "exe"
|
1703
|
+
end
|
1704
|
+
|
1705
|
+
write_file File.join(@tempdir, "exe", "foo") do |fp|
|
1706
|
+
fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
|
1707
|
+
end
|
1657
1708
|
|
1658
|
-
a = util_spec "a", "1", nil, "lib/a.rb"
|
1659
1709
|
b = util_spec "b", "1", nil, "lib/b.rb"
|
1660
1710
|
c = util_spec "c", "1", nil, "lib/c.rb"
|
1661
1711
|
|
@@ -1666,32 +1716,45 @@ class TestGem < Gem::TestCase
|
|
1666
1716
|
install_gem b, :install_dir => path
|
1667
1717
|
install_gem c, :install_dir => path
|
1668
1718
|
|
1669
|
-
ENV[
|
1670
|
-
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
1719
|
+
ENV["GEM_PATH"] = path
|
1671
1720
|
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1721
|
+
with_rubygems_gemdeps("-") do
|
1722
|
+
new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
|
1723
|
+
new_RUBYOPT = "-I#{rubygems_path} -I#{BUNDLER_LIB_PATH}"
|
1676
1724
|
|
1677
|
-
|
1678
|
-
f.puts "gem 'a'"
|
1679
|
-
end
|
1680
|
-
out0 = IO.popen(cmd, &:read).split(/\n/)
|
1725
|
+
path = File.join @tempdir, "gem.deps.rb"
|
1681
1726
|
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1727
|
+
File.open path, "w" do |f|
|
1728
|
+
f.puts "gem 'a'"
|
1729
|
+
end
|
1730
|
+
out0 = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
|
1731
|
+
IO.popen("foo", &:read).split(/\n/)
|
1732
|
+
end
|
1733
|
+
|
1734
|
+
File.open path, "a" do |f|
|
1735
|
+
f.puts "gem 'b'"
|
1736
|
+
f.puts "gem 'c'"
|
1737
|
+
end
|
1738
|
+
out = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
|
1739
|
+
IO.popen("foo", &:read).split(/\n/)
|
1740
|
+
end
|
1687
1741
|
|
1688
|
-
|
1742
|
+
assert_equal ["b-1", "c-1"], out - out0
|
1743
|
+
end
|
1689
1744
|
end
|
1690
1745
|
|
1691
|
-
def
|
1692
|
-
|
1746
|
+
def test_looks_for_gemdeps_files_automatically_from_binstubs_in_parent_dir
|
1747
|
+
pend "Requiring bundler messes things up" if Gem.java_platform?
|
1748
|
+
|
1749
|
+
a = util_spec "a", "1" do |s|
|
1750
|
+
s.executables = %w[foo]
|
1751
|
+
s.bindir = "exe"
|
1752
|
+
end
|
1753
|
+
|
1754
|
+
write_file File.join(@tempdir, "exe", "foo") do |fp|
|
1755
|
+
fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
|
1756
|
+
end
|
1693
1757
|
|
1694
|
-
a = util_spec "a", "1", nil, "lib/a.rb"
|
1695
1758
|
b = util_spec "b", "1", nil, "lib/b.rb"
|
1696
1759
|
c = util_spec "c", "1", nil, "lib/c.rb"
|
1697
1760
|
|
@@ -1702,30 +1765,35 @@ class TestGem < Gem::TestCase
|
|
1702
1765
|
install_gem b, :install_dir => path
|
1703
1766
|
install_gem c, :install_dir => path
|
1704
1767
|
|
1705
|
-
ENV[
|
1706
|
-
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
1768
|
+
ENV["GEM_PATH"] = path
|
1707
1769
|
|
1708
|
-
|
1770
|
+
with_rubygems_gemdeps("-") do
|
1771
|
+
Dir.mkdir "sub1"
|
1709
1772
|
|
1710
|
-
|
1711
|
-
|
1712
|
-
"-I#{BUNDLER_LIB_PATH.tap(&Gem::UNTAINT)}", "-rrubygems"]
|
1713
|
-
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
1773
|
+
new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
|
1774
|
+
new_RUBYOPT = "-I#{rubygems_path} -I#{BUNDLER_LIB_PATH}"
|
1714
1775
|
|
1715
|
-
|
1716
|
-
f.puts "gem 'a'"
|
1717
|
-
end
|
1718
|
-
out0 = IO.popen(cmd, &:read).split(/\n/)
|
1776
|
+
path = File.join @tempdir, "gem.deps.rb"
|
1719
1777
|
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1778
|
+
File.open path, "w" do |f|
|
1779
|
+
f.puts "gem 'a'"
|
1780
|
+
end
|
1781
|
+
out0 = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
|
1782
|
+
IO.popen("foo", :chdir => "sub1", &:read).split(/\n/)
|
1783
|
+
end
|
1784
|
+
|
1785
|
+
File.open path, "a" do |f|
|
1786
|
+
f.puts "gem 'b'"
|
1787
|
+
f.puts "gem 'c'"
|
1788
|
+
end
|
1789
|
+
out = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
|
1790
|
+
IO.popen("foo", :chdir => "sub1", &:read).split(/\n/)
|
1791
|
+
end
|
1725
1792
|
|
1726
|
-
|
1793
|
+
Dir.rmdir "sub1"
|
1727
1794
|
|
1728
|
-
|
1795
|
+
assert_equal ["b-1", "c-1"], out - out0
|
1796
|
+
end
|
1729
1797
|
end
|
1730
1798
|
|
1731
1799
|
def test_register_default_spec
|
@@ -1769,14 +1837,14 @@ class TestGem < Gem::TestCase
|
|
1769
1837
|
end
|
1770
1838
|
|
1771
1839
|
def test_use_gemdeps
|
1772
|
-
gem_deps_file =
|
1773
|
-
spec = util_spec
|
1840
|
+
gem_deps_file = "gem.deps.rb".tap(&Gem::UNTAINT)
|
1841
|
+
spec = util_spec "a", 1
|
1774
1842
|
install_specs spec
|
1775
1843
|
|
1776
|
-
spec = Gem::Specification.find {
|
1844
|
+
spec = Gem::Specification.find {|s| s == spec }
|
1777
1845
|
refute spec.activated?
|
1778
1846
|
|
1779
|
-
File.open gem_deps_file,
|
1847
|
+
File.open gem_deps_file, "w" do |io|
|
1780
1848
|
io.write 'gem "a"'
|
1781
1849
|
end
|
1782
1850
|
|
@@ -1784,146 +1852,126 @@ class TestGem < Gem::TestCase
|
|
1784
1852
|
|
1785
1853
|
Gem.use_gemdeps gem_deps_file
|
1786
1854
|
|
1787
|
-
assert_equal add_bundler_full_name(%W
|
1855
|
+
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1788
1856
|
refute_nil Gem.gemdeps
|
1789
1857
|
end
|
1790
1858
|
|
1791
1859
|
def test_use_gemdeps_ENV
|
1792
|
-
|
1793
|
-
|
1794
|
-
spec = util_spec 'a', 1
|
1860
|
+
with_rubygems_gemdeps(nil) do
|
1861
|
+
spec = util_spec "a", 1
|
1795
1862
|
|
1796
|
-
|
1863
|
+
refute spec.activated?
|
1797
1864
|
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1865
|
+
File.open "gem.deps.rb", "w" do |io|
|
1866
|
+
io.write 'gem "a"'
|
1867
|
+
end
|
1801
1868
|
|
1802
|
-
|
1869
|
+
Gem.use_gemdeps
|
1803
1870
|
|
1804
|
-
|
1805
|
-
|
1806
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1871
|
+
refute spec.activated?
|
1872
|
+
end
|
1807
1873
|
end
|
1808
1874
|
|
1809
1875
|
def test_use_gemdeps_argument_missing
|
1810
|
-
e =
|
1811
|
-
Gem.use_gemdeps
|
1876
|
+
e = assert_raise ArgumentError do
|
1877
|
+
Gem.use_gemdeps "gem.deps.rb"
|
1812
1878
|
end
|
1813
1879
|
|
1814
|
-
assert_equal
|
1880
|
+
assert_equal "Unable to find gem dependencies file at gem.deps.rb",
|
1815
1881
|
e.message
|
1816
1882
|
end
|
1817
1883
|
|
1818
1884
|
def test_use_gemdeps_argument_missing_match_ENV
|
1819
|
-
|
1820
|
-
|
1885
|
+
with_rubygems_gemdeps("gem.deps.rb") do
|
1886
|
+
e = assert_raise ArgumentError do
|
1887
|
+
Gem.use_gemdeps "gem.deps.rb"
|
1888
|
+
end
|
1821
1889
|
|
1822
|
-
|
1823
|
-
|
1890
|
+
assert_equal "Unable to find gem dependencies file at gem.deps.rb",
|
1891
|
+
e.message
|
1824
1892
|
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
1893
|
end
|
1831
1894
|
|
1832
1895
|
def test_use_gemdeps_automatic
|
1833
|
-
|
1896
|
+
with_rubygems_gemdeps("-") do
|
1897
|
+
spec = util_spec "a", 1
|
1898
|
+
install_specs spec
|
1899
|
+
spec = Gem::Specification.find {|s| s == spec }
|
1834
1900
|
|
1835
|
-
|
1836
|
-
install_specs spec
|
1837
|
-
spec = Gem::Specification.find { |s| s == spec }
|
1838
|
-
|
1839
|
-
refute spec.activated?
|
1901
|
+
refute spec.activated?
|
1840
1902
|
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1903
|
+
File.open "Gemfile", "w" do |io|
|
1904
|
+
io.write 'gem "a"'
|
1905
|
+
end
|
1844
1906
|
|
1845
|
-
|
1907
|
+
Gem.use_gemdeps
|
1846
1908
|
|
1847
|
-
|
1848
|
-
|
1849
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1909
|
+
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1910
|
+
end
|
1850
1911
|
end
|
1851
1912
|
|
1852
1913
|
def test_use_gemdeps_automatic_missing
|
1853
|
-
|
1914
|
+
with_rubygems_gemdeps("-") do
|
1915
|
+
Gem.use_gemdeps
|
1854
1916
|
|
1855
|
-
|
1856
|
-
|
1857
|
-
assert true # count
|
1858
|
-
ensure
|
1859
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1917
|
+
assert true # count
|
1918
|
+
end
|
1860
1919
|
end
|
1861
1920
|
|
1862
1921
|
def test_use_gemdeps_disabled
|
1863
|
-
|
1864
|
-
|
1865
|
-
spec = util_spec 'a', 1
|
1922
|
+
with_rubygems_gemdeps("") do
|
1923
|
+
spec = util_spec "a", 1
|
1866
1924
|
|
1867
|
-
|
1925
|
+
refute spec.activated?
|
1868
1926
|
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1927
|
+
File.open "gem.deps.rb", "w" do |io|
|
1928
|
+
io.write 'gem "a"'
|
1929
|
+
end
|
1872
1930
|
|
1873
|
-
|
1931
|
+
Gem.use_gemdeps
|
1874
1932
|
|
1875
|
-
|
1876
|
-
|
1877
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1933
|
+
refute spec.activated?
|
1934
|
+
end
|
1878
1935
|
end
|
1879
1936
|
|
1880
1937
|
def test_use_gemdeps_missing_gem
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
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
|
1938
|
+
with_rubygems_gemdeps("x") do
|
1939
|
+
File.open "x", "w" do |io|
|
1940
|
+
io.write 'gem "a"'
|
1941
|
+
end
|
1893
1942
|
|
1894
|
-
|
1895
|
-
Could not find gem 'a
|
1896
|
-
You may need to `
|
1943
|
+
expected = <<-EXPECTED
|
1944
|
+
Could not find gem 'a' in locally installed gems.
|
1945
|
+
You may need to `bundle install` to install missing gems
|
1897
1946
|
|
1898
|
-
|
1947
|
+
EXPECTED
|
1899
1948
|
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1949
|
+
Gem::Deprecate.skip_during do
|
1950
|
+
actual_stdout, actual_stderr = capture_output do
|
1951
|
+
Gem.use_gemdeps
|
1952
|
+
end
|
1953
|
+
assert_empty actual_stdout
|
1954
|
+
assert_equal(expected, actual_stderr)
|
1903
1955
|
end
|
1904
1956
|
end
|
1905
|
-
ensure
|
1906
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1907
1957
|
end
|
1908
1958
|
|
1909
1959
|
def test_use_gemdeps_specific
|
1910
|
-
|
1960
|
+
with_rubygems_gemdeps("x") do
|
1961
|
+
spec = util_spec "a", 1
|
1962
|
+
install_specs spec
|
1911
1963
|
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
spec = Gem::Specification.find { |s| s == spec }
|
1916
|
-
refute spec.activated?
|
1964
|
+
spec = Gem::Specification.find {|s| s == spec }
|
1965
|
+
refute spec.activated?
|
1917
1966
|
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1967
|
+
File.open "x", "w" do |io|
|
1968
|
+
io.write 'gem "a"'
|
1969
|
+
end
|
1921
1970
|
|
1922
|
-
|
1971
|
+
Gem.use_gemdeps
|
1923
1972
|
|
1924
|
-
|
1925
|
-
|
1926
|
-
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1973
|
+
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1974
|
+
end
|
1927
1975
|
end
|
1928
1976
|
|
1929
1977
|
def test_operating_system_defaults
|
@@ -1943,8 +1991,8 @@ You may need to `gem install -g` to install missing gems
|
|
1943
1991
|
# Ensure that `Gem.source_date_epoch` is consistent even if
|
1944
1992
|
# $SOURCE_DATE_EPOCH has not been set.
|
1945
1993
|
def test_default_source_date_epoch_doesnt_change
|
1946
|
-
old_epoch = ENV[
|
1947
|
-
ENV[
|
1994
|
+
old_epoch = ENV["SOURCE_DATE_EPOCH"]
|
1995
|
+
ENV["SOURCE_DATE_EPOCH"] = nil
|
1948
1996
|
|
1949
1997
|
# Unfortunately, there is no real way to test this aside from waiting
|
1950
1998
|
# enough for `Time.now.to_i` to change -- which is a whole second.
|
@@ -1955,31 +2003,46 @@ You may need to `gem install -g` to install missing gems
|
|
1955
2003
|
b = Gem.source_date_epoch
|
1956
2004
|
assert_equal a, b
|
1957
2005
|
ensure
|
1958
|
-
ENV[
|
2006
|
+
ENV["SOURCE_DATE_EPOCH"] = old_epoch
|
1959
2007
|
end
|
1960
2008
|
|
2009
|
+
private
|
2010
|
+
|
1961
2011
|
def ruby_install_name(name)
|
1962
2012
|
with_clean_path_to_ruby do
|
1963
|
-
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG[
|
1964
|
-
RbConfig::CONFIG[
|
2013
|
+
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG["ruby_install_name"]
|
2014
|
+
RbConfig::CONFIG["ruby_install_name"] = name
|
1965
2015
|
|
1966
2016
|
begin
|
1967
2017
|
yield
|
1968
2018
|
ensure
|
1969
2019
|
if orig_RUBY_INSTALL_NAME
|
1970
|
-
RbConfig::CONFIG[
|
2020
|
+
RbConfig::CONFIG["ruby_install_name"] = orig_RUBY_INSTALL_NAME
|
1971
2021
|
else
|
1972
|
-
RbConfig::CONFIG.delete
|
2022
|
+
RbConfig::CONFIG.delete "ruby_install_name"
|
1973
2023
|
end
|
1974
2024
|
end
|
1975
2025
|
end
|
1976
2026
|
end
|
1977
2027
|
|
1978
|
-
def
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
2028
|
+
def with_rb_config_ruby(path)
|
2029
|
+
rb_config_singleton_class = class << RbConfig; self; end
|
2030
|
+
orig_path = RbConfig.ruby
|
2031
|
+
|
2032
|
+
redefine_method(rb_config_singleton_class, :ruby, path)
|
2033
|
+
|
2034
|
+
yield
|
2035
|
+
ensure
|
2036
|
+
redefine_method(rb_config_singleton_class, :ruby, orig_path)
|
2037
|
+
end
|
2038
|
+
|
2039
|
+
def redefine_method(base, method, new_result)
|
2040
|
+
if RUBY_VERSION >= "2.5"
|
2041
|
+
base.alias_method(method, method)
|
2042
|
+
base.define_method(method) { new_result }
|
2043
|
+
else
|
2044
|
+
base.send(:alias_method, method, method)
|
2045
|
+
base.send(:define_method, method) { new_result }
|
1983
2046
|
end
|
1984
2047
|
end
|
1985
2048
|
|
@@ -1992,7 +2055,7 @@ You may need to `gem install -g` to install missing gems
|
|
1992
2055
|
refute_includes $LOAD_PATH, test_plugin_path
|
1993
2056
|
$LOAD_PATH.unshift test_plugin_path
|
1994
2057
|
|
1995
|
-
|
2058
|
+
capture_output do
|
1996
2059
|
yield
|
1997
2060
|
end
|
1998
2061
|
ensure
|
@@ -2011,12 +2074,12 @@ You may need to `gem install -g` to install missing gems
|
|
2011
2074
|
end
|
2012
2075
|
|
2013
2076
|
def util_exec_gem
|
2014
|
-
spec, _ = util_spec
|
2015
|
-
s.executables = [
|
2077
|
+
spec, _ = util_spec "a", "4" do |s|
|
2078
|
+
s.executables = ["exec", "abin"]
|
2016
2079
|
end
|
2017
2080
|
|
2018
|
-
@exec_path = File.join spec.full_gem_path, spec.bindir,
|
2019
|
-
@abin_path = File.join spec.full_gem_path, spec.bindir,
|
2081
|
+
@exec_path = File.join spec.full_gem_path, spec.bindir, "exec"
|
2082
|
+
@abin_path = File.join spec.full_gem_path, spec.bindir, "abin"
|
2020
2083
|
spec
|
2021
2084
|
end
|
2022
2085
|
|
@@ -2029,4 +2092,21 @@ You may need to `gem install -g` to install missing gems
|
|
2029
2092
|
File.join Gem.dir, "cache"
|
2030
2093
|
end
|
2031
2094
|
|
2095
|
+
def with_path_and_rubyopt(path_value, rubyopt_value)
|
2096
|
+
path, ENV["PATH"] = ENV["PATH"], path_value
|
2097
|
+
rubyopt, ENV["RUBYOPT"] = ENV["RUBYOPT"], rubyopt_value
|
2098
|
+
|
2099
|
+
yield
|
2100
|
+
ensure
|
2101
|
+
ENV["PATH"] = path
|
2102
|
+
ENV["RUBYOPT"] = rubyopt
|
2103
|
+
end
|
2104
|
+
|
2105
|
+
def with_rubygems_gemdeps(value)
|
2106
|
+
rubygems_gemdeps, ENV["RUBYGEMS_GEMDEPS"] = ENV["RUBYGEMS_GEMDEPS"], value
|
2107
|
+
|
2108
|
+
yield
|
2109
|
+
ensure
|
2110
|
+
ENV["RUBYGEMS_GEMDEPS"] = rubygems_gemdeps
|
2111
|
+
end
|
2032
2112
|
end
|