rubygems-update 3.0.6 → 3.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{History.txt → CHANGELOG.md} +1100 -436
- data/CODE_OF_CONDUCT.md +55 -19
- data/CONTRIBUTING.md +37 -10
- data/MAINTAINERS.txt +1 -6
- data/Manifest.txt +104 -64
- data/POLICIES.md +6 -12
- data/README.md +6 -6
- data/Rakefile +121 -111
- data/bin/gem +0 -6
- data/bin/update_rubygems +2 -2
- data/bundler/CHANGELOG.md +1788 -1251
- data/bundler/LICENSE.md +18 -19
- data/bundler/README.md +9 -10
- data/bundler/UPGRADING.md +215 -0
- data/bundler/bundler.gemspec +9 -26
- data/bundler/exe/bundle +22 -3
- data/bundler/lib/bundler.rb +233 -94
- data/bundler/lib/bundler/build_metadata.rb +5 -13
- data/bundler/lib/bundler/capistrano.rb +4 -4
- data/bundler/lib/bundler/cli.rb +221 -148
- data/bundler/lib/bundler/cli/add.rb +28 -16
- data/bundler/lib/bundler/cli/binstubs.rb +6 -2
- data/bundler/lib/bundler/cli/cache.rb +24 -17
- data/bundler/lib/bundler/cli/clean.rb +1 -1
- data/bundler/lib/bundler/cli/common.rb +25 -12
- data/bundler/lib/bundler/cli/config.rb +161 -86
- data/bundler/lib/bundler/cli/console.rb +1 -1
- data/bundler/lib/bundler/cli/doctor.rb +5 -5
- data/bundler/lib/bundler/cli/exec.rb +8 -20
- data/bundler/lib/bundler/cli/fund.rb +36 -0
- data/bundler/lib/bundler/cli/gem.rb +125 -32
- data/bundler/lib/bundler/cli/info.rb +29 -6
- data/bundler/lib/bundler/cli/init.rb +2 -2
- data/bundler/lib/bundler/cli/inject.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +27 -23
- data/bundler/lib/bundler/cli/issue.rb +5 -5
- data/bundler/lib/bundler/cli/list.rb +12 -10
- data/bundler/lib/bundler/cli/open.rb +10 -6
- data/bundler/lib/bundler/cli/outdated.rb +134 -109
- data/bundler/lib/bundler/cli/plugin.rb +19 -2
- data/bundler/lib/bundler/cli/pristine.rb +6 -1
- data/bundler/lib/bundler/cli/show.rb +2 -2
- data/bundler/lib/bundler/cli/update.rb +34 -12
- data/bundler/lib/bundler/compact_index_client.rb +26 -10
- data/bundler/lib/bundler/compact_index_client/cache.rb +6 -14
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +8 -20
- data/bundler/lib/bundler/current_ruby.rb +9 -7
- data/bundler/lib/bundler/definition.rb +133 -132
- data/bundler/lib/bundler/dep_proxy.rb +16 -9
- data/bundler/lib/bundler/dependency.rb +19 -14
- data/bundler/lib/bundler/deployment.rb +1 -1
- data/bundler/lib/bundler/dsl.rb +54 -71
- data/bundler/lib/bundler/endpoint_specification.rb +1 -1
- data/bundler/lib/bundler/env.rb +9 -14
- data/bundler/lib/bundler/environment_preserver.rb +26 -3
- data/bundler/lib/bundler/errors.rb +1 -0
- data/bundler/lib/bundler/feature_flag.rb +19 -34
- data/bundler/lib/bundler/fetcher.rb +19 -16
- data/bundler/lib/bundler/fetcher/base.rb +1 -1
- data/bundler/lib/bundler/fetcher/compact_index.rb +27 -13
- data/bundler/lib/bundler/fetcher/dependency.rb +1 -1
- data/bundler/lib/bundler/fetcher/downloader.rb +6 -3
- data/bundler/lib/bundler/fetcher/index.rb +8 -7
- data/bundler/lib/bundler/friendly_errors.rb +27 -19
- data/bundler/lib/bundler/gem_helper.rb +68 -37
- data/bundler/lib/bundler/gem_helpers.rb +38 -29
- data/bundler/lib/bundler/gem_tasks.rb +1 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +5 -5
- data/bundler/lib/bundler/graph.rb +3 -3
- data/bundler/lib/bundler/index.rb +12 -7
- data/bundler/lib/bundler/injector.rb +32 -12
- data/bundler/lib/bundler/inline.rb +41 -30
- data/bundler/lib/bundler/installer.rb +41 -60
- data/bundler/lib/bundler/installer/gem_installer.rb +8 -4
- data/bundler/lib/bundler/installer/parallel_installer.rb +20 -26
- data/bundler/lib/bundler/installer/standalone.rb +18 -4
- data/bundler/lib/bundler/lazy_specification.rb +41 -27
- data/bundler/lib/bundler/lockfile_generator.rb +1 -1
- data/bundler/lib/bundler/lockfile_parser.rb +16 -33
- data/bundler/lib/bundler/{ssl_certs → man}/.document +0 -0
- data/bundler/lib/bundler/man/bundle-add.1 +66 -0
- data/bundler/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +42 -0
- data/bundler/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
- data/bundler/lib/bundler/man/bundle-cache.1 +55 -0
- data/bundler/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +15 -15
- data/bundler/lib/bundler/man/bundle-check.1 +31 -0
- data/bundler/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-clean.1 +24 -0
- data/bundler/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-config.1 +488 -0
- data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +59 -67
- data/bundler/lib/bundler/man/bundle-doctor.1 +44 -0
- data/bundler/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-exec.1 +165 -0
- data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +102 -0
- data/bundler/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +30 -7
- data/bundler/lib/bundler/man/bundle-info.1 +20 -0
- data/bundler/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-init.1 +25 -0
- data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +33 -0
- data/bundler/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-install.1 +338 -0
- data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +34 -7
- data/bundler/lib/bundler/man/bundle-list.1 +50 -0
- data/bundler/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
- data/bundler/lib/bundler/man/bundle-lock.1 +84 -0
- data/bundler/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-open.1 +32 -0
- data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-outdated.1 +155 -0
- data/bundler/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-platform.1 +61 -0
- data/bundler/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-pristine.1 +34 -0
- data/bundler/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-remove.1 +31 -0
- data/bundler/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-show.1 +23 -0
- data/bundler/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-update.1 +394 -0
- data/bundler/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +3 -3
- data/bundler/lib/bundler/man/bundle-viz.1 +39 -0
- data/bundler/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle.1 +136 -0
- data/bundler/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +2 -2
- data/bundler/lib/bundler/man/gemfile.5 +686 -0
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +16 -20
- data/bundler/lib/bundler/man/index.txt +25 -0
- data/bundler/lib/bundler/match_platform.rb +1 -1
- data/bundler/lib/bundler/mirror.rb +5 -5
- data/bundler/lib/bundler/plugin.rb +75 -36
- data/bundler/lib/bundler/plugin/api.rb +1 -1
- data/bundler/lib/bundler/plugin/api/source.rb +12 -7
- data/bundler/lib/bundler/plugin/dsl.rb +1 -1
- data/bundler/lib/bundler/plugin/index.rb +24 -4
- data/bundler/lib/bundler/plugin/installer.rb +33 -22
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -1
- data/bundler/lib/bundler/plugin/source_list.rb +5 -1
- data/bundler/lib/bundler/psyched_yaml.rb +0 -15
- data/bundler/lib/bundler/remote_specification.rb +5 -4
- data/bundler/lib/bundler/resolver.rb +191 -87
- data/bundler/lib/bundler/resolver/spec_group.rb +76 -48
- data/bundler/lib/bundler/retry.rb +3 -3
- data/bundler/lib/bundler/ruby_version.rb +5 -20
- data/bundler/lib/bundler/rubygems_ext.rb +76 -72
- data/bundler/lib/bundler/rubygems_gem_installer.rb +47 -13
- data/bundler/lib/bundler/rubygems_integration.rb +159 -444
- data/bundler/lib/bundler/runtime.rb +6 -23
- data/bundler/lib/bundler/settings.rb +67 -93
- data/bundler/lib/bundler/setup.rb +11 -12
- data/bundler/lib/bundler/shared_helpers.rb +54 -80
- data/bundler/lib/bundler/similarity_detector.rb +3 -3
- data/bundler/lib/bundler/source.rb +12 -6
- data/bundler/lib/bundler/source/git.rb +47 -38
- data/bundler/lib/bundler/source/git/git_proxy.rb +101 -102
- data/bundler/lib/bundler/source/metadata.rb +7 -6
- data/bundler/lib/bundler/source/path.rb +20 -11
- data/bundler/lib/bundler/source/path/installer.rb +10 -10
- data/bundler/lib/bundler/source/rubygems.rb +56 -29
- data/bundler/lib/bundler/source/rubygems/remote.rb +3 -4
- data/bundler/lib/bundler/source_list.rb +32 -30
- data/bundler/lib/bundler/spec_set.rb +37 -25
- data/bundler/lib/bundler/stub_specification.rb +40 -34
- data/bundler/lib/bundler/templates/Executable.bundler +23 -14
- data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +16 -2
- data/bundler/lib/bundler/templates/newgem/README.md.tt +7 -5
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +19 -5
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +18 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +18 -31
- data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
- data/bundler/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
- data/bundler/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -1
- data/bundler/lib/bundler/ui.rb +3 -3
- data/bundler/lib/bundler/ui/rg_proxy.rb +1 -1
- data/bundler/lib/bundler/ui/shell.rb +7 -11
- data/bundler/lib/bundler/uri_credentials_filter.rb +10 -4
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +36 -4
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -3
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +39 -11
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +4 -4
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +53 -51
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +16 -9
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +28 -13
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +20 -9
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +21 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +65 -8
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/bundler/lib/bundler/vendored_fileutils.rb +1 -6
- data/bundler/lib/bundler/vendored_molinillo.rb +1 -1
- data/bundler/lib/bundler/vendored_persistent.rb +7 -12
- data/bundler/lib/bundler/vendored_thor.rb +2 -2
- data/bundler/lib/bundler/vendored_tmpdir.rb +4 -0
- data/bundler/lib/bundler/vendored_uri.rb +4 -0
- data/bundler/lib/bundler/version.rb +1 -20
- data/bundler/lib/bundler/version_ranges.rb +51 -5
- data/bundler/lib/bundler/vlad.rb +2 -2
- data/bundler/lib/bundler/worker.rb +2 -4
- data/bundler/lib/bundler/yaml_serializer.rb +3 -4
- data/lib/rubygems.rb +198 -222
- data/lib/rubygems/available_set.rb +4 -5
- data/lib/rubygems/basic_specification.rb +32 -19
- data/lib/rubygems/bundler_version_finder.rb +19 -9
- data/lib/rubygems/command.rb +73 -21
- data/lib/rubygems/command_manager.rb +5 -12
- data/lib/rubygems/commands/build_command.rb +51 -18
- data/lib/rubygems/commands/cert_command.rb +2 -11
- data/lib/rubygems/commands/check_command.rb +0 -2
- data/lib/rubygems/commands/cleanup_command.rb +17 -13
- data/lib/rubygems/commands/contents_command.rb +7 -9
- data/lib/rubygems/commands/dependency_command.rb +9 -10
- data/lib/rubygems/commands/environment_command.rb +1 -6
- data/lib/rubygems/commands/fetch_command.rb +2 -4
- data/lib/rubygems/commands/generate_index_command.rb +3 -2
- data/lib/rubygems/commands/help_command.rb +4 -4
- data/lib/rubygems/commands/info_command.rb +9 -4
- data/lib/rubygems/commands/install_command.rb +12 -54
- data/lib/rubygems/commands/list_command.rb +8 -7
- data/lib/rubygems/commands/lock_command.rb +3 -5
- data/lib/rubygems/commands/mirror_command.rb +0 -1
- data/lib/rubygems/commands/open_command.rb +1 -4
- data/lib/rubygems/commands/outdated_command.rb +0 -1
- data/lib/rubygems/commands/owner_command.rb +10 -10
- data/lib/rubygems/commands/pristine_command.rb +13 -9
- data/lib/rubygems/commands/push_command.rb +12 -51
- data/lib/rubygems/commands/query_command.rb +14 -330
- data/lib/rubygems/commands/rdoc_command.rb +0 -1
- data/lib/rubygems/commands/search_command.rb +7 -7
- data/lib/rubygems/commands/server_command.rb +3 -1
- data/lib/rubygems/commands/setup_command.rb +143 -101
- data/lib/rubygems/commands/signin_command.rb +0 -1
- data/lib/rubygems/commands/signout_command.rb +0 -2
- data/lib/rubygems/commands/sources_command.rb +22 -6
- data/lib/rubygems/commands/specification_command.rb +8 -3
- data/lib/rubygems/commands/stale_command.rb +1 -1
- data/lib/rubygems/commands/uninstall_command.rb +2 -3
- data/lib/rubygems/commands/unpack_command.rb +3 -32
- data/lib/rubygems/commands/update_command.rb +73 -28
- data/lib/rubygems/commands/which_command.rb +0 -1
- data/lib/rubygems/commands/yank_command.rb +10 -7
- data/lib/rubygems/compatibility.rb +4 -4
- data/lib/rubygems/config_file.rb +48 -27
- data/lib/rubygems/core_ext/kernel_gem.rb +7 -6
- data/lib/rubygems/core_ext/kernel_require.rb +44 -6
- data/lib/rubygems/core_ext/kernel_warn.rb +22 -13
- data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
- data/lib/rubygems/defaults.rb +110 -23
- data/lib/rubygems/dependency.rb +28 -14
- data/lib/rubygems/dependency_installer.rb +11 -166
- data/lib/rubygems/dependency_list.rb +17 -18
- data/lib/rubygems/deprecate.rb +51 -6
- data/lib/rubygems/doctor.rb +4 -4
- data/lib/rubygems/errors.rb +5 -7
- data/lib/rubygems/exceptions.rb +2 -24
- data/lib/rubygems/ext.rb +6 -6
- data/lib/rubygems/ext/build_error.rb +2 -0
- data/lib/rubygems/ext/builder.rb +45 -82
- data/lib/rubygems/ext/cmake_builder.rb +6 -7
- data/lib/rubygems/ext/configure_builder.rb +5 -8
- data/lib/rubygems/ext/ext_conf_builder.rb +27 -23
- data/lib/rubygems/ext/rake_builder.rb +4 -6
- data/lib/rubygems/gem_runner.rb +3 -10
- data/lib/rubygems/gemcutter_utilities.rb +111 -37
- data/lib/rubygems/indexer.rb +9 -26
- data/lib/rubygems/install_update_options.rb +7 -7
- data/lib/rubygems/installer.rb +91 -98
- data/lib/rubygems/installer_test_case.rb +104 -42
- data/lib/rubygems/installer_uninstaller_utils.rb +29 -0
- data/lib/rubygems/local_remote_options.rb +1 -1
- data/lib/rubygems/mock_gem_ui.rb +1 -4
- data/lib/rubygems/name_tuple.rb +4 -7
- data/lib/rubygems/openssl.rb +7 -0
- data/lib/rubygems/package.rb +49 -32
- data/lib/rubygems/package/digest_io.rb +0 -2
- data/lib/rubygems/package/file_source.rb +0 -2
- data/lib/rubygems/package/io_source.rb +0 -2
- data/lib/rubygems/package/old.rb +1 -3
- data/lib/rubygems/package/tar_header.rb +4 -6
- data/lib/rubygems/package/tar_reader.rb +15 -12
- data/lib/rubygems/package/tar_reader/entry.rb +0 -3
- data/lib/rubygems/package/tar_test_case.rb +2 -4
- data/lib/rubygems/package/tar_writer.rb +6 -16
- data/lib/rubygems/package_task.rb +1 -7
- data/lib/rubygems/path_support.rb +2 -2
- data/lib/rubygems/platform.rb +22 -16
- data/lib/rubygems/query_utils.rb +353 -0
- data/lib/rubygems/rdoc.rb +0 -12
- data/lib/rubygems/remote_fetcher.rb +33 -59
- data/lib/rubygems/request.rb +11 -14
- data/lib/rubygems/request/connection_pools.rb +3 -7
- data/lib/rubygems/request/http_pool.rb +0 -1
- data/lib/rubygems/request_set.rb +10 -23
- data/lib/rubygems/request_set/gem_dependency_api.rb +9 -11
- data/lib/rubygems/request_set/lockfile.rb +13 -12
- data/lib/rubygems/request_set/lockfile/parser.rb +2 -2
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +1 -1
- data/lib/rubygems/requirement.rb +36 -35
- data/lib/rubygems/resolver.rb +20 -16
- data/lib/rubygems/resolver/activation_request.rb +27 -51
- data/lib/rubygems/resolver/api_set.rb +31 -24
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_specification.rb +24 -10
- data/lib/rubygems/resolver/best_set.rb +4 -6
- data/lib/rubygems/resolver/composed_set.rb +3 -5
- data/lib/rubygems/resolver/conflict.rb +2 -9
- data/lib/rubygems/resolver/current_set.rb +0 -2
- data/lib/rubygems/resolver/dependency_request.rb +1 -3
- data/lib/rubygems/resolver/git_set.rb +0 -2
- data/lib/rubygems/resolver/git_specification.rb +0 -2
- data/lib/rubygems/resolver/index_set.rb +1 -3
- data/lib/rubygems/resolver/index_specification.rb +32 -2
- data/lib/rubygems/resolver/installed_specification.rb +0 -2
- data/lib/rubygems/resolver/installer_set.rb +63 -16
- data/lib/rubygems/resolver/local_specification.rb +0 -2
- data/lib/rubygems/resolver/lock_set.rb +3 -5
- data/lib/rubygems/resolver/lock_specification.rb +2 -4
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +8 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +39 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +51 -12
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +76 -8
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +12 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +510 -165
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/rubygems/resolver/requirement_list.rb +0 -1
- data/lib/rubygems/resolver/set.rb +0 -2
- data/lib/rubygems/resolver/source_set.rb +0 -2
- data/lib/rubygems/resolver/spec_specification.rb +14 -2
- data/lib/rubygems/resolver/specification.rb +13 -2
- data/lib/rubygems/resolver/vendor_set.rb +0 -2
- data/lib/rubygems/resolver/vendor_specification.rb +0 -2
- data/lib/rubygems/s3_uri_signer.rb +15 -13
- data/lib/rubygems/safe_yaml.rb +4 -4
- data/lib/rubygems/security.rb +27 -34
- data/lib/rubygems/security/policy.rb +4 -8
- data/lib/rubygems/security/signer.rb +8 -9
- data/lib/rubygems/security/trust_dir.rb +1 -3
- data/lib/rubygems/server.rb +20 -16
- data/lib/rubygems/source.rb +30 -13
- data/lib/rubygems/source/git.rb +7 -8
- data/lib/rubygems/source/installed.rb +0 -2
- data/lib/rubygems/source/local.rb +2 -4
- data/lib/rubygems/source/lock.rb +0 -2
- data/lib/rubygems/source/specific_file.rb +0 -2
- data/lib/rubygems/source/vendor.rb +0 -2
- data/lib/rubygems/source_list.rb +6 -6
- data/lib/rubygems/spec_fetcher.rb +22 -34
- data/lib/rubygems/specification.rb +207 -278
- data/lib/rubygems/specification_policy.rb +135 -57
- data/{bundler/lib/bundler/ssl_certs/index.rubygems.org → lib/rubygems/ssl_certs/rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +4 -5
- data/lib/rubygems/test_case.rb +221 -341
- data/lib/rubygems/test_utilities.rb +22 -18
- data/lib/rubygems/text.rb +2 -3
- data/lib/rubygems/uninstaller.rb +49 -30
- data/lib/rubygems/uri_formatter.rb +2 -4
- data/lib/rubygems/uri_parser.rb +34 -0
- data/lib/rubygems/uri_parsing.rb +23 -0
- data/lib/rubygems/user_interaction.rb +3 -20
- data/lib/rubygems/util.rb +20 -44
- data/lib/rubygems/util/licenses.rb +400 -400
- data/lib/rubygems/validator.rb +9 -31
- data/lib/rubygems/version.rb +29 -21
- data/lib/rubygems/version_option.rb +6 -0
- data/rubygems-update.gemspec +4 -11
- data/setup.rb +2 -7
- data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
- data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
- data/test/rubygems/rubygems/commands/crash_command.rb +0 -2
- data/test/rubygems/rubygems_plugin.rb +0 -2
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +12 -0
- data/test/rubygems/test_bundled_ca.rb +42 -45
- data/test/rubygems/test_config.rb +0 -2
- data/test/rubygems/test_deprecate.rb +41 -5
- data/test/rubygems/test_gem.rb +405 -236
- data/test/rubygems/test_gem_available_set.rb +5 -6
- data/test/rubygems/test_gem_bundler_version_finder.rb +20 -2
- data/test/rubygems/test_gem_command.rb +144 -9
- data/test/rubygems/test_gem_command_manager.rb +40 -17
- data/test/rubygems/test_gem_commands_build_command.rb +386 -13
- data/test/rubygems/test_gem_commands_cert_command.rb +18 -6
- data/test/rubygems/test_gem_commands_check_command.rb +0 -2
- data/test/rubygems/test_gem_commands_cleanup_command.rb +35 -10
- data/test/rubygems/test_gem_commands_contents_command.rb +50 -19
- data/test/rubygems/test_gem_commands_dependency_command.rb +1 -3
- data/test/rubygems/test_gem_commands_environment_command.rb +21 -33
- data/test/rubygems/test_gem_commands_fetch_command.rb +0 -2
- data/test/rubygems/test_gem_commands_generate_index_command.rb +32 -2
- data/test/rubygems/test_gem_commands_help_command.rb +16 -8
- data/test/rubygems/test_gem_commands_info_command.rb +6 -7
- data/test/rubygems/test_gem_commands_install_command.rb +368 -34
- data/test/rubygems/test_gem_commands_list_command.rb +0 -2
- data/test/rubygems/test_gem_commands_lock_command.rb +0 -2
- data/test/rubygems/test_gem_commands_mirror.rb +1 -2
- data/test/rubygems/test_gem_commands_open_command.rb +4 -6
- data/test/rubygems/test_gem_commands_outdated_command.rb +18 -1
- data/test/rubygems/test_gem_commands_owner_command.rb +62 -9
- data/test/rubygems/test_gem_commands_pristine_command.rb +148 -16
- data/test/rubygems/test_gem_commands_push_command.rb +94 -21
- data/test/rubygems/test_gem_commands_query_command.rb +35 -10
- data/test/rubygems/test_gem_commands_search_command.rb +0 -2
- data/test/rubygems/test_gem_commands_server_command.rb +6 -4
- data/test/rubygems/test_gem_commands_setup_command.rb +228 -128
- data/test/rubygems/test_gem_commands_signin_command.rb +36 -11
- data/test/rubygems/test_gem_commands_signout_command.rb +0 -7
- data/test/rubygems/test_gem_commands_sources_command.rb +193 -9
- data/test/rubygems/test_gem_commands_specification_command.rb +46 -20
- data/test/rubygems/test_gem_commands_stale_command.rb +0 -2
- data/test/rubygems/test_gem_commands_uninstall_command.rb +108 -52
- data/test/rubygems/test_gem_commands_unpack_command.rb +0 -2
- data/test/rubygems/test_gem_commands_update_command.rb +201 -29
- data/test/rubygems/test_gem_commands_which_command.rb +3 -5
- data/test/rubygems/test_gem_commands_yank_command.rb +86 -5
- data/test/rubygems/test_gem_config_file.rb +25 -13
- data/test/rubygems/test_gem_dependency.rb +6 -2
- data/test/rubygems/test_gem_dependency_installer.rb +169 -252
- data/test/rubygems/test_gem_dependency_list.rb +31 -26
- data/test/rubygems/test_gem_dependency_resolution_error.rb +1 -3
- data/test/rubygems/test_gem_doctor.rb +28 -2
- data/test/rubygems/test_gem_ext_builder.rb +51 -44
- data/test/rubygems/test_gem_ext_cmake_builder.rb +16 -23
- data/test/rubygems/test_gem_ext_configure_builder.rb +6 -14
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +21 -29
- data/test/rubygems/test_gem_ext_rake_builder.rb +39 -22
- data/test/rubygems/test_gem_gem_runner.rb +47 -2
- data/test/rubygems/test_gem_gemcutter_utilities.rb +16 -13
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -2
- data/test/rubygems/test_gem_indexer.rb +40 -55
- data/test/rubygems/test_gem_install_update_options.rb +45 -21
- data/test/rubygems/test_gem_installer.rb +661 -338
- data/test/rubygems/test_gem_local_remote_options.rb +0 -2
- data/test/rubygems/test_gem_name_tuple.rb +0 -2
- data/test/rubygems/test_gem_package.rb +132 -45
- data/test/rubygems/test_gem_package_old.rb +56 -55
- data/test/rubygems/test_gem_package_tar_header.rb +18 -1
- data/test/rubygems/test_gem_package_tar_reader.rb +0 -2
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +6 -7
- data/test/rubygems/test_gem_package_tar_writer.rb +20 -12
- data/test/rubygems/test_gem_package_task.rb +46 -13
- data/test/rubygems/test_gem_path_support.rb +17 -13
- data/test/rubygems/test_gem_platform.rb +74 -7
- data/test/rubygems/test_gem_rdoc.rb +0 -1
- data/test/rubygems/test_gem_remote_fetcher.rb +223 -209
- data/test/rubygems/test_gem_request.rb +30 -19
- data/test/rubygems/test_gem_request_connection_pools.rb +2 -2
- data/test/rubygems/test_gem_request_set.rb +104 -29
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +4 -6
- data/test/rubygems/test_gem_request_set_lockfile.rb +4 -5
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +9 -10
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +118 -118
- data/test/rubygems/test_gem_requirement.rb +50 -4
- data/test/rubygems/test_gem_resolver.rb +73 -31
- data/test/rubygems/test_gem_resolver_activation_request.rb +3 -34
- data/test/rubygems/test_gem_resolver_api_set.rb +60 -59
- data/test/rubygems/test_gem_resolver_api_specification.rb +3 -5
- data/test/rubygems/test_gem_resolver_best_set.rb +27 -6
- data/test/rubygems/test_gem_resolver_composed_set.rb +0 -2
- data/test/rubygems/test_gem_resolver_conflict.rb +1 -7
- data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -2
- data/test/rubygems/test_gem_resolver_git_set.rb +0 -2
- data/test/rubygems/test_gem_resolver_git_specification.rb +1 -2
- data/test/rubygems/test_gem_resolver_index_set.rb +2 -4
- data/test/rubygems/test_gem_resolver_index_specification.rb +7 -4
- data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -3
- data/test/rubygems/test_gem_resolver_installer_set.rb +10 -10
- data/test/rubygems/test_gem_resolver_local_specification.rb +0 -2
- data/test/rubygems/test_gem_resolver_lock_set.rb +3 -5
- data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -2
- data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -2
- data/test/rubygems/test_gem_resolver_specification.rb +0 -2
- data/test/rubygems/test_gem_resolver_vendor_set.rb +1 -3
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -2
- data/test/rubygems/test_gem_security.rb +27 -25
- data/test/rubygems/test_gem_security_policy.rb +7 -12
- data/test/rubygems/test_gem_security_signer.rb +11 -12
- data/test/rubygems/test_gem_security_trust_dir.rb +4 -6
- data/test/rubygems/test_gem_server.rb +13 -12
- data/test/rubygems/test_gem_silent_ui.rb +0 -1
- data/test/rubygems/test_gem_source.rb +32 -17
- data/test/rubygems/test_gem_source_fetch_problem.rb +0 -1
- data/test/rubygems/test_gem_source_git.rb +12 -18
- data/test/rubygems/test_gem_source_installed.rb +11 -13
- data/test/rubygems/test_gem_source_list.rb +1 -1
- data/test/rubygems/test_gem_source_local.rb +8 -9
- data/test/rubygems/test_gem_source_lock.rb +17 -19
- data/test/rubygems/test_gem_source_specific_file.rb +9 -10
- data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
- data/test/rubygems/test_gem_source_vendor.rb +7 -9
- data/test/rubygems/test_gem_spec_fetcher.rb +11 -4
- data/test/rubygems/test_gem_specification.rb +363 -245
- data/test/rubygems/test_gem_stream_ui.rb +3 -1
- data/test/rubygems/test_gem_stub_specification.rb +6 -7
- data/test/rubygems/test_gem_text.rb +1 -2
- data/test/rubygems/test_gem_uninstaller.rb +165 -22
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -2
- data/test/rubygems/test_gem_uri_formatter.rb +0 -2
- data/test/rubygems/test_gem_util.rb +17 -15
- data/test/rubygems/test_gem_validator.rb +4 -7
- data/test/rubygems/test_gem_version.rb +23 -10
- data/test/rubygems/test_gem_version_option.rb +1 -3
- data/test/rubygems/test_kernel.rb +25 -9
- data/test/rubygems/test_project_sanity.rb +20 -0
- data/test/rubygems/test_remote_fetch_error.rb +1 -2
- data/test/rubygems/test_require.rb +394 -56
- data/test/test_changelog_generator.rb +17 -0
- metadata +109 -155
- data/.rubocop.yml +0 -67
- data/.travis.yml +0 -38
- data/appveyor.yml +0 -43
- data/bundler/CODE_OF_CONDUCT.md +0 -42
- data/bundler/CONTRIBUTING.md +0 -17
- data/bundler/exe/bundle_ruby +0 -60
- data/bundler/lib/bundler/cli/package.rb +0 -49
- data/bundler/lib/bundler/compatibility_guard.rb +0 -14
- data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/lib/rubygems/source_local.rb +0 -7
- data/lib/rubygems/source_specific_file.rb +0 -6
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/ubygems.rb +0 -14
- data/util/CL2notes +0 -55
- data/util/ci +0 -82
- data/util/cops/deprecations.rb +0 -52
- data/util/create_certs.rb +0 -171
- data/util/create_certs.sh +0 -27
- data/util/create_encrypted_key.rb +0 -16
- data/util/generate_spdx_license_list.rb +0 -61
- data/util/patch_with_prs.rb +0 -77
- data/util/rubocop +0 -8
- data/util/update_bundled_ca_certificates.rb +0 -139
- data/util/update_changelog.rb +0 -67
data/lib/rubygems/source_list.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'rubygems/source'
|
3
2
|
|
4
3
|
##
|
5
4
|
# The SourceList represents the sources rubygems has been configured to use.
|
@@ -15,7 +14,6 @@ require 'rubygems/source'
|
|
15
14
|
# The most common way to get a SourceList is Gem.sources.
|
16
15
|
|
17
16
|
class Gem::SourceList
|
18
|
-
|
19
17
|
include Enumerable
|
20
18
|
|
21
19
|
##
|
@@ -50,6 +48,8 @@ class Gem::SourceList
|
|
50
48
|
# String.
|
51
49
|
|
52
50
|
def <<(obj)
|
51
|
+
require "uri"
|
52
|
+
|
53
53
|
src = case obj
|
54
54
|
when URI
|
55
55
|
Gem::Source.new(obj)
|
@@ -88,7 +88,7 @@ class Gem::SourceList
|
|
88
88
|
# Yields each source URI in the list.
|
89
89
|
|
90
90
|
def each
|
91
|
-
@sources.each {
|
91
|
+
@sources.each {|s| yield s.uri.to_s }
|
92
92
|
end
|
93
93
|
|
94
94
|
##
|
@@ -113,7 +113,7 @@ class Gem::SourceList
|
|
113
113
|
# Returns an Array of source URI Strings.
|
114
114
|
|
115
115
|
def to_a
|
116
|
-
@sources.map {
|
116
|
+
@sources.map {|x| x.uri.to_s }
|
117
117
|
end
|
118
118
|
|
119
119
|
alias_method :to_ary, :to_a
|
@@ -133,7 +133,7 @@ class Gem::SourceList
|
|
133
133
|
if other.kind_of? Gem::Source
|
134
134
|
@sources.include? other
|
135
135
|
else
|
136
|
-
@sources.find {
|
136
|
+
@sources.find {|x| x.uri.to_s == other.to_s }
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
@@ -144,7 +144,7 @@ class Gem::SourceList
|
|
144
144
|
if source.kind_of? Gem::Source
|
145
145
|
@sources.delete source
|
146
146
|
else
|
147
|
-
@sources.delete_if {
|
147
|
+
@sources.delete_if {|x| x.uri.to_s == source.to_s }
|
148
148
|
end
|
149
149
|
end
|
150
150
|
end
|
@@ -9,7 +9,6 @@ require 'rubygems/name_tuple'
|
|
9
9
|
# SpecFetcher handles metadata updates from remote gem repositories.
|
10
10
|
|
11
11
|
class Gem::SpecFetcher
|
12
|
-
|
13
12
|
include Gem::UserInteraction
|
14
13
|
include Gem::Text
|
15
14
|
|
@@ -88,29 +87,18 @@ class Gem::SpecFetcher
|
|
88
87
|
|
89
88
|
rejected_specs = {}
|
90
89
|
|
91
|
-
|
92
|
-
if dependency.specific?
|
93
|
-
type = :complete
|
94
|
-
else
|
95
|
-
type = :abs_latest
|
96
|
-
end
|
97
|
-
elsif dependency.latest_version?
|
98
|
-
type = :latest
|
99
|
-
else
|
100
|
-
type = :released
|
101
|
-
end
|
90
|
+
list, errors = available_specs(dependency.identity)
|
102
91
|
|
103
|
-
list, errors = available_specs(type)
|
104
92
|
list.each do |source, specs|
|
105
93
|
if dependency.name.is_a?(String) && specs.respond_to?(:bsearch)
|
106
|
-
start_index = (0 ... specs.length).bsearch{
|
107
|
-
end_index = (0 ... specs.length).bsearch{
|
94
|
+
start_index = (0 ... specs.length).bsearch{|i| specs[i].name >= dependency.name }
|
95
|
+
end_index = (0 ... specs.length).bsearch{|i| specs[i].name > dependency.name }
|
108
96
|
specs = specs[start_index ... end_index] if start_index && end_index
|
109
97
|
end
|
110
98
|
|
111
99
|
found[source] = specs.select do |tup|
|
112
100
|
if dependency.match?(tup)
|
113
|
-
if matching_platform and !Gem::Platform.
|
101
|
+
if matching_platform and !Gem::Platform.match_gem?(tup.platform, tup.name)
|
114
102
|
pm = (
|
115
103
|
rejected_specs[dependency] ||= \
|
116
104
|
Gem::PlatformMismatch.new(tup.name, tup.version))
|
@@ -133,12 +121,11 @@ class Gem::SpecFetcher
|
|
133
121
|
end
|
134
122
|
end
|
135
123
|
|
136
|
-
tuples = tuples.sort_by {
|
124
|
+
tuples = tuples.sort_by {|x| x[0] }
|
137
125
|
|
138
126
|
return [tuples, errors]
|
139
127
|
end
|
140
128
|
|
141
|
-
|
142
129
|
##
|
143
130
|
# Return all gem name tuples who's names match +obj+
|
144
131
|
|
@@ -157,7 +144,6 @@ class Gem::SpecFetcher
|
|
157
144
|
tuples
|
158
145
|
end
|
159
146
|
|
160
|
-
|
161
147
|
##
|
162
148
|
# Find and fetch specs that match +dependency+.
|
163
149
|
#
|
@@ -184,30 +170,33 @@ class Gem::SpecFetcher
|
|
184
170
|
# Suggests gems based on the supplied +gem_name+. Returns an array of
|
185
171
|
# alternative gem names.
|
186
172
|
|
187
|
-
def suggest_gems_from_name(gem_name, type = :latest)
|
173
|
+
def suggest_gems_from_name(gem_name, type = :latest, num_results = 5)
|
188
174
|
gem_name = gem_name.downcase.tr('_-', '')
|
189
175
|
max = gem_name.size / 2
|
190
176
|
names = available_specs(type).first.values.flatten(1)
|
191
177
|
|
192
|
-
matches = names.map
|
178
|
+
matches = names.map do |n|
|
193
179
|
next unless n.match_platform?
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
180
|
+
[n.name, 0] if n.name.downcase.tr('_-', '').include?(gem_name)
|
181
|
+
end.compact
|
182
|
+
|
183
|
+
if matches.length < num_results
|
184
|
+
matches += names.map do |n|
|
185
|
+
next unless n.match_platform?
|
186
|
+
distance = levenshtein_distance gem_name, n.name.downcase.tr('_-', '')
|
187
|
+
next if distance >= max
|
188
|
+
return [n.name] if distance == 0
|
189
|
+
[n.name, distance]
|
190
|
+
end.compact
|
191
|
+
end
|
203
192
|
|
204
193
|
matches = if matches.empty? && type != :prerelease
|
205
194
|
suggest_gems_from_name gem_name, :prerelease
|
206
195
|
else
|
207
|
-
matches.uniq.sort_by {
|
196
|
+
matches.uniq.sort_by {|name, dist| dist }
|
208
197
|
end
|
209
198
|
|
210
|
-
matches.
|
199
|
+
matches.map {|name, dist| name }.uniq.first(num_results)
|
211
200
|
end
|
212
201
|
|
213
202
|
##
|
@@ -264,10 +253,9 @@ class Gem::SpecFetcher
|
|
264
253
|
|
265
254
|
def tuples_for(source, type, gracefully_ignore=false) # :nodoc:
|
266
255
|
@caches[type][source.uri] ||=
|
267
|
-
source.load_specs(type).sort_by {
|
256
|
+
source.load_specs(type).sort_by {|tup| tup.name }
|
268
257
|
rescue Gem::RemoteFetcher::FetchError
|
269
258
|
raise unless gracefully_ignore
|
270
259
|
[]
|
271
260
|
end
|
272
|
-
|
273
261
|
end
|
@@ -6,16 +6,11 @@
|
|
6
6
|
# See LICENSE.txt for permissions.
|
7
7
|
#++
|
8
8
|
|
9
|
-
|
10
|
-
require 'rubygems/version'
|
11
|
-
require 'rubygems/requirement'
|
12
|
-
require 'rubygems/platform'
|
13
9
|
require 'rubygems/deprecate'
|
14
10
|
require 'rubygems/basic_specification'
|
15
11
|
require 'rubygems/stub_specification'
|
16
12
|
require 'rubygems/specification_policy'
|
17
13
|
require 'rubygems/util/list'
|
18
|
-
require 'stringio'
|
19
14
|
|
20
15
|
##
|
21
16
|
# The Specification class contains the information for a gem. Typically
|
@@ -39,7 +34,6 @@ require 'stringio'
|
|
39
34
|
# items you may add to a specification.
|
40
35
|
|
41
36
|
class Gem::Specification < Gem::BasicSpecification
|
42
|
-
|
43
37
|
extend Gem::Deprecate
|
44
38
|
|
45
39
|
# REFACTOR: Consider breaking out this version stuff into a separate
|
@@ -83,18 +77,18 @@ class Gem::Specification < Gem::BasicSpecification
|
|
83
77
|
-1 => ['(RubyGems versions up to and including 0.7 did not have versioned specifications)'],
|
84
78
|
1 => [
|
85
79
|
'Deprecated "test_suite_file" in favor of the new, but equivalent, "test_files"',
|
86
|
-
'"test_file=x" is a shortcut for "test_files=[x]"'
|
80
|
+
'"test_file=x" is a shortcut for "test_files=[x]"',
|
87
81
|
],
|
88
|
-
2
|
82
|
+
2 => [
|
89
83
|
'Added "required_rubygems_version"',
|
90
84
|
'Now forward-compatible with future versions',
|
91
85
|
],
|
92
|
-
3
|
93
|
-
'Added Fixnum validation to the specification_version'
|
86
|
+
3 => [
|
87
|
+
'Added Fixnum validation to the specification_version',
|
88
|
+
],
|
89
|
+
4 => [
|
90
|
+
'Added sandboxed freeform metadata to the specification version.',
|
94
91
|
],
|
95
|
-
4 => [
|
96
|
-
'Added sandboxed freeform metadata to the specification version.'
|
97
|
-
]
|
98
92
|
}.freeze
|
99
93
|
|
100
94
|
MARSHAL_FIELDS = { # :nodoc:
|
@@ -111,6 +105,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
111
105
|
# rubocop:disable Style/MutableConstant
|
112
106
|
LOAD_CACHE = {} # :nodoc:
|
113
107
|
# rubocop:enable Style/MutableConstant
|
108
|
+
LOAD_CACHE_MUTEX = Mutex.new
|
114
109
|
|
115
110
|
private_constant :LOAD_CACHE if defined? private_constant
|
116
111
|
|
@@ -181,18 +176,25 @@ class Gem::Specification < Gem::BasicSpecification
|
|
181
176
|
end
|
182
177
|
end
|
183
178
|
|
184
|
-
@@attributes = @@default_value.keys.sort_by {
|
185
|
-
@@array_attributes = @@default_value.reject {
|
186
|
-
@@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition
|
179
|
+
@@attributes = @@default_value.keys.sort_by {|s| s.to_s }
|
180
|
+
@@array_attributes = @@default_value.reject {|k,v| v != [] }.keys
|
181
|
+
@@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition do |k|
|
187
182
|
@@default_value[k].nil?
|
188
|
-
|
183
|
+
end
|
189
184
|
|
185
|
+
@@stubs = nil
|
190
186
|
@@stubs_by_name = {}
|
191
187
|
|
192
188
|
# Sentinel object to represent "not found" stubs
|
193
189
|
NOT_FOUND = Struct.new(:to_spec, :this).new # :nodoc:
|
194
|
-
@@spec_with_requirable_file
|
195
|
-
@@active_stub_with_requirable_file
|
190
|
+
@@spec_with_requirable_file = {}
|
191
|
+
@@active_stub_with_requirable_file = {}
|
192
|
+
|
193
|
+
# Tracking removed method calls to warn users during build time.
|
194
|
+
REMOVED_METHODS = [:rubyforge_project=].freeze # :nodoc:
|
195
|
+
def removed_method_calls
|
196
|
+
@removed_method_calls ||= []
|
197
|
+
end
|
196
198
|
|
197
199
|
######################################################################
|
198
200
|
# :section: Required gemspec attributes
|
@@ -244,12 +246,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
244
246
|
# require 'rake'
|
245
247
|
# spec.files = FileList['lib/**/*.rb',
|
246
248
|
# 'bin/*',
|
247
|
-
# '[A-Z]*'
|
248
|
-
# 'test/**/*'].to_a
|
249
|
+
# '[A-Z]*'].to_a
|
249
250
|
#
|
250
251
|
# # or without Rake...
|
251
252
|
# spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
|
252
|
-
# spec.files += Dir['[A-Z]*']
|
253
|
+
# spec.files += Dir['[A-Z]*']
|
253
254
|
# spec.files.reject! { |fn| fn.include? "CVS" }
|
254
255
|
|
255
256
|
def files
|
@@ -385,6 +386,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
385
386
|
# "mailing_list_uri" => "https://groups.example.com/bestgemever",
|
386
387
|
# "source_code_uri" => "https://example.com/user/bestgemever",
|
387
388
|
# "wiki_uri" => "https://example.com/user/bestgemever/wiki"
|
389
|
+
# "funding_uri" => "https://example.com/donate"
|
388
390
|
# }
|
389
391
|
#
|
390
392
|
# These links will be used on your gem's page on rubygems.org and must pass
|
@@ -555,6 +557,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
555
557
|
# spec.add_runtime_dependency 'example', '~> 1.1', '>= 1.1.4'
|
556
558
|
|
557
559
|
def add_runtime_dependency(gem, *requirements)
|
560
|
+
if requirements.uniq.size != requirements.size
|
561
|
+
warn "WARNING: duplicated #{gem} dependency #{requirements}"
|
562
|
+
end
|
563
|
+
|
558
564
|
add_dependency_with_type(gem, :runtime, requirements)
|
559
565
|
end
|
560
566
|
|
@@ -660,6 +666,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
660
666
|
#
|
661
667
|
# # Only prereleases or final releases after 2.6.0.preview2
|
662
668
|
# spec.required_ruby_version = '> 2.6.0.preview2'
|
669
|
+
#
|
670
|
+
# # This gem will work with 2.3.0 or greater, including major version 3, but lesser than 4.0.0
|
671
|
+
# spec.required_ruby_version = '>= 2.3', '< 4'
|
663
672
|
|
664
673
|
def required_ruby_version=(req)
|
665
674
|
@required_ruby_version = Gem::Requirement.create req
|
@@ -720,20 +729,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
720
729
|
# Deprecated: You must now specify the executable name to Gem.bin_path.
|
721
730
|
|
722
731
|
attr_writer :default_executable
|
723
|
-
|
732
|
+
rubygems_deprecate :default_executable=
|
724
733
|
|
725
734
|
##
|
726
735
|
# Allows deinstallation of gems with legacy platforms.
|
727
736
|
|
728
737
|
attr_writer :original_platform # :nodoc:
|
729
738
|
|
730
|
-
##
|
731
|
-
# Deprecated and ignored.
|
732
|
-
#
|
733
|
-
# Formerly used to set rubyforge project.
|
734
|
-
|
735
|
-
attr_writer :rubyforge_project
|
736
|
-
|
737
739
|
##
|
738
740
|
# The Gem::Specification version of this gemspec.
|
739
741
|
#
|
@@ -748,38 +750,31 @@ class Gem::Specification < Gem::BasicSpecification
|
|
748
750
|
# After a reset, make sure already loaded specs
|
749
751
|
# are still marked as activated.
|
750
752
|
specs = {}
|
751
|
-
Gem.loaded_specs.each_value{|s| specs[s] = true}
|
752
|
-
@@all.each{|s| s.activated = true if specs[s]}
|
753
|
+
Gem.loaded_specs.each_value{|s| specs[s] = true }
|
754
|
+
@@all.each{|s| s.activated = true if specs[s] }
|
753
755
|
end
|
754
756
|
@@all
|
755
757
|
end
|
756
758
|
|
757
759
|
def self._clear_load_cache # :nodoc:
|
758
|
-
|
760
|
+
LOAD_CACHE_MUTEX.synchronize do
|
761
|
+
LOAD_CACHE.clear
|
762
|
+
end
|
759
763
|
end
|
760
764
|
|
761
765
|
def self.each_gemspec(dirs) # :nodoc:
|
762
766
|
dirs.each do |dir|
|
763
767
|
Gem::Util.glob_files_in_dir("*.gemspec", dir).each do |path|
|
764
|
-
yield path.
|
768
|
+
yield path.tap(&Gem::UNTAINT)
|
765
769
|
end
|
766
770
|
end
|
767
771
|
end
|
768
772
|
|
769
773
|
def self.gemspec_stubs_in(dir, pattern)
|
770
|
-
Gem::Util.glob_files_in_dir(pattern, dir).map {
|
774
|
+
Gem::Util.glob_files_in_dir(pattern, dir).map {|path| yield path }.select(&:valid?)
|
771
775
|
end
|
772
776
|
private_class_method :gemspec_stubs_in
|
773
777
|
|
774
|
-
def self.default_stubs(pattern)
|
775
|
-
base_dir = Gem.default_dir
|
776
|
-
gems_dir = File.join base_dir, "gems"
|
777
|
-
gemspec_stubs_in(default_specifications_dir, pattern) do |path|
|
778
|
-
Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir)
|
779
|
-
end
|
780
|
-
end
|
781
|
-
private_class_method :default_stubs
|
782
|
-
|
783
778
|
def self.installed_stubs(dirs, pattern)
|
784
779
|
map_stubs(dirs, pattern) do |path, base_dir, gems_dir|
|
785
780
|
Gem::StubSpecification.gemspec_stub(path, base_dir, gems_dir)
|
@@ -788,24 +783,14 @@ class Gem::Specification < Gem::BasicSpecification
|
|
788
783
|
private_class_method :installed_stubs
|
789
784
|
|
790
785
|
def self.map_stubs(dirs, pattern) # :nodoc:
|
791
|
-
dirs.flat_map
|
786
|
+
dirs.flat_map do |dir|
|
792
787
|
base_dir = File.dirname dir
|
793
788
|
gems_dir = File.join base_dir, "gems"
|
794
|
-
gemspec_stubs_in(dir, pattern) {
|
795
|
-
|
789
|
+
gemspec_stubs_in(dir, pattern) {|path| yield path, base_dir, gems_dir }
|
790
|
+
end
|
796
791
|
end
|
797
792
|
private_class_method :map_stubs
|
798
793
|
|
799
|
-
def self.uniq_by(list, &block) # :nodoc:
|
800
|
-
list.uniq(&block)
|
801
|
-
end
|
802
|
-
private_class_method :uniq_by
|
803
|
-
|
804
|
-
def self.sort_by!(list, &block)
|
805
|
-
list.sort_by!(&block)
|
806
|
-
end
|
807
|
-
private_class_method :sort_by!
|
808
|
-
|
809
794
|
def self.each_spec(dirs) # :nodoc:
|
810
795
|
each_gemspec(dirs) do |path|
|
811
796
|
spec = self.load path
|
@@ -819,16 +804,23 @@ class Gem::Specification < Gem::BasicSpecification
|
|
819
804
|
def self.stubs
|
820
805
|
@@stubs ||= begin
|
821
806
|
pattern = "*.gemspec"
|
822
|
-
stubs =
|
823
|
-
stubs = uniq_by(stubs) { |stub| stub.full_name }
|
807
|
+
stubs = stubs_for_pattern(pattern, false)
|
824
808
|
|
825
|
-
|
826
|
-
@@stubs_by_name = stubs.select { |s| Gem::Platform.match s.platform }.group_by(&:name)
|
809
|
+
@@stubs_by_name = stubs.select {|s| Gem::Platform.match_spec? s }.group_by(&:name)
|
827
810
|
stubs
|
828
811
|
end
|
829
812
|
end
|
830
813
|
|
831
|
-
|
814
|
+
##
|
815
|
+
# Returns a Gem::StubSpecification for default gems
|
816
|
+
|
817
|
+
def self.default_stubs(pattern = "*.gemspec")
|
818
|
+
base_dir = Gem.default_dir
|
819
|
+
gems_dir = File.join base_dir, "gems"
|
820
|
+
gemspec_stubs_in(Gem.default_specifications_dir, pattern) do |path|
|
821
|
+
Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir)
|
822
|
+
end
|
823
|
+
end
|
832
824
|
|
833
825
|
##
|
834
826
|
# Returns a Gem::StubSpecification for installed gem named +name+
|
@@ -838,81 +830,46 @@ class Gem::Specification < Gem::BasicSpecification
|
|
838
830
|
if @@stubs
|
839
831
|
@@stubs_by_name[name] || []
|
840
832
|
else
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
stubs = uniq_by(stubs) { |stub| stub.full_name }.group_by(&:name)
|
845
|
-
stubs.each_value { |v| _resort!(v) }
|
846
|
-
|
847
|
-
@@stubs_by_name.merge! stubs
|
848
|
-
@@stubs_by_name[name] ||= EMPTY
|
833
|
+
@@stubs_by_name[name] ||= stubs_for_pattern("#{name}-*.gemspec").select do |s|
|
834
|
+
s.name == name
|
835
|
+
end
|
849
836
|
end
|
850
837
|
end
|
851
838
|
|
839
|
+
##
|
840
|
+
# Finds stub specifications matching a pattern from the standard locations,
|
841
|
+
# optionally filtering out specs not matching the current platform
|
842
|
+
#
|
843
|
+
def self.stubs_for_pattern(pattern, match_platform = true) # :nodoc:
|
844
|
+
installed_stubs = installed_stubs(Gem::Specification.dirs, pattern)
|
845
|
+
installed_stubs.select! {|s| Gem::Platform.match_spec? s } if match_platform
|
846
|
+
stubs = installed_stubs + default_stubs(pattern)
|
847
|
+
stubs = stubs.uniq {|stub| stub.full_name }
|
848
|
+
_resort!(stubs)
|
849
|
+
stubs
|
850
|
+
end
|
851
|
+
|
852
852
|
def self._resort!(specs) # :nodoc:
|
853
|
-
specs.sort!
|
853
|
+
specs.sort! do |a, b|
|
854
854
|
names = a.name <=> b.name
|
855
855
|
next names if names.nonzero?
|
856
|
-
b.version <=> a.version
|
857
|
-
|
856
|
+
versions = b.version <=> a.version
|
857
|
+
next versions if versions.nonzero?
|
858
|
+
b.platform == Gem::Platform::RUBY ? -1 : 1
|
859
|
+
end
|
858
860
|
end
|
859
861
|
|
860
862
|
##
|
861
863
|
# Loads the default specifications. It should be called only once.
|
862
864
|
|
863
865
|
def self.load_defaults
|
864
|
-
each_spec([default_specifications_dir]) do |spec|
|
866
|
+
each_spec([Gem.default_specifications_dir]) do |spec|
|
865
867
|
# #load returns nil if the spec is bad, so we just ignore
|
866
868
|
# it at this stage
|
867
869
|
Gem.register_default_spec(spec)
|
868
870
|
end
|
869
871
|
end
|
870
872
|
|
871
|
-
##
|
872
|
-
# Adds +spec+ to the known specifications, keeping the collection
|
873
|
-
# properly sorted.
|
874
|
-
|
875
|
-
def self.add_spec(spec)
|
876
|
-
warn "Gem::Specification.add_spec is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
|
877
|
-
# TODO: find all extraneous adds
|
878
|
-
# puts
|
879
|
-
# p :add_spec => [spec.full_name, caller.reject { |s| s =~ /minitest/ }]
|
880
|
-
|
881
|
-
# TODO: flush the rest of the crap from the tests
|
882
|
-
# raise "no dupes #{spec.full_name} in #{all_names.inspect}" if
|
883
|
-
# _all.include? spec
|
884
|
-
|
885
|
-
raise "nil spec!" unless spec # TODO: remove once we're happy with tests
|
886
|
-
|
887
|
-
return if _all.include? spec
|
888
|
-
|
889
|
-
_all << spec
|
890
|
-
stubs << spec
|
891
|
-
(@@stubs_by_name[spec.name] ||= []) << spec
|
892
|
-
sort_by!(@@stubs_by_name[spec.name]) { |s| s.version }
|
893
|
-
_resort!(_all)
|
894
|
-
_resort!(stubs)
|
895
|
-
end
|
896
|
-
|
897
|
-
##
|
898
|
-
# Adds multiple specs to the known specifications.
|
899
|
-
|
900
|
-
def self.add_specs(*specs)
|
901
|
-
warn "Gem::Specification.add_specs is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
|
902
|
-
|
903
|
-
raise "nil spec!" if specs.any?(&:nil?) # TODO: remove once we're happy
|
904
|
-
|
905
|
-
# TODO: this is much more efficient, but we need the extra checks for now
|
906
|
-
# _all.concat specs
|
907
|
-
# _resort!
|
908
|
-
|
909
|
-
Gem::Deprecate.skip_during do
|
910
|
-
specs.each do |spec| # TODO: slow
|
911
|
-
add_spec spec
|
912
|
-
end
|
913
|
-
end
|
914
|
-
end
|
915
|
-
|
916
873
|
##
|
917
874
|
# Returns all specifications. This method is discouraged from use.
|
918
875
|
# You probably want to use one of the Enumerable methods instead.
|
@@ -969,9 +926,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
969
926
|
# Return the directories that Specification uses to find specs.
|
970
927
|
|
971
928
|
def self.dirs
|
972
|
-
@@dirs ||= Gem.path.collect
|
973
|
-
File.join dir.dup.
|
974
|
-
|
929
|
+
@@dirs ||= Gem.path.collect do |dir|
|
930
|
+
File.join dir.dup.tap(&Gem::UNTAINT), "specifications"
|
931
|
+
end
|
975
932
|
end
|
976
933
|
|
977
934
|
##
|
@@ -981,7 +938,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
981
938
|
def self.dirs=(dirs)
|
982
939
|
self.reset
|
983
940
|
|
984
|
-
@@dirs = Array(dirs).map {
|
941
|
+
@@dirs = Array(dirs).map {|dir| File.join dir, "specifications" }
|
985
942
|
end
|
986
943
|
|
987
944
|
extend Enumerable
|
@@ -1033,10 +990,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1033
990
|
|
1034
991
|
def self.find_by_path(path)
|
1035
992
|
path = path.dup.freeze
|
1036
|
-
spec = @@spec_with_requirable_file[path] ||= (stubs.find
|
993
|
+
spec = @@spec_with_requirable_file[path] ||= (stubs.find do |s|
|
1037
994
|
next unless Gem::BundlerVersionFinder.compatible?(s)
|
1038
995
|
s.contains_requirable_file? path
|
1039
|
-
|
996
|
+
end || NOT_FOUND)
|
1040
997
|
spec.to_spec
|
1041
998
|
end
|
1042
999
|
|
@@ -1045,18 +1002,18 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1045
1002
|
# amongst the specs that are not activated.
|
1046
1003
|
|
1047
1004
|
def self.find_inactive_by_path(path)
|
1048
|
-
stub = stubs.find
|
1005
|
+
stub = stubs.find do |s|
|
1049
1006
|
next if s.activated?
|
1050
1007
|
next unless Gem::BundlerVersionFinder.compatible?(s)
|
1051
1008
|
s.contains_requirable_file? path
|
1052
|
-
|
1009
|
+
end
|
1053
1010
|
stub && stub.to_spec
|
1054
1011
|
end
|
1055
1012
|
|
1056
1013
|
def self.find_active_stub_by_path(path)
|
1057
|
-
stub = @@active_stub_with_requirable_file[path] ||= (stubs.find
|
1014
|
+
stub = @@active_stub_with_requirable_file[path] ||= (stubs.find do |s|
|
1058
1015
|
s.activated? and s.contains_requirable_file? path
|
1059
|
-
|
1016
|
+
end || NOT_FOUND)
|
1060
1017
|
stub.this
|
1061
1018
|
end
|
1062
1019
|
|
@@ -1064,10 +1021,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1064
1021
|
# Return currently unresolved specs that contain the file matching +path+.
|
1065
1022
|
|
1066
1023
|
def self.find_in_unresolved(path)
|
1067
|
-
|
1068
|
-
specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
|
1069
|
-
|
1070
|
-
specs.find_all { |spec| spec.contains_requirable_file? path }
|
1024
|
+
unresolved_specs.find_all {|spec| spec.contains_requirable_file? path }
|
1071
1025
|
end
|
1072
1026
|
|
1073
1027
|
##
|
@@ -1075,9 +1029,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1075
1029
|
# specs that contain the file matching +path+.
|
1076
1030
|
|
1077
1031
|
def self.find_in_unresolved_tree(path)
|
1078
|
-
|
1079
|
-
|
1080
|
-
specs.each do |spec|
|
1032
|
+
unresolved_specs.each do |spec|
|
1081
1033
|
spec.traverse do |from_spec, dep, to_spec, trail|
|
1082
1034
|
if to_spec.has_conflicts? || to_spec.conficts_when_loaded_with?(trail)
|
1083
1035
|
:next
|
@@ -1090,6 +1042,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1090
1042
|
[]
|
1091
1043
|
end
|
1092
1044
|
|
1045
|
+
def self.unresolved_specs
|
1046
|
+
unresolved_deps.values.map {|dep| dep.to_specs }.flatten
|
1047
|
+
end
|
1048
|
+
private_class_method :unresolved_specs
|
1049
|
+
|
1093
1050
|
##
|
1094
1051
|
# Special loader for YAML files. When a Specification object is loaded
|
1095
1052
|
# from a YAML file, it bypasses the normal Ruby object initialization
|
@@ -1126,21 +1083,23 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1126
1083
|
_latest_specs Gem::Specification._all, prerelease
|
1127
1084
|
end
|
1128
1085
|
|
1086
|
+
##
|
1087
|
+
# Return the latest installed spec for gem +name+.
|
1088
|
+
|
1089
|
+
def self.latest_spec_for(name)
|
1090
|
+
latest_specs(true).find {|installed_spec| installed_spec.name == name }
|
1091
|
+
end
|
1092
|
+
|
1129
1093
|
def self._latest_specs(specs, prerelease = false) # :nodoc:
|
1130
|
-
result =
|
1131
|
-
native = {}
|
1094
|
+
result = {}
|
1132
1095
|
|
1133
1096
|
specs.reverse_each do |spec|
|
1134
1097
|
next if spec.version.prerelease? unless prerelease
|
1135
1098
|
|
1136
|
-
|
1137
|
-
result[spec.name][spec.platform] = spec
|
1099
|
+
result[spec.name] = spec
|
1138
1100
|
end
|
1139
1101
|
|
1140
|
-
result.map(&:last).
|
1141
|
-
minimum = native[spec.name]
|
1142
|
-
minimum && spec.version < minimum
|
1143
|
-
}.sort_by{ |tup| tup.name }
|
1102
|
+
result.map(&:last).flatten.sort_by{|tup| tup.name }
|
1144
1103
|
end
|
1145
1104
|
|
1146
1105
|
##
|
@@ -1149,22 +1108,29 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1149
1108
|
def self.load(file)
|
1150
1109
|
return unless file
|
1151
1110
|
|
1152
|
-
_spec = LOAD_CACHE[file]
|
1111
|
+
_spec = LOAD_CACHE_MUTEX.synchronize { LOAD_CACHE[file] }
|
1153
1112
|
return _spec if _spec
|
1154
1113
|
|
1155
|
-
file = file.dup.
|
1114
|
+
file = file.dup.tap(&Gem::UNTAINT)
|
1156
1115
|
return unless File.file?(file)
|
1157
1116
|
|
1158
1117
|
code = File.read file, :mode => 'r:UTF-8:-'
|
1159
1118
|
|
1160
|
-
code.
|
1119
|
+
code.tap(&Gem::UNTAINT)
|
1161
1120
|
|
1162
1121
|
begin
|
1163
1122
|
_spec = eval code, binding, file
|
1164
1123
|
|
1165
1124
|
if Gem::Specification === _spec
|
1166
1125
|
_spec.loaded_from = File.expand_path file.to_s
|
1167
|
-
|
1126
|
+
LOAD_CACHE_MUTEX.synchronize do
|
1127
|
+
prev = LOAD_CACHE[file]
|
1128
|
+
if prev
|
1129
|
+
_spec = prev
|
1130
|
+
else
|
1131
|
+
LOAD_CACHE[file] = _spec
|
1132
|
+
end
|
1133
|
+
end
|
1168
1134
|
return _spec
|
1169
1135
|
end
|
1170
1136
|
|
@@ -1190,7 +1156,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1190
1156
|
|
1191
1157
|
def self.normalize_yaml_input(input)
|
1192
1158
|
result = input.respond_to?(:read) ? input.read : input
|
1193
|
-
result = "--- " + result unless result
|
1159
|
+
result = "--- " + result unless result.start_with?("--- ")
|
1194
1160
|
result = result.dup
|
1195
1161
|
result.gsub!(/ !!null \n/, " \n")
|
1196
1162
|
# date: 2011-04-26 00:00:00.000000000Z
|
@@ -1207,7 +1173,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1207
1173
|
# version as well.
|
1208
1174
|
|
1209
1175
|
def self.outdated
|
1210
|
-
outdated_and_latest_version.map {
|
1176
|
+
outdated_and_latest_version.map {|local, _| local.name }
|
1211
1177
|
end
|
1212
1178
|
|
1213
1179
|
##
|
@@ -1228,7 +1194,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1228
1194
|
Gem::Dependency.new local_spec.name, ">= #{local_spec.version}"
|
1229
1195
|
|
1230
1196
|
remotes, = fetcher.search_for_dependency dependency
|
1231
|
-
remotes = remotes.map {
|
1197
|
+
remotes = remotes.map {|n, _| n.version }
|
1232
1198
|
|
1233
1199
|
latest_remote = remotes.sort.last
|
1234
1200
|
|
@@ -1239,17 +1205,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1239
1205
|
nil
|
1240
1206
|
end
|
1241
1207
|
|
1242
|
-
##
|
1243
|
-
# Removes +spec+ from the known specs.
|
1244
|
-
|
1245
|
-
def self.remove_spec(spec)
|
1246
|
-
warn "Gem::Specification.remove_spec is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
|
1247
|
-
_all.delete spec
|
1248
|
-
stubs.delete_if { |s| s.full_name == spec.full_name }
|
1249
|
-
(@@stubs_by_name[spec.name] || []).delete_if { |s| s.full_name == spec.full_name }
|
1250
|
-
reset
|
1251
|
-
end
|
1252
|
-
|
1253
1208
|
##
|
1254
1209
|
# Is +name+ a required attribute?
|
1255
1210
|
|
@@ -1270,36 +1225,36 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1270
1225
|
|
1271
1226
|
def self.reset
|
1272
1227
|
@@dirs = nil
|
1273
|
-
Gem.pre_reset_hooks.each {
|
1228
|
+
Gem.pre_reset_hooks.each {|hook| hook.call }
|
1274
1229
|
@@all = nil
|
1275
1230
|
@@stubs = nil
|
1276
1231
|
@@stubs_by_name = {}
|
1277
|
-
@@spec_with_requirable_file
|
1278
|
-
@@active_stub_with_requirable_file
|
1232
|
+
@@spec_with_requirable_file = {}
|
1233
|
+
@@active_stub_with_requirable_file = {}
|
1279
1234
|
_clear_load_cache
|
1280
1235
|
unresolved = unresolved_deps
|
1281
1236
|
unless unresolved.empty?
|
1282
1237
|
w = "W" + "ARN"
|
1283
|
-
warn "#{w}: Unresolved or
|
1238
|
+
warn "#{w}: Unresolved or ambiguous specs during Gem::Specification.reset:"
|
1284
1239
|
unresolved.values.each do |dep|
|
1285
1240
|
warn " #{dep}"
|
1286
1241
|
|
1287
1242
|
versions = find_all_by_name(dep.name)
|
1288
1243
|
unless versions.empty?
|
1289
1244
|
warn " Available/installed versions of this gem:"
|
1290
|
-
versions.each {
|
1245
|
+
versions.each {|s| warn " - #{s.version}" }
|
1291
1246
|
end
|
1292
1247
|
end
|
1293
1248
|
warn "#{w}: Clearing out unresolved specs. Try 'gem cleanup <gem>'"
|
1294
1249
|
warn "Please report a bug if this causes problems."
|
1295
1250
|
unresolved.clear
|
1296
1251
|
end
|
1297
|
-
Gem.post_reset_hooks.each {
|
1252
|
+
Gem.post_reset_hooks.each {|hook| hook.call }
|
1298
1253
|
end
|
1299
1254
|
|
1300
1255
|
# DOC: This method needs documented or nodoc'd
|
1301
1256
|
def self.unresolved_deps
|
1302
|
-
@unresolved_deps ||= Hash.new {
|
1257
|
+
@unresolved_deps ||= Hash.new {|h, n| h[n] = Gem::Dependency.new n }
|
1303
1258
|
end
|
1304
1259
|
|
1305
1260
|
##
|
@@ -1330,7 +1285,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1330
1285
|
# Cleanup any YAML::PrivateType. They only show up for an old bug
|
1331
1286
|
# where nil => null, so just convert them to nil based on the type.
|
1332
1287
|
|
1333
|
-
array.map! {
|
1288
|
+
array.map! {|e| e.kind_of?(YAML::PrivateType) ? nil : e }
|
1334
1289
|
|
1335
1290
|
spec.instance_variable_set :@rubygems_version, array[0]
|
1336
1291
|
# spec version
|
@@ -1395,7 +1350,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1395
1350
|
true, # has_rdoc
|
1396
1351
|
@new_platform,
|
1397
1352
|
@licenses,
|
1398
|
-
@metadata
|
1353
|
+
@metadata,
|
1399
1354
|
]
|
1400
1355
|
end
|
1401
1356
|
|
@@ -1443,7 +1398,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1443
1398
|
raise e
|
1444
1399
|
end
|
1445
1400
|
|
1446
|
-
|
1401
|
+
begin
|
1402
|
+
specs = spec_dep.to_specs
|
1403
|
+
rescue Gem::MissingSpecError => e
|
1404
|
+
raise Gem::MissingSpecError.new(e.name, e.requirement, "at: #{self.spec_file}")
|
1405
|
+
end
|
1447
1406
|
|
1448
1407
|
if specs.size == 1
|
1449
1408
|
specs.first.activate
|
@@ -1479,7 +1438,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1479
1438
|
self.summary = sanitize_string(summary)
|
1480
1439
|
self.description = sanitize_string(description)
|
1481
1440
|
self.post_install_message = sanitize_string(post_install_message)
|
1482
|
-
self.authors = authors.collect {
|
1441
|
+
self.authors = authors.collect {|a| sanitize_string(a) }
|
1483
1442
|
end
|
1484
1443
|
|
1485
1444
|
##
|
@@ -1491,13 +1450,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1491
1450
|
# HACK the #to_s is in here because RSpec has an Array of Arrays of
|
1492
1451
|
# Strings for authors. Need a way to disallow bad values on gemspec
|
1493
1452
|
# generation. (Probably won't happen.)
|
1494
|
-
string
|
1495
|
-
|
1496
|
-
begin
|
1497
|
-
Builder::XChar.encode string
|
1498
|
-
rescue NameError, NoMethodError
|
1499
|
-
string.to_xs
|
1500
|
-
end
|
1453
|
+
string.to_s
|
1501
1454
|
end
|
1502
1455
|
|
1503
1456
|
##
|
@@ -1508,7 +1461,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1508
1461
|
return nil if executables.nil?
|
1509
1462
|
|
1510
1463
|
if @bindir
|
1511
|
-
Array(executables).map {
|
1464
|
+
Array(executables).map {|e| File.join(@bindir, e) }
|
1512
1465
|
else
|
1513
1466
|
executables
|
1514
1467
|
end
|
@@ -1548,16 +1501,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1548
1501
|
|
1549
1502
|
paths = full_require_paths
|
1550
1503
|
|
1551
|
-
|
1552
|
-
insert_index = Gem.load_path_insert_index
|
1553
|
-
|
1554
|
-
if insert_index
|
1555
|
-
# gem directories must come after -I and ENV['RUBYLIB']
|
1556
|
-
$LOAD_PATH.insert(insert_index, *paths)
|
1557
|
-
else
|
1558
|
-
# we are probably testing in core, -I and RUBYLIB don't apply
|
1559
|
-
$LOAD_PATH.unshift(*paths)
|
1560
|
-
end
|
1504
|
+
Gem.add_to_load_path(*paths)
|
1561
1505
|
end
|
1562
1506
|
|
1563
1507
|
##
|
@@ -1583,7 +1527,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1583
1527
|
# a full path.
|
1584
1528
|
|
1585
1529
|
def bin_dir
|
1586
|
-
@bin_dir ||= File.join gem_dir, bindir
|
1530
|
+
@bin_dir ||= File.join gem_dir, bindir
|
1587
1531
|
end
|
1588
1532
|
|
1589
1533
|
##
|
@@ -1599,7 +1543,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1599
1543
|
def build_args
|
1600
1544
|
if File.exist? build_info_file
|
1601
1545
|
build_info = File.readlines build_info_file
|
1602
|
-
build_info = build_info.map {
|
1546
|
+
build_info = build_info.map {|x| x.strip }
|
1603
1547
|
build_info.delete ""
|
1604
1548
|
build_info
|
1605
1549
|
else
|
@@ -1675,12 +1619,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1675
1619
|
|
1676
1620
|
def conflicts
|
1677
1621
|
conflicts = {}
|
1678
|
-
self.runtime_dependencies.each
|
1622
|
+
self.runtime_dependencies.each do |dep|
|
1679
1623
|
spec = Gem.loaded_specs[dep.name]
|
1680
1624
|
if spec and not spec.satisfies_requirement? dep
|
1681
1625
|
(conflicts[spec] ||= []) << dep
|
1682
1626
|
end
|
1683
|
-
|
1627
|
+
end
|
1684
1628
|
env_req = Gem.env_requirement(name)
|
1685
1629
|
(conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version
|
1686
1630
|
conflicts
|
@@ -1690,9 +1634,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1690
1634
|
# return true if there will be conflict when spec if loaded together with the list of specs.
|
1691
1635
|
|
1692
1636
|
def conficts_when_loaded_with?(list_of_specs) # :nodoc:
|
1693
|
-
result = list_of_specs.any?
|
1694
|
-
spec.dependencies.any? {
|
1695
|
-
|
1637
|
+
result = list_of_specs.any? do |spec|
|
1638
|
+
spec.dependencies.any? {|dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }
|
1639
|
+
end
|
1696
1640
|
result
|
1697
1641
|
end
|
1698
1642
|
|
@@ -1701,14 +1645,14 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1701
1645
|
|
1702
1646
|
def has_conflicts?
|
1703
1647
|
return true unless Gem.env_requirement(name).satisfied_by?(version)
|
1704
|
-
self.dependencies.any?
|
1648
|
+
self.dependencies.any? do |dep|
|
1705
1649
|
if dep.runtime?
|
1706
1650
|
spec = Gem.loaded_specs[dep.name]
|
1707
1651
|
spec and not spec.satisfies_requirement? dep
|
1708
1652
|
else
|
1709
1653
|
false
|
1710
1654
|
end
|
1711
|
-
|
1655
|
+
end
|
1712
1656
|
end
|
1713
1657
|
|
1714
1658
|
# The date this gem was created.
|
@@ -1720,7 +1664,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1720
1664
|
# https://reproducible-builds.org/specs/source-date-epoch/
|
1721
1665
|
|
1722
1666
|
def date
|
1723
|
-
@date ||=
|
1667
|
+
@date ||= Time.utc(*Gem.source_date_epoch.utc.to_a[3..5].reverse)
|
1724
1668
|
end
|
1725
1669
|
|
1726
1670
|
DateLike = Object.new # :nodoc:
|
@@ -1780,7 +1724,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1780
1724
|
end
|
1781
1725
|
result
|
1782
1726
|
end
|
1783
|
-
|
1727
|
+
rubygems_deprecate :default_executable
|
1784
1728
|
|
1785
1729
|
##
|
1786
1730
|
# The default value for specification attribute +name+
|
@@ -1805,10 +1749,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1805
1749
|
#
|
1806
1750
|
# [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]]
|
1807
1751
|
|
1808
|
-
def dependent_gems
|
1752
|
+
def dependent_gems(check_dev=true)
|
1809
1753
|
out = []
|
1810
1754
|
Gem::Specification.each do |spec|
|
1811
|
-
spec.dependencies
|
1755
|
+
deps = check_dev ? spec.dependencies : spec.runtime_dependencies
|
1756
|
+
deps.each do |dep|
|
1812
1757
|
if self.satisfies_requirement?(dep)
|
1813
1758
|
sats = []
|
1814
1759
|
find_all_satisfiers(dep) do |sat|
|
@@ -1825,7 +1770,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1825
1770
|
# Returns all specs that matches this spec's runtime dependencies.
|
1826
1771
|
|
1827
1772
|
def dependent_specs
|
1828
|
-
runtime_dependencies.map {
|
1773
|
+
runtime_dependencies.map {|dep| dep.to_specs }.flatten
|
1829
1774
|
end
|
1830
1775
|
|
1831
1776
|
##
|
@@ -1839,7 +1784,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1839
1784
|
# List of dependencies that are used for development
|
1840
1785
|
|
1841
1786
|
def development_dependencies
|
1842
|
-
dependencies.select {
|
1787
|
+
dependencies.select {|d| d.type == :development }
|
1843
1788
|
end
|
1844
1789
|
|
1845
1790
|
##
|
@@ -1900,29 +1845,23 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1900
1845
|
end
|
1901
1846
|
|
1902
1847
|
##
|
1903
|
-
# Sets executables to +value+, ensuring it is an array.
|
1904
|
-
# use this, push onto the array instead.
|
1848
|
+
# Sets executables to +value+, ensuring it is an array.
|
1905
1849
|
|
1906
1850
|
def executables=(value)
|
1907
|
-
# TODO: warn about setting instead of pushing
|
1908
1851
|
@executables = Array(value)
|
1909
1852
|
end
|
1910
1853
|
|
1911
1854
|
##
|
1912
|
-
# Sets extensions to +extensions+, ensuring it is an array.
|
1913
|
-
# use this, push onto the array instead.
|
1855
|
+
# Sets extensions to +extensions+, ensuring it is an array.
|
1914
1856
|
|
1915
1857
|
def extensions=(extensions)
|
1916
|
-
# TODO: warn about setting instead of pushing
|
1917
1858
|
@extensions = Array extensions
|
1918
1859
|
end
|
1919
1860
|
|
1920
1861
|
##
|
1921
|
-
# Sets extra_rdoc_files to +files+, ensuring it is an array.
|
1922
|
-
# use this, push onto the array instead.
|
1862
|
+
# Sets extra_rdoc_files to +files+, ensuring it is an array.
|
1923
1863
|
|
1924
1864
|
def extra_rdoc_files=(files)
|
1925
|
-
# TODO: warn about setting instead of pushing
|
1926
1865
|
@extra_rdoc_files = Array files
|
1927
1866
|
end
|
1928
1867
|
|
@@ -1977,8 +1916,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1977
1916
|
end
|
1978
1917
|
|
1979
1918
|
def gems_dir
|
1980
|
-
|
1981
|
-
@gems_dir ||= File.join(loaded_from && base_dir || Gem.dir, "gems")
|
1919
|
+
@gems_dir ||= File.join(base_dir, "gems")
|
1982
1920
|
end
|
1983
1921
|
|
1984
1922
|
##
|
@@ -1989,7 +1927,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1989
1927
|
def has_rdoc # :nodoc:
|
1990
1928
|
true
|
1991
1929
|
end
|
1992
|
-
|
1930
|
+
rubygems_deprecate :has_rdoc
|
1993
1931
|
|
1994
1932
|
##
|
1995
1933
|
# Deprecated and ignored.
|
@@ -1999,10 +1937,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1999
1937
|
def has_rdoc=(ignored) # :nodoc:
|
2000
1938
|
@has_rdoc = true
|
2001
1939
|
end
|
2002
|
-
|
1940
|
+
rubygems_deprecate :has_rdoc=
|
2003
1941
|
|
2004
1942
|
alias :has_rdoc? :has_rdoc # :nodoc:
|
2005
|
-
|
1943
|
+
rubygems_deprecate :has_rdoc?
|
2006
1944
|
|
2007
1945
|
##
|
2008
1946
|
# True if this gem has files in test_files
|
@@ -2024,9 +1962,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2024
1962
|
yaml_initialize coder.tag, coder.map
|
2025
1963
|
end
|
2026
1964
|
|
1965
|
+
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
|
1966
|
+
# frozen_string_literal: true
|
2027
1967
|
|
2028
|
-
|
2029
|
-
eval <<-RB, binding, __FILE__, __LINE__ + 1
|
2030
1968
|
def set_nil_attributes_to_nil
|
2031
1969
|
#{@@nil_attributes.map {|key| "@#{key} = nil" }.join "; "}
|
2032
1970
|
end
|
@@ -2036,7 +1974,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2036
1974
|
#{@@non_nil_attributes.map {|key| "@#{key} = #{INITIALIZE_CODE_FOR_DEFAULTS[key]}" }.join ";"}
|
2037
1975
|
end
|
2038
1976
|
private :set_not_nil_attributes_to_default_values
|
2039
|
-
|
1977
|
+
RUBY
|
2040
1978
|
|
2041
1979
|
##
|
2042
1980
|
# Specification constructor. Assigns the default values to the attributes
|
@@ -2061,6 +1999,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2061
1999
|
self.name = name if name
|
2062
2000
|
self.version = version if version
|
2063
2001
|
|
2002
|
+
if platform = Gem.platforms.last and platform != Gem::Platform::RUBY and platform != Gem::Platform.local
|
2003
|
+
self.platform = platform
|
2004
|
+
end
|
2005
|
+
|
2064
2006
|
yield self if block_given?
|
2065
2007
|
end
|
2066
2008
|
|
@@ -2163,11 +2105,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2163
2105
|
end
|
2164
2106
|
|
2165
2107
|
##
|
2108
|
+
# Track removed method calls to warn about during build time.
|
2166
2109
|
# Warn about unknown attributes while loading a spec.
|
2167
2110
|
|
2168
2111
|
def method_missing(sym, *a, &b) # :nodoc:
|
2112
|
+
if REMOVED_METHODS.include?(sym)
|
2113
|
+
removed_method_calls << sym
|
2114
|
+
return
|
2115
|
+
end
|
2116
|
+
|
2169
2117
|
if @specification_version > CURRENT_SPECIFICATION_VERSION and
|
2170
|
-
sym.to_s
|
2118
|
+
sym.to_s.end_with?("=")
|
2171
2119
|
warn "ignoring #{sym} loading #{full_name}" if $DEBUG
|
2172
2120
|
else
|
2173
2121
|
super
|
@@ -2251,6 +2199,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2251
2199
|
|
2252
2200
|
attributes.each do |attr_name|
|
2253
2201
|
current_value = self.send attr_name
|
2202
|
+
current_value = current_value.sort if %i[files test_files].include? attr_name
|
2254
2203
|
if current_value != default_value(attr_name) or
|
2255
2204
|
self.class.required_attribute? attr_name
|
2256
2205
|
|
@@ -2300,11 +2249,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2300
2249
|
end
|
2301
2250
|
|
2302
2251
|
##
|
2303
|
-
# Sets rdoc_options to +value+, ensuring it is an array.
|
2304
|
-
# use this, push onto the array instead.
|
2252
|
+
# Sets rdoc_options to +value+, ensuring it is an array.
|
2305
2253
|
|
2306
2254
|
def rdoc_options=(options)
|
2307
|
-
# TODO: warn about setting instead of pushing
|
2308
2255
|
@rdoc_options = Array options
|
2309
2256
|
end
|
2310
2257
|
|
@@ -2323,11 +2270,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2323
2270
|
end
|
2324
2271
|
|
2325
2272
|
##
|
2326
|
-
# Set requirements to +req+, ensuring it is an array.
|
2327
|
-
# use this, push onto the array instead.
|
2273
|
+
# Set requirements to +req+, ensuring it is an array.
|
2328
2274
|
|
2329
2275
|
def requirements=(req)
|
2330
|
-
# TODO: warn about setting instead of pushing
|
2331
2276
|
@requirements = Array req
|
2332
2277
|
end
|
2333
2278
|
|
@@ -2348,18 +2293,18 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2348
2293
|
|
2349
2294
|
def ruby_code(obj)
|
2350
2295
|
case obj
|
2351
|
-
when String
|
2352
|
-
when Array
|
2353
|
-
when Hash
|
2354
|
-
seg = obj.keys.sort.map {
|
2296
|
+
when String then obj.dump + ".freeze"
|
2297
|
+
when Array then '[' + obj.map {|x| ruby_code x }.join(", ") + ']'
|
2298
|
+
when Hash then
|
2299
|
+
seg = obj.keys.sort.map {|k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
|
2355
2300
|
"{ #{seg.join(', ')} }"
|
2356
|
-
when Gem::Version
|
2357
|
-
when DateLike
|
2358
|
-
when Time
|
2359
|
-
when Numeric
|
2360
|
-
when true, false, nil
|
2361
|
-
when Gem::Platform
|
2362
|
-
when Gem::Requirement
|
2301
|
+
when Gem::Version then obj.to_s.dump
|
2302
|
+
when DateLike then obj.strftime('%Y-%m-%d').dump
|
2303
|
+
when Time then obj.strftime('%Y-%m-%d').dump
|
2304
|
+
when Numeric then obj.inspect
|
2305
|
+
when true, false, nil then obj.inspect
|
2306
|
+
when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
|
2307
|
+
when Gem::Requirement then
|
2363
2308
|
list = obj.as_list
|
2364
2309
|
"Gem::Requirement.new(#{ruby_code(list.size == 1 ? obj.to_s : list)})"
|
2365
2310
|
else raise Gem::Exception, "ruby_code case not handled: #{obj.class}"
|
@@ -2379,7 +2324,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2379
2324
|
# True if this gem has the same attributes as +other+.
|
2380
2325
|
|
2381
2326
|
def same_attributes?(spec)
|
2382
|
-
@@attributes.all? {
|
2327
|
+
@@attributes.all? {|name, default| self.send(name) == spec.send(name) }
|
2383
2328
|
end
|
2384
2329
|
|
2385
2330
|
private :same_attributes?
|
@@ -2478,6 +2423,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2478
2423
|
# still have their default values are omitted.
|
2479
2424
|
|
2480
2425
|
def to_ruby
|
2426
|
+
require_relative 'openssl'
|
2481
2427
|
mark_version
|
2482
2428
|
result = []
|
2483
2429
|
result << "# -*- encoding: utf-8 -*-"
|
@@ -2510,15 +2456,14 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2510
2456
|
:version,
|
2511
2457
|
:has_rdoc,
|
2512
2458
|
:default_executable,
|
2513
|
-
:metadata
|
2459
|
+
:metadata,
|
2514
2460
|
]
|
2515
2461
|
|
2516
2462
|
@@attributes.each do |attr_name|
|
2517
2463
|
next if handled.include? attr_name
|
2518
2464
|
current_value = self.send(attr_name)
|
2519
|
-
if current_value != default_value(attr_name)
|
2520
|
-
|
2521
|
-
result << " s.#{attr_name} = #{ruby_code current_value}"
|
2465
|
+
if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name)
|
2466
|
+
result << " s.#{attr_name} = #{ruby_code current_value}" unless defined?(OpenSSL::PKey::RSA) && current_value.is_a?(OpenSSL::PKey::RSA)
|
2522
2467
|
end
|
2523
2468
|
end
|
2524
2469
|
|
@@ -2531,25 +2476,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2531
2476
|
result << nil
|
2532
2477
|
result << " if s.respond_to? :specification_version then"
|
2533
2478
|
result << " s.specification_version = #{specification_version}"
|
2479
|
+
result << " end"
|
2534
2480
|
result << nil
|
2535
2481
|
|
2536
|
-
result << "
|
2482
|
+
result << " if s.respond_to? :add_runtime_dependency then"
|
2537
2483
|
|
2538
2484
|
dependencies.each do |dep|
|
2539
2485
|
req = dep.requirements_list.inspect
|
2540
2486
|
dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
|
2541
|
-
result << "
|
2487
|
+
result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})"
|
2542
2488
|
end
|
2543
2489
|
|
2544
|
-
result << " else"
|
2545
|
-
|
2546
|
-
dependencies.each do |dep|
|
2547
|
-
version_reqs_param = dep.requirements_list.inspect
|
2548
|
-
result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})"
|
2549
|
-
end
|
2550
|
-
|
2551
|
-
result << ' end'
|
2552
|
-
|
2553
2490
|
result << " else"
|
2554
2491
|
dependencies.each do |dep|
|
2555
2492
|
version_reqs_param = dep.requirements_list.inspect
|
@@ -2599,6 +2536,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2599
2536
|
builder << self
|
2600
2537
|
ast = builder.tree
|
2601
2538
|
|
2539
|
+
require 'stringio'
|
2602
2540
|
io = StringIO.new
|
2603
2541
|
io.set_encoding Encoding::UTF_8
|
2604
2542
|
|
@@ -2616,7 +2554,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2616
2554
|
begin
|
2617
2555
|
dependencies.each do |dep|
|
2618
2556
|
next unless dep.runtime?
|
2619
|
-
dep.
|
2557
|
+
dep.matching_specs(true).each do |dep_spec|
|
2620
2558
|
next if visited.has_key?(dep_spec)
|
2621
2559
|
visited[dep_spec] = true
|
2622
2560
|
trail.push(dep_spec)
|
@@ -2628,7 +2566,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2628
2566
|
unless result == :next
|
2629
2567
|
spec_name = dep_spec.name
|
2630
2568
|
dep_spec.traverse(trail, visited, &block) unless
|
2631
|
-
trail.any? {
|
2569
|
+
trail.any? {|s| s.name == spec_name }
|
2632
2570
|
end
|
2633
2571
|
end
|
2634
2572
|
end
|
@@ -2645,8 +2583,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2645
2583
|
# checks..
|
2646
2584
|
|
2647
2585
|
def validate(packaging = true, strict = false)
|
2648
|
-
require 'rubygems/user_interaction'
|
2649
|
-
extend Gem::UserInteraction
|
2650
2586
|
normalize
|
2651
2587
|
|
2652
2588
|
validation_policy = Gem::SpecificationPolicy.new(self)
|
@@ -2655,30 +2591,27 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2655
2591
|
end
|
2656
2592
|
|
2657
2593
|
def keep_only_files_and_directories
|
2658
|
-
@executables.delete_if {
|
2659
|
-
@extensions.delete_if {
|
2660
|
-
@extra_rdoc_files.delete_if {
|
2661
|
-
@files.delete_if {
|
2662
|
-
@test_files.delete_if {
|
2594
|
+
@executables.delete_if {|x| File.directory?(File.join(@bindir, x)) }
|
2595
|
+
@extensions.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2596
|
+
@extra_rdoc_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2597
|
+
@files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2598
|
+
@test_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2663
2599
|
end
|
2664
2600
|
|
2665
2601
|
def validate_metadata
|
2666
2602
|
Gem::SpecificationPolicy.new(self).validate_metadata
|
2667
2603
|
end
|
2604
|
+
rubygems_deprecate :validate_metadata
|
2668
2605
|
|
2669
|
-
##
|
2670
|
-
# Checks that dependencies use requirements as we recommend. Warnings are
|
2671
|
-
# issued when dependencies are open-ended or overly strict for semantic
|
2672
|
-
# versioning.
|
2673
2606
|
def validate_dependencies
|
2674
2607
|
Gem::SpecificationPolicy.new(self).validate_dependencies
|
2675
2608
|
end
|
2609
|
+
rubygems_deprecate :validate_dependencies
|
2676
2610
|
|
2677
|
-
##
|
2678
|
-
# Checks to see if the files to be packaged are world-readable.
|
2679
2611
|
def validate_permissions
|
2680
2612
|
Gem::SpecificationPolicy.new(self).validate_permissions
|
2681
2613
|
end
|
2614
|
+
rubygems_deprecate :validate_permissions
|
2682
2615
|
|
2683
2616
|
##
|
2684
2617
|
# Set the version to +version+, potentially also setting
|
@@ -2706,9 +2639,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2706
2639
|
case ivar
|
2707
2640
|
when "date"
|
2708
2641
|
# Force Date to go through the extra coerce logic in date=
|
2709
|
-
self.date = val.
|
2642
|
+
self.date = val.tap(&Gem::UNTAINT)
|
2710
2643
|
else
|
2711
|
-
instance_variable_set "@#{ivar}", val.
|
2644
|
+
instance_variable_set "@#{ivar}", val.tap(&Gem::UNTAINT)
|
2712
2645
|
end
|
2713
2646
|
end
|
2714
2647
|
|
@@ -2741,8 +2674,4 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2741
2674
|
def raw_require_paths # :nodoc:
|
2742
2675
|
@require_paths
|
2743
2676
|
end
|
2744
|
-
|
2745
2677
|
end
|
2746
|
-
|
2747
|
-
# DOC: What is this and why is it here, randomly, at the end of this file?
|
2748
|
-
Gem.clear_paths
|