rubygems-update 3.0.3 → 3.4.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5633 -0
- data/CODE_OF_CONDUCT.md +62 -24
- data/CONTRIBUTING.md +111 -21
- data/MAINTAINERS.txt +1 -6
- data/Manifest.txt +216 -101
- data/POLICIES.md +70 -27
- data/README.md +40 -19
- data/UPGRADING.md +5 -81
- data/bin/gem +2 -16
- data/bin/update_rubygems +5 -5
- data/bundler/CHANGELOG.md +2698 -1256
- data/bundler/LICENSE.md +18 -19
- data/bundler/README.md +10 -14
- data/bundler/UPGRADING.md +222 -0
- data/bundler/bundler.gemspec +13 -33
- data/bundler/exe/bundle +26 -11
- data/bundler/exe/bundler +1 -1
- data/bundler/lib/bundler/.document +1 -0
- data/bundler/lib/bundler/build_metadata.rb +5 -13
- data/bundler/lib/bundler/capistrano.rb +4 -4
- data/bundler/lib/bundler/cli/add.rb +28 -16
- data/bundler/lib/bundler/cli/binstubs.rb +11 -3
- data/bundler/lib/bundler/cli/cache.rb +24 -17
- data/bundler/lib/bundler/cli/check.rb +5 -3
- data/bundler/lib/bundler/cli/clean.rb +1 -1
- data/bundler/lib/bundler/cli/common.rb +41 -13
- data/bundler/lib/bundler/cli/config.rb +170 -86
- data/bundler/lib/bundler/cli/console.rb +3 -3
- data/bundler/lib/bundler/cli/doctor.rb +27 -10
- data/bundler/lib/bundler/cli/exec.rb +8 -25
- data/bundler/lib/bundler/cli/fund.rb +36 -0
- data/bundler/lib/bundler/cli/gem.rb +261 -48
- data/bundler/lib/bundler/cli/info.rb +52 -8
- data/bundler/lib/bundler/cli/init.rb +7 -3
- data/bundler/lib/bundler/cli/inject.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +38 -66
- data/bundler/lib/bundler/cli/issue.rb +8 -7
- data/bundler/lib/bundler/cli/list.rb +19 -11
- data/bundler/lib/bundler/cli/lock.rb +11 -4
- data/bundler/lib/bundler/cli/open.rb +14 -9
- data/bundler/lib/bundler/cli/outdated.rb +152 -121
- data/bundler/lib/bundler/cli/platform.rb +2 -2
- data/bundler/lib/bundler/cli/plugin.rb +19 -2
- data/bundler/lib/bundler/cli/pristine.rb +6 -1
- data/bundler/lib/bundler/cli/remove.rb +1 -2
- data/bundler/lib/bundler/cli/show.rb +3 -3
- data/bundler/lib/bundler/cli/update.rb +49 -18
- data/bundler/lib/bundler/cli/viz.rb +1 -1
- data/bundler/lib/bundler/cli.rb +269 -165
- data/bundler/lib/bundler/compact_index_client/cache.rb +7 -24
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +58 -57
- data/bundler/lib/bundler/compact_index_client.rb +28 -18
- data/bundler/lib/bundler/constants.rb +1 -1
- data/bundler/lib/bundler/current_ruby.rb +26 -11
- data/bundler/lib/bundler/definition.rb +371 -441
- data/bundler/lib/bundler/dependency.rb +29 -71
- data/bundler/lib/bundler/deployment.rb +1 -1
- data/bundler/lib/bundler/digest.rb +71 -0
- data/bundler/lib/bundler/dsl.rb +84 -116
- data/bundler/lib/bundler/endpoint_specification.rb +16 -14
- data/bundler/lib/bundler/env.rb +10 -15
- data/bundler/lib/bundler/environment_preserver.rb +32 -5
- data/bundler/lib/bundler/errors.rb +31 -14
- data/bundler/lib/bundler/feature_flag.rb +13 -33
- data/bundler/lib/bundler/fetcher/base.rb +7 -9
- data/bundler/lib/bundler/fetcher/compact_index.rb +46 -39
- data/bundler/lib/bundler/fetcher/dependency.rb +3 -7
- data/bundler/lib/bundler/fetcher/downloader.rb +15 -12
- data/bundler/lib/bundler/fetcher/index.rb +4 -30
- data/bundler/lib/bundler/fetcher.rb +40 -42
- data/bundler/lib/bundler/force_platform.rb +18 -0
- data/bundler/lib/bundler/friendly_errors.rb +49 -54
- data/bundler/lib/bundler/gem_helper.rb +79 -43
- data/bundler/lib/bundler/gem_helpers.rb +44 -28
- data/bundler/lib/bundler/gem_tasks.rb +1 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +54 -99
- data/bundler/lib/bundler/graph.rb +5 -5
- data/bundler/lib/bundler/index.rb +16 -54
- data/bundler/lib/bundler/injector.rb +51 -17
- data/bundler/lib/bundler/inline.rb +28 -29
- data/bundler/lib/bundler/installer/gem_installer.rb +22 -23
- data/bundler/lib/bundler/installer/parallel_installer.rb +38 -51
- data/bundler/lib/bundler/installer/standalone.rb +62 -12
- data/bundler/lib/bundler/installer.rb +46 -97
- data/bundler/lib/bundler/lazy_specification.rb +88 -52
- data/bundler/lib/bundler/lockfile_generator.rb +4 -4
- data/bundler/lib/bundler/lockfile_parser.rb +40 -72
- data/bundler/{man → lib/bundler/man}/bundle-add.1 +29 -5
- data/bundler/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +22 -4
- data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +6 -4
- data/bundler/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
- data/bundler/lib/bundler/man/bundle-cache.1 +61 -0
- data/bundler/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +22 -15
- data/bundler/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-clean.1 +2 -2
- data/bundler/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-config.1 +78 -60
- data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +96 -85
- data/bundler/lib/bundler/man/bundle-console.1 +53 -0
- data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-exec.1 +6 -6
- data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +6 -6
- data/bundler/lib/bundler/man/bundle-gem.1 +105 -0
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +117 -0
- data/bundler/lib/bundler/man/bundle-help.1 +13 -0
- data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/bundler/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-init.1 +6 -2
- data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +3 -1
- data/bundler/{man → lib/bundler/man}/bundle-inject.1 +5 -2
- data/bundler/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
- data/bundler/{man → lib/bundler/man}/bundle-install.1 +42 -37
- data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +42 -38
- data/bundler/{man → lib/bundler/man}/bundle-list.1 +7 -7
- data/bundler/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
- data/bundler/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-open.1 +22 -2
- data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +9 -1
- data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +3 -10
- data/bundler/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +1 -10
- data/bundler/{man → lib/bundler/man}/bundle-platform.1 +16 -6
- data/bundler/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
- data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/bundler/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-update.1 +8 -8
- data/bundler/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +8 -7
- data/bundler/lib/bundler/man/bundle-version.1 +35 -0
- data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/bundler/{man → lib/bundler/man}/bundle-viz.1 +4 -1
- data/bundler/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +2 -0
- data/bundler/{man → lib/bundler/man}/bundle.1 +17 -12
- data/bundler/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +14 -9
- data/bundler/lib/bundler/man/gemfile.5 +723 -0
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +112 -95
- data/bundler/lib/bundler/man/index.txt +29 -0
- data/bundler/lib/bundler/match_metadata.rb +13 -0
- data/bundler/lib/bundler/match_platform.rb +1 -2
- data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
- data/bundler/lib/bundler/mirror.rb +10 -12
- data/bundler/lib/bundler/plugin/api/source.rb +29 -15
- data/bundler/lib/bundler/plugin/api.rb +1 -1
- data/bundler/lib/bundler/plugin/dsl.rb +1 -1
- data/bundler/lib/bundler/plugin/index.rb +31 -8
- data/bundler/lib/bundler/plugin/installer/git.rb +0 -4
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -9
- data/bundler/lib/bundler/plugin/installer.rb +40 -24
- data/bundler/lib/bundler/plugin/source_list.rb +5 -1
- data/bundler/lib/bundler/plugin.rb +103 -43
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/remote_specification.rb +12 -9
- data/bundler/lib/bundler/resolver/base.rb +107 -0
- data/bundler/lib/bundler/resolver/candidate.rb +94 -0
- data/bundler/lib/bundler/resolver/incompatibility.rb +15 -0
- data/bundler/lib/bundler/resolver/package.rb +72 -0
- data/bundler/lib/bundler/resolver/root.rb +25 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +49 -73
- data/bundler/lib/bundler/resolver.rb +341 -301
- data/bundler/lib/bundler/retry.rb +4 -4
- data/bundler/lib/bundler/ruby_dsl.rb +1 -1
- data/bundler/lib/bundler/ruby_version.rb +10 -38
- data/bundler/lib/bundler/rubygems_ext.rb +237 -92
- data/bundler/lib/bundler/rubygems_gem_installer.rb +87 -21
- data/bundler/lib/bundler/rubygems_integration.rb +179 -515
- data/bundler/lib/bundler/runtime.rb +25 -40
- data/bundler/lib/bundler/self_manager.rb +168 -0
- data/bundler/lib/bundler/settings.rb +163 -119
- data/bundler/lib/bundler/setup.rb +14 -12
- data/bundler/lib/bundler/shared_helpers.rb +62 -103
- data/bundler/lib/bundler/similarity_detector.rb +3 -3
- data/bundler/lib/bundler/source/git/git_proxy.rb +274 -128
- data/bundler/lib/bundler/source/git.rb +86 -62
- data/bundler/lib/bundler/source/metadata.rb +9 -9
- data/bundler/lib/bundler/source/path/installer.rb +11 -32
- data/bundler/lib/bundler/source/path.rb +29 -18
- data/bundler/lib/bundler/source/rubygems/remote.rb +3 -4
- data/bundler/lib/bundler/source/rubygems.rb +176 -206
- data/bundler/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/bundler/lib/bundler/source.rb +30 -10
- data/bundler/lib/bundler/source_list.rb +112 -67
- data/bundler/lib/bundler/source_map.rb +71 -0
- data/bundler/lib/bundler/spec_set.rb +96 -72
- data/bundler/lib/bundler/stub_specification.rb +45 -37
- data/bundler/lib/bundler/templates/Executable +3 -5
- data/bundler/lib/bundler/templates/Executable.bundler +22 -18
- data/bundler/lib/bundler/templates/Executable.standalone +4 -4
- data/bundler/lib/bundler/templates/Gemfile +0 -2
- data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
- data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +22 -2
- data/bundler/lib/bundler/templates/newgem/README.md.tt +13 -15
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +43 -5
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -4
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
- data/bundler/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +36 -41
- data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
- data/bundler/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
- data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/ui/rg_proxy.rb +1 -1
- data/bundler/lib/bundler/ui/shell.rb +39 -20
- data/bundler/lib/bundler/ui/silent.rb +21 -5
- data/bundler/lib/bundler/ui.rb +3 -3
- data/bundler/lib/bundler/uri_credentials_filter.rb +10 -4
- data/bundler/lib/bundler/uri_normalizer.rb +23 -0
- data/bundler/lib/bundler/vendor/.document +1 -0
- data/bundler/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +128 -0
- data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1493 -425
- data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
- data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +243 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/bundler/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +25 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +20 -10
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +34 -15
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +83 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +40 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +88 -13
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +5 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +16 -9
- data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
- data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +729 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +100 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1587 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +125 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +293 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +539 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +119 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/bundler/lib/bundler/vendored_fileutils.rb +1 -6
- data/bundler/lib/bundler/vendored_persistent.rb +2 -39
- data/bundler/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
- data/bundler/lib/bundler/vendored_thor.rb +2 -2
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/vendored_uri.rb +4 -0
- data/bundler/lib/bundler/version.rb +5 -20
- data/bundler/lib/bundler/vlad.rb +2 -2
- data/bundler/lib/bundler/worker.rb +26 -15
- data/bundler/lib/bundler/yaml_serializer.rb +3 -4
- data/bundler/lib/bundler.rb +290 -187
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/available_set.rb +7 -8
- data/lib/rubygems/basic_specification.rb +44 -31
- data/lib/rubygems/bundler_version_finder.rb +29 -51
- data/lib/rubygems/command.rb +114 -52
- data/lib/rubygems/command_manager.rb +38 -18
- data/lib/rubygems/commands/build_command.rb +77 -26
- data/lib/rubygems/commands/cert_command.rb +78 -76
- data/lib/rubygems/commands/check_command.rb +20 -22
- data/lib/rubygems/commands/cleanup_command.rb +36 -32
- data/lib/rubygems/commands/contents_command.rb +16 -18
- data/lib/rubygems/commands/dependency_command.rb +39 -50
- data/lib/rubygems/commands/environment_command.rb +11 -13
- data/lib/rubygems/commands/exec_command.rb +248 -0
- data/lib/rubygems/commands/fetch_command.rb +33 -16
- data/lib/rubygems/commands/generate_index_command.rb +18 -17
- data/lib/rubygems/commands/help_command.rb +10 -10
- data/lib/rubygems/commands/info_command.rb +11 -6
- data/lib/rubygems/commands/install_command.rb +45 -79
- data/lib/rubygems/commands/list_command.rb +9 -8
- data/lib/rubygems/commands/lock_command.rb +7 -9
- data/lib/rubygems/commands/mirror_command.rb +3 -4
- data/lib/rubygems/commands/open_command.rb +11 -14
- data/lib/rubygems/commands/outdated_command.rb +5 -6
- data/lib/rubygems/commands/owner_command.rb +33 -24
- data/lib/rubygems/commands/pristine_command.rb +70 -51
- data/lib/rubygems/commands/push_command.rb +26 -63
- data/lib/rubygems/commands/query_command.rb +21 -337
- data/lib/rubygems/commands/rdoc_command.rb +26 -26
- data/lib/rubygems/commands/search_command.rb +8 -8
- data/lib/rubygems/commands/server_command.rb +16 -77
- data/lib/rubygems/commands/setup_command.rb +282 -241
- data/lib/rubygems/commands/signin_command.rb +9 -10
- data/lib/rubygems/commands/signout_command.rb +7 -9
- data/lib/rubygems/commands/sources_command.rb +42 -26
- data/lib/rubygems/commands/specification_command.rb +25 -20
- data/lib/rubygems/commands/stale_command.rb +3 -3
- data/lib/rubygems/commands/uninstall_command.rb +61 -49
- data/lib/rubygems/commands/unpack_command.rb +15 -44
- data/lib/rubygems/commands/update_command.rb +133 -81
- data/lib/rubygems/commands/which_command.rb +8 -11
- data/lib/rubygems/commands/yank_command.rb +22 -19
- data/lib/rubygems/compatibility.rb +7 -5
- data/lib/rubygems/config_file.rb +101 -47
- data/lib/rubygems/core_ext/kernel_gem.rb +8 -12
- data/lib/rubygems/core_ext/kernel_require.rb +115 -84
- data/lib/rubygems/core_ext/kernel_warn.rb +35 -30
- data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
- data/lib/rubygems/defaults.rb +132 -56
- data/lib/rubygems/dependency.rb +44 -27
- data/lib/rubygems/dependency_installer.rb +49 -205
- data/lib/rubygems/dependency_list.rb +24 -25
- data/lib/rubygems/deprecate.rb +106 -12
- data/lib/rubygems/doctor.rb +22 -22
- data/lib/rubygems/errors.rb +8 -14
- data/lib/rubygems/exceptions.rb +45 -33
- data/lib/rubygems/ext/build_error.rb +2 -0
- data/lib/rubygems/ext/builder.rb +86 -93
- data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +27 -0
- data/lib/rubygems/ext/cargo_builder.rb +360 -0
- data/lib/rubygems/ext/cmake_builder.rb +6 -7
- data/lib/rubygems/ext/configure_builder.rb +5 -8
- data/lib/rubygems/ext/ext_conf_builder.rb +44 -65
- data/lib/rubygems/ext/rake_builder.rb +7 -10
- data/lib/rubygems/ext.rb +7 -6
- data/lib/rubygems/gem_runner.rb +15 -26
- data/lib/rubygems/gemcutter_utilities.rb +221 -54
- data/lib/rubygems/indexer.rb +38 -53
- data/lib/rubygems/install_default_message.rb +2 -2
- data/lib/rubygems/install_message.rb +2 -2
- data/lib/rubygems/install_update_options.rb +73 -64
- data/lib/rubygems/installer.rb +231 -174
- data/lib/rubygems/installer_uninstaller_utils.rb +29 -0
- data/lib/rubygems/local_remote_options.rb +22 -24
- data/lib/rubygems/mock_gem_ui.rb +2 -5
- data/lib/rubygems/name_tuple.rb +10 -14
- data/lib/rubygems/openssl.rb +7 -0
- data/lib/rubygems/optparse/.document +1 -0
- data/lib/rubygems/optparse/COPYING +56 -0
- data/lib/rubygems/optparse/lib/optionparser.rb +2 -0
- data/lib/rubygems/optparse/lib/optparse/ac.rb +54 -0
- data/lib/rubygems/optparse/lib/optparse/date.rb +18 -0
- data/lib/rubygems/optparse/lib/optparse/kwargs.rb +22 -0
- data/lib/rubygems/optparse/lib/optparse/shellwords.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/time.rb +11 -0
- data/lib/rubygems/optparse/lib/optparse/uri.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/version.rb +71 -0
- data/lib/rubygems/optparse/lib/optparse.rb +2308 -0
- data/lib/rubygems/optparse.rb +3 -0
- data/lib/rubygems/package/digest_io.rb +0 -2
- data/lib/rubygems/package/file_source.rb +2 -4
- data/lib/rubygems/package/io_source.rb +4 -2
- data/lib/rubygems/package/old.rb +9 -11
- data/lib/rubygems/package/tar_header.rb +73 -66
- data/lib/rubygems/package/tar_reader/entry.rb +89 -11
- data/lib/rubygems/package/tar_reader.rb +1 -26
- data/lib/rubygems/package/tar_writer.rb +12 -22
- data/lib/rubygems/package.rb +142 -125
- data/lib/rubygems/package_task.rb +5 -11
- data/lib/rubygems/path_support.rb +3 -8
- data/lib/rubygems/platform.rb +113 -73
- data/lib/rubygems/psych_tree.rb +1 -1
- data/lib/rubygems/query_utils.rb +351 -0
- data/lib/rubygems/rdoc.rb +4 -16
- data/lib/rubygems/remote_fetcher.rb +64 -136
- data/lib/rubygems/request/connection_pools.rb +7 -11
- data/lib/rubygems/request/http_pool.rb +2 -3
- data/lib/rubygems/request.rb +31 -32
- data/lib/rubygems/request_set/gem_dependency_api.rb +134 -136
- data/lib/rubygems/request_set/lockfile/parser.rb +28 -28
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +5 -5
- data/lib/rubygems/request_set/lockfile.rb +21 -20
- data/lib/rubygems/request_set.rb +32 -45
- data/lib/rubygems/requirement.rb +43 -65
- data/lib/rubygems/resolver/activation_request.rb +29 -53
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_set.rb +33 -26
- data/lib/rubygems/resolver/api_specification.rb +30 -16
- data/lib/rubygems/resolver/best_set.rb +9 -11
- data/lib/rubygems/resolver/composed_set.rb +3 -5
- data/lib/rubygems/resolver/conflict.rb +12 -19
- data/lib/rubygems/resolver/current_set.rb +0 -2
- data/lib/rubygems/resolver/dependency_request.rb +3 -5
- data/lib/rubygems/resolver/git_set.rb +2 -4
- data/lib/rubygems/resolver/git_specification.rb +6 -8
- data/lib/rubygems/resolver/index_set.rb +4 -6
- data/lib/rubygems/resolver/index_specification.rb +38 -7
- data/lib/rubygems/resolver/installed_specification.rb +4 -6
- data/lib/rubygems/resolver/installer_set.rb +69 -27
- data/lib/rubygems/resolver/local_specification.rb +2 -4
- data/lib/rubygems/resolver/lock_set.rb +7 -9
- data/lib/rubygems/resolver/lock_specification.rb +6 -8
- data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +8 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +51 -12
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +42 -9
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +82 -8
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +13 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +510 -165
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- data/lib/rubygems/resolver/molinillo.rb +1 -1
- data/lib/rubygems/resolver/requirement_list.rb +0 -1
- data/lib/rubygems/resolver/set.rb +0 -3
- data/lib/rubygems/resolver/source_set.rb +0 -2
- data/lib/rubygems/resolver/spec_specification.rb +14 -2
- data/lib/rubygems/resolver/specification.rb +14 -3
- data/lib/rubygems/resolver/stats.rb +1 -1
- data/lib/rubygems/resolver/vendor_set.rb +1 -3
- data/lib/rubygems/resolver/vendor_specification.rb +3 -5
- data/lib/rubygems/resolver.rb +58 -54
- data/lib/rubygems/s3_uri_signer.rb +175 -0
- data/lib/rubygems/safe_yaml.rb +14 -16
- data/lib/rubygems/security/policies.rb +47 -47
- data/lib/rubygems/security/policy.rb +25 -29
- data/lib/rubygems/security/signer.rb +16 -18
- data/lib/rubygems/security/trust_dir.rb +5 -6
- data/lib/rubygems/security.rb +90 -69
- data/lib/rubygems/security_option.rb +7 -8
- data/lib/rubygems/source/git.rb +31 -31
- data/lib/rubygems/source/installed.rb +1 -3
- data/lib/rubygems/source/local.rb +4 -6
- data/lib/rubygems/source/lock.rb +0 -2
- data/lib/rubygems/source/specific_file.rb +1 -3
- data/lib/rubygems/source/vendor.rb +0 -2
- data/lib/rubygems/source.rb +50 -38
- data/lib/rubygems/source_list.rb +9 -13
- data/lib/rubygems/spec_fetcher.rb +52 -64
- data/lib/rubygems/specification.rb +444 -465
- data/lib/rubygems/specification_policy.rb +185 -87
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +28 -32
- data/lib/rubygems/text.rb +22 -22
- data/lib/rubygems/tsort/.document +1 -0
- data/lib/rubygems/tsort/LICENSE.txt +22 -0
- data/lib/rubygems/tsort/lib/tsort.rb +452 -0
- data/lib/rubygems/tsort.rb +3 -0
- data/lib/rubygems/uninstaller.rb +110 -57
- data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
- data/lib/rubygems/update_suggestion.rb +69 -0
- data/lib/rubygems/uri.rb +126 -0
- data/lib/rubygems/uri_formatter.rb +2 -4
- data/lib/rubygems/user_interaction.rb +46 -49
- data/lib/rubygems/util/licenses.rb +511 -404
- data/lib/rubygems/util.rb +40 -56
- data/lib/rubygems/validator.rb +15 -37
- data/lib/rubygems/version.rb +50 -31
- data/lib/rubygems/version_option.rb +11 -5
- data/lib/rubygems/webauthn_listener/response.rb +161 -0
- data/lib/rubygems/webauthn_listener.rb +92 -0
- data/lib/rubygems.rb +307 -334
- data/rubygems-update.gemspec +6 -13
- data/setup.rb +11 -22
- data/test/rubygems/alternate_cert.pem +14 -14
- data/test/rubygems/alternate_cert_32.pem +15 -15
- data/test/rubygems/alternate_key.pem +25 -25
- data/test/rubygems/bundler_test_gem.rb +419 -0
- data/test/rubygems/ca_cert.pem +74 -65
- data/test/rubygems/child_cert.pem +15 -16
- data/test/rubygems/child_cert_32.pem +15 -16
- data/test/rubygems/child_key.pem +25 -25
- data/test/rubygems/client.pem +103 -45
- data/test/rubygems/data/excon-0.7.7.gemspec.rz +0 -0
- data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
- data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
- data/test/rubygems/data/pry-0.4.7.gemspec.rz +0 -0
- data/test/rubygems/encrypted_private_key.pem +26 -26
- data/test/rubygems/expired_cert.pem +15 -15
- data/test/rubygems/future_cert.pem +15 -15
- data/test/rubygems/future_cert_32.pem +15 -15
- data/test/rubygems/grandchild_cert.pem +15 -16
- data/test/rubygems/grandchild_cert_32.pem +15 -16
- data/test/rubygems/grandchild_key.pem +25 -25
- data/{lib/rubygems/test_case.rb → test/rubygems/helper.rb} +518 -507
- data/{lib → test}/rubygems/installer_test_case.rb +115 -53
- data/test/rubygems/invalid_issuer_cert.pem +16 -16
- data/test/rubygems/invalid_issuer_cert_32.pem +16 -16
- data/test/rubygems/invalid_key.pem +25 -25
- data/test/rubygems/invalid_signer_cert.pem +15 -15
- data/test/rubygems/invalid_signer_cert_32.pem +15 -15
- data/test/rubygems/invalidchild_cert.pem +15 -16
- data/test/rubygems/invalidchild_cert_32.pem +15 -16
- data/test/rubygems/invalidchild_key.pem +25 -25
- data/{lib → test}/rubygems/package/tar_test_case.rb +51 -18
- data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
- data/test/rubygems/packages/ascii_binder-0.1.10.1.gem +0 -0
- data/test/rubygems/packages/ill-formatted-platform-1.0.0.10.gem +0 -0
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
- data/test/rubygems/private_ec_key.pem +9 -0
- data/test/rubygems/private_key.pem +25 -25
- data/test/rubygems/public_cert.pem +16 -16
- data/test/rubygems/public_cert_32.pem +15 -15
- data/test/rubygems/public_key.pem +7 -7
- data/test/rubygems/rubygems/commands/crash_command.rb +0 -2
- data/test/rubygems/rubygems_plugin.rb +2 -4
- data/test/rubygems/simple_gem.rb +1 -1
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +12 -0
- data/test/rubygems/ssl_cert.pem +78 -17
- data/test/rubygems/ssl_key.pem +25 -13
- data/test/rubygems/test_bundled_ca.rb +44 -47
- data/test/rubygems/test_config.rb +6 -8
- data/test/rubygems/test_deprecate.rb +91 -11
- data/test/rubygems/test_exit.rb +17 -0
- data/test/rubygems/test_gem.rb +701 -878
- data/test/rubygems/test_gem_available_set.rb +24 -25
- data/test/rubygems/test_gem_bundler_version_finder.rb +42 -42
- data/test/rubygems/test_gem_command.rb +186 -39
- data/test/rubygems/test_gem_command_manager.rb +166 -36
- data/test/rubygems/test_gem_commands_build_command.rb +436 -52
- data/test/rubygems/test_gem_commands_cert_command.rb +193 -124
- data/test/rubygems/test_gem_commands_check_command.rb +9 -11
- data/test/rubygems/test_gem_commands_cleanup_command.rb +87 -62
- data/test/rubygems/test_gem_commands_contents_command.rb +73 -42
- data/test/rubygems/test_gem_commands_dependency_command.rb +39 -41
- data/test/rubygems/test_gem_commands_environment_command.rb +60 -48
- data/test/rubygems/test_gem_commands_exec_command.rb +851 -0
- data/test/rubygems/test_gem_commands_fetch_command.rb +163 -32
- data/test/rubygems/test_gem_commands_generate_index_command.rb +39 -9
- data/test/rubygems/test_gem_commands_help_command.rb +34 -19
- data/test/rubygems/test_gem_commands_info_command.rb +34 -9
- data/test/rubygems/test_gem_commands_install_command.rb +601 -174
- data/test/rubygems/test_gem_commands_list_command.rb +5 -7
- data/test/rubygems/test_gem_commands_lock_command.rb +11 -13
- data/test/rubygems/test_gem_commands_mirror.rb +3 -4
- data/test/rubygems/test_gem_commands_open_command.rb +16 -19
- data/test/rubygems/test_gem_commands_outdated_command.rb +24 -7
- data/test/rubygems/test_gem_commands_owner_command.rb +250 -49
- data/test/rubygems/test_gem_commands_pristine_command.rb +270 -89
- data/test/rubygems/test_gem_commands_push_command.rb +251 -69
- data/test/rubygems/test_gem_commands_query_command.rb +114 -89
- data/test/rubygems/test_gem_commands_search_command.rb +2 -4
- data/test/rubygems/test_gem_commands_server_command.rb +6 -46
- data/test/rubygems/test_gem_commands_setup_command.rb +334 -157
- data/test/rubygems/test_gem_commands_signin_command.rb +187 -27
- data/test/rubygems/test_gem_commands_signout_command.rb +3 -10
- data/test/rubygems/test_gem_commands_sources_command.rb +266 -33
- data/test/rubygems/test_gem_commands_specification_command.rb +81 -55
- data/test/rubygems/test_gem_commands_stale_command.rb +4 -6
- data/test/rubygems/test_gem_commands_uninstall_command.rb +251 -99
- data/test/rubygems/test_gem_commands_unpack_command.rb +32 -34
- data/test/rubygems/test_gem_commands_update_command.rb +412 -102
- data/test/rubygems/test_gem_commands_which_command.rb +12 -14
- data/test/rubygems/test_gem_commands_yank_command.rb +191 -26
- data/test/rubygems/test_gem_config_file.rb +120 -96
- data/test/rubygems/test_gem_dependency.rb +94 -86
- data/test/rubygems/test_gem_dependency_installer.rb +305 -388
- data/test/rubygems/test_gem_dependency_list.rb +66 -61
- data/test/rubygems/test_gem_dependency_resolution_error.rb +5 -7
- data/test/rubygems/test_gem_doctor.rb +73 -47
- data/test/rubygems/test_gem_ext_builder.rb +116 -108
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +8 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock +233 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/src/lib.rs +27 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +247 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec +8 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +51 -0
- data/test/rubygems/test_gem_ext_cargo_builder.rb +167 -0
- data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +33 -0
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +60 -0
- data/test/rubygems/test_gem_ext_cmake_builder.rb +32 -37
- data/test/rubygems/test_gem_ext_configure_builder.rb +23 -31
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +75 -79
- data/test/rubygems/test_gem_ext_rake_builder.rb +49 -30
- data/test/rubygems/test_gem_gem_runner.rb +58 -8
- data/test/rubygems/test_gem_gemcutter_utilities.rb +159 -76
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -6
- data/test/rubygems/test_gem_indexer.rb +120 -105
- data/test/rubygems/test_gem_install_update_options.rb +57 -33
- data/test/rubygems/test_gem_installer.rb +1230 -644
- data/test/rubygems/test_gem_local_remote_options.rb +11 -13
- data/test/rubygems/test_gem_name_tuple.rb +4 -6
- data/test/rubygems/test_gem_package.rb +390 -285
- data/test/rubygems/test_gem_package_old.rb +57 -56
- data/test/rubygems/test_gem_package_tar_header.rb +108 -50
- data/test/rubygems/test_gem_package_tar_reader.rb +54 -9
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +168 -24
- data/test/rubygems/test_gem_package_tar_writer.rb +107 -101
- data/test/rubygems/test_gem_package_task.rb +58 -25
- data/test/rubygems/test_gem_path_support.rb +29 -29
- data/test/rubygems/test_gem_platform.rb +388 -199
- data/test/rubygems/test_gem_rdoc.rb +20 -155
- data/test/rubygems/test_gem_remote_fetcher.rb +475 -304
- data/test/rubygems/test_gem_request.rb +128 -85
- data/test/rubygems/test_gem_request_connection_pools.rb +32 -32
- data/test/rubygems/test_gem_request_set.rb +186 -110
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +283 -264
- data/test/rubygems/test_gem_request_set_lockfile.rb +93 -94
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +69 -70
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +136 -136
- data/test/rubygems/test_gem_requirement.rb +140 -55
- data/test/rubygems/test_gem_resolver.rb +224 -115
- data/test/rubygems/test_gem_resolver_activation_request.rb +9 -40
- data/test/rubygems/test_gem_resolver_api_set.rb +79 -78
- data/test/rubygems/test_gem_resolver_api_specification.rb +47 -49
- data/test/rubygems/test_gem_resolver_best_set.rb +43 -22
- data/test/rubygems/test_gem_resolver_composed_set.rb +1 -3
- data/test/rubygems/test_gem_resolver_conflict.rb +12 -18
- data/test/rubygems/test_gem_resolver_dependency_request.rb +15 -17
- data/test/rubygems/test_gem_resolver_git_set.rb +22 -24
- data/test/rubygems/test_gem_resolver_git_specification.rb +22 -22
- data/test/rubygems/test_gem_resolver_index_set.rb +14 -16
- data/test/rubygems/test_gem_resolver_index_specification.rb +21 -18
- data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -8
- data/test/rubygems/test_gem_resolver_installer_set.rb +106 -44
- data/test/rubygems/test_gem_resolver_local_specification.rb +7 -9
- data/test/rubygems/test_gem_resolver_lock_set.rb +15 -17
- data/test/rubygems/test_gem_resolver_lock_specification.rb +17 -19
- data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -3
- data/test/rubygems/test_gem_resolver_specification.rb +8 -10
- data/test/rubygems/test_gem_resolver_vendor_set.rb +9 -11
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +10 -12
- data/test/rubygems/test_gem_security.rb +109 -79
- data/test/rubygems/test_gem_security_policy.rb +102 -107
- data/test/rubygems/test_gem_security_signer.rb +51 -52
- data/test/rubygems/test_gem_security_trust_dir.rb +14 -16
- data/test/rubygems/test_gem_silent_ui.rb +47 -42
- data/test/rubygems/test_gem_source.rb +66 -51
- data/test/rubygems/test_gem_source_fetch_problem.rb +17 -8
- data/test/rubygems/test_gem_source_git.rb +78 -77
- data/test/rubygems/test_gem_source_installed.rb +16 -18
- data/test/rubygems/test_gem_source_list.rb +5 -5
- data/test/rubygems/test_gem_source_local.rb +15 -16
- data/test/rubygems/test_gem_source_lock.rb +31 -33
- data/test/rubygems/test_gem_source_specific_file.rb +18 -19
- data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
- data/test/rubygems/test_gem_source_vendor.rb +13 -15
- data/test/rubygems/test_gem_spec_fetcher.rb +74 -67
- data/test/rubygems/test_gem_specification.rb +1070 -1073
- data/test/rubygems/test_gem_stream_ui.rb +25 -23
- data/test/rubygems/test_gem_stub_specification.rb +39 -56
- data/test/rubygems/test_gem_text.rb +8 -3
- data/test/rubygems/test_gem_uninstaller.rb +269 -100
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -5
- data/test/rubygems/test_gem_update_suggestion.rb +208 -0
- data/test/rubygems/test_gem_uri.rb +39 -0
- data/test/rubygems/test_gem_uri_formatter.rb +14 -16
- data/test/rubygems/test_gem_util.rb +46 -34
- data/test/rubygems/test_gem_validator.rb +12 -15
- data/test/rubygems/test_gem_version.rb +50 -35
- data/test/rubygems/test_gem_version_option.rb +16 -18
- data/test/rubygems/test_kernel.rb +61 -61
- data/test/rubygems/test_project_sanity.rb +49 -0
- data/test/rubygems/test_remote_fetch_error.rb +8 -9
- data/test/rubygems/test_require.rb +415 -121
- data/test/rubygems/test_rubygems.rb +74 -0
- data/test/rubygems/test_webauthn_listener.rb +120 -0
- data/test/rubygems/test_webauthn_listener_response.rb +93 -0
- data/{lib/rubygems/test_utilities.rb → test/rubygems/utilities.rb} +115 -51
- data/test/rubygems/wrong_key_cert.pem +15 -15
- data/test/rubygems/wrong_key_cert_32.pem +15 -15
- data/test/test_changelog_generator.rb +17 -0
- metadata +225 -244
- data/.rubocop.yml +0 -66
- data/.travis.yml +0 -38
- data/History.txt +0 -3965
- data/Rakefile +0 -372
- data/appveyor.yml +0 -43
- data/bundler/CODE_OF_CONDUCT.md +0 -42
- data/bundler/CONTRIBUTING.md +0 -17
- data/bundler/exe/bundle_ruby +0 -60
- data/bundler/lib/bundler/cli/package.rb +0 -49
- data/bundler/lib/bundler/compatibility_guard.rb +0 -14
- data/bundler/lib/bundler/dep_proxy.rb +0 -48
- data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/bundler/lib/bundler/gemdeps.rb +0 -29
- data/bundler/lib/bundler/psyched_yaml.rb +0 -37
- data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/bundler/lib/bundler/templates/gems.rb +0 -8
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -3
- data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -7
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -81
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -136
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -101
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -12
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/bundler/lib/bundler/version_ranges.rb +0 -76
- data/bundler/man/bundle-gem.1 +0 -80
- data/bundler/man/bundle-gem.ronn +0 -78
- data/bundler/man/bundle-package.1 +0 -55
- data/lib/rubygems/psych_additions.rb +0 -10
- data/lib/rubygems/server.rb +0 -878
- data/lib/rubygems/source_local.rb +0 -7
- data/lib/rubygems/source_specific_file.rb +0 -6
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/rubygems/syck_hack.rb +0 -77
- data/lib/ubygems.rb +0 -14
- data/test/rubygems/bogussources.rb +0 -9
- data/test/rubygems/data/null-type.gemspec.rz +0 -0
- data/test/rubygems/test_gem_server.rb +0 -607
- data/util/CL2notes +0 -55
- data/util/ci +0 -77
- data/util/create_certs.rb +0 -171
- data/util/create_encrypted_key.rb +0 -16
- data/util/generate_spdx_license_list.rb +0 -61
- data/util/patch_with_prs.rb +0 -77
- data/util/rubocop +0 -8
- data/util/update_bundled_ca_certificates.rb +0 -139
- data/util/update_changelog.rb +0 -67
- /data/bundler/lib/bundler/{ssl_certs → man}/.document +0 -0
- /data/bundler/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- /data/bundler/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- /data/bundler/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- /data/bundler/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- /data/bundler/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- /data/bundler/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- /data/bundler/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
- /data/{bundler/lib/bundler/ssl_certs/index.rubygems.org → lib/rubygems/ssl_certs/rubygems.org}/GlobalSignRootCA.pem +0 -0
@@ -1,24 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
#
|
2
|
+
#
|
3
3
|
#--
|
4
4
|
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
5
5
|
# All rights reserved.
|
6
6
|
# See LICENSE.txt for permissions.
|
7
7
|
#++
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
require 'rubygems/basic_specification'
|
15
|
-
require 'rubygems/stub_specification'
|
16
|
-
require 'rubygems/specification_policy'
|
17
|
-
require 'rubygems/util/list'
|
18
|
-
require 'stringio'
|
9
|
+
require_relative "deprecate"
|
10
|
+
require_relative "basic_specification"
|
11
|
+
require_relative "stub_specification"
|
12
|
+
require_relative "platform"
|
13
|
+
require_relative "util/list"
|
19
14
|
|
20
15
|
##
|
21
|
-
# The Specification class contains the information for a
|
16
|
+
# The Specification class contains the information for a gem. Typically
|
22
17
|
# defined in a .gemspec file or a Rakefile, and looks like this:
|
23
18
|
#
|
24
19
|
# Gem::Specification.new do |s|
|
@@ -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
|
@@ -80,39 +74,36 @@ class Gem::Specification < Gem::BasicSpecification
|
|
80
74
|
# key should be equal to the CURRENT_SPECIFICATION_VERSION.
|
81
75
|
|
82
76
|
SPECIFICATION_VERSION_HISTORY = { # :nodoc:
|
83
|
-
-1 => [
|
84
|
-
1
|
77
|
+
-1 => ["(RubyGems versions up to and including 0.7 did not have versioned specifications)"],
|
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
|
-
|
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:
|
101
95
|
-1 => 16,
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
96
|
+
1 => 16,
|
97
|
+
2 => 16,
|
98
|
+
3 => 17,
|
99
|
+
4 => 18,
|
106
100
|
}.freeze
|
107
101
|
|
108
102
|
today = Time.now.utc
|
109
103
|
TODAY = Time.utc(today.year, today.month, today.day) # :nodoc:
|
110
104
|
|
111
|
-
#
|
112
|
-
|
113
|
-
# rubocop:enable Style/MutableConstant
|
114
|
-
|
115
|
-
private_constant :LOAD_CACHE if defined? private_constant
|
105
|
+
@load_cache = {} # :nodoc:
|
106
|
+
@load_cache_mutex = Thread::Mutex.new
|
116
107
|
|
117
108
|
VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/.freeze # :nodoc:
|
118
109
|
|
@@ -133,66 +124,79 @@ class Gem::Specification < Gem::BasicSpecification
|
|
133
124
|
# Map of attribute names to default values.
|
134
125
|
|
135
126
|
@@default_value = {
|
136
|
-
:authors
|
137
|
-
:autorequire
|
138
|
-
:bindir
|
139
|
-
:cert_chain
|
140
|
-
:date
|
141
|
-
:dependencies
|
142
|
-
:description
|
143
|
-
:email
|
144
|
-
:executables
|
145
|
-
:extensions
|
146
|
-
:extra_rdoc_files
|
147
|
-
:files
|
148
|
-
:homepage
|
149
|
-
:licenses
|
150
|
-
:metadata
|
151
|
-
:name
|
152
|
-
:platform
|
153
|
-
:post_install_message
|
154
|
-
:rdoc_options
|
155
|
-
:require_paths
|
156
|
-
:required_ruby_version
|
127
|
+
:authors => [],
|
128
|
+
:autorequire => nil,
|
129
|
+
:bindir => "bin",
|
130
|
+
:cert_chain => [],
|
131
|
+
:date => nil,
|
132
|
+
:dependencies => [],
|
133
|
+
:description => nil,
|
134
|
+
:email => nil,
|
135
|
+
:executables => [],
|
136
|
+
:extensions => [],
|
137
|
+
:extra_rdoc_files => [],
|
138
|
+
:files => [],
|
139
|
+
:homepage => nil,
|
140
|
+
:licenses => [],
|
141
|
+
:metadata => {},
|
142
|
+
:name => nil,
|
143
|
+
:platform => Gem::Platform::RUBY,
|
144
|
+
:post_install_message => nil,
|
145
|
+
:rdoc_options => [],
|
146
|
+
:require_paths => ["lib"],
|
147
|
+
:required_ruby_version => Gem::Requirement.default,
|
157
148
|
:required_rubygems_version => Gem::Requirement.default,
|
158
|
-
:requirements
|
159
|
-
:rubygems_version
|
160
|
-
:signing_key
|
161
|
-
:specification_version
|
162
|
-
:summary
|
163
|
-
:test_files
|
164
|
-
:version
|
149
|
+
:requirements => [],
|
150
|
+
:rubygems_version => Gem::VERSION,
|
151
|
+
:signing_key => nil,
|
152
|
+
:specification_version => CURRENT_SPECIFICATION_VERSION,
|
153
|
+
:summary => nil,
|
154
|
+
:test_files => [],
|
155
|
+
:version => nil,
|
165
156
|
}.freeze
|
166
157
|
|
167
158
|
# rubocop:disable Style/MutableConstant
|
168
|
-
INITIALIZE_CODE_FOR_DEFAULTS = {
|
159
|
+
INITIALIZE_CODE_FOR_DEFAULTS = {} # :nodoc:
|
169
160
|
# rubocop:enable Style/MutableConstant
|
170
161
|
|
171
162
|
@@default_value.each do |k,v|
|
172
163
|
INITIALIZE_CODE_FOR_DEFAULTS[k] = case v
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
end
|
183
|
-
|
184
|
-
@@attributes = @@default_value.keys.sort_by {
|
185
|
-
@@array_attributes = @@default_value.reject {
|
186
|
-
@@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition
|
164
|
+
when [], {}, true, false, nil, Numeric, Symbol
|
165
|
+
v.inspect
|
166
|
+
when String
|
167
|
+
v.dump
|
168
|
+
when Numeric
|
169
|
+
"default_value(:#{k})"
|
170
|
+
else
|
171
|
+
"default_value(:#{k}).dup"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
@@attributes = @@default_value.keys.sort_by {|s| s.to_s }
|
176
|
+
@@array_attributes = @@default_value.reject {|k,v| v != [] }.keys
|
177
|
+
@@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition do |k|
|
187
178
|
@@default_value[k].nil?
|
188
|
-
|
179
|
+
end
|
189
180
|
|
190
|
-
|
181
|
+
def self.clear_specs # :nodoc:
|
182
|
+
@@all = nil
|
183
|
+
@@stubs = nil
|
184
|
+
@@stubs_by_name = {}
|
185
|
+
@@spec_with_requirable_file = {}
|
186
|
+
@@active_stub_with_requirable_file = {}
|
187
|
+
end
|
188
|
+
private_class_method :clear_specs
|
189
|
+
|
190
|
+
clear_specs
|
191
191
|
|
192
192
|
# Sentinel object to represent "not found" stubs
|
193
193
|
NOT_FOUND = Struct.new(:to_spec, :this).new # :nodoc:
|
194
|
-
|
195
|
-
|
194
|
+
|
195
|
+
# Tracking removed method calls to warn users during build time.
|
196
|
+
REMOVED_METHODS = [:rubyforge_project=].freeze # :nodoc:
|
197
|
+
def removed_method_calls
|
198
|
+
@removed_method_calls ||= []
|
199
|
+
end
|
196
200
|
|
197
201
|
######################################################################
|
198
202
|
# :section: Required gemspec attributes
|
@@ -220,7 +224,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
220
224
|
attr_reader :version
|
221
225
|
|
222
226
|
##
|
223
|
-
# A short summary of this gem's description. Displayed in
|
227
|
+
# A short summary of this gem's description. Displayed in <tt>gem list -d</tt>.
|
224
228
|
#
|
225
229
|
# The #description should be more detailed than the summary.
|
226
230
|
#
|
@@ -244,12 +248,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
244
248
|
# require 'rake'
|
245
249
|
# spec.files = FileList['lib/**/*.rb',
|
246
250
|
# 'bin/*',
|
247
|
-
# '[A-Z]*'
|
248
|
-
# 'test/**/*'].to_a
|
251
|
+
# '[A-Z]*'].to_a
|
249
252
|
#
|
250
253
|
# # or without Rake...
|
251
254
|
# spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
|
252
|
-
# spec.files += Dir['[A-Z]*']
|
255
|
+
# spec.files += Dir['[A-Z]*']
|
253
256
|
# spec.files.reject! { |fn| fn.include? "CVS" }
|
254
257
|
|
255
258
|
def files
|
@@ -267,7 +270,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
267
270
|
# A list of authors for this gem.
|
268
271
|
#
|
269
272
|
# Alternatively, a single author can be specified by assigning a string to
|
270
|
-
#
|
273
|
+
# +spec.author+
|
271
274
|
#
|
272
275
|
# Usage:
|
273
276
|
#
|
@@ -280,6 +283,15 @@ class Gem::Specification < Gem::BasicSpecification
|
|
280
283
|
######################################################################
|
281
284
|
# :section: Recommended gemspec attributes
|
282
285
|
|
286
|
+
##
|
287
|
+
# The version of Ruby required by this gem
|
288
|
+
#
|
289
|
+
# Usage:
|
290
|
+
#
|
291
|
+
# spec.required_ruby_version = '>= 2.7.0'
|
292
|
+
|
293
|
+
attr_reader :required_ruby_version
|
294
|
+
|
283
295
|
##
|
284
296
|
# A long description of this gem
|
285
297
|
#
|
@@ -323,17 +335,21 @@ class Gem::Specification < Gem::BasicSpecification
|
|
323
335
|
# This should just be the name of your license. The full text of the license
|
324
336
|
# should be inside of the gem (at the top level) when you build it.
|
325
337
|
#
|
326
|
-
# The simplest way
|
338
|
+
# The simplest way is to specify the standard SPDX ID
|
327
339
|
# https://spdx.org/licenses/ for the license.
|
328
|
-
# Ideally you should pick one that is OSI (Open Source Initiative)
|
329
|
-
#
|
340
|
+
# Ideally, you should pick one that is OSI (Open Source Initiative)
|
341
|
+
# https://opensource.org/licenses/ approved.
|
330
342
|
#
|
331
|
-
# The most commonly used OSI
|
343
|
+
# The most commonly used OSI-approved licenses are MIT and Apache-2.0.
|
332
344
|
# GitHub also provides a license picker at http://choosealicense.com/.
|
333
345
|
#
|
346
|
+
# You can also use a custom license file along with your gemspec and specify
|
347
|
+
# a LicenseRef-<idstring>, where idstring is the name of the file containing
|
348
|
+
# the license text.
|
349
|
+
#
|
334
350
|
# You should specify a license for your gem so that people know how they are
|
335
|
-
# permitted to use it
|
336
|
-
# specifying a license means all rights are reserved; others have no
|
351
|
+
# permitted to use it and any restrictions you're placing on it. Not
|
352
|
+
# specifying a license means all rights are reserved; others have no right
|
337
353
|
# to use the code for any purpose.
|
338
354
|
#
|
339
355
|
# You can set multiple licenses with #licenses=
|
@@ -364,8 +380,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
364
380
|
|
365
381
|
##
|
366
382
|
# The metadata holds extra data for this gem that may be useful to other
|
367
|
-
# consumers and is settable by gem authors
|
368
|
-
# the rubygems software.
|
383
|
+
# consumers and is settable by gem authors.
|
369
384
|
#
|
370
385
|
# Metadata items have the following restrictions:
|
371
386
|
#
|
@@ -386,6 +401,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
386
401
|
# "mailing_list_uri" => "https://groups.example.com/bestgemever",
|
387
402
|
# "source_code_uri" => "https://example.com/user/bestgemever",
|
388
403
|
# "wiki_uri" => "https://example.com/user/bestgemever/wiki"
|
404
|
+
# "funding_uri" => "https://example.com/donate"
|
389
405
|
# }
|
390
406
|
#
|
391
407
|
# These links will be used on your gem's page on rubygems.org and must pass
|
@@ -457,7 +473,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
457
473
|
# spec.platform = Gem::Platform.local
|
458
474
|
|
459
475
|
def platform=(platform)
|
460
|
-
if @original_platform.nil?
|
476
|
+
if @original_platform.nil? ||
|
461
477
|
@original_platform == Gem::Platform::RUBY
|
462
478
|
@original_platform = platform
|
463
479
|
end
|
@@ -473,12 +489,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
473
489
|
# legacy constants
|
474
490
|
when nil, Gem::Platform::RUBY then
|
475
491
|
@new_platform = Gem::Platform::RUBY
|
476
|
-
when
|
477
|
-
@new_platform = Gem::Platform.new
|
478
|
-
when
|
479
|
-
@new_platform = Gem::Platform.new
|
480
|
-
when
|
481
|
-
@new_platform = Gem::Platform.new
|
492
|
+
when "mswin32" then # was Gem::Platform::WIN32
|
493
|
+
@new_platform = Gem::Platform.new "x86-mswin32"
|
494
|
+
when "i586-linux" then # was Gem::Platform::LINUX_586
|
495
|
+
@new_platform = Gem::Platform.new "x86-linux"
|
496
|
+
when "powerpc-darwin" then # was Gem::Platform::DARWIN
|
497
|
+
@new_platform = Gem::Platform.new "ppc-darwin"
|
482
498
|
else
|
483
499
|
@new_platform = Gem::Platform.new platform
|
484
500
|
end
|
@@ -511,11 +527,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
511
527
|
@require_paths = Array(val)
|
512
528
|
end
|
513
529
|
|
514
|
-
##
|
515
|
-
# The version of Ruby required by this gem
|
516
|
-
|
517
|
-
attr_reader :required_ruby_version
|
518
|
-
|
519
530
|
##
|
520
531
|
# The RubyGems version required by this gem
|
521
532
|
|
@@ -556,6 +567,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
556
567
|
# spec.add_runtime_dependency 'example', '~> 1.1', '>= 1.1.4'
|
557
568
|
|
558
569
|
def add_runtime_dependency(gem, *requirements)
|
570
|
+
if requirements.uniq.size != requirements.size
|
571
|
+
warn "WARNING: duplicated #{gem} dependency #{requirements}"
|
572
|
+
end
|
573
|
+
|
559
574
|
add_dependency_with_type(gem, :runtime, requirements)
|
560
575
|
end
|
561
576
|
|
@@ -641,6 +656,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
641
656
|
@rdoc_options ||= []
|
642
657
|
end
|
643
658
|
|
659
|
+
LATEST_RUBY_WITHOUT_PATCH_VERSIONS = Gem::Version.new("2.1")
|
660
|
+
|
644
661
|
##
|
645
662
|
# The version of Ruby required by this gem. The ruby version can be
|
646
663
|
# specified to the patch-level:
|
@@ -656,14 +673,25 @@ class Gem::Specification < Gem::BasicSpecification
|
|
656
673
|
# # This gem will work with 1.8.6 or greater...
|
657
674
|
# spec.required_ruby_version = '>= 1.8.6'
|
658
675
|
#
|
659
|
-
# # Only with
|
660
|
-
# spec.required_ruby_version = '~> 2.
|
676
|
+
# # Only with final releases of major version 2 where minor version is at least 3
|
677
|
+
# spec.required_ruby_version = '~> 2.3'
|
661
678
|
#
|
662
679
|
# # Only prereleases or final releases after 2.6.0.preview2
|
663
680
|
# spec.required_ruby_version = '> 2.6.0.preview2'
|
681
|
+
#
|
682
|
+
# # This gem will work with 2.3.0 or greater, including major version 3, but lesser than 4.0.0
|
683
|
+
# spec.required_ruby_version = '>= 2.3', '< 4'
|
664
684
|
|
665
685
|
def required_ruby_version=(req)
|
666
686
|
@required_ruby_version = Gem::Requirement.create req
|
687
|
+
|
688
|
+
@required_ruby_version.requirements.map! do |op, v|
|
689
|
+
if v >= LATEST_RUBY_WITHOUT_PATCH_VERSIONS && v.release.segments.size == 4
|
690
|
+
[op == "~>" ? "=" : op, Gem::Version.new(v.segments.tap {|s| s.delete_at(3) }.join("."))]
|
691
|
+
else
|
692
|
+
[op, v]
|
693
|
+
end
|
694
|
+
end
|
667
695
|
end
|
668
696
|
|
669
697
|
##
|
@@ -721,20 +749,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
721
749
|
# Deprecated: You must now specify the executable name to Gem.bin_path.
|
722
750
|
|
723
751
|
attr_writer :default_executable
|
724
|
-
|
752
|
+
rubygems_deprecate :default_executable=
|
725
753
|
|
726
754
|
##
|
727
755
|
# Allows deinstallation of gems with legacy platforms.
|
728
756
|
|
729
757
|
attr_writer :original_platform # :nodoc:
|
730
758
|
|
731
|
-
##
|
732
|
-
# Deprecated and ignored.
|
733
|
-
#
|
734
|
-
# Formerly used to set rubyforge project.
|
735
|
-
|
736
|
-
attr_writer :rubyforge_project
|
737
|
-
|
738
759
|
##
|
739
760
|
# The Gem::Specification version of this gemspec.
|
740
761
|
#
|
@@ -743,47 +764,29 @@ class Gem::Specification < Gem::BasicSpecification
|
|
743
764
|
attr_accessor :specification_version
|
744
765
|
|
745
766
|
def self._all # :nodoc:
|
746
|
-
|
747
|
-
@@all = stubs.map(&:to_spec)
|
748
|
-
if @@all.any?(&:nil?) # TODO: remove once we're happy
|
749
|
-
raise "pid: #{$$} nil spec! included in #{stubs.inspect}"
|
750
|
-
end
|
751
|
-
|
752
|
-
# After a reset, make sure already loaded specs
|
753
|
-
# are still marked as activated.
|
754
|
-
specs = {}
|
755
|
-
Gem.loaded_specs.each_value{|s| specs[s] = true}
|
756
|
-
@@all.each{|s| s.activated = true if specs[s]}
|
757
|
-
end
|
758
|
-
@@all
|
767
|
+
@@all ||= Gem.loaded_specs.values | stubs.map(&:to_spec)
|
759
768
|
end
|
760
769
|
|
761
|
-
def self.
|
762
|
-
|
770
|
+
def self.clear_load_cache # :nodoc:
|
771
|
+
@load_cache_mutex.synchronize do
|
772
|
+
@load_cache.clear
|
773
|
+
end
|
763
774
|
end
|
775
|
+
private_class_method :clear_load_cache
|
764
776
|
|
765
777
|
def self.each_gemspec(dirs) # :nodoc:
|
766
778
|
dirs.each do |dir|
|
767
779
|
Gem::Util.glob_files_in_dir("*.gemspec", dir).each do |path|
|
768
|
-
yield path.
|
780
|
+
yield path.tap(&Gem::UNTAINT)
|
769
781
|
end
|
770
782
|
end
|
771
783
|
end
|
772
784
|
|
773
785
|
def self.gemspec_stubs_in(dir, pattern)
|
774
|
-
Gem::Util.glob_files_in_dir(pattern, dir).map {
|
786
|
+
Gem::Util.glob_files_in_dir(pattern, dir).map {|path| yield path }.select(&:valid?)
|
775
787
|
end
|
776
788
|
private_class_method :gemspec_stubs_in
|
777
789
|
|
778
|
-
def self.default_stubs(pattern)
|
779
|
-
base_dir = Gem.default_dir
|
780
|
-
gems_dir = File.join base_dir, "gems"
|
781
|
-
gemspec_stubs_in(default_specifications_dir, pattern) do |path|
|
782
|
-
Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir)
|
783
|
-
end
|
784
|
-
end
|
785
|
-
private_class_method :default_stubs
|
786
|
-
|
787
790
|
def self.installed_stubs(dirs, pattern)
|
788
791
|
map_stubs(dirs, pattern) do |path, base_dir, gems_dir|
|
789
792
|
Gem::StubSpecification.gemspec_stub(path, base_dir, gems_dir)
|
@@ -792,24 +795,14 @@ class Gem::Specification < Gem::BasicSpecification
|
|
792
795
|
private_class_method :installed_stubs
|
793
796
|
|
794
797
|
def self.map_stubs(dirs, pattern) # :nodoc:
|
795
|
-
dirs.flat_map
|
798
|
+
dirs.flat_map do |dir|
|
796
799
|
base_dir = File.dirname dir
|
797
800
|
gems_dir = File.join base_dir, "gems"
|
798
|
-
gemspec_stubs_in(dir, pattern) {
|
799
|
-
|
801
|
+
gemspec_stubs_in(dir, pattern) {|path| yield path, base_dir, gems_dir }
|
802
|
+
end
|
800
803
|
end
|
801
804
|
private_class_method :map_stubs
|
802
805
|
|
803
|
-
def self.uniq_by(list, &block) # :nodoc:
|
804
|
-
list.uniq(&block)
|
805
|
-
end
|
806
|
-
private_class_method :uniq_by
|
807
|
-
|
808
|
-
def self.sort_by!(list, &block)
|
809
|
-
list.sort_by!(&block)
|
810
|
-
end
|
811
|
-
private_class_method :sort_by!
|
812
|
-
|
813
806
|
def self.each_spec(dirs) # :nodoc:
|
814
807
|
each_gemspec(dirs) do |path|
|
815
808
|
spec = self.load path
|
@@ -823,16 +816,23 @@ class Gem::Specification < Gem::BasicSpecification
|
|
823
816
|
def self.stubs
|
824
817
|
@@stubs ||= begin
|
825
818
|
pattern = "*.gemspec"
|
826
|
-
stubs =
|
827
|
-
stubs = uniq_by(stubs) { |stub| stub.full_name }
|
819
|
+
stubs = stubs_for_pattern(pattern, false)
|
828
820
|
|
829
|
-
|
830
|
-
@@stubs_by_name = stubs.select { |s| Gem::Platform.match s.platform }.group_by(&:name)
|
821
|
+
@@stubs_by_name = stubs.select {|s| Gem::Platform.match_spec? s }.group_by(&:name)
|
831
822
|
stubs
|
832
823
|
end
|
833
824
|
end
|
834
825
|
|
835
|
-
|
826
|
+
##
|
827
|
+
# Returns a Gem::StubSpecification for default gems
|
828
|
+
|
829
|
+
def self.default_stubs(pattern = "*.gemspec")
|
830
|
+
base_dir = Gem.default_dir
|
831
|
+
gems_dir = File.join base_dir, "gems"
|
832
|
+
gemspec_stubs_in(Gem.default_specifications_dir, pattern) do |path|
|
833
|
+
Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir)
|
834
|
+
end
|
835
|
+
end
|
836
836
|
|
837
837
|
##
|
838
838
|
# Returns a Gem::StubSpecification for installed gem named +name+
|
@@ -842,30 +842,40 @@ class Gem::Specification < Gem::BasicSpecification
|
|
842
842
|
if @@stubs
|
843
843
|
@@stubs_by_name[name] || []
|
844
844
|
else
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
stubs = uniq_by(stubs) { |stub| stub.full_name }.group_by(&:name)
|
849
|
-
stubs.each_value { |v| _resort!(v) }
|
850
|
-
|
851
|
-
@@stubs_by_name.merge! stubs
|
852
|
-
@@stubs_by_name[name] ||= EMPTY
|
845
|
+
@@stubs_by_name[name] ||= stubs_for_pattern("#{name}-*.gemspec").select do |s|
|
846
|
+
s.name == name
|
847
|
+
end
|
853
848
|
end
|
854
849
|
end
|
855
850
|
|
851
|
+
##
|
852
|
+
# Finds stub specifications matching a pattern from the standard locations,
|
853
|
+
# optionally filtering out specs not matching the current platform
|
854
|
+
#
|
855
|
+
def self.stubs_for_pattern(pattern, match_platform = true) # :nodoc:
|
856
|
+
installed_stubs = installed_stubs(Gem::Specification.dirs, pattern)
|
857
|
+
installed_stubs.select! {|s| Gem::Platform.match_spec? s } if match_platform
|
858
|
+
stubs = installed_stubs + default_stubs(pattern)
|
859
|
+
stubs = stubs.uniq {|stub| stub.full_name }
|
860
|
+
_resort!(stubs)
|
861
|
+
stubs
|
862
|
+
end
|
863
|
+
|
856
864
|
def self._resort!(specs) # :nodoc:
|
857
|
-
specs.sort!
|
865
|
+
specs.sort! do |a, b|
|
858
866
|
names = a.name <=> b.name
|
859
867
|
next names if names.nonzero?
|
860
|
-
b.version <=> a.version
|
861
|
-
|
868
|
+
versions = b.version <=> a.version
|
869
|
+
next versions if versions.nonzero?
|
870
|
+
Gem::Platform.sort_priority(b.platform)
|
871
|
+
end
|
862
872
|
end
|
863
873
|
|
864
874
|
##
|
865
875
|
# Loads the default specifications. It should be called only once.
|
866
876
|
|
867
877
|
def self.load_defaults
|
868
|
-
each_spec([default_specifications_dir]) do |spec|
|
878
|
+
each_spec([Gem.default_specifications_dir]) do |spec|
|
869
879
|
# #load returns nil if the spec is bad, so we just ignore
|
870
880
|
# it at this stage
|
871
881
|
Gem.register_default_spec(spec)
|
@@ -877,44 +887,23 @@ class Gem::Specification < Gem::BasicSpecification
|
|
877
887
|
# properly sorted.
|
878
888
|
|
879
889
|
def self.add_spec(spec)
|
880
|
-
warn "Gem::Specification.add_spec is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
|
881
|
-
# TODO: find all extraneous adds
|
882
|
-
# puts
|
883
|
-
# p :add_spec => [spec.full_name, caller.reject { |s| s =~ /minitest/ }]
|
884
|
-
|
885
|
-
# TODO: flush the rest of the crap from the tests
|
886
|
-
# raise "no dupes #{spec.full_name} in #{all_names.inspect}" if
|
887
|
-
# _all.include? spec
|
888
|
-
|
889
|
-
raise "nil spec!" unless spec # TODO: remove once we're happy with tests
|
890
|
-
|
891
890
|
return if _all.include? spec
|
892
891
|
|
893
892
|
_all << spec
|
894
893
|
stubs << spec
|
895
894
|
(@@stubs_by_name[spec.name] ||= []) << spec
|
896
|
-
|
897
|
-
_resort!(
|
895
|
+
|
896
|
+
_resort!(@@stubs_by_name[spec.name])
|
898
897
|
_resort!(stubs)
|
899
898
|
end
|
900
899
|
|
901
900
|
##
|
902
|
-
#
|
903
|
-
|
904
|
-
def self.add_specs(*specs)
|
905
|
-
warn "Gem::Specification.add_specs is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
|
906
|
-
|
907
|
-
raise "nil spec!" if specs.any?(&:nil?) # TODO: remove once we're happy
|
908
|
-
|
909
|
-
# TODO: this is much more efficient, but we need the extra checks for now
|
910
|
-
# _all.concat specs
|
911
|
-
# _resort!
|
901
|
+
# Removes +spec+ from the known specs.
|
912
902
|
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
end
|
903
|
+
def self.remove_spec(spec)
|
904
|
+
_all.delete spec.to_spec
|
905
|
+
stubs.delete spec
|
906
|
+
(@@stubs_by_name[spec.name] || []).delete spec
|
918
907
|
end
|
919
908
|
|
920
909
|
##
|
@@ -940,7 +929,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
940
929
|
# -- wilsonb
|
941
930
|
|
942
931
|
def self.all=(specs)
|
943
|
-
raise "nil spec!" if specs.any?(&:nil?) # TODO: remove once we're happy
|
944
932
|
@@stubs_by_name = specs.group_by(&:name)
|
945
933
|
@@all = @@stubs = specs
|
946
934
|
end
|
@@ -974,9 +962,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
974
962
|
# Return the directories that Specification uses to find specs.
|
975
963
|
|
976
964
|
def self.dirs
|
977
|
-
@@dirs ||= Gem.path.collect
|
978
|
-
File.join dir.dup.
|
979
|
-
|
965
|
+
@@dirs ||= Gem.path.collect do |dir|
|
966
|
+
File.join dir.dup.tap(&Gem::UNTAINT), "specifications"
|
967
|
+
end
|
980
968
|
end
|
981
969
|
|
982
970
|
##
|
@@ -986,7 +974,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
986
974
|
def self.dirs=(dirs)
|
987
975
|
self.reset
|
988
976
|
|
989
|
-
@@dirs = Array(dirs).map {
|
977
|
+
@@dirs = Array(dirs).map {|dir| File.join dir, "specifications" }
|
990
978
|
end
|
991
979
|
|
992
980
|
extend Enumerable
|
@@ -1033,15 +1021,20 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1033
1021
|
Gem::Dependency.new(name, *requirements).to_spec
|
1034
1022
|
end
|
1035
1023
|
|
1024
|
+
##
|
1025
|
+
# Find the best specification matching a +full_name+.
|
1026
|
+
def self.find_by_full_name(full_name)
|
1027
|
+
stubs.find {|s| s.full_name == full_name }&.to_spec
|
1028
|
+
end
|
1029
|
+
|
1036
1030
|
##
|
1037
1031
|
# Return the best specification that contains the file matching +path+.
|
1038
1032
|
|
1039
1033
|
def self.find_by_path(path)
|
1040
1034
|
path = path.dup.freeze
|
1041
|
-
spec = @@spec_with_requirable_file[path] ||= (stubs.find
|
1042
|
-
next unless Gem::BundlerVersionFinder.compatible?(s)
|
1035
|
+
spec = @@spec_with_requirable_file[path] ||= (stubs.find do |s|
|
1043
1036
|
s.contains_requirable_file? path
|
1044
|
-
|
1037
|
+
end || NOT_FOUND)
|
1045
1038
|
spec.to_spec
|
1046
1039
|
end
|
1047
1040
|
|
@@ -1050,18 +1043,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1050
1043
|
# amongst the specs that are not activated.
|
1051
1044
|
|
1052
1045
|
def self.find_inactive_by_path(path)
|
1053
|
-
stub = stubs.find
|
1046
|
+
stub = stubs.find do |s|
|
1054
1047
|
next if s.activated?
|
1055
|
-
next unless Gem::BundlerVersionFinder.compatible?(s)
|
1056
1048
|
s.contains_requirable_file? path
|
1057
|
-
|
1049
|
+
end
|
1058
1050
|
stub && stub.to_spec
|
1059
1051
|
end
|
1060
1052
|
|
1061
1053
|
def self.find_active_stub_by_path(path)
|
1062
|
-
stub = @@active_stub_with_requirable_file[path] ||= (stubs.find
|
1063
|
-
s.activated?
|
1064
|
-
|
1054
|
+
stub = @@active_stub_with_requirable_file[path] ||= (stubs.find do |s|
|
1055
|
+
s.activated? && s.contains_requirable_file?(path)
|
1056
|
+
end || NOT_FOUND)
|
1065
1057
|
stub.this
|
1066
1058
|
end
|
1067
1059
|
|
@@ -1069,10 +1061,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1069
1061
|
# Return currently unresolved specs that contain the file matching +path+.
|
1070
1062
|
|
1071
1063
|
def self.find_in_unresolved(path)
|
1072
|
-
|
1073
|
-
specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
|
1074
|
-
|
1075
|
-
specs.find_all { |spec| spec.contains_requirable_file? path }
|
1064
|
+
unresolved_specs.find_all {|spec| spec.contains_requirable_file? path }
|
1076
1065
|
end
|
1077
1066
|
|
1078
1067
|
##
|
@@ -1080,9 +1069,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1080
1069
|
# specs that contain the file matching +path+.
|
1081
1070
|
|
1082
1071
|
def self.find_in_unresolved_tree(path)
|
1083
|
-
|
1084
|
-
|
1085
|
-
specs.each do |spec|
|
1072
|
+
unresolved_specs.each do |spec|
|
1086
1073
|
spec.traverse do |from_spec, dep, to_spec, trail|
|
1087
1074
|
if to_spec.has_conflicts? || to_spec.conficts_when_loaded_with?(trail)
|
1088
1075
|
:next
|
@@ -1095,6 +1082,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1095
1082
|
[]
|
1096
1083
|
end
|
1097
1084
|
|
1085
|
+
def self.unresolved_specs
|
1086
|
+
unresolved_deps.values.map {|dep| dep.to_specs }.flatten
|
1087
|
+
end
|
1088
|
+
private_class_method :unresolved_specs
|
1089
|
+
|
1098
1090
|
##
|
1099
1091
|
# Special loader for YAML files. When a Specification object is loaded
|
1100
1092
|
# from a YAML file, it bypasses the normal Ruby object initialization
|
@@ -1119,6 +1111,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1119
1111
|
|
1120
1112
|
spec.specification_version ||= NONEXISTENT_SPECIFICATION_VERSION
|
1121
1113
|
spec.reset_nil_attributes_to_default
|
1114
|
+
spec.flatten_require_paths
|
1122
1115
|
|
1123
1116
|
spec
|
1124
1117
|
end
|
@@ -1128,24 +1121,26 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1128
1121
|
# +prerelease+ is true.
|
1129
1122
|
|
1130
1123
|
def self.latest_specs(prerelease = false)
|
1131
|
-
_latest_specs Gem::Specification.
|
1124
|
+
_latest_specs Gem::Specification.stubs, prerelease
|
1125
|
+
end
|
1126
|
+
|
1127
|
+
##
|
1128
|
+
# Return the latest installed spec for gem +name+.
|
1129
|
+
|
1130
|
+
def self.latest_spec_for(name)
|
1131
|
+
latest_specs(true).find {|installed_spec| installed_spec.name == name }
|
1132
1132
|
end
|
1133
1133
|
|
1134
1134
|
def self._latest_specs(specs, prerelease = false) # :nodoc:
|
1135
|
-
result =
|
1136
|
-
native = {}
|
1135
|
+
result = {}
|
1137
1136
|
|
1138
1137
|
specs.reverse_each do |spec|
|
1139
1138
|
next if spec.version.prerelease? unless prerelease
|
1140
1139
|
|
1141
|
-
|
1142
|
-
result[spec.name][spec.platform] = spec
|
1140
|
+
result[spec.name] = spec
|
1143
1141
|
end
|
1144
1142
|
|
1145
|
-
result.map(&:last).
|
1146
|
-
minimum = native[spec.name]
|
1147
|
-
minimum && spec.version < minimum
|
1148
|
-
}.sort_by{ |tup| tup.name }
|
1143
|
+
result.map(&:last).flatten.sort_by {|tup| tup.name }
|
1149
1144
|
end
|
1150
1145
|
|
1151
1146
|
##
|
@@ -1154,22 +1149,29 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1154
1149
|
def self.load(file)
|
1155
1150
|
return unless file
|
1156
1151
|
|
1157
|
-
_spec =
|
1152
|
+
_spec = @load_cache_mutex.synchronize { @load_cache[file] }
|
1158
1153
|
return _spec if _spec
|
1159
1154
|
|
1160
|
-
file = file.dup.
|
1155
|
+
file = file.dup.tap(&Gem::UNTAINT)
|
1161
1156
|
return unless File.file?(file)
|
1162
1157
|
|
1163
|
-
code =
|
1158
|
+
code = Gem.open_file(file, "r:UTF-8:-", &:read)
|
1164
1159
|
|
1165
|
-
code.
|
1160
|
+
code.tap(&Gem::UNTAINT)
|
1166
1161
|
|
1167
1162
|
begin
|
1168
1163
|
_spec = eval code, binding, file
|
1169
1164
|
|
1170
1165
|
if Gem::Specification === _spec
|
1171
1166
|
_spec.loaded_from = File.expand_path file.to_s
|
1172
|
-
|
1167
|
+
@load_cache_mutex.synchronize do
|
1168
|
+
prev = @load_cache[file]
|
1169
|
+
if prev
|
1170
|
+
_spec = prev
|
1171
|
+
else
|
1172
|
+
@load_cache[file] = _spec
|
1173
|
+
end
|
1174
|
+
end
|
1173
1175
|
return _spec
|
1174
1176
|
end
|
1175
1177
|
|
@@ -1195,7 +1197,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1195
1197
|
|
1196
1198
|
def self.normalize_yaml_input(input)
|
1197
1199
|
result = input.respond_to?(:read) ? input.read : input
|
1198
|
-
result = "--- " + result unless result
|
1200
|
+
result = "--- " + result unless result.start_with?("--- ")
|
1199
1201
|
result = result.dup
|
1200
1202
|
result.gsub!(/ !!null \n/, " \n")
|
1201
1203
|
# date: 2011-04-26 00:00:00.000000000Z
|
@@ -1212,7 +1214,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1212
1214
|
# version as well.
|
1213
1215
|
|
1214
1216
|
def self.outdated
|
1215
|
-
outdated_and_latest_version.map {
|
1217
|
+
outdated_and_latest_version.map {|local, _| local.name }
|
1216
1218
|
end
|
1217
1219
|
|
1218
1220
|
##
|
@@ -1233,28 +1235,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1233
1235
|
Gem::Dependency.new local_spec.name, ">= #{local_spec.version}"
|
1234
1236
|
|
1235
1237
|
remotes, = fetcher.search_for_dependency dependency
|
1236
|
-
remotes = remotes.map {
|
1238
|
+
remotes = remotes.map {|n, _| n.version }
|
1237
1239
|
|
1238
1240
|
latest_remote = remotes.sort.last
|
1239
1241
|
|
1240
1242
|
yield [local_spec, latest_remote] if
|
1241
|
-
latest_remote
|
1243
|
+
latest_remote && local_spec.version < latest_remote
|
1242
1244
|
end
|
1243
1245
|
|
1244
1246
|
nil
|
1245
1247
|
end
|
1246
1248
|
|
1247
|
-
##
|
1248
|
-
# Removes +spec+ from the known specs.
|
1249
|
-
|
1250
|
-
def self.remove_spec(spec)
|
1251
|
-
warn "Gem::Specification.remove_spec is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
|
1252
|
-
_all.delete spec
|
1253
|
-
stubs.delete_if { |s| s.full_name == spec.full_name }
|
1254
|
-
(@@stubs_by_name[spec.name] || []).delete_if { |s| s.full_name == spec.full_name }
|
1255
|
-
reset
|
1256
|
-
end
|
1257
|
-
|
1258
1249
|
##
|
1259
1250
|
# Is +name+ a required attribute?
|
1260
1251
|
|
@@ -1275,43 +1266,63 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1275
1266
|
|
1276
1267
|
def self.reset
|
1277
1268
|
@@dirs = nil
|
1278
|
-
Gem.pre_reset_hooks.each {
|
1279
|
-
|
1280
|
-
|
1281
|
-
@@stubs_by_name = {}
|
1282
|
-
@@spec_with_requirable_file = {}
|
1283
|
-
@@active_stub_with_requirable_file = {}
|
1284
|
-
_clear_load_cache
|
1269
|
+
Gem.pre_reset_hooks.each {|hook| hook.call }
|
1270
|
+
clear_specs
|
1271
|
+
clear_load_cache
|
1285
1272
|
unresolved = unresolved_deps
|
1286
1273
|
unless unresolved.empty?
|
1287
|
-
|
1288
|
-
warn "#{w}: Unresolved or ambigious specs during Gem::Specification.reset:"
|
1274
|
+
warn "WARN: Unresolved or ambiguous specs during Gem::Specification.reset:"
|
1289
1275
|
unresolved.values.each do |dep|
|
1290
1276
|
warn " #{dep}"
|
1291
1277
|
|
1292
1278
|
versions = find_all_by_name(dep.name)
|
1293
1279
|
unless versions.empty?
|
1294
1280
|
warn " Available/installed versions of this gem:"
|
1295
|
-
versions.each {
|
1281
|
+
versions.each {|s| warn " - #{s.version}" }
|
1296
1282
|
end
|
1297
1283
|
end
|
1298
|
-
warn "
|
1284
|
+
warn "WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'"
|
1299
1285
|
warn "Please report a bug if this causes problems."
|
1300
1286
|
unresolved.clear
|
1301
1287
|
end
|
1302
|
-
Gem.post_reset_hooks.each {
|
1288
|
+
Gem.post_reset_hooks.each {|hook| hook.call }
|
1303
1289
|
end
|
1304
1290
|
|
1305
1291
|
# DOC: This method needs documented or nodoc'd
|
1306
1292
|
def self.unresolved_deps
|
1307
|
-
@unresolved_deps ||= Hash.new {
|
1293
|
+
@unresolved_deps ||= Hash.new {|h, n| h[n] = Gem::Dependency.new n }
|
1308
1294
|
end
|
1309
1295
|
|
1310
1296
|
##
|
1311
1297
|
# Load custom marshal format, re-initializing defaults as needed
|
1312
1298
|
|
1313
1299
|
def self._load(str)
|
1314
|
-
|
1300
|
+
Gem.load_yaml
|
1301
|
+
|
1302
|
+
array = begin
|
1303
|
+
Marshal.load str
|
1304
|
+
rescue ArgumentError => e
|
1305
|
+
#
|
1306
|
+
# Some very old marshaled specs included references to `YAML::PrivateType`
|
1307
|
+
# and `YAML::Syck::DefaultKey` constants due to bugs in the old emitter
|
1308
|
+
# that generated them. Workaround the issue by defining the necessary
|
1309
|
+
# constants and retrying.
|
1310
|
+
#
|
1311
|
+
message = e.message
|
1312
|
+
raise unless message.include?("YAML::")
|
1313
|
+
|
1314
|
+
Object.const_set "YAML", Psych unless Object.const_defined?(:YAML)
|
1315
|
+
|
1316
|
+
if message.include?("YAML::Syck::")
|
1317
|
+
YAML.const_set "Syck", YAML unless YAML.const_defined?(:Syck)
|
1318
|
+
|
1319
|
+
YAML::Syck.const_set "DefaultKey", Class.new if message.include?("YAML::Syck::DefaultKey")
|
1320
|
+
elsif message.include?("YAML::PrivateType")
|
1321
|
+
YAML.const_set "PrivateType", Class.new
|
1322
|
+
end
|
1323
|
+
|
1324
|
+
retry
|
1325
|
+
end
|
1315
1326
|
|
1316
1327
|
spec = Gem::Specification.new
|
1317
1328
|
spec.instance_variable_set :@specification_version, array[1]
|
@@ -1319,22 +1330,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1319
1330
|
current_version = CURRENT_SPECIFICATION_VERSION
|
1320
1331
|
|
1321
1332
|
field_count = if spec.specification_version > current_version
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1333
|
+
spec.instance_variable_set :@specification_version,
|
1334
|
+
current_version
|
1335
|
+
MARSHAL_FIELDS[current_version]
|
1336
|
+
else
|
1337
|
+
MARSHAL_FIELDS[spec.specification_version]
|
1338
|
+
end
|
1328
1339
|
|
1329
1340
|
if array.size < field_count
|
1330
1341
|
raise TypeError, "invalid Gem::Specification format #{array.inspect}"
|
1331
1342
|
end
|
1332
1343
|
|
1333
|
-
# Cleanup any YAML::PrivateType. They only show up for an old bug
|
1334
|
-
# where nil => null, so just convert them to nil based on the type.
|
1335
|
-
|
1336
|
-
array.map! { |e| e.kind_of?(YAML::PrivateType) ? nil : e }
|
1337
|
-
|
1338
1344
|
spec.instance_variable_set :@rubygems_version, array[0]
|
1339
1345
|
# spec version
|
1340
1346
|
spec.instance_variable_set :@name, array[2]
|
@@ -1390,7 +1396,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1390
1396
|
@required_rubygems_version,
|
1391
1397
|
@original_platform,
|
1392
1398
|
@dependencies,
|
1393
|
-
|
1399
|
+
"", # rubyforge_project
|
1394
1400
|
@email,
|
1395
1401
|
@authors,
|
1396
1402
|
@description,
|
@@ -1398,7 +1404,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1398
1404
|
true, # has_rdoc
|
1399
1405
|
@new_platform,
|
1400
1406
|
@licenses,
|
1401
|
-
@metadata
|
1407
|
+
@metadata,
|
1402
1408
|
]
|
1403
1409
|
end
|
1404
1410
|
|
@@ -1446,7 +1452,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1446
1452
|
raise e
|
1447
1453
|
end
|
1448
1454
|
|
1449
|
-
|
1455
|
+
begin
|
1456
|
+
specs = spec_dep.to_specs
|
1457
|
+
rescue Gem::MissingSpecError => e
|
1458
|
+
raise Gem::MissingSpecError.new(e.name, e.requirement, "at: #{self.spec_file}")
|
1459
|
+
end
|
1450
1460
|
|
1451
1461
|
if specs.size == 1
|
1452
1462
|
specs.first.activate
|
@@ -1482,7 +1492,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1482
1492
|
self.summary = sanitize_string(summary)
|
1483
1493
|
self.description = sanitize_string(description)
|
1484
1494
|
self.post_install_message = sanitize_string(post_install_message)
|
1485
|
-
self.authors = authors.collect {
|
1495
|
+
self.authors = authors.collect {|a| sanitize_string(a) }
|
1486
1496
|
end
|
1487
1497
|
|
1488
1498
|
##
|
@@ -1494,13 +1504,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1494
1504
|
# HACK the #to_s is in here because RSpec has an Array of Arrays of
|
1495
1505
|
# Strings for authors. Need a way to disallow bad values on gemspec
|
1496
1506
|
# generation. (Probably won't happen.)
|
1497
|
-
string
|
1498
|
-
|
1499
|
-
begin
|
1500
|
-
Builder::XChar.encode string
|
1501
|
-
rescue NameError, NoMethodError
|
1502
|
-
string.to_xs
|
1503
|
-
end
|
1507
|
+
string.to_s
|
1504
1508
|
end
|
1505
1509
|
|
1506
1510
|
##
|
@@ -1511,7 +1515,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1511
1515
|
return nil if executables.nil?
|
1512
1516
|
|
1513
1517
|
if @bindir
|
1514
|
-
Array(executables).map {
|
1518
|
+
Array(executables).map {|e| File.join(@bindir, e) }
|
1515
1519
|
else
|
1516
1520
|
executables
|
1517
1521
|
end
|
@@ -1526,10 +1530,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1526
1530
|
|
1527
1531
|
def add_dependency_with_type(dependency, type, requirements)
|
1528
1532
|
requirements = if requirements.empty?
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
+
Gem::Requirement.default
|
1534
|
+
else
|
1535
|
+
requirements.flatten
|
1536
|
+
end
|
1533
1537
|
|
1534
1538
|
unless dependency.respond_to?(:name) &&
|
1535
1539
|
dependency.respond_to?(:requirement)
|
@@ -1551,23 +1555,14 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1551
1555
|
|
1552
1556
|
paths = full_require_paths
|
1553
1557
|
|
1554
|
-
|
1555
|
-
insert_index = Gem.load_path_insert_index
|
1556
|
-
|
1557
|
-
if insert_index
|
1558
|
-
# gem directories must come after -I and ENV['RUBYLIB']
|
1559
|
-
$LOAD_PATH.insert(insert_index, *paths)
|
1560
|
-
else
|
1561
|
-
# we are probably testing in core, -I and RUBYLIB don't apply
|
1562
|
-
$LOAD_PATH.unshift(*paths)
|
1563
|
-
end
|
1558
|
+
Gem.add_to_load_path(*paths)
|
1564
1559
|
end
|
1565
1560
|
|
1566
1561
|
##
|
1567
1562
|
# Singular reader for #authors. Returns the first author in the list
|
1568
1563
|
|
1569
1564
|
def author
|
1570
|
-
val = authors
|
1565
|
+
(val = authors) && val.first
|
1571
1566
|
end
|
1572
1567
|
|
1573
1568
|
##
|
@@ -1586,7 +1581,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1586
1581
|
# a full path.
|
1587
1582
|
|
1588
1583
|
def bin_dir
|
1589
|
-
@bin_dir ||= File.join gem_dir, bindir
|
1584
|
+
@bin_dir ||= File.join gem_dir, bindir
|
1590
1585
|
end
|
1591
1586
|
|
1592
1587
|
##
|
@@ -1602,7 +1597,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1602
1597
|
def build_args
|
1603
1598
|
if File.exist? build_info_file
|
1604
1599
|
build_info = File.readlines build_info_file
|
1605
|
-
build_info = build_info.map {
|
1600
|
+
build_info = build_info.map {|x| x.strip }
|
1606
1601
|
build_info.delete ""
|
1607
1602
|
build_info
|
1608
1603
|
else
|
@@ -1615,12 +1610,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1615
1610
|
# the gem.build_complete file is missing.
|
1616
1611
|
|
1617
1612
|
def build_extensions # :nodoc:
|
1618
|
-
return if default_gem?
|
1619
1613
|
return if extensions.empty?
|
1620
|
-
return if
|
1614
|
+
return if default_gem?
|
1615
|
+
# we need to fresh build when same name and version of default gems
|
1616
|
+
return if self.class.find_by_full_name(full_name)&.default_gem?
|
1621
1617
|
return if File.exist? gem_build_complete_path
|
1622
1618
|
return if !File.writable?(base_dir)
|
1623
|
-
return if !File.exist?(File.join(base_dir,
|
1619
|
+
return if !File.exist?(File.join(base_dir, "extensions"))
|
1624
1620
|
|
1625
1621
|
begin
|
1626
1622
|
# We need to require things in $LOAD_PATH without looking for the
|
@@ -1628,9 +1624,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1628
1624
|
unresolved_deps = Gem::Specification.unresolved_deps.dup
|
1629
1625
|
Gem::Specification.unresolved_deps.clear
|
1630
1626
|
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1627
|
+
require_relative "config_file"
|
1628
|
+
require_relative "ext"
|
1629
|
+
require_relative "user_interaction"
|
1634
1630
|
|
1635
1631
|
ui = Gem::SilentUI.new
|
1636
1632
|
Gem::DefaultUserInteraction.use_ui ui do
|
@@ -1678,12 +1674,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1678
1674
|
|
1679
1675
|
def conflicts
|
1680
1676
|
conflicts = {}
|
1681
|
-
self.runtime_dependencies.each
|
1677
|
+
self.runtime_dependencies.each do |dep|
|
1682
1678
|
spec = Gem.loaded_specs[dep.name]
|
1683
|
-
if spec
|
1679
|
+
if spec && !spec.satisfies_requirement?(dep)
|
1684
1680
|
(conflicts[spec] ||= []) << dep
|
1685
1681
|
end
|
1686
|
-
|
1682
|
+
end
|
1687
1683
|
env_req = Gem.env_requirement(name)
|
1688
1684
|
(conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version
|
1689
1685
|
conflicts
|
@@ -1693,9 +1689,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1693
1689
|
# return true if there will be conflict when spec if loaded together with the list of specs.
|
1694
1690
|
|
1695
1691
|
def conficts_when_loaded_with?(list_of_specs) # :nodoc:
|
1696
|
-
result = list_of_specs.any?
|
1697
|
-
spec.dependencies.any? {
|
1698
|
-
|
1692
|
+
result = list_of_specs.any? do |spec|
|
1693
|
+
spec.dependencies.any? {|dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }
|
1694
|
+
end
|
1699
1695
|
result
|
1700
1696
|
end
|
1701
1697
|
|
@@ -1704,14 +1700,14 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1704
1700
|
|
1705
1701
|
def has_conflicts?
|
1706
1702
|
return true unless Gem.env_requirement(name).satisfied_by?(version)
|
1707
|
-
self.dependencies.any?
|
1703
|
+
self.dependencies.any? do |dep|
|
1708
1704
|
if dep.runtime?
|
1709
1705
|
spec = Gem.loaded_specs[dep.name]
|
1710
|
-
spec
|
1706
|
+
spec && !spec.satisfies_requirement?(dep)
|
1711
1707
|
else
|
1712
1708
|
false
|
1713
1709
|
end
|
1714
|
-
|
1710
|
+
end
|
1715
1711
|
end
|
1716
1712
|
|
1717
1713
|
# The date this gem was created.
|
@@ -1723,12 +1719,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1723
1719
|
# https://reproducible-builds.org/specs/source-date-epoch/
|
1724
1720
|
|
1725
1721
|
def date
|
1726
|
-
@date ||=
|
1722
|
+
@date ||= Time.utc(*Gem.source_date_epoch.utc.to_a[3..5].reverse)
|
1727
1723
|
end
|
1728
1724
|
|
1729
1725
|
DateLike = Object.new # :nodoc:
|
1730
1726
|
def DateLike.===(obj) # :nodoc:
|
1731
|
-
defined?(::Date)
|
1727
|
+
defined?(::Date) && Date === obj
|
1732
1728
|
end
|
1733
1729
|
|
1734
1730
|
DateTimeFormat = # :nodoc:
|
@@ -1747,24 +1743,18 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1747
1743
|
# This is the cleanest, most-readable, faster-than-using-Date
|
1748
1744
|
# way to do it.
|
1749
1745
|
@date = case date
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
end
|
1763
|
-
when Time, DateLike then
|
1764
|
-
Time.utc(date.year, date.month, date.day)
|
1765
|
-
else
|
1766
|
-
TODAY
|
1767
|
-
end
|
1746
|
+
when String then
|
1747
|
+
if DateTimeFormat =~ date
|
1748
|
+
Time.utc($1.to_i, $2.to_i, $3.to_i)
|
1749
|
+
else
|
1750
|
+
raise(Gem::InvalidSpecificationException,
|
1751
|
+
"invalid date format in specification: #{date.inspect}")
|
1752
|
+
end
|
1753
|
+
when Time, DateLike then
|
1754
|
+
Time.utc(date.year, date.month, date.day)
|
1755
|
+
else
|
1756
|
+
TODAY
|
1757
|
+
end
|
1768
1758
|
end
|
1769
1759
|
|
1770
1760
|
##
|
@@ -1774,16 +1764,16 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1774
1764
|
# executable now. See Gem.bin_path.
|
1775
1765
|
|
1776
1766
|
def default_executable # :nodoc:
|
1777
|
-
if defined?(@default_executable)
|
1767
|
+
if defined?(@default_executable) && @default_executable
|
1778
1768
|
result = @default_executable
|
1779
|
-
elsif @executables
|
1769
|
+
elsif @executables && @executables.size == 1
|
1780
1770
|
result = Array(@executables).first
|
1781
1771
|
else
|
1782
1772
|
result = nil
|
1783
1773
|
end
|
1784
1774
|
result
|
1785
1775
|
end
|
1786
|
-
|
1776
|
+
rubygems_deprecate :default_executable
|
1787
1777
|
|
1788
1778
|
##
|
1789
1779
|
# The default value for specification attribute +name+
|
@@ -1808,10 +1798,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1808
1798
|
#
|
1809
1799
|
# [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]]
|
1810
1800
|
|
1811
|
-
def dependent_gems
|
1801
|
+
def dependent_gems(check_dev=true)
|
1812
1802
|
out = []
|
1813
1803
|
Gem::Specification.each do |spec|
|
1814
|
-
spec.dependencies
|
1804
|
+
deps = check_dev ? spec.dependencies : spec.runtime_dependencies
|
1805
|
+
deps.each do |dep|
|
1815
1806
|
if self.satisfies_requirement?(dep)
|
1816
1807
|
sats = []
|
1817
1808
|
find_all_satisfiers(dep) do |sat|
|
@@ -1828,7 +1819,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1828
1819
|
# Returns all specs that matches this spec's runtime dependencies.
|
1829
1820
|
|
1830
1821
|
def dependent_specs
|
1831
|
-
runtime_dependencies.map {
|
1822
|
+
runtime_dependencies.map {|dep| dep.to_specs }.flatten
|
1832
1823
|
end
|
1833
1824
|
|
1834
1825
|
##
|
@@ -1842,7 +1833,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1842
1833
|
# List of dependencies that are used for development
|
1843
1834
|
|
1844
1835
|
def development_dependencies
|
1845
|
-
dependencies.select {
|
1836
|
+
dependencies.select {|d| d.type == :development }
|
1846
1837
|
end
|
1847
1838
|
|
1848
1839
|
##
|
@@ -1854,7 +1845,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1854
1845
|
# spec.doc_dir 'ri' # => "/path/to/gem_repo/doc/a-1/ri"
|
1855
1846
|
|
1856
1847
|
def doc_dir(type = nil)
|
1857
|
-
@doc_dir ||= File.join base_dir,
|
1848
|
+
@doc_dir ||= File.join base_dir, "doc", full_name
|
1858
1849
|
|
1859
1850
|
if type
|
1860
1851
|
File.join @doc_dir, type
|
@@ -1866,17 +1857,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1866
1857
|
def encode_with(coder) # :nodoc:
|
1867
1858
|
mark_version
|
1868
1859
|
|
1869
|
-
coder.add
|
1870
|
-
coder.add
|
1860
|
+
coder.add "name", @name
|
1861
|
+
coder.add "version", @version
|
1871
1862
|
platform = case @original_platform
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
coder.add
|
1863
|
+
when nil, "" then
|
1864
|
+
"ruby"
|
1865
|
+
when String then
|
1866
|
+
@original_platform
|
1867
|
+
else
|
1868
|
+
@original_platform.to_s
|
1869
|
+
end
|
1870
|
+
coder.add "platform", platform
|
1880
1871
|
|
1881
1872
|
attributes = @@attributes.map(&:to_s) - %w[name version platform]
|
1882
1873
|
attributes.each do |name|
|
@@ -1892,7 +1883,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1892
1883
|
# Singular accessor for #executables
|
1893
1884
|
|
1894
1885
|
def executable
|
1895
|
-
val = executables
|
1886
|
+
(val = executables) && val.first
|
1896
1887
|
end
|
1897
1888
|
|
1898
1889
|
##
|
@@ -1903,29 +1894,23 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1903
1894
|
end
|
1904
1895
|
|
1905
1896
|
##
|
1906
|
-
# Sets executables to +value+, ensuring it is an array.
|
1907
|
-
# use this, push onto the array instead.
|
1897
|
+
# Sets executables to +value+, ensuring it is an array.
|
1908
1898
|
|
1909
1899
|
def executables=(value)
|
1910
|
-
# TODO: warn about setting instead of pushing
|
1911
1900
|
@executables = Array(value)
|
1912
1901
|
end
|
1913
1902
|
|
1914
1903
|
##
|
1915
|
-
# Sets extensions to +extensions+, ensuring it is an array.
|
1916
|
-
# use this, push onto the array instead.
|
1904
|
+
# Sets extensions to +extensions+, ensuring it is an array.
|
1917
1905
|
|
1918
1906
|
def extensions=(extensions)
|
1919
|
-
# TODO: warn about setting instead of pushing
|
1920
1907
|
@extensions = Array extensions
|
1921
1908
|
end
|
1922
1909
|
|
1923
1910
|
##
|
1924
|
-
# Sets extra_rdoc_files to +files+, ensuring it is an array.
|
1925
|
-
# use this, push onto the array instead.
|
1911
|
+
# Sets extra_rdoc_files to +files+, ensuring it is an array.
|
1926
1912
|
|
1927
1913
|
def extra_rdoc_files=(files)
|
1928
|
-
# TODO: warn about setting instead of pushing
|
1929
1914
|
@extra_rdoc_files = Array files
|
1930
1915
|
end
|
1931
1916
|
|
@@ -1980,8 +1965,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1980
1965
|
end
|
1981
1966
|
|
1982
1967
|
def gems_dir
|
1983
|
-
|
1984
|
-
@gems_dir ||= File.join(loaded_from && base_dir || Gem.dir, "gems")
|
1968
|
+
@gems_dir ||= File.join(base_dir, "gems")
|
1985
1969
|
end
|
1986
1970
|
|
1987
1971
|
##
|
@@ -1992,7 +1976,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1992
1976
|
def has_rdoc # :nodoc:
|
1993
1977
|
true
|
1994
1978
|
end
|
1995
|
-
|
1979
|
+
rubygems_deprecate :has_rdoc
|
1996
1980
|
|
1997
1981
|
##
|
1998
1982
|
# Deprecated and ignored.
|
@@ -2002,16 +1986,16 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2002
1986
|
def has_rdoc=(ignored) # :nodoc:
|
2003
1987
|
@has_rdoc = true
|
2004
1988
|
end
|
2005
|
-
|
1989
|
+
rubygems_deprecate :has_rdoc=
|
2006
1990
|
|
2007
1991
|
alias :has_rdoc? :has_rdoc # :nodoc:
|
2008
|
-
|
1992
|
+
rubygems_deprecate :has_rdoc?
|
2009
1993
|
|
2010
1994
|
##
|
2011
1995
|
# True if this gem has files in test_files
|
2012
1996
|
|
2013
1997
|
def has_unit_tests? # :nodoc:
|
2014
|
-
|
1998
|
+
!test_files.empty?
|
2015
1999
|
end
|
2016
2000
|
|
2017
2001
|
# :stopdoc:
|
@@ -2027,9 +2011,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2027
2011
|
yaml_initialize coder.tag, coder.map
|
2028
2012
|
end
|
2029
2013
|
|
2014
|
+
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
|
2015
|
+
# frozen_string_literal: true
|
2030
2016
|
|
2031
|
-
|
2032
|
-
eval <<-RB, binding, __FILE__, __LINE__ + 1
|
2033
2017
|
def set_nil_attributes_to_nil
|
2034
2018
|
#{@@nil_attributes.map {|key| "@#{key} = nil" }.join "; "}
|
2035
2019
|
end
|
@@ -2039,7 +2023,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2039
2023
|
#{@@non_nil_attributes.map {|key| "@#{key} = #{INITIALIZE_CODE_FOR_DEFAULTS[key]}" }.join ";"}
|
2040
2024
|
end
|
2041
2025
|
private :set_not_nil_attributes_to_default_values
|
2042
|
-
|
2026
|
+
RUBY
|
2043
2027
|
|
2044
2028
|
##
|
2045
2029
|
# Specification constructor. Assigns the default values to the attributes
|
@@ -2064,6 +2048,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2064
2048
|
self.name = name if name
|
2065
2049
|
self.version = version if version
|
2066
2050
|
|
2051
|
+
if (platform = Gem.platforms.last) && platform != Gem::Platform::RUBY && platform != Gem::Platform.local
|
2052
|
+
self.platform = platform
|
2053
|
+
end
|
2054
|
+
|
2067
2055
|
yield self if block_given?
|
2068
2056
|
end
|
2069
2057
|
|
@@ -2095,10 +2083,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2095
2083
|
def base_dir
|
2096
2084
|
return Gem.dir unless loaded_from
|
2097
2085
|
@base_dir ||= if default_gem?
|
2098
|
-
|
2099
|
-
|
2100
|
-
|
2101
|
-
|
2086
|
+
File.dirname File.dirname File.dirname loaded_from
|
2087
|
+
else
|
2088
|
+
File.dirname File.dirname loaded_from
|
2089
|
+
end
|
2102
2090
|
end
|
2103
2091
|
|
2104
2092
|
##
|
@@ -2166,11 +2154,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2166
2154
|
end
|
2167
2155
|
|
2168
2156
|
##
|
2157
|
+
# Track removed method calls to warn about during build time.
|
2169
2158
|
# Warn about unknown attributes while loading a spec.
|
2170
2159
|
|
2171
2160
|
def method_missing(sym, *a, &b) # :nodoc:
|
2172
|
-
if
|
2173
|
-
|
2161
|
+
if REMOVED_METHODS.include?(sym)
|
2162
|
+
removed_method_calls << sym
|
2163
|
+
return
|
2164
|
+
end
|
2165
|
+
|
2166
|
+
if @specification_version > CURRENT_SPECIFICATION_VERSION &&
|
2167
|
+
sym.to_s.end_with?("=")
|
2174
2168
|
warn "ignoring #{sym} loading #{full_name}" if $DEBUG
|
2175
2169
|
else
|
2176
2170
|
super
|
@@ -2182,9 +2176,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2182
2176
|
# probably want to build_extensions
|
2183
2177
|
|
2184
2178
|
def missing_extensions?
|
2185
|
-
return false if default_gem?
|
2186
2179
|
return false if extensions.empty?
|
2187
|
-
return false if
|
2180
|
+
return false if default_gem?
|
2188
2181
|
return false if File.exist? gem_build_complete_path
|
2189
2182
|
|
2190
2183
|
true
|
@@ -2197,7 +2190,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2197
2190
|
# file list.
|
2198
2191
|
|
2199
2192
|
def normalize
|
2200
|
-
if defined?(@extra_rdoc_files)
|
2193
|
+
if defined?(@extra_rdoc_files) && @extra_rdoc_files
|
2201
2194
|
@extra_rdoc_files.uniq!
|
2202
2195
|
@files ||= []
|
2203
2196
|
@files.concat(@extra_rdoc_files)
|
@@ -2222,7 +2215,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2222
2215
|
# platform. For use with legacy gems.
|
2223
2216
|
|
2224
2217
|
def original_name # :nodoc:
|
2225
|
-
if platform == Gem::Platform::RUBY
|
2218
|
+
if platform == Gem::Platform::RUBY || platform.nil?
|
2226
2219
|
"#{@name}-#{@version}"
|
2227
2220
|
else
|
2228
2221
|
"#{@name}-#{@version}-#{@original_platform}"
|
@@ -2240,11 +2233,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2240
2233
|
# The platform this gem runs on. See Gem::Platform for details.
|
2241
2234
|
|
2242
2235
|
def platform
|
2243
|
-
@new_platform ||= Gem::Platform::RUBY
|
2236
|
+
@new_platform ||= Gem::Platform::RUBY # rubocop:disable Naming/MemoizedInstanceVariableName
|
2244
2237
|
end
|
2245
2238
|
|
2246
2239
|
def pretty_print(q) # :nodoc:
|
2247
|
-
q.group 2,
|
2240
|
+
q.group 2, "Gem::Specification.new do |s|", "end" do
|
2248
2241
|
q.breakable
|
2249
2242
|
|
2250
2243
|
attributes = @@attributes - [:name, :version]
|
@@ -2254,8 +2247,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2254
2247
|
|
2255
2248
|
attributes.each do |attr_name|
|
2256
2249
|
current_value = self.send attr_name
|
2257
|
-
|
2258
|
-
|
2250
|
+
current_value = current_value.sort if %i[files test_files].include? attr_name
|
2251
|
+
if current_value != default_value(attr_name) ||
|
2252
|
+
self.class.required_attribute?(attr_name)
|
2259
2253
|
|
2260
2254
|
q.text "s.#{attr_name} = "
|
2261
2255
|
|
@@ -2287,7 +2281,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2287
2281
|
|
2288
2282
|
e = Gem::LoadError.new msg
|
2289
2283
|
e.name = self.name
|
2290
|
-
# TODO: e.requirement = dep.requirement
|
2291
2284
|
|
2292
2285
|
raise e
|
2293
2286
|
end
|
@@ -2304,11 +2297,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2304
2297
|
end
|
2305
2298
|
|
2306
2299
|
##
|
2307
|
-
# Sets rdoc_options to +value+, ensuring it is an array.
|
2308
|
-
# use this, push onto the array instead.
|
2300
|
+
# Sets rdoc_options to +value+, ensuring it is an array.
|
2309
2301
|
|
2310
2302
|
def rdoc_options=(options)
|
2311
|
-
# TODO: warn about setting instead of pushing
|
2312
2303
|
@rdoc_options = Array options
|
2313
2304
|
end
|
2314
2305
|
|
@@ -2316,7 +2307,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2316
2307
|
# Singular accessor for #require_paths
|
2317
2308
|
|
2318
2309
|
def require_path
|
2319
|
-
val = require_paths
|
2310
|
+
(val = require_paths) && val.first
|
2320
2311
|
end
|
2321
2312
|
|
2322
2313
|
##
|
@@ -2327,11 +2318,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2327
2318
|
end
|
2328
2319
|
|
2329
2320
|
##
|
2330
|
-
# Set requirements to +req+, ensuring it is an array.
|
2331
|
-
# use this, push onto the array instead.
|
2321
|
+
# Set requirements to +req+, ensuring it is an array.
|
2332
2322
|
|
2333
2323
|
def requirements=(req)
|
2334
|
-
# TODO: warn about setting instead of pushing
|
2335
2324
|
@requirements = Array req
|
2336
2325
|
end
|
2337
2326
|
|
@@ -2343,7 +2332,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2343
2332
|
# Returns the full path to this spec's ri directory.
|
2344
2333
|
|
2345
2334
|
def ri_dir
|
2346
|
-
@ri_dir ||= File.join base_dir,
|
2335
|
+
@ri_dir ||= File.join base_dir, "ri", full_name
|
2347
2336
|
end
|
2348
2337
|
|
2349
2338
|
##
|
@@ -2352,18 +2341,18 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2352
2341
|
|
2353
2342
|
def ruby_code(obj)
|
2354
2343
|
case obj
|
2355
|
-
when String
|
2356
|
-
when Array
|
2357
|
-
when Hash
|
2358
|
-
seg = obj.keys.sort.map {
|
2344
|
+
when String then obj.dump + ".freeze"
|
2345
|
+
when Array then "[" + obj.map {|x| ruby_code x }.join(", ") + "]"
|
2346
|
+
when Hash then
|
2347
|
+
seg = obj.keys.sort.map {|k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
|
2359
2348
|
"{ #{seg.join(', ')} }"
|
2360
|
-
when Gem::Version
|
2361
|
-
when DateLike
|
2362
|
-
when Time
|
2363
|
-
when Numeric
|
2364
|
-
when true, false, nil
|
2365
|
-
when Gem::Platform
|
2366
|
-
when Gem::Requirement
|
2349
|
+
when Gem::Version then obj.to_s.dump
|
2350
|
+
when DateLike then obj.strftime("%Y-%m-%d").dump
|
2351
|
+
when Time then obj.strftime("%Y-%m-%d").dump
|
2352
|
+
when Numeric then obj.inspect
|
2353
|
+
when true, false, nil then obj.inspect
|
2354
|
+
when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
|
2355
|
+
when Gem::Requirement then
|
2367
2356
|
list = obj.as_list
|
2368
2357
|
"Gem::Requirement.new(#{ruby_code(list.size == 1 ? obj.to_s : list)})"
|
2369
2358
|
else raise Gem::Exception, "ruby_code case not handled: #{obj.class}"
|
@@ -2383,7 +2372,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2383
2372
|
# True if this gem has the same attributes as +other+.
|
2384
2373
|
|
2385
2374
|
def same_attributes?(spec)
|
2386
|
-
@@attributes.all? {
|
2375
|
+
@@attributes.all? {|name, default| self.send(name) == spec.send(name) }
|
2387
2376
|
end
|
2388
2377
|
|
2389
2378
|
private :same_attributes?
|
@@ -2393,14 +2382,14 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2393
2382
|
|
2394
2383
|
def satisfies_requirement?(dependency)
|
2395
2384
|
return @name == dependency.name &&
|
2396
|
-
|
2385
|
+
dependency.requirement.satisfied_by?(@version)
|
2397
2386
|
end
|
2398
2387
|
|
2399
2388
|
##
|
2400
2389
|
# Returns an object you can use to sort specifications in #sort_by.
|
2401
2390
|
|
2402
2391
|
def sort_obj
|
2403
|
-
[@name, @version,
|
2392
|
+
[@name, @version, Gem::Platform.sort_priority(@new_platform)]
|
2404
2393
|
end
|
2405
2394
|
|
2406
2395
|
##
|
@@ -2447,7 +2436,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2447
2436
|
# Singular accessor for #test_files
|
2448
2437
|
|
2449
2438
|
def test_file # :nodoc:
|
2450
|
-
val = test_files
|
2439
|
+
(val = test_files) && val.first
|
2451
2440
|
end
|
2452
2441
|
|
2453
2442
|
##
|
@@ -2469,7 +2458,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2469
2458
|
@test_files = [@test_suite_file].flatten
|
2470
2459
|
@test_suite_file = nil
|
2471
2460
|
end
|
2472
|
-
if defined?(@test_files)
|
2461
|
+
if defined?(@test_files) && @test_files
|
2473
2462
|
@test_files
|
2474
2463
|
else
|
2475
2464
|
@test_files = []
|
@@ -2493,13 +2482,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2493
2482
|
|
2494
2483
|
result << " s.name = #{ruby_code name}"
|
2495
2484
|
result << " s.version = #{ruby_code version}"
|
2496
|
-
unless platform.nil?
|
2485
|
+
unless platform.nil? || platform == Gem::Platform::RUBY
|
2497
2486
|
result << " s.platform = #{ruby_code original_platform}"
|
2498
2487
|
end
|
2499
2488
|
result << ""
|
2500
2489
|
result << " s.required_rubygems_version = #{ruby_code required_rubygems_version} if s.respond_to? :required_rubygems_version="
|
2501
2490
|
|
2502
|
-
if metadata
|
2491
|
+
if metadata && !metadata.empty?
|
2503
2492
|
result << " s.metadata = #{ruby_code metadata} if s.respond_to? :metadata="
|
2504
2493
|
end
|
2505
2494
|
result << " s.require_paths = #{ruby_code raw_require_paths}"
|
@@ -2514,18 +2503,22 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2514
2503
|
:version,
|
2515
2504
|
:has_rdoc,
|
2516
2505
|
:default_executable,
|
2517
|
-
:metadata
|
2506
|
+
:metadata,
|
2507
|
+
:signing_key,
|
2518
2508
|
]
|
2519
2509
|
|
2520
2510
|
@@attributes.each do |attr_name|
|
2521
2511
|
next if handled.include? attr_name
|
2522
2512
|
current_value = self.send(attr_name)
|
2523
|
-
if current_value != default_value(attr_name)
|
2524
|
-
self.class.required_attribute? attr_name
|
2513
|
+
if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name)
|
2525
2514
|
result << " s.#{attr_name} = #{ruby_code current_value}"
|
2526
2515
|
end
|
2527
2516
|
end
|
2528
2517
|
|
2518
|
+
if String === signing_key
|
2519
|
+
result << " s.signing_key = #{signing_key.dump}.freeze"
|
2520
|
+
end
|
2521
|
+
|
2529
2522
|
if @installed_by_version
|
2530
2523
|
result << nil
|
2531
2524
|
result << " s.installed_by_version = \"#{Gem::VERSION}\" if s.respond_to? :installed_by_version"
|
@@ -2533,33 +2526,14 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2533
2526
|
|
2534
2527
|
unless dependencies.empty?
|
2535
2528
|
result << nil
|
2536
|
-
result << "
|
2537
|
-
result << " s.specification_version = #{specification_version}"
|
2529
|
+
result << " s.specification_version = #{specification_version}"
|
2538
2530
|
result << nil
|
2539
2531
|
|
2540
|
-
result << " if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then"
|
2541
|
-
|
2542
2532
|
dependencies.each do |dep|
|
2543
2533
|
req = dep.requirements_list.inspect
|
2544
2534
|
dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
|
2545
|
-
result << "
|
2546
|
-
end
|
2547
|
-
|
2548
|
-
result << " else"
|
2549
|
-
|
2550
|
-
dependencies.each do |dep|
|
2551
|
-
version_reqs_param = dep.requirements_list.inspect
|
2552
|
-
result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})"
|
2535
|
+
result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})"
|
2553
2536
|
end
|
2554
|
-
|
2555
|
-
result << ' end'
|
2556
|
-
|
2557
|
-
result << " else"
|
2558
|
-
dependencies.each do |dep|
|
2559
|
-
version_reqs_param = dep.requirements_list.inspect
|
2560
|
-
result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})"
|
2561
|
-
end
|
2562
|
-
result << " end"
|
2563
2537
|
end
|
2564
2538
|
|
2565
2539
|
result << "end"
|
@@ -2590,17 +2564,20 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2590
2564
|
end
|
2591
2565
|
|
2592
2566
|
def to_yaml(opts = {}) # :nodoc:
|
2567
|
+
Gem.load_yaml
|
2568
|
+
|
2593
2569
|
# Because the user can switch the YAML engine behind our
|
2594
2570
|
# back, we have to check again here to make sure that our
|
2595
2571
|
# psych code was properly loaded, and load it if not.
|
2596
2572
|
unless Gem.const_defined?(:NoAliasYAMLTree)
|
2597
|
-
|
2573
|
+
require_relative "psych_tree"
|
2598
2574
|
end
|
2599
2575
|
|
2600
2576
|
builder = Gem::NoAliasYAMLTree.create
|
2601
2577
|
builder << self
|
2602
2578
|
ast = builder.tree
|
2603
2579
|
|
2580
|
+
require "stringio"
|
2604
2581
|
io = StringIO.new
|
2605
2582
|
io.set_encoding Encoding::UTF_8
|
2606
2583
|
|
@@ -2618,7 +2595,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2618
2595
|
begin
|
2619
2596
|
dependencies.each do |dep|
|
2620
2597
|
next unless dep.runtime?
|
2621
|
-
dep.
|
2598
|
+
dep.matching_specs(true).each do |dep_spec|
|
2622
2599
|
next if visited.has_key?(dep_spec)
|
2623
2600
|
visited[dep_spec] = true
|
2624
2601
|
trail.push(dep_spec)
|
@@ -2630,7 +2607,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2630
2607
|
unless result == :next
|
2631
2608
|
spec_name = dep_spec.name
|
2632
2609
|
dep_spec.traverse(trail, visited, &block) unless
|
2633
|
-
trail.any? {
|
2610
|
+
trail.any? {|s| s.name == spec_name }
|
2634
2611
|
end
|
2635
2612
|
end
|
2636
2613
|
end
|
@@ -2647,8 +2624,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2647
2624
|
# checks..
|
2648
2625
|
|
2649
2626
|
def validate(packaging = true, strict = false)
|
2650
|
-
require 'rubygems/user_interaction'
|
2651
|
-
extend Gem::UserInteraction
|
2652
2627
|
normalize
|
2653
2628
|
|
2654
2629
|
validation_policy = Gem::SpecificationPolicy.new(self)
|
@@ -2657,30 +2632,27 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2657
2632
|
end
|
2658
2633
|
|
2659
2634
|
def keep_only_files_and_directories
|
2660
|
-
@executables.delete_if {
|
2661
|
-
@extensions.delete_if {
|
2662
|
-
@extra_rdoc_files.delete_if {
|
2663
|
-
@files.delete_if {
|
2664
|
-
@test_files.delete_if {
|
2635
|
+
@executables.delete_if {|x| File.directory?(File.join(@bindir, x)) }
|
2636
|
+
@extensions.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2637
|
+
@extra_rdoc_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2638
|
+
@files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2639
|
+
@test_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2665
2640
|
end
|
2666
2641
|
|
2667
2642
|
def validate_metadata
|
2668
2643
|
Gem::SpecificationPolicy.new(self).validate_metadata
|
2669
2644
|
end
|
2645
|
+
rubygems_deprecate :validate_metadata
|
2670
2646
|
|
2671
|
-
##
|
2672
|
-
# Checks that dependencies use requirements as we recommend. Warnings are
|
2673
|
-
# issued when dependencies are open-ended or overly strict for semantic
|
2674
|
-
# versioning.
|
2675
2647
|
def validate_dependencies
|
2676
2648
|
Gem::SpecificationPolicy.new(self).validate_dependencies
|
2677
2649
|
end
|
2650
|
+
rubygems_deprecate :validate_dependencies
|
2678
2651
|
|
2679
|
-
##
|
2680
|
-
# Checks to see if the files to be packaged are world-readable.
|
2681
2652
|
def validate_permissions
|
2682
2653
|
Gem::SpecificationPolicy.new(self).validate_permissions
|
2683
2654
|
end
|
2655
|
+
rubygems_deprecate :validate_permissions
|
2684
2656
|
|
2685
2657
|
##
|
2686
2658
|
# Set the version to +version+, potentially also setting
|
@@ -2689,10 +2661,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2689
2661
|
|
2690
2662
|
def version=(version)
|
2691
2663
|
@version = Gem::Version.create(version)
|
2664
|
+
return if @version.nil?
|
2665
|
+
|
2692
2666
|
# skip to set required_ruby_version when pre-released rubygems.
|
2693
2667
|
# It caused to raise CircularDependencyError
|
2694
2668
|
if @version.prerelease? && (@name.nil? || @name.strip != "rubygems")
|
2695
|
-
self.required_rubygems_version =
|
2669
|
+
self.required_rubygems_version = "> 1.3.1"
|
2696
2670
|
end
|
2697
2671
|
invalidate_memoized_attributes
|
2698
2672
|
|
@@ -2708,9 +2682,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2708
2682
|
case ivar
|
2709
2683
|
when "date"
|
2710
2684
|
# Force Date to go through the extra coerce logic in date=
|
2711
|
-
self.date = val.
|
2685
|
+
self.date = val.tap(&Gem::UNTAINT)
|
2712
2686
|
else
|
2713
|
-
instance_variable_set "@#{ivar}", val.
|
2687
|
+
instance_variable_set "@#{ivar}", val.tap(&Gem::UNTAINT)
|
2714
2688
|
end
|
2715
2689
|
end
|
2716
2690
|
|
@@ -2730,21 +2704,26 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2730
2704
|
default = self.default_value attribute
|
2731
2705
|
|
2732
2706
|
value = case default
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2707
|
+
when Time, Numeric, Symbol, true, false, nil then default
|
2708
|
+
else default.dup
|
2709
|
+
end
|
2736
2710
|
|
2737
2711
|
instance_variable_set "@#{attribute}", value
|
2738
2712
|
end
|
2739
2713
|
|
2740
2714
|
@installed_by_version ||= nil
|
2715
|
+
|
2716
|
+
nil
|
2717
|
+
end
|
2718
|
+
|
2719
|
+
def flatten_require_paths # :nodoc:
|
2720
|
+
return unless raw_require_paths.first.is_a?(Array)
|
2721
|
+
|
2722
|
+
warn "#{name} #{version} includes a gemspec with `require_paths` set to an array of arrays. Newer versions of this gem might've already fixed this"
|
2723
|
+
raw_require_paths.flatten!
|
2741
2724
|
end
|
2742
2725
|
|
2743
2726
|
def raw_require_paths # :nodoc:
|
2744
2727
|
@require_paths
|
2745
2728
|
end
|
2746
|
-
|
2747
2729
|
end
|
2748
|
-
|
2749
|
-
# DOC: What is this and why is it here, randomly, at the end of this file?
|
2750
|
-
Gem.clear_paths
|