rubygems-update 2.6.0 → 3.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5941 -0
- data/CODE_OF_CONDUCT.md +76 -35
- data/CONTRIBUTING.md +231 -0
- data/MAINTAINERS.txt +8 -0
- data/Manifest.txt +439 -216
- data/POLICIES.md +135 -0
- data/README.md +112 -0
- data/UPGRADING.md +15 -0
- data/bundler/CHANGELOG.md +4753 -0
- data/bundler/LICENSE.md +22 -0
- data/bundler/README.md +58 -0
- data/bundler/UPGRADING.md +222 -0
- data/bundler/bundler.gemspec +46 -0
- data/bundler/exe/bundle +29 -0
- data/bundler/exe/bundler +4 -0
- data/bundler/lib/bundler/.document +1 -0
- data/bundler/lib/bundler/build_metadata.rb +45 -0
- data/bundler/lib/bundler/capistrano.rb +22 -0
- data/bundler/lib/bundler/checksum.rb +254 -0
- data/bundler/lib/bundler/ci_detector.rb +75 -0
- data/bundler/lib/bundler/cli/add.rb +47 -0
- data/bundler/lib/bundler/cli/binstubs.rb +57 -0
- data/bundler/lib/bundler/cli/cache.rb +43 -0
- data/bundler/lib/bundler/cli/check.rb +40 -0
- data/bundler/lib/bundler/cli/clean.rb +25 -0
- data/bundler/lib/bundler/cli/common.rb +138 -0
- data/bundler/lib/bundler/cli/config.rb +204 -0
- data/bundler/lib/bundler/cli/console.rb +44 -0
- data/bundler/lib/bundler/cli/doctor.rb +157 -0
- data/bundler/lib/bundler/cli/exec.rb +88 -0
- data/bundler/lib/bundler/cli/fund.rb +36 -0
- data/bundler/lib/bundler/cli/gem.rb +471 -0
- data/bundler/lib/bundler/cli/info.rb +83 -0
- data/bundler/lib/bundler/cli/init.rb +51 -0
- data/bundler/lib/bundler/cli/inject.rb +60 -0
- data/bundler/lib/bundler/cli/install.rb +190 -0
- data/bundler/lib/bundler/cli/issue.rb +41 -0
- data/bundler/lib/bundler/cli/list.rb +66 -0
- data/bundler/lib/bundler/cli/lock.rb +73 -0
- data/bundler/lib/bundler/cli/open.rb +29 -0
- data/bundler/lib/bundler/cli/outdated.rb +297 -0
- data/bundler/lib/bundler/cli/platform.rb +48 -0
- data/bundler/lib/bundler/cli/plugin.rb +34 -0
- data/bundler/lib/bundler/cli/pristine.rb +60 -0
- data/bundler/lib/bundler/cli/remove.rb +17 -0
- data/bundler/lib/bundler/cli/show.rb +75 -0
- data/bundler/lib/bundler/cli/update.rb +123 -0
- data/bundler/lib/bundler/cli/viz.rb +31 -0
- data/bundler/lib/bundler/cli.rb +846 -0
- data/bundler/lib/bundler/compact_index_client/cache.rb +121 -0
- data/bundler/lib/bundler/compact_index_client/cache_file.rb +153 -0
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +32 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +115 -0
- data/bundler/lib/bundler/compact_index_client.rb +126 -0
- data/bundler/lib/bundler/constants.rb +7 -0
- data/bundler/lib/bundler/current_ruby.rb +92 -0
- data/bundler/lib/bundler/definition.rb +1015 -0
- data/bundler/lib/bundler/dependency.rb +105 -0
- data/bundler/lib/bundler/deployment.rb +69 -0
- data/bundler/lib/bundler/deprecate.rb +44 -0
- data/bundler/lib/bundler/digest.rb +71 -0
- data/bundler/lib/bundler/dsl.rb +604 -0
- data/bundler/lib/bundler/endpoint_specification.rb +147 -0
- data/bundler/lib/bundler/env.rb +148 -0
- data/bundler/lib/bundler/environment_preserver.rb +86 -0
- data/bundler/lib/bundler/errors.rb +233 -0
- data/bundler/lib/bundler/feature_flag.rb +53 -0
- data/bundler/lib/bundler/fetcher/base.rb +52 -0
- data/bundler/lib/bundler/fetcher/compact_index.rb +129 -0
- data/bundler/lib/bundler/fetcher/dependency.rb +78 -0
- data/bundler/lib/bundler/fetcher/downloader.rb +91 -0
- data/bundler/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
- data/bundler/lib/bundler/fetcher/index.rb +25 -0
- data/bundler/lib/bundler/fetcher.rb +324 -0
- data/bundler/lib/bundler/force_platform.rb +18 -0
- data/bundler/lib/bundler/friendly_errors.rb +126 -0
- data/bundler/lib/bundler/gem_helper.rb +237 -0
- data/bundler/lib/bundler/gem_helpers.rb +127 -0
- data/bundler/lib/bundler/gem_tasks.rb +7 -0
- data/bundler/lib/bundler/gem_version_promoter.rb +145 -0
- data/bundler/lib/bundler/graph.rb +152 -0
- data/bundler/lib/bundler/index.rb +205 -0
- data/bundler/lib/bundler/injector.rb +287 -0
- data/bundler/lib/bundler/inline.rb +73 -0
- data/bundler/lib/bundler/installer/gem_installer.rb +84 -0
- data/bundler/lib/bundler/installer/parallel_installer.rb +202 -0
- data/bundler/lib/bundler/installer/standalone.rb +116 -0
- data/bundler/lib/bundler/installer.rb +267 -0
- data/bundler/lib/bundler/lazy_specification.rb +172 -0
- data/bundler/lib/bundler/lockfile_generator.rb +104 -0
- data/bundler/lib/bundler/lockfile_parser.rb +289 -0
- data/bundler/lib/bundler/man/.document +1 -0
- data/bundler/lib/bundler/man/bundle-add.1 +59 -0
- data/bundler/lib/bundler/man/bundle-add.1.ronn +58 -0
- data/bundler/lib/bundler/man/bundle-binstubs.1 +30 -0
- data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +41 -0
- data/bundler/lib/bundler/man/bundle-cache.1 +40 -0
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +79 -0
- data/bundler/lib/bundler/man/bundle-check.1 +22 -0
- data/bundler/lib/bundler/man/bundle-check.1.ronn +26 -0
- data/bundler/lib/bundler/man/bundle-clean.1 +17 -0
- data/bundler/lib/bundler/man/bundle-clean.1.ronn +18 -0
- data/bundler/lib/bundler/man/bundle-config.1 +321 -0
- data/bundler/lib/bundler/man/bundle-config.1.ronn +411 -0
- data/bundler/lib/bundler/man/bundle-console.1 +35 -0
- data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/bundler/lib/bundler/man/bundle-doctor.1 +30 -0
- data/bundler/lib/bundler/man/bundle-doctor.1.ronn +33 -0
- data/bundler/lib/bundler/man/bundle-exec.1 +104 -0
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +151 -0
- data/bundler/lib/bundler/man/bundle-gem.1 +69 -0
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +117 -0
- data/bundler/lib/bundler/man/bundle-help.1 +9 -0
- data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/bundler/lib/bundler/man/bundle-info.1 +14 -0
- data/bundler/lib/bundler/man/bundle-info.1.ronn +17 -0
- data/bundler/lib/bundler/man/bundle-init.1 +20 -0
- data/bundler/lib/bundler/man/bundle-init.1.ronn +31 -0
- data/bundler/lib/bundler/man/bundle-inject.1 +23 -0
- data/bundler/lib/bundler/man/bundle-inject.1.ronn +24 -0
- data/bundler/lib/bundler/man/bundle-install.1 +215 -0
- data/bundler/lib/bundler/man/bundle-install.1.ronn +383 -0
- data/bundler/lib/bundler/man/bundle-list.1 +35 -0
- data/bundler/lib/bundler/man/bundle-list.1.ronn +33 -0
- data/bundler/lib/bundler/man/bundle-lock.1 +60 -0
- data/bundler/lib/bundler/man/bundle-lock.1.ronn +94 -0
- data/bundler/lib/bundler/man/bundle-open.1 +32 -0
- data/bundler/lib/bundler/man/bundle-open.1.ronn +27 -0
- data/bundler/lib/bundler/man/bundle-outdated.1 +100 -0
- data/bundler/lib/bundler/man/bundle-outdated.1.ronn +106 -0
- data/bundler/lib/bundler/man/bundle-platform.1 +49 -0
- data/bundler/lib/bundler/man/bundle-platform.1.ronn +49 -0
- data/bundler/lib/bundler/man/bundle-plugin.1 +55 -0
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/bundler/lib/bundler/man/bundle-pristine.1 +23 -0
- data/bundler/lib/bundler/man/bundle-pristine.1.ronn +34 -0
- data/bundler/lib/bundler/man/bundle-remove.1 +21 -0
- data/bundler/lib/bundler/man/bundle-remove.1.ronn +23 -0
- data/bundler/lib/bundler/man/bundle-show.1 +16 -0
- data/bundler/lib/bundler/man/bundle-show.1.ronn +21 -0
- data/bundler/lib/bundler/man/bundle-update.1 +275 -0
- data/bundler/lib/bundler/man/bundle-update.1.ronn +351 -0
- data/bundler/lib/bundler/man/bundle-version.1 +22 -0
- data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/bundler/lib/bundler/man/bundle-viz.1 +30 -0
- data/bundler/lib/bundler/man/bundle-viz.1.ronn +32 -0
- data/bundler/lib/bundler/man/bundle.1 +102 -0
- data/bundler/lib/bundler/man/bundle.1.ronn +116 -0
- data/bundler/lib/bundler/man/gemfile.5 +470 -0
- data/bundler/lib/bundler/man/gemfile.5.ronn +552 -0
- data/bundler/lib/bundler/man/index.txt +29 -0
- data/bundler/lib/bundler/match_metadata.rb +17 -0
- data/bundler/lib/bundler/match_platform.rb +23 -0
- data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
- data/bundler/lib/bundler/mirror.rb +221 -0
- data/bundler/lib/bundler/plugin/api/source.rb +321 -0
- data/bundler/lib/bundler/plugin/api.rb +81 -0
- data/bundler/lib/bundler/plugin/dsl.rb +53 -0
- data/bundler/lib/bundler/plugin/events.rb +61 -0
- data/bundler/lib/bundler/plugin/index.rb +193 -0
- data/bundler/lib/bundler/plugin/installer/git.rb +34 -0
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +19 -0
- data/bundler/lib/bundler/plugin/installer.rb +112 -0
- data/bundler/lib/bundler/plugin/source_list.rb +31 -0
- data/bundler/lib/bundler/plugin.rb +359 -0
- data/bundler/lib/bundler/process_lock.rb +24 -0
- data/bundler/lib/bundler/remote_specification.rb +121 -0
- 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 +77 -0
- data/bundler/lib/bundler/resolver/root.rb +25 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +79 -0
- data/bundler/lib/bundler/resolver.rb +462 -0
- data/bundler/lib/bundler/retry.rb +66 -0
- data/bundler/lib/bundler/ruby_dsl.rb +53 -0
- data/bundler/lib/bundler/ruby_version.rb +131 -0
- data/bundler/lib/bundler/rubygems_ext.rb +328 -0
- data/bundler/lib/bundler/rubygems_gem_installer.rb +137 -0
- data/bundler/lib/bundler/rubygems_integration.rb +493 -0
- data/bundler/lib/bundler/runtime.rb +307 -0
- data/bundler/lib/bundler/safe_marshal.rb +31 -0
- data/bundler/lib/bundler/self_manager.rb +186 -0
- data/bundler/lib/bundler/settings/validator.rb +102 -0
- data/bundler/lib/bundler/settings.rb +588 -0
- data/bundler/lib/bundler/setup.rb +33 -0
- data/bundler/lib/bundler/shared_helpers.rb +380 -0
- data/bundler/lib/bundler/similarity_detector.rb +63 -0
- data/bundler/lib/bundler/source/gemspec.rb +18 -0
- data/bundler/lib/bundler/source/git/git_proxy.rb +455 -0
- data/bundler/lib/bundler/source/git.rb +380 -0
- data/bundler/lib/bundler/source/metadata.rb +62 -0
- data/bundler/lib/bundler/source/path/installer.rb +53 -0
- data/bundler/lib/bundler/source/path.rb +261 -0
- data/bundler/lib/bundler/source/rubygems/remote.rb +68 -0
- data/bundler/lib/bundler/source/rubygems.rb +516 -0
- data/bundler/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/bundler/lib/bundler/source.rb +116 -0
- data/bundler/lib/bundler/source_list.rb +227 -0
- data/bundler/lib/bundler/source_map.rb +71 -0
- data/bundler/lib/bundler/spec_set.rb +296 -0
- data/bundler/lib/bundler/stub_specification.rb +119 -0
- data/bundler/lib/bundler/templates/.document +1 -0
- data/bundler/lib/bundler/templates/Executable +27 -0
- data/bundler/lib/bundler/templates/Executable.bundler +109 -0
- data/bundler/lib/bundler/templates/Executable.standalone +14 -0
- data/bundler/lib/bundler/templates/Gemfile +5 -0
- data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +84 -0
- data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +26 -0
- data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
- data/bundler/lib/bundler/templates/newgem/README.md.tt +45 -0
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +67 -0
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +11 -0
- data/bundler/lib/bundler/templates/newgem/bin/setup.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
- data/bundler/lib/bundler/templates/newgem/exe/newgem.tt +3 -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 +9 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
- data/bundler/lib/bundler/templates/newgem/gitignore.tt +23 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +51 -0
- data/bundler/lib/bundler/templates/newgem/rspec.tt +3 -0
- 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 +11 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +15 -0
- 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/minitest/test_newgem.rb.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/ui/rg_proxy.rb +19 -0
- data/bundler/lib/bundler/ui/shell.rb +165 -0
- data/bundler/lib/bundler/ui/silent.rb +85 -0
- data/bundler/lib/bundler/ui.rb +9 -0
- data/bundler/lib/bundler/uri_credentials_filter.rb +43 -0
- data/bundler/lib/bundler/uri_normalizer.rb +23 -0
- data/bundler/lib/bundler/vendor/.document +1 -0
- data/bundler/lib/bundler/vendor/connection_pool/.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 +175 -0
- data/bundler/lib/bundler/vendor/fileutils/.document +1 -0
- data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +2694 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/.document +1 -0
- 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 +41 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +65 -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 +1073 -0
- data/bundler/lib/bundler/vendor/pub_grub/.document +1 -0
- 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 +248 -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/.document +1 -0
- data/bundler/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +105 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +61 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +108 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +143 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +373 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +130 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +340 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +825 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +151 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +107 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +106 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +37 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +89 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +195 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +178 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +293 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +72 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +335 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +388 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +112 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +81 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +134 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +285 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +663 -0
- data/bundler/lib/bundler/vendor/tsort/.document +1 -0
- data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +455 -0
- data/bundler/lib/bundler/vendor/uri/.document +1 -0
- data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +853 -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 +1588 -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 +183 -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 +4 -0
- data/bundler/lib/bundler/vendored_net_http.rb +8 -0
- data/bundler/lib/bundler/vendored_persistent.rb +11 -0
- data/bundler/lib/bundler/vendored_pub_grub.rb +4 -0
- data/bundler/lib/bundler/vendored_thor.rb +8 -0
- data/bundler/lib/bundler/vendored_timeout.rb +8 -0
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/vendored_uri.rb +4 -0
- data/bundler/lib/bundler/version.rb +13 -0
- data/bundler/lib/bundler/vlad.rb +17 -0
- data/bundler/lib/bundler/worker.rb +117 -0
- data/bundler/lib/bundler/yaml_serializer.rb +93 -0
- data/bundler/lib/bundler.rb +663 -0
- data/{test/rubygems/bogussources.rb → exe/gem} +5 -2
- data/exe/update_rubygems +38 -0
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/available_set.rb +12 -12
- data/lib/rubygems/basic_specification.rb +82 -59
- data/lib/rubygems/bundler_version_finder.rb +77 -0
- data/lib/rubygems/ci_detector.rb +75 -0
- data/lib/rubygems/command.rb +144 -71
- data/lib/rubygems/command_manager.rb +64 -27
- data/lib/rubygems/commands/build_command.rb +88 -17
- data/lib/rubygems/commands/cert_command.rb +131 -83
- data/lib/rubygems/commands/check_command.rb +30 -27
- data/lib/rubygems/commands/cleanup_command.rb +57 -40
- data/lib/rubygems/commands/contents_command.rb +37 -39
- data/lib/rubygems/commands/dependency_command.rb +53 -65
- data/lib/rubygems/commands/environment_command.rb +32 -16
- data/lib/rubygems/commands/exec_command.rb +249 -0
- data/lib/rubygems/commands/fetch_command.rb +36 -19
- data/lib/rubygems/commands/generate_index_command.rb +40 -74
- data/lib/rubygems/commands/help_command.rb +22 -22
- data/lib/rubygems/commands/info_command.rb +38 -0
- data/lib/rubygems/commands/install_command.rb +67 -143
- data/lib/rubygems/commands/list_command.rb +10 -9
- data/lib/rubygems/commands/lock_command.rb +12 -14
- data/lib/rubygems/commands/mirror_command.rb +4 -4
- data/lib/rubygems/commands/open_command.rb +28 -26
- data/lib/rubygems/commands/outdated_command.rb +6 -6
- data/lib/rubygems/commands/owner_command.rb +51 -27
- data/lib/rubygems/commands/pristine_command.rb +99 -71
- data/lib/rubygems/commands/push_command.rb +53 -46
- data/lib/rubygems/commands/query_command.rb +21 -328
- data/lib/rubygems/commands/rdoc_command.rb +33 -33
- data/lib/rubygems/commands/search_command.rb +9 -9
- data/lib/rubygems/commands/server_command.rb +15 -76
- data/lib/rubygems/commands/setup_command.rb +370 -186
- data/lib/rubygems/commands/signin_command.rb +34 -0
- data/lib/rubygems/commands/signout_command.rb +32 -0
- data/lib/rubygems/commands/sources_command.rb +57 -41
- data/lib/rubygems/commands/specification_command.rb +38 -28
- data/lib/rubygems/commands/stale_command.rb +6 -5
- data/lib/rubygems/commands/uninstall_command.rb +96 -62
- data/lib/rubygems/commands/unpack_command.rb +44 -53
- data/lib/rubygems/commands/update_command.rb +153 -99
- data/lib/rubygems/commands/which_command.rb +14 -17
- data/lib/rubygems/commands/yank_command.rb +28 -32
- data/lib/rubygems/compatibility.rb +13 -32
- data/lib/rubygems/config_file.rb +214 -119
- data/lib/rubygems/core_ext/kernel_gem.rb +10 -16
- data/lib/rubygems/core_ext/kernel_require.rb +92 -90
- data/lib/rubygems/core_ext/kernel_warn.rb +49 -0
- data/lib/rubygems/core_ext/tcpsocket_init.rb +54 -0
- data/lib/rubygems/defaults.rb +184 -54
- data/lib/rubygems/dependency.rb +75 -62
- data/lib/rubygems/dependency_installer.rb +74 -230
- data/lib/rubygems/dependency_list.rb +32 -33
- data/lib/rubygems/deprecate.rb +113 -17
- data/lib/rubygems/doctor.rb +31 -31
- data/lib/rubygems/errors.rb +51 -13
- data/lib/rubygems/exceptions.rb +65 -35
- data/lib/rubygems/ext/build_error.rb +3 -1
- data/lib/rubygems/ext/builder.rb +103 -77
- 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 +6 -9
- data/lib/rubygems/ext/ext_conf_builder.rb +40 -61
- data/lib/rubygems/ext/rake_builder.rb +18 -21
- data/lib/rubygems/ext.rb +8 -7
- data/lib/rubygems/gem_runner.rb +19 -21
- data/lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb +163 -0
- data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +105 -0
- data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +78 -0
- data/lib/rubygems/gemcutter_utilities.rb +246 -43
- data/lib/rubygems/install_default_message.rb +3 -3
- data/lib/rubygems/install_message.rb +3 -3
- data/lib/rubygems/install_update_options.rb +104 -98
- data/lib/rubygems/installer.rb +407 -225
- data/lib/rubygems/installer_uninstaller_utils.rb +27 -0
- data/lib/rubygems/local_remote_options.rb +29 -32
- data/lib/rubygems/name_tuple.rb +18 -23
- data/lib/rubygems/net/http.rb +3 -0
- data/lib/rubygems/net-http/.document +1 -0
- data/lib/rubygems/net-http/LICENSE.txt +22 -0
- data/lib/rubygems/net-http/lib/net/http/backward.rb +40 -0
- data/lib/rubygems/net-http/lib/net/http/exceptions.rb +34 -0
- data/lib/rubygems/net-http/lib/net/http/generic_request.rb +414 -0
- data/lib/rubygems/net-http/lib/net/http/header.rb +981 -0
- data/lib/rubygems/net-http/lib/net/http/proxy_delta.rb +17 -0
- data/lib/rubygems/net-http/lib/net/http/request.rb +88 -0
- data/lib/rubygems/net-http/lib/net/http/requests.rb +425 -0
- data/lib/rubygems/net-http/lib/net/http/response.rb +738 -0
- data/lib/rubygems/net-http/lib/net/http/responses.rb +1174 -0
- data/lib/rubygems/net-http/lib/net/http/status.rb +84 -0
- data/lib/rubygems/net-http/lib/net/http.rb +2496 -0
- data/lib/rubygems/net-http/lib/net/https.rb +23 -0
- data/lib/rubygems/net-protocol/.document +1 -0
- data/lib/rubygems/net-protocol/LICENSE.txt +22 -0
- data/lib/rubygems/net-protocol/lib/net/protocol.rb +544 -0
- 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 +2330 -0
- data/lib/rubygems/optparse.rb +3 -0
- data/lib/rubygems/package/digest_io.rb +5 -7
- data/lib/rubygems/package/file_source.rb +6 -8
- data/lib/rubygems/package/io_source.rb +6 -4
- data/lib/rubygems/package/old.rb +19 -28
- data/lib/rubygems/package/source.rb +1 -1
- data/lib/rubygems/package/tar_header.rb +114 -93
- data/lib/rubygems/package/tar_reader/entry.rb +116 -22
- data/lib/rubygems/package/tar_reader.rb +18 -40
- data/lib/rubygems/package/tar_writer.rb +42 -56
- data/lib/rubygems/package.rb +254 -144
- data/lib/rubygems/package_task.rb +8 -14
- data/lib/rubygems/path_support.rb +21 -16
- data/lib/rubygems/platform.rb +135 -74
- data/lib/rubygems/psych_tree.rb +3 -2
- data/lib/rubygems/query_utils.rb +349 -0
- data/lib/rubygems/rdoc.rb +4 -326
- data/lib/rubygems/remote_fetcher.rb +99 -181
- data/lib/rubygems/request/connection_pools.rb +31 -24
- data/lib/rubygems/request/http_pool.rb +6 -7
- data/lib/rubygems/request/https_pool.rb +2 -3
- data/lib/rubygems/request.rb +107 -57
- data/lib/rubygems/request_set/gem_dependency_api.rb +182 -190
- data/lib/rubygems/request_set/lockfile/parser.rb +42 -52
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +34 -24
- data/lib/rubygems/request_set/lockfile.rb +32 -35
- data/lib/rubygems/request_set.rb +115 -71
- data/lib/rubygems/requirement.rb +77 -68
- data/lib/rubygems/resolv/.document +1 -0
- data/lib/rubygems/resolv/LICENSE.txt +22 -0
- data/lib/rubygems/resolv/lib/resolv.rb +3387 -0
- data/lib/rubygems/resolver/activation_request.rb +34 -61
- data/lib/rubygems/resolver/api_set/gem_parser.rb +24 -0
- data/lib/rubygems/resolver/api_set.rb +40 -32
- data/lib/rubygems/resolver/api_specification.rb +37 -18
- data/lib/rubygems/resolver/best_set.rb +15 -17
- data/lib/rubygems/resolver/composed_set.rb +9 -11
- data/lib/rubygems/resolver/conflict.rb +19 -33
- data/lib/rubygems/resolver/current_set.rb +2 -4
- data/lib/rubygems/resolver/dependency_request.rb +8 -9
- data/lib/rubygems/resolver/git_set.rb +8 -10
- data/lib/rubygems/resolver/git_specification.rb +11 -13
- data/lib/rubygems/resolver/index_set.rb +13 -15
- data/lib/rubygems/resolver/index_specification.rb +42 -11
- data/lib/rubygems/resolver/installed_specification.rb +9 -11
- data/lib/rubygems/resolver/installer_set.rb +93 -47
- data/lib/rubygems/resolver/local_specification.rb +5 -7
- data/lib/rubygems/resolver/lock_set.rb +13 -15
- data/lib/rubygems/resolver/lock_specification.rb +13 -15
- data/lib/rubygems/resolver/molinillo/.document +1 -0
- data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +88 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +36 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +66 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +62 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +63 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +61 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +126 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +46 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +36 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +164 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +110 -146
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +83 -9
- 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 +552 -172
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +12 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- data/lib/rubygems/resolver/molinillo.rb +2 -1
- data/lib/rubygems/resolver/requirement_list.rb +2 -2
- data/lib/rubygems/resolver/set.rb +3 -5
- data/lib/rubygems/resolver/source_set.rb +6 -7
- data/lib/rubygems/resolver/spec_specification.rb +16 -4
- data/lib/rubygems/resolver/specification.rb +25 -10
- data/lib/rubygems/resolver/stats.rb +1 -0
- data/lib/rubygems/resolver/vendor_set.rb +6 -8
- data/lib/rubygems/resolver/vendor_specification.rb +6 -8
- data/lib/rubygems/resolver.rb +121 -72
- data/lib/rubygems/s3_uri_signer.rb +177 -0
- data/lib/rubygems/safe_marshal/elements.rb +146 -0
- data/lib/rubygems/safe_marshal/reader.rb +308 -0
- data/lib/rubygems/safe_marshal/visitors/stream_printer.rb +31 -0
- data/lib/rubygems/safe_marshal/visitors/to_ruby.rb +415 -0
- data/lib/rubygems/safe_marshal/visitors/visitor.rb +74 -0
- data/lib/rubygems/safe_marshal.rb +74 -0
- data/lib/rubygems/safe_yaml.rb +36 -0
- data/lib/rubygems/security/policies.rb +49 -51
- data/lib/rubygems/security/policy.rb +46 -53
- data/lib/rubygems/security/signer.rb +86 -29
- data/lib/rubygems/security/trust_dir.rb +22 -24
- data/lib/rubygems/security.rb +101 -82
- data/lib/rubygems/security_option.rb +43 -0
- data/lib/rubygems/shellwords.rb +3 -0
- data/lib/rubygems/source/git.rb +40 -42
- data/lib/rubygems/source/installed.rb +5 -9
- data/lib/rubygems/source/local.rb +30 -33
- data/lib/rubygems/source/lock.rb +10 -10
- data/lib/rubygems/source/specific_file.rb +7 -9
- data/lib/rubygems/source/vendor.rb +3 -7
- data/lib/rubygems/source.rb +78 -68
- data/lib/rubygems/source_list.rb +11 -15
- data/lib/rubygems/spec_fetcher.rb +71 -83
- data/lib/rubygems/specification.rb +833 -1115
- data/lib/rubygems/specification_policy.rb +538 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem +21 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +55 -57
- data/lib/rubygems/text.rb +39 -27
- data/lib/rubygems/timeout/.document +1 -0
- data/lib/rubygems/timeout/LICENSE.txt +22 -0
- data/lib/rubygems/timeout/lib/timeout.rb +199 -0
- data/lib/rubygems/timeout.rb +3 -0
- data/lib/rubygems/tsort/.document +1 -0
- data/lib/rubygems/tsort/LICENSE.txt +22 -0
- data/lib/rubygems/tsort/lib/tsort.rb +455 -0
- data/lib/rubygems/tsort.rb +3 -0
- data/lib/rubygems/uninstaller.rb +150 -87
- data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
- data/lib/rubygems/update_suggestion.rb +56 -0
- data/lib/rubygems/uri.rb +126 -0
- data/lib/rubygems/uri_formatter.rb +4 -7
- data/lib/rubygems/user_interaction.rb +92 -146
- data/lib/rubygems/util/licenses.rb +712 -317
- data/lib/rubygems/util/list.rb +5 -2
- data/lib/rubygems/util.rb +58 -75
- data/lib/rubygems/validator.rb +26 -48
- data/lib/rubygems/version.rb +106 -56
- data/lib/rubygems/version_option.rb +22 -14
- data/lib/rubygems/yaml_serializer.rb +93 -0
- data/lib/rubygems.rb +453 -358
- data/rubygems-update.gemspec +38 -0
- data/setup.rb +13 -27
- metadata +511 -363
- data/.autotest +0 -71
- data/.document +0 -5
- data/.travis.yml +0 -46
- data/CONTRIBUTING.rdoc +0 -129
- data/CVE-2013-4287.txt +0 -35
- data/CVE-2013-4363.txt +0 -45
- data/CVE-2015-3900.txt +0 -40
- data/History.txt +0 -3094
- data/MAINTAINERS.md +0 -5
- data/POLICIES.rdoc +0 -61
- data/README.rdoc +0 -54
- data/Rakefile +0 -449
- data/UPGRADING.rdoc +0 -92
- data/appveyor.yml +0 -36
- data/bin/gem +0 -25
- data/bin/update_rubygems +0 -37
- data/lib/gauntlet_rubygems.rb +0 -51
- data/lib/rubygems/indexer.rb +0 -434
- data/lib/rubygems/installer_test_case.rb +0 -194
- data/lib/rubygems/mock_gem_ui.rb +0 -89
- data/lib/rubygems/package/tar_test_case.rb +0 -147
- data/lib/rubygems/psych_additions.rb +0 -10
- data/lib/rubygems/server.rb +0 -869
- data/lib/rubygems/source_local.rb +0 -6
- data/lib/rubygems/source_specific_file.rb +0 -5
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +0 -32
- data/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
- data/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
- data/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem +0 -20
- data/lib/rubygems/syck_hack.rb +0 -77
- data/lib/rubygems/test_case.rb +0 -1496
- data/lib/rubygems/test_utilities.rb +0 -384
- data/lib/ubygems.rb +0 -11
- data/test/rubygems/alternate_cert.pem +0 -18
- data/test/rubygems/alternate_cert_32.pem +0 -18
- data/test/rubygems/alternate_key.pem +0 -27
- data/test/rubygems/bad_rake.rb +0 -2
- data/test/rubygems/ca_cert.pem +0 -68
- data/test/rubygems/child_cert.pem +0 -18
- data/test/rubygems/child_cert_32.pem +0 -18
- data/test/rubygems/child_key.pem +0 -27
- data/test/rubygems/client.pem +0 -49
- data/test/rubygems/data/gem-private_key.pem +0 -27
- data/test/rubygems/data/gem-public_cert.pem +0 -20
- data/test/rubygems/data/null-type.gemspec.rz +0 -0
- data/test/rubygems/encrypted_private_key.pem +0 -30
- data/test/rubygems/expired_cert.pem +0 -18
- data/test/rubygems/fake_certlib/openssl.rb +0 -8
- data/test/rubygems/fix_openssl_warnings.rb +0 -13
- data/test/rubygems/foo/discover.rb +0 -1
- data/test/rubygems/future_cert.pem +0 -18
- data/test/rubygems/future_cert_32.pem +0 -18
- data/test/rubygems/good_rake.rb +0 -2
- data/test/rubygems/grandchild_cert.pem +0 -18
- data/test/rubygems/grandchild_cert_32.pem +0 -18
- data/test/rubygems/grandchild_key.pem +0 -27
- data/test/rubygems/invalid_client.pem +0 -49
- data/test/rubygems/invalid_issuer_cert.pem +0 -18
- data/test/rubygems/invalid_issuer_cert_32.pem +0 -18
- data/test/rubygems/invalid_key.pem +0 -27
- data/test/rubygems/invalid_signer_cert.pem +0 -18
- data/test/rubygems/invalid_signer_cert_32.pem +0 -18
- data/test/rubygems/invalidchild_cert.pem +0 -18
- data/test/rubygems/invalidchild_cert_32.pem +0 -18
- data/test/rubygems/invalidchild_key.pem +0 -27
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +0 -3
- data/test/rubygems/plugin/load/rubygems_plugin.rb +0 -4
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +0 -3
- data/test/rubygems/private_key.pem +0 -27
- data/test/rubygems/public_cert.pem +0 -18
- data/test/rubygems/public_cert_32.pem +0 -18
- data/test/rubygems/public_key.pem +0 -9
- data/test/rubygems/rubygems/commands/crash_command.rb +0 -6
- data/test/rubygems/rubygems_plugin.rb +0 -22
- data/test/rubygems/sff/discover.rb +0 -1
- data/test/rubygems/simple_gem.rb +0 -67
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -9
- data/test/rubygems/specifications/foo-0.0.1-x86-mswin32.gemspec +0 -0
- data/test/rubygems/ssl_cert.pem +0 -19
- data/test/rubygems/ssl_key.pem +0 -15
- data/test/rubygems/test_bundled_ca.rb +0 -59
- data/test/rubygems/test_config.rb +0 -24
- data/test/rubygems/test_deprecate.rb +0 -77
- data/test/rubygems/test_gem.rb +0 -1679
- data/test/rubygems/test_gem_available_set.rb +0 -130
- data/test/rubygems/test_gem_command.rb +0 -248
- data/test/rubygems/test_gem_command_manager.rb +0 -264
- data/test/rubygems/test_gem_commands_build_command.rb +0 -121
- data/test/rubygems/test_gem_commands_cert_command.rb +0 -671
- data/test/rubygems/test_gem_commands_check_command.rb +0 -69
- data/test/rubygems/test_gem_commands_cleanup_command.rb +0 -197
- data/test/rubygems/test_gem_commands_contents_command.rb +0 -240
- data/test/rubygems/test_gem_commands_dependency_command.rb +0 -230
- data/test/rubygems/test_gem_commands_environment_command.rb +0 -154
- data/test/rubygems/test_gem_commands_fetch_command.rb +0 -127
- data/test/rubygems/test_gem_commands_generate_index_command.rb +0 -51
- data/test/rubygems/test_gem_commands_help_command.rb +0 -75
- data/test/rubygems/test_gem_commands_install_command.rb +0 -987
- data/test/rubygems/test_gem_commands_list_command.rb +0 -34
- data/test/rubygems/test_gem_commands_lock_command.rb +0 -69
- data/test/rubygems/test_gem_commands_mirror.rb +0 -20
- data/test/rubygems/test_gem_commands_open_command.rb +0 -70
- data/test/rubygems/test_gem_commands_outdated_command.rb +0 -33
- data/test/rubygems/test_gem_commands_owner_command.rb +0 -205
- data/test/rubygems/test_gem_commands_pristine_command.rb +0 -491
- data/test/rubygems/test_gem_commands_push_command.rb +0 -330
- data/test/rubygems/test_gem_commands_query_command.rb +0 -657
- data/test/rubygems/test_gem_commands_search_command.rb +0 -18
- data/test/rubygems/test_gem_commands_server_command.rb +0 -60
- data/test/rubygems/test_gem_commands_setup_command.rb +0 -136
- data/test/rubygems/test_gem_commands_sources_command.rb +0 -249
- data/test/rubygems/test_gem_commands_specification_command.rb +0 -251
- data/test/rubygems/test_gem_commands_stale_command.rb +0 -43
- data/test/rubygems/test_gem_commands_uninstall_command.rb +0 -283
- data/test/rubygems/test_gem_commands_unpack_command.rb +0 -209
- data/test/rubygems/test_gem_commands_update_command.rb +0 -514
- data/test/rubygems/test_gem_commands_which_command.rb +0 -87
- data/test/rubygems/test_gem_commands_yank_command.rb +0 -100
- data/test/rubygems/test_gem_config_file.rb +0 -491
- data/test/rubygems/test_gem_dependency.rb +0 -362
- data/test/rubygems/test_gem_dependency_installer.rb +0 -1235
- data/test/rubygems/test_gem_dependency_list.rb +0 -260
- data/test/rubygems/test_gem_dependency_resolution_error.rb +0 -29
- data/test/rubygems/test_gem_doctor.rb +0 -169
- data/test/rubygems/test_gem_ext_builder.rb +0 -341
- data/test/rubygems/test_gem_ext_cmake_builder.rb +0 -87
- data/test/rubygems/test_gem_ext_configure_builder.rb +0 -87
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +0 -211
- data/test/rubygems/test_gem_ext_rake_builder.rb +0 -65
- data/test/rubygems/test_gem_gem_runner.rb +0 -69
- data/test/rubygems/test_gem_gemcutter_utilities.rb +0 -235
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -62
- data/test/rubygems/test_gem_indexer.rb +0 -367
- data/test/rubygems/test_gem_install_update_options.rb +0 -197
- data/test/rubygems/test_gem_installer.rb +0 -1552
- data/test/rubygems/test_gem_local_remote_options.rb +0 -134
- data/test/rubygems/test_gem_name_tuple.rb +0 -45
- data/test/rubygems/test_gem_package.rb +0 -876
- data/test/rubygems/test_gem_package_old.rb +0 -90
- data/test/rubygems/test_gem_package_tar_header.rb +0 -147
- data/test/rubygems/test_gem_package_tar_reader.rb +0 -90
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +0 -142
- data/test/rubygems/test_gem_package_tar_writer.rb +0 -264
- data/test/rubygems/test_gem_package_task.rb +0 -84
- data/test/rubygems/test_gem_path_support.rb +0 -121
- data/test/rubygems/test_gem_platform.rb +0 -308
- data/test/rubygems/test_gem_rdoc.rb +0 -270
- data/test/rubygems/test_gem_remote_fetcher.rb +0 -1051
- data/test/rubygems/test_gem_request.rb +0 -363
- data/test/rubygems/test_gem_request_connection_pools.rb +0 -130
- data/test/rubygems/test_gem_request_set.rb +0 -595
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +0 -831
- data/test/rubygems/test_gem_request_set_lockfile.rb +0 -470
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +0 -549
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +0 -306
- data/test/rubygems/test_gem_requirement.rb +0 -387
- data/test/rubygems/test_gem_resolver.rb +0 -715
- data/test/rubygems/test_gem_resolver_activation_request.rb +0 -74
- data/test/rubygems/test_gem_resolver_api_set.rb +0 -209
- data/test/rubygems/test_gem_resolver_api_specification.rb +0 -145
- data/test/rubygems/test_gem_resolver_best_set.rb +0 -138
- data/test/rubygems/test_gem_resolver_composed_set.rb +0 -46
- data/test/rubygems/test_gem_resolver_conflict.rb +0 -88
- data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -85
- data/test/rubygems/test_gem_resolver_git_set.rb +0 -190
- data/test/rubygems/test_gem_resolver_git_specification.rb +0 -114
- data/test/rubygems/test_gem_resolver_index_set.rb +0 -90
- data/test/rubygems/test_gem_resolver_index_specification.rb +0 -90
- data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -50
- data/test/rubygems/test_gem_resolver_installer_set.rb +0 -258
- data/test/rubygems/test_gem_resolver_local_specification.rb +0 -46
- data/test/rubygems/test_gem_resolver_lock_set.rb +0 -64
- data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -100
- data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -21
- data/test/rubygems/test_gem_resolver_specification.rb +0 -65
- data/test/rubygems/test_gem_resolver_vendor_set.rb +0 -84
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -84
- data/test/rubygems/test_gem_security.rb +0 -307
- data/test/rubygems/test_gem_security_policy.rb +0 -541
- data/test/rubygems/test_gem_security_signer.rb +0 -209
- data/test/rubygems/test_gem_security_trust_dir.rb +0 -101
- data/test/rubygems/test_gem_server.rb +0 -409
- data/test/rubygems/test_gem_silent_ui.rb +0 -117
- data/test/rubygems/test_gem_source.rb +0 -242
- data/test/rubygems/test_gem_source_fetch_problem.rb +0 -20
- data/test/rubygems/test_gem_source_git.rb +0 -309
- data/test/rubygems/test_gem_source_installed.rb +0 -37
- data/test/rubygems/test_gem_source_list.rb +0 -118
- data/test/rubygems/test_gem_source_local.rb +0 -107
- data/test/rubygems/test_gem_source_lock.rb +0 -115
- data/test/rubygems/test_gem_source_specific_file.rb +0 -76
- data/test/rubygems/test_gem_source_vendor.rb +0 -32
- data/test/rubygems/test_gem_spec_fetcher.rb +0 -311
- data/test/rubygems/test_gem_specification.rb +0 -3519
- data/test/rubygems/test_gem_stream_ui.rb +0 -239
- data/test/rubygems/test_gem_stub_specification.rb +0 -217
- data/test/rubygems/test_gem_text.rb +0 -77
- data/test/rubygems/test_gem_uninstaller.rb +0 -485
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -33
- data/test/rubygems/test_gem_uri_formatter.rb +0 -29
- data/test/rubygems/test_gem_util.rb +0 -40
- data/test/rubygems/test_gem_validator.rb +0 -46
- data/test/rubygems/test_gem_version.rb +0 -222
- data/test/rubygems/test_gem_version_option.rb +0 -152
- data/test/rubygems/test_kernel.rb +0 -86
- data/test/rubygems/test_require.rb +0 -322
- data/test/rubygems/wrong_key_cert.pem +0 -18
- data/test/rubygems/wrong_key_cert_32.pem +0 -18
- data/util/CL2notes +0 -56
- data/util/create_certs.rb +0 -157
- data/util/create_encrypted_key.rb +0 -17
- data/util/generate_spdx_license_list.rb +0 -51
- data/util/update_bundled_ca_certificates.rb +0 -118
@@ -1,23 +1,22 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
1
|
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
3
4
|
#--
|
4
5
|
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
5
6
|
# All rights reserved.
|
6
7
|
# See LICENSE.txt for permissions.
|
7
8
|
#++
|
8
9
|
|
10
|
+
require_relative "deprecate"
|
11
|
+
require_relative "basic_specification"
|
12
|
+
require_relative "stub_specification"
|
13
|
+
require_relative "platform"
|
14
|
+
require_relative "util/list"
|
9
15
|
|
10
|
-
require
|
11
|
-
require 'rubygems/requirement'
|
12
|
-
require 'rubygems/platform'
|
13
|
-
require 'rubygems/deprecate'
|
14
|
-
require 'rubygems/basic_specification'
|
15
|
-
require 'rubygems/stub_specification'
|
16
|
-
require 'rubygems/util/list'
|
17
|
-
require 'stringio'
|
16
|
+
require "rbconfig"
|
18
17
|
|
19
18
|
##
|
20
|
-
# The Specification class contains the information for a
|
19
|
+
# The Specification class contains the information for a gem. Typically
|
21
20
|
# defined in a .gemspec file or a Rakefile, and looks like this:
|
22
21
|
#
|
23
22
|
# Gem::Specification.new do |s|
|
@@ -30,6 +29,7 @@ require 'stringio'
|
|
30
29
|
# s.email = 'rubycoder@example.com'
|
31
30
|
# s.files = ["lib/example.rb"]
|
32
31
|
# s.homepage = 'https://rubygems.org/gems/example'
|
32
|
+
# s.metadata = { "source_code_uri" => "https://github.com/example/example" }
|
33
33
|
# end
|
34
34
|
#
|
35
35
|
# Starting in RubyGems 2.0, a Specification can hold arbitrary
|
@@ -37,6 +37,7 @@ require 'stringio'
|
|
37
37
|
# items you may add to a specification.
|
38
38
|
|
39
39
|
class Gem::Specification < Gem::BasicSpecification
|
40
|
+
extend Gem::Deprecate
|
40
41
|
|
41
42
|
# REFACTOR: Consider breaking out this version stuff into a separate
|
42
43
|
# module. There's enough special stuff around it that it may justify
|
@@ -76,37 +77,38 @@ class Gem::Specification < Gem::BasicSpecification
|
|
76
77
|
# key should be equal to the CURRENT_SPECIFICATION_VERSION.
|
77
78
|
|
78
79
|
SPECIFICATION_VERSION_HISTORY = { # :nodoc:
|
79
|
-
-1 => [
|
80
|
-
1
|
80
|
+
-1 => ["(RubyGems versions up to and including 0.7 did not have versioned specifications)"],
|
81
|
+
1 => [
|
81
82
|
'Deprecated "test_suite_file" in favor of the new, but equivalent, "test_files"',
|
82
|
-
'"test_file=x" is a shortcut for "test_files=[x]"'
|
83
|
+
'"test_file=x" is a shortcut for "test_files=[x]"',
|
83
84
|
],
|
84
|
-
2
|
85
|
+
2 => [
|
85
86
|
'Added "required_rubygems_version"',
|
86
|
-
|
87
|
+
"Now forward-compatible with future versions",
|
87
88
|
],
|
88
89
|
3 => [
|
89
|
-
|
90
|
+
"Added Fixnum validation to the specification_version",
|
90
91
|
],
|
91
92
|
4 => [
|
92
|
-
|
93
|
-
]
|
94
|
-
}
|
93
|
+
"Added sandboxed freeform metadata to the specification version.",
|
94
|
+
],
|
95
|
+
}.freeze
|
95
96
|
|
96
97
|
MARSHAL_FIELDS = { # :nodoc:
|
97
98
|
-1 => 16,
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
}
|
99
|
+
1 => 16,
|
100
|
+
2 => 16,
|
101
|
+
3 => 17,
|
102
|
+
4 => 18,
|
103
|
+
}.freeze
|
103
104
|
|
104
105
|
today = Time.now.utc
|
105
106
|
TODAY = Time.utc(today.year, today.month, today.day) # :nodoc:
|
106
107
|
|
107
|
-
|
108
|
+
@load_cache = {} # :nodoc:
|
109
|
+
@load_cache_mutex = Thread::Mutex.new
|
108
110
|
|
109
|
-
|
111
|
+
VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/ # :nodoc:
|
110
112
|
|
111
113
|
# :startdoc:
|
112
114
|
|
@@ -125,61 +127,77 @@ class Gem::Specification < Gem::BasicSpecification
|
|
125
127
|
# Map of attribute names to default values.
|
126
128
|
|
127
129
|
@@default_value = {
|
128
|
-
:
|
129
|
-
:
|
130
|
-
:
|
131
|
-
:
|
132
|
-
:
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
138
|
-
:
|
139
|
-
:
|
140
|
-
:
|
141
|
-
:
|
142
|
-
:
|
143
|
-
:
|
144
|
-
:
|
145
|
-
:
|
146
|
-
:
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
150
|
-
:
|
151
|
-
:
|
152
|
-
:
|
153
|
-
:
|
154
|
-
:
|
155
|
-
:
|
156
|
-
:
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
130
|
+
authors: [],
|
131
|
+
autorequire: nil,
|
132
|
+
bindir: "bin",
|
133
|
+
cert_chain: [],
|
134
|
+
date: nil,
|
135
|
+
dependencies: [],
|
136
|
+
description: nil,
|
137
|
+
email: nil,
|
138
|
+
executables: [],
|
139
|
+
extensions: [],
|
140
|
+
extra_rdoc_files: [],
|
141
|
+
files: [],
|
142
|
+
homepage: nil,
|
143
|
+
licenses: [],
|
144
|
+
metadata: {},
|
145
|
+
name: nil,
|
146
|
+
platform: Gem::Platform::RUBY,
|
147
|
+
post_install_message: nil,
|
148
|
+
rdoc_options: [],
|
149
|
+
require_paths: ["lib"],
|
150
|
+
required_ruby_version: Gem::Requirement.default,
|
151
|
+
required_rubygems_version: Gem::Requirement.default,
|
152
|
+
requirements: [],
|
153
|
+
rubygems_version: Gem::VERSION,
|
154
|
+
signing_key: nil,
|
155
|
+
specification_version: CURRENT_SPECIFICATION_VERSION,
|
156
|
+
summary: nil,
|
157
|
+
test_files: [],
|
158
|
+
version: nil,
|
159
|
+
}.freeze
|
160
|
+
|
161
|
+
# rubocop:disable Style/MutableConstant
|
162
|
+
INITIALIZE_CODE_FOR_DEFAULTS = {} # :nodoc:
|
163
|
+
# rubocop:enable Style/MutableConstant
|
161
164
|
|
162
165
|
@@default_value.each do |k,v|
|
163
|
-
case v
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
166
|
+
INITIALIZE_CODE_FOR_DEFAULTS[k] = case v
|
167
|
+
when [], {}, true, false, nil, Numeric, Symbol
|
168
|
+
v.inspect
|
169
|
+
when String
|
170
|
+
v.dump
|
171
|
+
else
|
172
|
+
"default_value(:#{k}).dup"
|
168
173
|
end
|
169
174
|
end
|
170
175
|
|
171
|
-
@@attributes = @@default_value.keys.sort_by
|
172
|
-
@@array_attributes = @@default_value.reject {
|
173
|
-
@@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition
|
176
|
+
@@attributes = @@default_value.keys.sort_by(&:to_s)
|
177
|
+
@@array_attributes = @@default_value.reject {|_k,v| v != [] }.keys
|
178
|
+
@@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition do |k|
|
174
179
|
@@default_value[k].nil?
|
175
|
-
|
180
|
+
end
|
181
|
+
|
182
|
+
def self.clear_specs # :nodoc:
|
183
|
+
@@all = nil
|
184
|
+
@@stubs = nil
|
185
|
+
@@stubs_by_name = {}
|
186
|
+
@@spec_with_requirable_file = {}
|
187
|
+
@@active_stub_with_requirable_file = {}
|
188
|
+
end
|
189
|
+
private_class_method :clear_specs
|
176
190
|
|
177
|
-
|
191
|
+
clear_specs
|
178
192
|
|
179
193
|
# Sentinel object to represent "not found" stubs
|
180
194
|
NOT_FOUND = Struct.new(:to_spec, :this).new # :nodoc:
|
181
|
-
|
182
|
-
|
195
|
+
|
196
|
+
# Tracking removed method calls to warn users during build time.
|
197
|
+
REMOVED_METHODS = [:rubyforge_project=].freeze # :nodoc:
|
198
|
+
def removed_method_calls
|
199
|
+
@removed_method_calls ||= []
|
200
|
+
end
|
183
201
|
|
184
202
|
######################################################################
|
185
203
|
# :section: Required gemspec attributes
|
@@ -207,35 +225,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
207
225
|
attr_reader :version
|
208
226
|
|
209
227
|
##
|
210
|
-
#
|
211
|
-
# activated.
|
212
|
-
#
|
213
|
-
# See also #require_paths
|
214
|
-
#
|
215
|
-
# If you have an extension you do not need to add <code>"ext"</code> to the
|
216
|
-
# require path, the extension build process will copy the extension files
|
217
|
-
# into "lib" for you.
|
218
|
-
#
|
219
|
-
# The default value is <code>"lib"</code>
|
220
|
-
#
|
221
|
-
# Usage:
|
222
|
-
#
|
223
|
-
# # If all library files are in the root directory...
|
224
|
-
# spec.require_paths = ['.']
|
225
|
-
|
226
|
-
def require_paths=(val)
|
227
|
-
@require_paths = Array(val)
|
228
|
-
end
|
229
|
-
|
230
|
-
##
|
231
|
-
# The version of RubyGems used to create this gem.
|
232
|
-
#
|
233
|
-
# Do not set this, it is set automatically when the gem is packaged.
|
234
|
-
|
235
|
-
attr_accessor :rubygems_version
|
236
|
-
|
237
|
-
##
|
238
|
-
# A short summary of this gem's description. Displayed in `gem list -d`.
|
228
|
+
# A short summary of this gem's description. Displayed in <tt>gem list -d</tt>.
|
239
229
|
#
|
240
230
|
# The #description should be more detailed than the summary.
|
241
231
|
#
|
@@ -245,85 +235,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
245
235
|
|
246
236
|
attr_reader :summary
|
247
237
|
|
248
|
-
##
|
249
|
-
# Singular writer for #authors
|
250
|
-
#
|
251
|
-
# Usage:
|
252
|
-
#
|
253
|
-
# spec.author = 'John Jones'
|
254
|
-
|
255
|
-
def author= o
|
256
|
-
self.authors = [o]
|
257
|
-
end
|
258
|
-
|
259
|
-
##
|
260
|
-
# Sets the list of authors, ensuring it is an array.
|
261
|
-
#
|
262
|
-
# Usage:
|
263
|
-
#
|
264
|
-
# spec.authors = ['John Jones', 'Mary Smith']
|
265
|
-
|
266
|
-
def authors= value
|
267
|
-
@authors = Array(value).flatten.grep(String)
|
268
|
-
end
|
269
|
-
|
270
|
-
##
|
271
|
-
# The platform this gem runs on.
|
272
|
-
#
|
273
|
-
# This is usually Gem::Platform::RUBY or Gem::Platform::CURRENT.
|
274
|
-
#
|
275
|
-
# Most gems contain pure Ruby code; they should simply leave the default
|
276
|
-
# value in place. Some gems contain C (or other) code to be compiled into a
|
277
|
-
# Ruby "extension". The gem should leave the default value in place unless
|
278
|
-
# the code will only compile on a certain type of system. Some gems consist
|
279
|
-
# of pre-compiled code ("binary gems"). It's especially important that they
|
280
|
-
# set the platform attribute appropriately. A shortcut is to set the
|
281
|
-
# platform to Gem::Platform::CURRENT, which will cause the gem builder to set
|
282
|
-
# the platform to the appropriate value for the system on which the build is
|
283
|
-
# being performed.
|
284
|
-
#
|
285
|
-
# If this attribute is set to a non-default value, it will be included in
|
286
|
-
# the filename of the gem when it is built such as:
|
287
|
-
# nokogiri-1.6.0-x86-mingw32.gem
|
288
|
-
#
|
289
|
-
# Usage:
|
290
|
-
#
|
291
|
-
# spec.platform = Gem::Platform.local
|
292
|
-
|
293
|
-
def platform= platform
|
294
|
-
if @original_platform.nil? or
|
295
|
-
@original_platform == Gem::Platform::RUBY then
|
296
|
-
@original_platform = platform
|
297
|
-
end
|
298
|
-
|
299
|
-
case platform
|
300
|
-
when Gem::Platform::CURRENT then
|
301
|
-
@new_platform = Gem::Platform.local
|
302
|
-
@original_platform = @new_platform.to_s
|
303
|
-
|
304
|
-
when Gem::Platform then
|
305
|
-
@new_platform = platform
|
306
|
-
|
307
|
-
# legacy constants
|
308
|
-
when nil, Gem::Platform::RUBY then
|
309
|
-
@new_platform = Gem::Platform::RUBY
|
310
|
-
when 'mswin32' then # was Gem::Platform::WIN32
|
311
|
-
@new_platform = Gem::Platform.new 'x86-mswin32'
|
312
|
-
when 'i586-linux' then # was Gem::Platform::LINUX_586
|
313
|
-
@new_platform = Gem::Platform.new 'x86-linux'
|
314
|
-
when 'powerpc-darwin' then # was Gem::Platform::DARWIN
|
315
|
-
@new_platform = Gem::Platform.new 'ppc-darwin'
|
316
|
-
else
|
317
|
-
@new_platform = Gem::Platform.new platform
|
318
|
-
end
|
319
|
-
|
320
|
-
@platform = @new_platform.to_s
|
321
|
-
|
322
|
-
invalidate_memoized_attributes
|
323
|
-
|
324
|
-
@new_platform
|
325
|
-
end
|
326
|
-
|
327
238
|
##
|
328
239
|
# Files included in this gem. You cannot append to this accessor, you must
|
329
240
|
# assign to it.
|
@@ -338,12 +249,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
338
249
|
# require 'rake'
|
339
250
|
# spec.files = FileList['lib/**/*.rb',
|
340
251
|
# 'bin/*',
|
341
|
-
# '[A-Z]*'
|
342
|
-
# 'test/**/*'].to_a
|
252
|
+
# '[A-Z]*'].to_a
|
343
253
|
#
|
344
254
|
# # or without Rake...
|
345
255
|
# spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
|
346
|
-
# spec.files += Dir['[A-Z]*']
|
256
|
+
# spec.files += Dir['[A-Z]*']
|
347
257
|
# spec.files.reject! { |fn| fn.include? "CVS" }
|
348
258
|
|
349
259
|
def files
|
@@ -353,27 +263,34 @@ class Gem::Specification < Gem::BasicSpecification
|
|
353
263
|
@test_files,
|
354
264
|
add_bindir(@executables),
|
355
265
|
@extra_rdoc_files,
|
356
|
-
@extensions
|
357
|
-
].flatten.compact.uniq.sort
|
266
|
+
@extensions].flatten.compact.uniq.sort
|
358
267
|
end
|
359
268
|
|
360
|
-
######################################################################
|
361
|
-
# :section: Optional gemspec attributes
|
362
|
-
|
363
269
|
##
|
364
|
-
#
|
270
|
+
# A list of authors for this gem.
|
271
|
+
#
|
272
|
+
# Alternatively, a single author can be specified by assigning a string to
|
273
|
+
# +spec.author+
|
365
274
|
#
|
366
275
|
# Usage:
|
367
276
|
#
|
368
|
-
# spec.
|
277
|
+
# spec.authors = ['John Jones', 'Mary Smith']
|
369
278
|
|
370
|
-
|
279
|
+
def authors=(value)
|
280
|
+
@authors = Array(value).flatten.grep(String)
|
281
|
+
end
|
282
|
+
|
283
|
+
######################################################################
|
284
|
+
# :section: Recommended gemspec attributes
|
371
285
|
|
372
286
|
##
|
373
|
-
# The
|
374
|
-
#
|
287
|
+
# The version of Ruby required by this gem
|
288
|
+
#
|
289
|
+
# Usage:
|
290
|
+
#
|
291
|
+
# spec.required_ruby_version = '>= 2.7.0'
|
375
292
|
|
376
|
-
|
293
|
+
attr_reader :required_ruby_version
|
377
294
|
|
378
295
|
##
|
379
296
|
# A long description of this gem
|
@@ -392,8 +309,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
392
309
|
attr_reader :description
|
393
310
|
|
394
311
|
##
|
395
|
-
# :category: Recommended gemspec attributes
|
396
|
-
#
|
397
312
|
# A contact email address (or addresses) for this gem
|
398
313
|
#
|
399
314
|
# Usage:
|
@@ -404,8 +319,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
404
319
|
attr_accessor :email
|
405
320
|
|
406
321
|
##
|
407
|
-
# :category: Recommended gemspec attributes
|
408
|
-
#
|
409
322
|
# The URL of this gem's home page
|
410
323
|
#
|
411
324
|
# Usage:
|
@@ -415,35 +328,59 @@ class Gem::Specification < Gem::BasicSpecification
|
|
415
328
|
attr_accessor :homepage
|
416
329
|
|
417
330
|
##
|
418
|
-
#
|
331
|
+
# The license for this gem.
|
419
332
|
#
|
420
|
-
#
|
333
|
+
# The license must be no more than 64 characters.
|
421
334
|
#
|
422
|
-
#
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
#
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
#
|
335
|
+
# This should just be the name of your license. The full text of the license
|
336
|
+
# should be inside of the gem (at the top level) when you build it.
|
337
|
+
#
|
338
|
+
# The simplest way is to specify the standard SPDX ID
|
339
|
+
# https://spdx.org/licenses/ for the license.
|
340
|
+
# Ideally, you should pick one that is OSI (Open Source Initiative)
|
341
|
+
# https://opensource.org/licenses/ approved.
|
342
|
+
#
|
343
|
+
# The most commonly used OSI-approved licenses are MIT and Apache-2.0.
|
344
|
+
# GitHub also provides a license picker at http://choosealicense.com/.
|
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
|
+
#
|
350
|
+
# You should specify a license for your gem so that people know how they are
|
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
|
353
|
+
# to use the code for any purpose.
|
354
|
+
#
|
355
|
+
# You can set multiple licenses with #licenses=
|
356
|
+
#
|
357
|
+
# Usage:
|
358
|
+
# spec.license = 'MIT'
|
433
359
|
|
434
|
-
|
360
|
+
def license=(o)
|
361
|
+
self.licenses = [o]
|
362
|
+
end
|
435
363
|
|
436
364
|
##
|
437
|
-
# The
|
365
|
+
# The license(s) for the library.
|
366
|
+
#
|
367
|
+
# Each license must be a short name, no more than 64 characters.
|
368
|
+
#
|
369
|
+
# This should just be the name of your license. The full
|
370
|
+
# text of the license should be inside of the gem when you build it.
|
371
|
+
#
|
372
|
+
# See #license= for more discussion
|
373
|
+
#
|
374
|
+
# Usage:
|
375
|
+
# spec.licenses = ['MIT', 'GPL-2.0']
|
438
376
|
|
439
|
-
|
377
|
+
def licenses=(licenses)
|
378
|
+
@licenses = Array licenses
|
379
|
+
end
|
440
380
|
|
441
381
|
##
|
442
|
-
# :attr_accessor: metadata
|
443
|
-
#
|
444
382
|
# The metadata holds extra data for this gem that may be useful to other
|
445
|
-
# consumers and is settable by gem authors
|
446
|
-
# the rubygems software.
|
383
|
+
# consumers and is settable by gem authors.
|
447
384
|
#
|
448
385
|
# Metadata items have the following restrictions:
|
449
386
|
#
|
@@ -453,12 +390,151 @@ class Gem::Specification < Gem::BasicSpecification
|
|
453
390
|
# bytes
|
454
391
|
# * All strings must be UTF-8, no binary data is allowed
|
455
392
|
#
|
456
|
-
#
|
393
|
+
# You can use metadata to specify links to your gem's homepage, codebase,
|
394
|
+
# documentation, wiki, mailing list, issue tracker and changelog.
|
457
395
|
#
|
458
|
-
# s.metadata = {
|
396
|
+
# s.metadata = {
|
397
|
+
# "bug_tracker_uri" => "https://example.com/user/bestgemever/issues",
|
398
|
+
# "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md",
|
399
|
+
# "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1",
|
400
|
+
# "homepage_uri" => "https://bestgemever.example.io",
|
401
|
+
# "mailing_list_uri" => "https://groups.example.com/bestgemever",
|
402
|
+
# "source_code_uri" => "https://example.com/user/bestgemever",
|
403
|
+
# "wiki_uri" => "https://example.com/user/bestgemever/wiki"
|
404
|
+
# "funding_uri" => "https://example.com/donate"
|
405
|
+
# }
|
406
|
+
#
|
407
|
+
# These links will be used on your gem's page on rubygems.org and must pass
|
408
|
+
# validation against following regex.
|
409
|
+
#
|
410
|
+
# %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}
|
459
411
|
|
460
412
|
attr_accessor :metadata
|
461
413
|
|
414
|
+
######################################################################
|
415
|
+
# :section: Optional gemspec attributes
|
416
|
+
|
417
|
+
##
|
418
|
+
# Singular (alternative) writer for #authors
|
419
|
+
#
|
420
|
+
# Usage:
|
421
|
+
#
|
422
|
+
# spec.author = 'John Jones'
|
423
|
+
|
424
|
+
def author=(o)
|
425
|
+
self.authors = [o]
|
426
|
+
end
|
427
|
+
|
428
|
+
##
|
429
|
+
# The path in the gem for executable scripts. Usually 'exe'
|
430
|
+
#
|
431
|
+
# Usage:
|
432
|
+
#
|
433
|
+
# spec.bindir = 'exe'
|
434
|
+
|
435
|
+
attr_accessor :bindir
|
436
|
+
|
437
|
+
##
|
438
|
+
# The certificate chain used to sign this gem. See Gem::Security for
|
439
|
+
# details.
|
440
|
+
|
441
|
+
attr_accessor :cert_chain
|
442
|
+
|
443
|
+
##
|
444
|
+
# A message that gets displayed after the gem is installed.
|
445
|
+
#
|
446
|
+
# Usage:
|
447
|
+
#
|
448
|
+
# spec.post_install_message = "Thanks for installing!"
|
449
|
+
|
450
|
+
attr_accessor :post_install_message
|
451
|
+
|
452
|
+
##
|
453
|
+
# The platform this gem runs on.
|
454
|
+
#
|
455
|
+
# This is usually Gem::Platform::RUBY or Gem::Platform::CURRENT.
|
456
|
+
#
|
457
|
+
# Most gems contain pure Ruby code; they should simply leave the default
|
458
|
+
# value in place. Some gems contain C (or other) code to be compiled into a
|
459
|
+
# Ruby "extension". The gem should leave the default value in place unless
|
460
|
+
# the code will only compile on a certain type of system. Some gems consist
|
461
|
+
# of pre-compiled code ("binary gems"). It's especially important that they
|
462
|
+
# set the platform attribute appropriately. A shortcut is to set the
|
463
|
+
# platform to Gem::Platform::CURRENT, which will cause the gem builder to set
|
464
|
+
# the platform to the appropriate value for the system on which the build is
|
465
|
+
# being performed.
|
466
|
+
#
|
467
|
+
# If this attribute is set to a non-default value, it will be included in
|
468
|
+
# the filename of the gem when it is built such as:
|
469
|
+
# nokogiri-1.6.0-x86-mingw32.gem
|
470
|
+
#
|
471
|
+
# Usage:
|
472
|
+
#
|
473
|
+
# spec.platform = Gem::Platform.local
|
474
|
+
|
475
|
+
def platform=(platform)
|
476
|
+
if @original_platform.nil? ||
|
477
|
+
@original_platform == Gem::Platform::RUBY
|
478
|
+
@original_platform = platform
|
479
|
+
end
|
480
|
+
|
481
|
+
case platform
|
482
|
+
when Gem::Platform::CURRENT then
|
483
|
+
@new_platform = Gem::Platform.local
|
484
|
+
@original_platform = @new_platform.to_s
|
485
|
+
|
486
|
+
when Gem::Platform then
|
487
|
+
@new_platform = platform
|
488
|
+
|
489
|
+
# legacy constants
|
490
|
+
when nil, Gem::Platform::RUBY then
|
491
|
+
@new_platform = Gem::Platform::RUBY
|
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"
|
498
|
+
else
|
499
|
+
@new_platform = Gem::Platform.new platform
|
500
|
+
end
|
501
|
+
|
502
|
+
@platform = @new_platform.to_s
|
503
|
+
|
504
|
+
invalidate_memoized_attributes
|
505
|
+
end
|
506
|
+
|
507
|
+
##
|
508
|
+
# Paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
|
509
|
+
# activated.
|
510
|
+
#--
|
511
|
+
# See also #require_paths
|
512
|
+
#++
|
513
|
+
# If you have an extension you do not need to add <code>"ext"</code> to the
|
514
|
+
# require path, the extension build process will copy the extension files
|
515
|
+
# into "lib" for you.
|
516
|
+
#
|
517
|
+
# The default value is <code>"lib"</code>
|
518
|
+
#
|
519
|
+
# Usage:
|
520
|
+
#
|
521
|
+
# # If all library files are in the root directory...
|
522
|
+
# spec.require_paths = ['.']
|
523
|
+
|
524
|
+
def require_paths=(val)
|
525
|
+
@require_paths = Array(val)
|
526
|
+
end
|
527
|
+
|
528
|
+
##
|
529
|
+
# The RubyGems version required by this gem
|
530
|
+
|
531
|
+
attr_reader :required_rubygems_version
|
532
|
+
|
533
|
+
##
|
534
|
+
# The key used to sign this gem. See Gem::Security for details.
|
535
|
+
|
536
|
+
attr_accessor :signing_key
|
537
|
+
|
462
538
|
##
|
463
539
|
# Adds a development dependency named +gem+ with +requirements+ to this
|
464
540
|
# gem.
|
@@ -471,7 +547,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
471
547
|
# activated when a gem is required.
|
472
548
|
|
473
549
|
def add_development_dependency(gem, *requirements)
|
474
|
-
add_dependency_with_type(gem, :development,
|
550
|
+
add_dependency_with_type(gem, :development, requirements)
|
475
551
|
end
|
476
552
|
|
477
553
|
##
|
@@ -482,13 +558,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|
482
558
|
# spec.add_runtime_dependency 'example', '~> 1.1', '>= 1.1.4'
|
483
559
|
|
484
560
|
def add_runtime_dependency(gem, *requirements)
|
485
|
-
|
561
|
+
if requirements.uniq.size != requirements.size
|
562
|
+
warn "WARNING: duplicated #{gem} dependency #{requirements}"
|
563
|
+
end
|
564
|
+
|
565
|
+
add_dependency_with_type(gem, :runtime, requirements)
|
486
566
|
end
|
487
567
|
|
488
568
|
##
|
489
569
|
# Executables included in the gem.
|
490
570
|
#
|
491
|
-
# For example, the rake gem has rake as an executable. You don
|
571
|
+
# For example, the rake gem has rake as an executable. You don't specify the
|
492
572
|
# full path (as in bin/rake); all application-style files are expected to be
|
493
573
|
# found in bindir. These files must be executable Ruby files. Files that
|
494
574
|
# use bash or other interpreters will not work.
|
@@ -509,7 +589,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
509
589
|
# extconf.rb-style files used to compile extensions.
|
510
590
|
#
|
511
591
|
# These files will be run when the gem is installed, causing the C (or
|
512
|
-
# whatever) code to be compiled on the user
|
592
|
+
# whatever) code to be compiled on the user's machine.
|
513
593
|
#
|
514
594
|
# Usage:
|
515
595
|
#
|
@@ -550,60 +630,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
550
630
|
# Sets the version of RubyGems that installed this gem. See also
|
551
631
|
# #installed_by_version.
|
552
632
|
|
553
|
-
def installed_by_version=
|
633
|
+
def installed_by_version=(version) # :nodoc:
|
554
634
|
@installed_by_version = Gem::Version.new version
|
555
635
|
end
|
556
636
|
|
557
|
-
##
|
558
|
-
# :category: Recommended gemspec attributes
|
559
|
-
#
|
560
|
-
# The license for this gem.
|
561
|
-
#
|
562
|
-
# The license must be no more than 64 characters.
|
563
|
-
#
|
564
|
-
# This should just be the name of your license. The full text of the license
|
565
|
-
# should be inside of the gem (at the top level) when you build it.
|
566
|
-
#
|
567
|
-
# The simplest way, is to specify the standard SPDX ID
|
568
|
-
# https://spdx.org/licenses/ for the license.
|
569
|
-
# Ideally you should pick one that is OSI (Open Source Initiative)
|
570
|
-
# http://opensource.org/licenses/alphabetical approved.
|
571
|
-
#
|
572
|
-
# The most commonly used OSI approved licenses are MIT and Apache-2.0.
|
573
|
-
# GitHub also provides a license picker at http://choosealicense.com/.
|
574
|
-
#
|
575
|
-
# You should specify a license for your gem so that people know how they are
|
576
|
-
# permitted to use it, and any restrictions you're placing on it. Not
|
577
|
-
# specifying a license means all rights are reserved; others have no rights
|
578
|
-
# to use the code for any purpose.
|
579
|
-
#
|
580
|
-
# You can set multiple licenses with #licenses=
|
581
|
-
#
|
582
|
-
# Usage:
|
583
|
-
# spec.license = 'MIT'
|
584
|
-
|
585
|
-
def license=o
|
586
|
-
self.licenses = [o]
|
587
|
-
end
|
588
|
-
|
589
|
-
##
|
590
|
-
# :category: Recommended gemspec attributes
|
591
|
-
# The license(s) for the library.
|
592
|
-
#
|
593
|
-
# Each license must be a short name, no more than 64 characters.
|
594
|
-
#
|
595
|
-
# This should just be the name of your license. The full
|
596
|
-
# text of the license should be inside of the gem when you build it.
|
597
|
-
#
|
598
|
-
# See #license= for more discussion
|
599
|
-
#
|
600
|
-
# Usage:
|
601
|
-
# spec.licenses = ['MIT', 'GPL-2.0']
|
602
|
-
|
603
|
-
def licenses= licenses
|
604
|
-
@licenses = Array licenses
|
605
|
-
end
|
606
|
-
|
607
637
|
##
|
608
638
|
# Specifies the rdoc options to be used when generating API documentation.
|
609
639
|
#
|
@@ -617,6 +647,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
617
647
|
@rdoc_options ||= []
|
618
648
|
end
|
619
649
|
|
650
|
+
LATEST_RUBY_WITHOUT_PATCH_VERSIONS = Gem::Version.new("2.1")
|
651
|
+
|
620
652
|
##
|
621
653
|
# The version of Ruby required by this gem. The ruby version can be
|
622
654
|
# specified to the patch-level:
|
@@ -625,29 +657,38 @@ class Gem::Specification < Gem::BasicSpecification
|
|
625
657
|
# ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
|
626
658
|
# #<Gem::Version "2.0.0.247">
|
627
659
|
#
|
628
|
-
#
|
629
|
-
# `<=`: `<= 2.2.2` will not match any patch-level of 2.2.2 after the `p0`
|
630
|
-
# release. It is much safer to specify `< 2.2.3` instead
|
660
|
+
# Prereleases can also be specified.
|
631
661
|
#
|
632
662
|
# Usage:
|
633
663
|
#
|
634
664
|
# # This gem will work with 1.8.6 or greater...
|
635
665
|
# spec.required_ruby_version = '>= 1.8.6'
|
636
666
|
#
|
637
|
-
# # Only with
|
638
|
-
# spec.required_ruby_version = '~> 2.
|
667
|
+
# # Only with final releases of major version 2 where minor version is at least 3
|
668
|
+
# spec.required_ruby_version = '~> 2.3'
|
669
|
+
#
|
670
|
+
# # Only prereleases or final releases after 2.6.0.preview2
|
671
|
+
# spec.required_ruby_version = '> 2.6.0.preview2'
|
639
672
|
#
|
640
|
-
# #
|
641
|
-
# spec.required_ruby_version =
|
673
|
+
# # This gem will work with 2.3.0 or greater, including major version 3, but lesser than 4.0.0
|
674
|
+
# spec.required_ruby_version = '>= 2.3', '< 4'
|
642
675
|
|
643
|
-
def required_ruby_version=
|
676
|
+
def required_ruby_version=(req)
|
644
677
|
@required_ruby_version = Gem::Requirement.create req
|
678
|
+
|
679
|
+
@required_ruby_version.requirements.map! do |op, v|
|
680
|
+
if v >= LATEST_RUBY_WITHOUT_PATCH_VERSIONS && v.release.segments.size == 4
|
681
|
+
[op == "~>" ? "=" : op, Gem::Version.new(v.segments.tap {|s| s.delete_at(3) }.join("."))]
|
682
|
+
else
|
683
|
+
[op, v]
|
684
|
+
end
|
685
|
+
end
|
645
686
|
end
|
646
687
|
|
647
688
|
##
|
648
689
|
# The RubyGems version required by this gem
|
649
690
|
|
650
|
-
def required_rubygems_version=
|
691
|
+
def required_rubygems_version=(req)
|
651
692
|
@required_rubygems_version = Gem::Requirement.create req
|
652
693
|
end
|
653
694
|
|
@@ -672,10 +713,25 @@ class Gem::Specification < Gem::BasicSpecification
|
|
672
713
|
# spec.test_files = Dir.glob('test/tc_*.rb')
|
673
714
|
# spec.test_files = ['tests/test-suite.rb']
|
674
715
|
|
675
|
-
def test_files=
|
716
|
+
def test_files=(files) # :nodoc:
|
676
717
|
@test_files = Array files
|
677
718
|
end
|
678
719
|
|
720
|
+
######################################################################
|
721
|
+
# :section: Read-only attributes
|
722
|
+
|
723
|
+
##
|
724
|
+
# The version of RubyGems used to create this gem.
|
725
|
+
|
726
|
+
attr_accessor :rubygems_version
|
727
|
+
|
728
|
+
##
|
729
|
+
# The path where this gem installs its extensions.
|
730
|
+
|
731
|
+
def extensions_dir
|
732
|
+
@extensions_dir ||= super
|
733
|
+
end
|
734
|
+
|
679
735
|
######################################################################
|
680
736
|
# :section: Specification internals
|
681
737
|
|
@@ -684,7 +740,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
684
740
|
|
685
741
|
attr_accessor :activated
|
686
742
|
|
687
|
-
|
743
|
+
alias_method :activated?, :activated
|
688
744
|
|
689
745
|
##
|
690
746
|
# Autorequire was used by old RubyGems to automatically require a file.
|
@@ -699,20 +755,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
699
755
|
# Deprecated: You must now specify the executable name to Gem.bin_path.
|
700
756
|
|
701
757
|
attr_writer :default_executable
|
758
|
+
rubygems_deprecate :default_executable=
|
702
759
|
|
703
760
|
##
|
704
761
|
# Allows deinstallation of gems with legacy platforms.
|
705
762
|
|
706
763
|
attr_writer :original_platform # :nodoc:
|
707
764
|
|
708
|
-
##
|
709
|
-
# The rubyforge project this gem lives under. i.e. RubyGems'
|
710
|
-
# rubyforge_project is "rubygems".
|
711
|
-
#
|
712
|
-
# This option is deprecated.
|
713
|
-
|
714
|
-
attr_accessor :rubyforge_project
|
715
|
-
|
716
765
|
##
|
717
766
|
# The Gem::Specification version of this gemspec.
|
718
767
|
#
|
@@ -721,100 +770,45 @@ class Gem::Specification < Gem::BasicSpecification
|
|
721
770
|
attr_accessor :specification_version
|
722
771
|
|
723
772
|
def self._all # :nodoc:
|
724
|
-
|
725
|
-
@@all = stubs.map(&:to_spec)
|
726
|
-
|
727
|
-
# After a reset, make sure already loaded specs
|
728
|
-
# are still marked as activated.
|
729
|
-
specs = {}
|
730
|
-
Gem.loaded_specs.each_value{|s| specs[s] = true}
|
731
|
-
@@all.each{|s| s.activated = true if specs[s]}
|
732
|
-
end
|
733
|
-
@@all
|
773
|
+
@@all ||= Gem.loaded_specs.values | stubs.map(&:to_spec)
|
734
774
|
end
|
735
775
|
|
736
|
-
def self.
|
737
|
-
|
776
|
+
def self.clear_load_cache # :nodoc:
|
777
|
+
@load_cache_mutex.synchronize do
|
778
|
+
@load_cache.clear
|
779
|
+
end
|
738
780
|
end
|
781
|
+
private_class_method :clear_load_cache
|
739
782
|
|
740
783
|
def self.each_gemspec(dirs) # :nodoc:
|
741
784
|
dirs.each do |dir|
|
742
|
-
|
743
|
-
yield path
|
785
|
+
Gem::Util.glob_files_in_dir("*.gemspec", dir).each do |path|
|
786
|
+
yield path
|
744
787
|
end
|
745
788
|
end
|
746
789
|
end
|
747
790
|
|
748
|
-
def self.gemspec_stubs_in
|
749
|
-
|
791
|
+
def self.gemspec_stubs_in(dir, pattern)
|
792
|
+
Gem::Util.glob_files_in_dir(pattern, dir).map {|path| yield path }.select(&:valid?)
|
750
793
|
end
|
751
794
|
private_class_method :gemspec_stubs_in
|
752
795
|
|
753
|
-
def self.
|
754
|
-
base_dir = Gem.default_dir
|
755
|
-
gems_dir = File.join base_dir, "gems"
|
756
|
-
gemspec_stubs_in(default_specifications_dir, pattern) do |path|
|
757
|
-
Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir)
|
758
|
-
end
|
759
|
-
end
|
760
|
-
private_class_method :default_stubs
|
761
|
-
|
762
|
-
def self.installed_stubs dirs, pattern
|
796
|
+
def self.installed_stubs(dirs, pattern)
|
763
797
|
map_stubs(dirs, pattern) do |path, base_dir, gems_dir|
|
764
798
|
Gem::StubSpecification.gemspec_stub(path, base_dir, gems_dir)
|
765
799
|
end
|
766
800
|
end
|
767
801
|
private_class_method :installed_stubs
|
768
802
|
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
gemspec_stubs_in(dir, pattern) { |path| yield path, base_dir, gems_dir }
|
775
|
-
}
|
776
|
-
end
|
777
|
-
else # FIXME: remove when 1.8 is dropped
|
778
|
-
def self.map_stubs(dirs, pattern) # :nodoc:
|
779
|
-
dirs.map { |dir|
|
780
|
-
base_dir = File.dirname dir
|
781
|
-
gems_dir = File.join base_dir, "gems"
|
782
|
-
gemspec_stubs_in(dir, pattern) { |path| yield path, base_dir, gems_dir }
|
783
|
-
}.flatten 1
|
803
|
+
def self.map_stubs(dirs, pattern) # :nodoc:
|
804
|
+
dirs.flat_map do |dir|
|
805
|
+
base_dir = File.dirname dir
|
806
|
+
gems_dir = File.join base_dir, "gems"
|
807
|
+
gemspec_stubs_in(dir, pattern) {|path| yield path, base_dir, gems_dir }
|
784
808
|
end
|
785
809
|
end
|
786
810
|
private_class_method :map_stubs
|
787
811
|
|
788
|
-
uniq_takes_a_block = false
|
789
|
-
[1,2].uniq { uniq_takes_a_block = true }
|
790
|
-
|
791
|
-
if uniq_takes_a_block
|
792
|
-
def self.uniq_by(list, &block) # :nodoc:
|
793
|
-
list.uniq(&block)
|
794
|
-
end
|
795
|
-
else # FIXME: remove when 1.8 is dropped
|
796
|
-
def self.uniq_by(list) # :nodoc:
|
797
|
-
values = {}
|
798
|
-
list.each { |item|
|
799
|
-
value = yield item
|
800
|
-
values[value] ||= item
|
801
|
-
}
|
802
|
-
values.values
|
803
|
-
end
|
804
|
-
end
|
805
|
-
private_class_method :uniq_by
|
806
|
-
|
807
|
-
if [].respond_to? :sort_by!
|
808
|
-
def self.sort_by! list, &block
|
809
|
-
list.sort_by!(&block)
|
810
|
-
end
|
811
|
-
else # FIXME: remove when 1.8 is dropped
|
812
|
-
def self.sort_by! list, &block
|
813
|
-
list.replace list.sort_by(&block)
|
814
|
-
end
|
815
|
-
end
|
816
|
-
private_class_method :sort_by!
|
817
|
-
|
818
812
|
def self.each_spec(dirs) # :nodoc:
|
819
813
|
each_gemspec(dirs) do |path|
|
820
814
|
spec = self.load path
|
@@ -828,47 +822,66 @@ class Gem::Specification < Gem::BasicSpecification
|
|
828
822
|
def self.stubs
|
829
823
|
@@stubs ||= begin
|
830
824
|
pattern = "*.gemspec"
|
831
|
-
stubs =
|
832
|
-
stubs = uniq_by(stubs) { |stub| stub.full_name }
|
825
|
+
stubs = stubs_for_pattern(pattern, false)
|
833
826
|
|
834
|
-
|
835
|
-
@@stubs_by_name = stubs.group_by(&:name)
|
827
|
+
@@stubs_by_name = stubs.select {|s| Gem::Platform.match_spec? s }.group_by(&:name)
|
836
828
|
stubs
|
837
829
|
end
|
838
830
|
end
|
839
831
|
|
840
|
-
|
832
|
+
##
|
833
|
+
# Returns a Gem::StubSpecification for default gems
|
834
|
+
|
835
|
+
def self.default_stubs(pattern = "*.gemspec")
|
836
|
+
base_dir = Gem.default_dir
|
837
|
+
gems_dir = File.join base_dir, "gems"
|
838
|
+
gemspec_stubs_in(Gem.default_specifications_dir, pattern) do |path|
|
839
|
+
Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir)
|
840
|
+
end
|
841
|
+
end
|
841
842
|
|
842
843
|
##
|
843
844
|
# Returns a Gem::StubSpecification for installed gem named +name+
|
845
|
+
# only returns stubs that match Gem.platforms
|
844
846
|
|
845
|
-
def self.stubs_for
|
847
|
+
def self.stubs_for(name)
|
846
848
|
if @@stubs
|
847
849
|
@@stubs_by_name[name] || []
|
848
850
|
else
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
851
|
+
@@stubs_by_name[name] ||= stubs_for_pattern("#{name}-*.gemspec").select do |s|
|
852
|
+
s.name == name
|
853
|
+
end
|
854
|
+
end
|
855
|
+
end
|
853
856
|
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
+
##
|
858
|
+
# Finds stub specifications matching a pattern from the standard locations,
|
859
|
+
# optionally filtering out specs not matching the current platform
|
860
|
+
#
|
861
|
+
def self.stubs_for_pattern(pattern, match_platform = true) # :nodoc:
|
862
|
+
installed_stubs = installed_stubs(Gem::Specification.dirs, pattern)
|
863
|
+
installed_stubs.select! {|s| Gem::Platform.match_spec? s } if match_platform
|
864
|
+
stubs = installed_stubs + default_stubs(pattern)
|
865
|
+
stubs = stubs.uniq(&:full_name)
|
866
|
+
_resort!(stubs)
|
867
|
+
stubs
|
857
868
|
end
|
858
869
|
|
859
870
|
def self._resort!(specs) # :nodoc:
|
860
|
-
specs.sort!
|
871
|
+
specs.sort! do |a, b|
|
861
872
|
names = a.name <=> b.name
|
862
873
|
next names if names.nonzero?
|
863
|
-
b.version <=> a.version
|
864
|
-
|
874
|
+
versions = b.version <=> a.version
|
875
|
+
next versions if versions.nonzero?
|
876
|
+
Gem::Platform.sort_priority(b.platform)
|
877
|
+
end
|
865
878
|
end
|
866
879
|
|
867
880
|
##
|
868
881
|
# Loads the default specifications. It should be called only once.
|
869
882
|
|
870
883
|
def self.load_defaults
|
871
|
-
each_spec([default_specifications_dir]) do |spec|
|
884
|
+
each_spec([Gem.default_specifications_dir]) do |spec|
|
872
885
|
# #load returns nil if the spec is bad, so we just ignore
|
873
886
|
# it at this stage
|
874
887
|
Gem.register_default_spec(spec)
|
@@ -879,45 +892,24 @@ class Gem::Specification < Gem::BasicSpecification
|
|
879
892
|
# Adds +spec+ to the known specifications, keeping the collection
|
880
893
|
# properly sorted.
|
881
894
|
|
882
|
-
def self.add_spec
|
883
|
-
warn "Gem::Specification.add_spec is deprecated and will be removed in Rubygems 3.0" unless Gem::Deprecate.skip
|
884
|
-
# TODO: find all extraneous adds
|
885
|
-
# puts
|
886
|
-
# p :add_spec => [spec.full_name, caller.reject { |s| s =~ /minitest/ }]
|
887
|
-
|
888
|
-
# TODO: flush the rest of the crap from the tests
|
889
|
-
# raise "no dupes #{spec.full_name} in #{all_names.inspect}" if
|
890
|
-
# _all.include? spec
|
891
|
-
|
892
|
-
raise "nil spec!" unless spec # TODO: remove once we're happy with tests
|
893
|
-
|
895
|
+
def self.add_spec(spec)
|
894
896
|
return if _all.include? spec
|
895
897
|
|
896
898
|
_all << spec
|
897
899
|
stubs << spec
|
898
900
|
(@@stubs_by_name[spec.name] ||= []) << spec
|
899
|
-
|
900
|
-
_resort!(
|
901
|
+
|
902
|
+
_resort!(@@stubs_by_name[spec.name])
|
901
903
|
_resort!(stubs)
|
902
904
|
end
|
903
905
|
|
904
906
|
##
|
905
|
-
#
|
906
|
-
|
907
|
-
def self.add_specs *specs
|
908
|
-
warn "Gem::Specification.add_specs is deprecated and will be removed in Rubygems 3.0" unless Gem::Deprecate.skip
|
909
|
-
|
910
|
-
raise "nil spec!" if specs.any?(&:nil?) # TODO: remove once we're happy
|
911
|
-
|
912
|
-
# TODO: this is much more efficient, but we need the extra checks for now
|
913
|
-
# _all.concat specs
|
914
|
-
# _resort!
|
907
|
+
# Removes +spec+ from the known specs.
|
915
908
|
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
end
|
909
|
+
def self.remove_spec(spec)
|
910
|
+
_all.delete spec.to_spec
|
911
|
+
stubs.delete spec
|
912
|
+
(@@stubs_by_name[spec.name] || []).delete spec
|
921
913
|
end
|
922
914
|
|
923
915
|
##
|
@@ -942,7 +934,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
942
934
|
#
|
943
935
|
# -- wilsonb
|
944
936
|
|
945
|
-
def self.all=
|
937
|
+
def self.all=(specs)
|
946
938
|
@@stubs_by_name = specs.group_by(&:name)
|
947
939
|
@@all = @@stubs = specs
|
948
940
|
end
|
@@ -951,7 +943,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
951
943
|
# Return full names of all specs in sorted order.
|
952
944
|
|
953
945
|
def self.all_names
|
954
|
-
|
946
|
+
_all.map(&:full_name)
|
955
947
|
end
|
956
948
|
|
957
949
|
##
|
@@ -976,19 +968,19 @@ class Gem::Specification < Gem::BasicSpecification
|
|
976
968
|
# Return the directories that Specification uses to find specs.
|
977
969
|
|
978
970
|
def self.dirs
|
979
|
-
@@dirs ||= Gem.path.collect
|
980
|
-
File.join dir
|
981
|
-
|
971
|
+
@@dirs ||= Gem.path.collect do |dir|
|
972
|
+
File.join dir, "specifications"
|
973
|
+
end
|
982
974
|
end
|
983
975
|
|
984
976
|
##
|
985
977
|
# Set the directories that Specification uses to find specs. Setting
|
986
978
|
# this resets the list of known specs.
|
987
979
|
|
988
|
-
def self.dirs=
|
989
|
-
|
980
|
+
def self.dirs=(dirs)
|
981
|
+
reset
|
990
982
|
|
991
|
-
@@dirs = Array(dirs).map {
|
983
|
+
@@dirs = Array(dirs).map {|dir| File.join dir, "specifications" }
|
992
984
|
end
|
993
985
|
|
994
986
|
extend Enumerable
|
@@ -1000,7 +992,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1000
992
|
def self.each
|
1001
993
|
return enum_for(:each) unless block_given?
|
1002
994
|
|
1003
|
-
|
995
|
+
_all.each do |x|
|
1004
996
|
yield x
|
1005
997
|
end
|
1006
998
|
end
|
@@ -1008,7 +1000,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1008
1000
|
##
|
1009
1001
|
# Returns every spec that matches +name+ and optional +requirements+.
|
1010
1002
|
|
1011
|
-
def self.find_all_by_name
|
1003
|
+
def self.find_all_by_name(name, *requirements)
|
1012
1004
|
requirements = Gem::Requirement.default if requirements.empty?
|
1013
1005
|
|
1014
1006
|
# TODO: maybe try: find_all { |s| spec === dep }
|
@@ -1016,11 +1008,18 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1016
1008
|
Gem::Dependency.new(name, *requirements).matching_specs
|
1017
1009
|
end
|
1018
1010
|
|
1011
|
+
##
|
1012
|
+
# Returns every spec that has the given +full_name+
|
1013
|
+
|
1014
|
+
def self.find_all_by_full_name(full_name)
|
1015
|
+
stubs.select {|s| s.full_name == full_name }.map(&:to_spec)
|
1016
|
+
end
|
1017
|
+
|
1019
1018
|
##
|
1020
1019
|
# Find the best specification matching a +name+ and +requirements+. Raises
|
1021
1020
|
# if the dependency doesn't resolve to a valid specification.
|
1022
1021
|
|
1023
|
-
def self.find_by_name
|
1022
|
+
def self.find_by_name(name, *requirements)
|
1024
1023
|
requirements = Gem::Requirement.default if requirements.empty?
|
1025
1024
|
|
1026
1025
|
# TODO: maybe try: find { |s| spec === dep }
|
@@ -1028,14 +1027,21 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1028
1027
|
Gem::Dependency.new(name, *requirements).to_spec
|
1029
1028
|
end
|
1030
1029
|
|
1030
|
+
##
|
1031
|
+
# Find the best specification matching a +full_name+.
|
1032
|
+
def self.find_by_full_name(full_name)
|
1033
|
+
stubs.find {|s| s.full_name == full_name }&.to_spec
|
1034
|
+
end
|
1035
|
+
|
1031
1036
|
##
|
1032
1037
|
# Return the best specification that contains the file matching +path+.
|
1033
1038
|
|
1034
|
-
def self.find_by_path
|
1039
|
+
def self.find_by_path(path)
|
1035
1040
|
path = path.dup.freeze
|
1036
|
-
spec = @@spec_with_requirable_file[path] ||=
|
1041
|
+
spec = @@spec_with_requirable_file[path] ||= stubs.find do |s|
|
1037
1042
|
s.contains_requirable_file? path
|
1038
|
-
|
1043
|
+
end || NOT_FOUND
|
1044
|
+
|
1039
1045
|
spec.to_spec
|
1040
1046
|
end
|
1041
1047
|
|
@@ -1043,39 +1049,36 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1043
1049
|
# Return the best specification that contains the file matching +path+
|
1044
1050
|
# amongst the specs that are not activated.
|
1045
1051
|
|
1046
|
-
def self.find_inactive_by_path
|
1047
|
-
stub = stubs.find
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1052
|
+
def self.find_inactive_by_path(path)
|
1053
|
+
stub = stubs.find do |s|
|
1054
|
+
next if s.activated?
|
1055
|
+
s.contains_requirable_file? path
|
1056
|
+
end
|
1057
|
+
stub&.to_spec
|
1051
1058
|
end
|
1052
1059
|
|
1053
|
-
def self.find_active_stub_by_path
|
1054
|
-
stub = @@active_stub_with_requirable_file[path] ||=
|
1055
|
-
s.activated?
|
1056
|
-
|
1060
|
+
def self.find_active_stub_by_path(path)
|
1061
|
+
stub = @@active_stub_with_requirable_file[path] ||= stubs.find do |s|
|
1062
|
+
s.activated? && s.contains_requirable_file?(path)
|
1063
|
+
end || NOT_FOUND
|
1064
|
+
|
1057
1065
|
stub.this
|
1058
1066
|
end
|
1059
1067
|
|
1060
1068
|
##
|
1061
1069
|
# Return currently unresolved specs that contain the file matching +path+.
|
1062
1070
|
|
1063
|
-
def self.find_in_unresolved
|
1064
|
-
|
1065
|
-
specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
|
1066
|
-
|
1067
|
-
specs.find_all { |spec| spec.contains_requirable_file? path }
|
1071
|
+
def self.find_in_unresolved(path)
|
1072
|
+
unresolved_specs.find_all {|spec| spec.contains_requirable_file? path }
|
1068
1073
|
end
|
1069
1074
|
|
1070
1075
|
##
|
1071
1076
|
# Search through all unresolved deps and sub-dependencies and return
|
1072
1077
|
# specs that contain the file matching +path+.
|
1073
1078
|
|
1074
|
-
def self.find_in_unresolved_tree
|
1075
|
-
|
1076
|
-
|
1077
|
-
specs.reverse_each do |spec|
|
1078
|
-
spec.traverse do |from_spec, dep, to_spec, trail|
|
1079
|
+
def self.find_in_unresolved_tree(path)
|
1080
|
+
unresolved_specs.each do |spec|
|
1081
|
+
spec.traverse do |_from_spec, _dep, to_spec, trail|
|
1079
1082
|
if to_spec.has_conflicts? || to_spec.conficts_when_loaded_with?(trail)
|
1080
1083
|
:next
|
1081
1084
|
else
|
@@ -1087,6 +1090,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1087
1090
|
[]
|
1088
1091
|
end
|
1089
1092
|
|
1093
|
+
def self.unresolved_specs
|
1094
|
+
unresolved_deps.values.map(&:to_specs).flatten
|
1095
|
+
end
|
1096
|
+
private_class_method :unresolved_specs
|
1097
|
+
|
1090
1098
|
##
|
1091
1099
|
# Special loader for YAML files. When a Specification object is loaded
|
1092
1100
|
# from a YAML file, it bypasses the normal Ruby object initialization
|
@@ -1099,18 +1107,19 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1099
1107
|
Gem.load_yaml
|
1100
1108
|
|
1101
1109
|
input = normalize_yaml_input input
|
1102
|
-
spec =
|
1110
|
+
spec = Gem::SafeYAML.safe_load input
|
1103
1111
|
|
1104
|
-
if spec && spec.class == FalseClass
|
1112
|
+
if spec && spec.class == FalseClass
|
1105
1113
|
raise Gem::EndOfYAMLException
|
1106
1114
|
end
|
1107
1115
|
|
1108
|
-
unless Gem::Specification === spec
|
1116
|
+
unless Gem::Specification === spec
|
1109
1117
|
raise Gem::Exception, "YAML data doesn't evaluate to gem specification"
|
1110
1118
|
end
|
1111
1119
|
|
1112
1120
|
spec.specification_version ||= NONEXISTENT_SPECIFICATION_VERSION
|
1113
1121
|
spec.reset_nil_attributes_to_default
|
1122
|
+
spec.flatten_require_paths
|
1114
1123
|
|
1115
1124
|
spec
|
1116
1125
|
end
|
@@ -1119,60 +1128,64 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1119
1128
|
# Return the latest specs, optionally including prerelease specs if
|
1120
1129
|
# +prerelease+ is true.
|
1121
1130
|
|
1122
|
-
def self.latest_specs
|
1123
|
-
_latest_specs Gem::Specification.
|
1131
|
+
def self.latest_specs(prerelease = false)
|
1132
|
+
_latest_specs Gem::Specification.stubs, prerelease
|
1133
|
+
end
|
1134
|
+
|
1135
|
+
##
|
1136
|
+
# Return the latest installed spec for gem +name+.
|
1137
|
+
|
1138
|
+
def self.latest_spec_for(name)
|
1139
|
+
latest_specs(true).find {|installed_spec| installed_spec.name == name }
|
1124
1140
|
end
|
1125
1141
|
|
1126
|
-
def self._latest_specs
|
1127
|
-
result =
|
1128
|
-
native = {}
|
1142
|
+
def self._latest_specs(specs, prerelease = false) # :nodoc:
|
1143
|
+
result = {}
|
1129
1144
|
|
1130
1145
|
specs.reverse_each do |spec|
|
1131
|
-
|
1146
|
+
unless prerelease
|
1147
|
+
next if spec.version.prerelease?
|
1148
|
+
end
|
1132
1149
|
|
1133
|
-
|
1134
|
-
result[spec.name][spec.platform] = spec
|
1150
|
+
result[spec.name] = spec
|
1135
1151
|
end
|
1136
1152
|
|
1137
|
-
result.map(&:last).
|
1138
|
-
minimum = native[spec.name]
|
1139
|
-
minimum && spec.version < minimum
|
1140
|
-
}.sort_by{ |tup| tup.name }
|
1153
|
+
result.map(&:last).flatten.sort_by(&:name)
|
1141
1154
|
end
|
1142
1155
|
|
1143
1156
|
##
|
1144
1157
|
# Loads Ruby format gemspec from +file+.
|
1145
1158
|
|
1146
|
-
def self.load
|
1159
|
+
def self.load(file)
|
1147
1160
|
return unless file
|
1148
1161
|
|
1149
|
-
|
1150
|
-
return
|
1162
|
+
spec = @load_cache_mutex.synchronize { @load_cache[file] }
|
1163
|
+
return spec if spec
|
1151
1164
|
|
1152
|
-
file = file.dup.untaint
|
1153
1165
|
return unless File.file?(file)
|
1154
1166
|
|
1155
|
-
code =
|
1156
|
-
File.read file, :mode => 'r:UTF-8:-'
|
1157
|
-
else
|
1158
|
-
File.read file
|
1159
|
-
end
|
1160
|
-
|
1161
|
-
code.untaint
|
1167
|
+
code = Gem.open_file(file, "r:UTF-8:-", &:read)
|
1162
1168
|
|
1163
1169
|
begin
|
1164
|
-
|
1165
|
-
|
1166
|
-
if Gem::Specification ===
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
+
spec = eval code, binding, file
|
1171
|
+
|
1172
|
+
if Gem::Specification === spec
|
1173
|
+
spec.loaded_from = File.expand_path file.to_s
|
1174
|
+
@load_cache_mutex.synchronize do
|
1175
|
+
prev = @load_cache[file]
|
1176
|
+
if prev
|
1177
|
+
spec = prev
|
1178
|
+
else
|
1179
|
+
@load_cache[file] = spec
|
1180
|
+
end
|
1181
|
+
end
|
1182
|
+
return spec
|
1170
1183
|
end
|
1171
1184
|
|
1172
|
-
warn "[#{file}] isn't a Gem::Specification (#{
|
1185
|
+
warn "[#{file}] isn't a Gem::Specification (#{spec.class} instead)."
|
1173
1186
|
rescue SignalException, SystemExit
|
1174
1187
|
raise
|
1175
|
-
rescue SyntaxError,
|
1188
|
+
rescue SyntaxError, StandardError => e
|
1176
1189
|
warn "Invalid gemspec in [#{file}]: #{e}"
|
1177
1190
|
end
|
1178
1191
|
|
@@ -1191,7 +1204,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1191
1204
|
|
1192
1205
|
def self.normalize_yaml_input(input)
|
1193
1206
|
result = input.respond_to?(:read) ? input.read : input
|
1194
|
-
result = "--- " + result unless result
|
1207
|
+
result = "--- " + result unless result.start_with?("--- ")
|
1195
1208
|
result = result.dup
|
1196
1209
|
result.gsub!(/ !!null \n/, " \n")
|
1197
1210
|
# date: 2011-04-26 00:00:00.000000000Z
|
@@ -1208,7 +1221,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1208
1221
|
# version as well.
|
1209
1222
|
|
1210
1223
|
def self.outdated
|
1211
|
-
outdated_and_latest_version.map {
|
1224
|
+
outdated_and_latest_version.map {|local, _| local.name }
|
1212
1225
|
end
|
1213
1226
|
|
1214
1227
|
##
|
@@ -1229,28 +1242,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1229
1242
|
Gem::Dependency.new local_spec.name, ">= #{local_spec.version}"
|
1230
1243
|
|
1231
1244
|
remotes, = fetcher.search_for_dependency dependency
|
1232
|
-
remotes = remotes.map {
|
1245
|
+
remotes = remotes.map {|n, _| n.version }
|
1233
1246
|
|
1234
1247
|
latest_remote = remotes.sort.last
|
1235
1248
|
|
1236
1249
|
yield [local_spec, latest_remote] if
|
1237
|
-
latest_remote
|
1250
|
+
latest_remote && local_spec.version < latest_remote
|
1238
1251
|
end
|
1239
1252
|
|
1240
1253
|
nil
|
1241
1254
|
end
|
1242
1255
|
|
1243
|
-
##
|
1244
|
-
# Removes +spec+ from the known specs.
|
1245
|
-
|
1246
|
-
def self.remove_spec spec
|
1247
|
-
warn "Gem::Specification.remove_spec is deprecated and will be removed in Rubygems 3.0" unless Gem::Deprecate.skip
|
1248
|
-
_all.delete spec
|
1249
|
-
stubs.delete_if { |s| s.full_name == spec.full_name }
|
1250
|
-
(@@stubs_by_name[spec.name] || []).delete_if { |s| s.full_name == spec.full_name }
|
1251
|
-
reset
|
1252
|
-
end
|
1253
|
-
|
1254
1256
|
##
|
1255
1257
|
# Is +name+ a required attribute?
|
1256
1258
|
|
@@ -1271,60 +1273,100 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1271
1273
|
|
1272
1274
|
def self.reset
|
1273
1275
|
@@dirs = nil
|
1274
|
-
Gem.pre_reset_hooks.each
|
1275
|
-
|
1276
|
-
|
1277
|
-
@@stubs_by_name = {}
|
1278
|
-
@@spec_with_requirable_file = {}
|
1279
|
-
@@active_stub_with_requirable_file = {}
|
1280
|
-
_clear_load_cache
|
1276
|
+
Gem.pre_reset_hooks.each(&:call)
|
1277
|
+
clear_specs
|
1278
|
+
clear_load_cache
|
1281
1279
|
unresolved = unresolved_deps
|
1282
|
-
unless unresolved.empty?
|
1283
|
-
|
1284
|
-
warn "#{w}: Unresolved specs during Gem::Specification.reset:"
|
1280
|
+
unless unresolved.empty?
|
1281
|
+
warn "WARN: Unresolved or ambiguous specs during Gem::Specification.reset:"
|
1285
1282
|
unresolved.values.each do |dep|
|
1286
1283
|
warn " #{dep}"
|
1284
|
+
|
1285
|
+
versions = find_all_by_name(dep.name)
|
1286
|
+
unless versions.empty?
|
1287
|
+
warn " Available/installed versions of this gem:"
|
1288
|
+
versions.each {|s| warn " - #{s.version}" }
|
1289
|
+
end
|
1287
1290
|
end
|
1288
|
-
warn "
|
1291
|
+
warn "WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'"
|
1289
1292
|
warn "Please report a bug if this causes problems."
|
1290
1293
|
unresolved.clear
|
1291
1294
|
end
|
1292
|
-
Gem.post_reset_hooks.each
|
1295
|
+
Gem.post_reset_hooks.each(&:call)
|
1293
1296
|
end
|
1294
1297
|
|
1295
1298
|
# DOC: This method needs documented or nodoc'd
|
1296
1299
|
def self.unresolved_deps
|
1297
|
-
@unresolved_deps ||= Hash.new {
|
1300
|
+
@unresolved_deps ||= Hash.new {|h, n| h[n] = Gem::Dependency.new n }
|
1298
1301
|
end
|
1299
1302
|
|
1300
1303
|
##
|
1301
1304
|
# Load custom marshal format, re-initializing defaults as needed
|
1302
1305
|
|
1303
1306
|
def self._load(str)
|
1304
|
-
|
1307
|
+
Gem.load_yaml
|
1308
|
+
Gem.load_safe_marshal
|
1309
|
+
|
1310
|
+
yaml_set = false
|
1311
|
+
retry_count = 0
|
1312
|
+
|
1313
|
+
array = begin
|
1314
|
+
Gem::SafeMarshal.safe_load str
|
1315
|
+
rescue ArgumentError => e
|
1316
|
+
# Avoid an infinite retry loop when the argument error has nothing to do
|
1317
|
+
# with the classes not being defined.
|
1318
|
+
# 1 retry each allowed in case all 3 of
|
1319
|
+
# - YAML
|
1320
|
+
# - YAML::Syck::DefaultKey
|
1321
|
+
# - YAML::PrivateType
|
1322
|
+
# need to be defined
|
1323
|
+
raise if retry_count >= 3
|
1324
|
+
|
1325
|
+
#
|
1326
|
+
# Some very old marshaled specs included references to `YAML::PrivateType`
|
1327
|
+
# and `YAML::Syck::DefaultKey` constants due to bugs in the old emitter
|
1328
|
+
# that generated them. Workaround the issue by defining the necessary
|
1329
|
+
# constants and retrying.
|
1330
|
+
#
|
1331
|
+
message = e.message
|
1332
|
+
raise unless message.include?("YAML::")
|
1333
|
+
|
1334
|
+
unless Object.const_defined?(:YAML)
|
1335
|
+
Object.const_set "YAML", Psych
|
1336
|
+
yaml_set = true
|
1337
|
+
end
|
1338
|
+
|
1339
|
+
if message.include?("YAML::Syck::")
|
1340
|
+
YAML.const_set "Syck", YAML unless YAML.const_defined?(:Syck)
|
1341
|
+
|
1342
|
+
YAML::Syck.const_set "DefaultKey", Class.new if message.include?("YAML::Syck::DefaultKey") && !YAML::Syck.const_defined?(:DefaultKey)
|
1343
|
+
elsif message.include?("YAML::PrivateType") && !YAML.const_defined?(:PrivateType)
|
1344
|
+
YAML.const_set "PrivateType", Class.new
|
1345
|
+
end
|
1346
|
+
|
1347
|
+
retry_count += 1
|
1348
|
+
retry
|
1349
|
+
ensure
|
1350
|
+
Object.__send__(:remove_const, "YAML") if yaml_set
|
1351
|
+
end
|
1305
1352
|
|
1306
1353
|
spec = Gem::Specification.new
|
1307
1354
|
spec.instance_variable_set :@specification_version, array[1]
|
1308
1355
|
|
1309
1356
|
current_version = CURRENT_SPECIFICATION_VERSION
|
1310
1357
|
|
1311
|
-
field_count = if spec.specification_version > current_version
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1358
|
+
field_count = if spec.specification_version > current_version
|
1359
|
+
spec.instance_variable_set :@specification_version,
|
1360
|
+
current_version
|
1361
|
+
MARSHAL_FIELDS[current_version]
|
1362
|
+
else
|
1363
|
+
MARSHAL_FIELDS[spec.specification_version]
|
1364
|
+
end
|
1318
1365
|
|
1319
|
-
if array.size < field_count
|
1366
|
+
if array.size < field_count
|
1320
1367
|
raise TypeError, "invalid Gem::Specification format #{array.inspect}"
|
1321
1368
|
end
|
1322
1369
|
|
1323
|
-
# Cleanup any YAML::PrivateType. They only show up for an old bug
|
1324
|
-
# where nil => null, so just convert them to nil based on the type.
|
1325
|
-
|
1326
|
-
array.map! { |e| e.kind_of?(YAML::PrivateType) ? nil : e }
|
1327
|
-
|
1328
1370
|
spec.instance_variable_set :@rubygems_version, array[0]
|
1329
1371
|
# spec version
|
1330
1372
|
spec.instance_variable_set :@name, array[2]
|
@@ -1335,7 +1377,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1335
1377
|
spec.instance_variable_set :@required_rubygems_version, array[7]
|
1336
1378
|
spec.instance_variable_set :@original_platform, array[8]
|
1337
1379
|
spec.instance_variable_set :@dependencies, array[9]
|
1338
|
-
|
1380
|
+
# offset due to rubyforge_project removal
|
1339
1381
|
spec.instance_variable_set :@email, array[11]
|
1340
1382
|
spec.instance_variable_set :@authors, array[12]
|
1341
1383
|
spec.instance_variable_set :@description, array[13]
|
@@ -1355,7 +1397,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1355
1397
|
sort_obj <=> other.sort_obj
|
1356
1398
|
end
|
1357
1399
|
|
1358
|
-
def ==
|
1400
|
+
def ==(other) # :nodoc:
|
1359
1401
|
self.class === other &&
|
1360
1402
|
name == other.name &&
|
1361
1403
|
version == other.version &&
|
@@ -1380,7 +1422,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1380
1422
|
@required_rubygems_version,
|
1381
1423
|
@original_platform,
|
1382
1424
|
@dependencies,
|
1383
|
-
|
1425
|
+
"", # rubyforge_project
|
1384
1426
|
@email,
|
1385
1427
|
@authors,
|
1386
1428
|
@description,
|
@@ -1388,7 +1430,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1388
1430
|
true, # has_rdoc
|
1389
1431
|
@new_platform,
|
1390
1432
|
@licenses,
|
1391
|
-
@metadata
|
1433
|
+
@metadata,
|
1392
1434
|
]
|
1393
1435
|
end
|
1394
1436
|
|
@@ -1399,8 +1441,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1399
1441
|
# there are conflicts upon activation.
|
1400
1442
|
|
1401
1443
|
def activate
|
1402
|
-
other = Gem.loaded_specs[
|
1403
|
-
if other
|
1444
|
+
other = Gem.loaded_specs[name]
|
1445
|
+
if other
|
1404
1446
|
check_version_conflict other
|
1405
1447
|
return false
|
1406
1448
|
end
|
@@ -1410,11 +1452,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1410
1452
|
activate_dependencies
|
1411
1453
|
add_self_to_load_path
|
1412
1454
|
|
1413
|
-
Gem.loaded_specs[
|
1455
|
+
Gem.loaded_specs[name] = self
|
1414
1456
|
@activated = true
|
1415
1457
|
@loaded = true
|
1416
1458
|
|
1417
|
-
|
1459
|
+
true
|
1418
1460
|
end
|
1419
1461
|
|
1420
1462
|
##
|
@@ -1425,7 +1467,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1425
1467
|
def activate_dependencies
|
1426
1468
|
unresolved = Gem::Specification.unresolved_deps
|
1427
1469
|
|
1428
|
-
|
1470
|
+
runtime_dependencies.each do |spec_dep|
|
1429
1471
|
if loaded = Gem.loaded_specs[spec_dep.name]
|
1430
1472
|
next if spec_dep.matches_spec? loaded
|
1431
1473
|
|
@@ -1436,9 +1478,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1436
1478
|
raise e
|
1437
1479
|
end
|
1438
1480
|
|
1439
|
-
|
1481
|
+
begin
|
1482
|
+
specs = spec_dep.to_specs
|
1483
|
+
rescue Gem::MissingSpecError => e
|
1484
|
+
raise Gem::MissingSpecError.new(e.name, e.requirement, "at: #{spec_file}")
|
1485
|
+
end
|
1440
1486
|
|
1441
|
-
if specs.size == 1
|
1487
|
+
if specs.size == 1
|
1442
1488
|
specs.first.activate
|
1443
1489
|
else
|
1444
1490
|
name = spec_dep.name
|
@@ -1472,7 +1518,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1472
1518
|
self.summary = sanitize_string(summary)
|
1473
1519
|
self.description = sanitize_string(description)
|
1474
1520
|
self.post_install_message = sanitize_string(post_install_message)
|
1475
|
-
self.authors = authors.collect {
|
1521
|
+
self.authors = authors.collect {|a| sanitize_string(a) }
|
1476
1522
|
end
|
1477
1523
|
|
1478
1524
|
##
|
@@ -1481,16 +1527,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1481
1527
|
def sanitize_string(string)
|
1482
1528
|
return string unless string
|
1483
1529
|
|
1484
|
-
# HACK the #to_s is in here because RSpec has an Array of Arrays of
|
1530
|
+
# HACK: the #to_s is in here because RSpec has an Array of Arrays of
|
1485
1531
|
# Strings for authors. Need a way to disallow bad values on gemspec
|
1486
1532
|
# generation. (Probably won't happen.)
|
1487
|
-
string
|
1488
|
-
|
1489
|
-
begin
|
1490
|
-
Builder::XChar.encode string
|
1491
|
-
rescue NameError, NoMethodError
|
1492
|
-
string.to_xs
|
1493
|
-
end
|
1533
|
+
string.to_s
|
1494
1534
|
end
|
1495
1535
|
|
1496
1536
|
##
|
@@ -1500,13 +1540,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1500
1540
|
def add_bindir(executables)
|
1501
1541
|
return nil if executables.nil?
|
1502
1542
|
|
1503
|
-
if @bindir
|
1504
|
-
Array(executables).map {
|
1543
|
+
if @bindir
|
1544
|
+
Array(executables).map {|e| File.join(@bindir, e) }
|
1505
1545
|
else
|
1506
1546
|
executables
|
1507
1547
|
end
|
1508
|
-
rescue
|
1509
|
-
|
1548
|
+
rescue StandardError
|
1549
|
+
nil
|
1510
1550
|
end
|
1511
1551
|
|
1512
1552
|
##
|
@@ -1514,12 +1554,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1514
1554
|
# +requirements+. Valid types are currently <tt>:runtime</tt> and
|
1515
1555
|
# <tt>:development</tt>.
|
1516
1556
|
|
1517
|
-
def add_dependency_with_type(dependency, type,
|
1518
|
-
requirements = if requirements.empty?
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1557
|
+
def add_dependency_with_type(dependency, type, requirements)
|
1558
|
+
requirements = if requirements.empty?
|
1559
|
+
Gem::Requirement.default
|
1560
|
+
else
|
1561
|
+
requirements.flatten
|
1562
|
+
end
|
1523
1563
|
|
1524
1564
|
unless dependency.respond_to?(:name) &&
|
1525
1565
|
dependency.respond_to?(:requirement)
|
@@ -1531,7 +1571,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1531
1571
|
|
1532
1572
|
private :add_dependency_with_type
|
1533
1573
|
|
1534
|
-
|
1574
|
+
alias_method :add_dependency, :add_runtime_dependency
|
1535
1575
|
|
1536
1576
|
##
|
1537
1577
|
# Adds this spec's require paths to LOAD_PATH, in the proper location.
|
@@ -1541,23 +1581,14 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1541
1581
|
|
1542
1582
|
paths = full_require_paths
|
1543
1583
|
|
1544
|
-
|
1545
|
-
insert_index = Gem.load_path_insert_index
|
1546
|
-
|
1547
|
-
if insert_index then
|
1548
|
-
# gem directories must come after -I and ENV['RUBYLIB']
|
1549
|
-
$LOAD_PATH.insert(insert_index, *paths)
|
1550
|
-
else
|
1551
|
-
# we are probably testing in core, -I and RUBYLIB don't apply
|
1552
|
-
$LOAD_PATH.unshift(*paths)
|
1553
|
-
end
|
1584
|
+
Gem.add_to_load_path(*paths)
|
1554
1585
|
end
|
1555
1586
|
|
1556
1587
|
##
|
1557
1588
|
# Singular reader for #authors. Returns the first author in the list
|
1558
1589
|
|
1559
1590
|
def author
|
1560
|
-
val = authors
|
1591
|
+
(val = authors) && val.first
|
1561
1592
|
end
|
1562
1593
|
|
1563
1594
|
##
|
@@ -1576,13 +1607,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1576
1607
|
# a full path.
|
1577
1608
|
|
1578
1609
|
def bin_dir
|
1579
|
-
@bin_dir ||= File.join gem_dir, bindir
|
1610
|
+
@bin_dir ||= File.join gem_dir, bindir
|
1580
1611
|
end
|
1581
1612
|
|
1582
1613
|
##
|
1583
1614
|
# Returns the full path to an executable named +name+ in this gem.
|
1584
1615
|
|
1585
|
-
def bin_file
|
1616
|
+
def bin_file(name)
|
1586
1617
|
File.join bin_dir, name
|
1587
1618
|
end
|
1588
1619
|
|
@@ -1592,7 +1623,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1592
1623
|
def build_args
|
1593
1624
|
if File.exist? build_info_file
|
1594
1625
|
build_info = File.readlines build_info_file
|
1595
|
-
build_info = build_info.map
|
1626
|
+
build_info = build_info.map(&:strip)
|
1596
1627
|
build_info.delete ""
|
1597
1628
|
build_info
|
1598
1629
|
else
|
@@ -1605,12 +1636,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1605
1636
|
# the gem.build_complete file is missing.
|
1606
1637
|
|
1607
1638
|
def build_extensions # :nodoc:
|
1608
|
-
return if default_gem?
|
1609
1639
|
return if extensions.empty?
|
1610
|
-
return if
|
1640
|
+
return if default_gem?
|
1641
|
+
# we need to fresh build when same name and version of default gems
|
1642
|
+
return if self.class.find_by_full_name(full_name)&.default_gem?
|
1611
1643
|
return if File.exist? gem_build_complete_path
|
1612
|
-
return
|
1613
|
-
return
|
1644
|
+
return unless File.writable?(base_dir)
|
1645
|
+
return unless File.exist?(File.join(base_dir, "extensions"))
|
1614
1646
|
|
1615
1647
|
begin
|
1616
1648
|
# We need to require things in $LOAD_PATH without looking for the
|
@@ -1618,9 +1650,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1618
1650
|
unresolved_deps = Gem::Specification.unresolved_deps.dup
|
1619
1651
|
Gem::Specification.unresolved_deps.clear
|
1620
1652
|
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1653
|
+
require_relative "config_file"
|
1654
|
+
require_relative "ext"
|
1655
|
+
require_relative "user_interaction"
|
1624
1656
|
|
1625
1657
|
ui = Gem::SilentUI.new
|
1626
1658
|
Gem::DefaultUserInteraction.use_ui ui do
|
@@ -1628,7 +1660,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1628
1660
|
builder.build_extensions
|
1629
1661
|
end
|
1630
1662
|
ensure
|
1631
|
-
ui
|
1663
|
+
ui&.close
|
1632
1664
|
Gem::Specification.unresolved_deps.replace unresolved_deps
|
1633
1665
|
end
|
1634
1666
|
end
|
@@ -1648,16 +1680,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1648
1680
|
File.join build_info_dir, "#{full_name}.info"
|
1649
1681
|
end
|
1650
1682
|
|
1651
|
-
##
|
1652
|
-
# Used to detect if the gem is bundled in older version of Ruby, but not
|
1653
|
-
# detectable as default gem (see BasicSpecification#default_gem?).
|
1654
|
-
|
1655
|
-
def bundled_gem_in_old_ruby?
|
1656
|
-
!default_gem? &&
|
1657
|
-
RUBY_VERSION < "2.0.0" &&
|
1658
|
-
summary == "This #{name} is bundled with Ruby"
|
1659
|
-
end
|
1660
|
-
|
1661
1683
|
##
|
1662
1684
|
# Returns the full path to the cache directory containing this
|
1663
1685
|
# spec's cached gem.
|
@@ -1678,12 +1700,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1678
1700
|
|
1679
1701
|
def conflicts
|
1680
1702
|
conflicts = {}
|
1681
|
-
|
1703
|
+
runtime_dependencies.each do |dep|
|
1682
1704
|
spec = Gem.loaded_specs[dep.name]
|
1683
|
-
if spec
|
1705
|
+
if spec && !spec.satisfies_requirement?(dep)
|
1684
1706
|
(conflicts[spec] ||= []) << dep
|
1685
1707
|
end
|
1686
|
-
|
1708
|
+
end
|
1687
1709
|
env_req = Gem.env_requirement(name)
|
1688
1710
|
(conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version
|
1689
1711
|
conflicts
|
@@ -1693,9 +1715,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1693
1715
|
# return true if there will be conflict when spec if loaded together with the list of specs.
|
1694
1716
|
|
1695
1717
|
def conficts_when_loaded_with?(list_of_specs) # :nodoc:
|
1696
|
-
result = list_of_specs.any?
|
1697
|
-
spec.
|
1698
|
-
|
1718
|
+
result = list_of_specs.any? do |spec|
|
1719
|
+
spec.runtime_dependencies.any? {|dep| (dep.name == name) && !satisfies_requirement?(dep) }
|
1720
|
+
end
|
1699
1721
|
result
|
1700
1722
|
end
|
1701
1723
|
|
@@ -1704,28 +1726,29 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1704
1726
|
|
1705
1727
|
def has_conflicts?
|
1706
1728
|
return true unless Gem.env_requirement(name).satisfied_by?(version)
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
end
|
1714
|
-
}
|
1729
|
+
runtime_dependencies.any? do |dep|
|
1730
|
+
spec = Gem.loaded_specs[dep.name]
|
1731
|
+
spec && !spec.satisfies_requirement?(dep)
|
1732
|
+
end
|
1733
|
+
rescue ArgumentError => e
|
1734
|
+
raise e, "#{name} #{version}: #{e.message}"
|
1715
1735
|
end
|
1716
1736
|
|
1717
|
-
|
1718
|
-
#
|
1737
|
+
# The date this gem was created.
|
1738
|
+
#
|
1739
|
+
# If SOURCE_DATE_EPOCH is set as an environment variable, use that to support
|
1740
|
+
# reproducible builds; otherwise, default to the current UTC date.
|
1719
1741
|
#
|
1720
|
-
#
|
1742
|
+
# Details on SOURCE_DATE_EPOCH:
|
1743
|
+
# https://reproducible-builds.org/specs/source-date-epoch/
|
1721
1744
|
|
1722
1745
|
def date
|
1723
|
-
@date ||=
|
1746
|
+
@date ||= Time.utc(*Gem.source_date_epoch.utc.to_a[3..5].reverse)
|
1724
1747
|
end
|
1725
1748
|
|
1726
1749
|
DateLike = Object.new # :nodoc:
|
1727
1750
|
def DateLike.===(obj) # :nodoc:
|
1728
|
-
defined?(::Date)
|
1751
|
+
defined?(::Date) && Date === obj
|
1729
1752
|
end
|
1730
1753
|
|
1731
1754
|
DateTimeFormat = # :nodoc:
|
@@ -1739,19 +1762,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1739
1762
|
#
|
1740
1763
|
# DO NOT set this, it is set automatically when the gem is packaged.
|
1741
1764
|
|
1742
|
-
def date=
|
1765
|
+
def date=(date)
|
1743
1766
|
# We want to end up with a Time object with one-day resolution.
|
1744
1767
|
# This is the cleanest, most-readable, faster-than-using-Date
|
1745
1768
|
# way to do it.
|
1746
1769
|
@date = case date
|
1747
1770
|
when String then
|
1748
|
-
if DateTimeFormat =~ date
|
1749
|
-
Time.utc($1.to_i, $2.to_i, $3.to_i)
|
1750
|
-
|
1751
|
-
# Workaround for where the date format output from psych isn't
|
1752
|
-
# parsed as a Time object by syck and thus comes through as a
|
1753
|
-
# string.
|
1754
|
-
elsif /\A(\d{4})-(\d{2})-(\d{2}) \d{2}:\d{2}:\d{2}\.\d+?Z\z/ =~ date then
|
1771
|
+
if DateTimeFormat =~ date
|
1755
1772
|
Time.utc($1.to_i, $2.to_i, $3.to_i)
|
1756
1773
|
else
|
1757
1774
|
raise(Gem::InvalidSpecificationException,
|
@@ -1761,7 +1778,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1761
1778
|
Time.utc(date.year, date.month, date.day)
|
1762
1779
|
else
|
1763
1780
|
TODAY
|
1764
|
-
|
1781
|
+
end
|
1765
1782
|
end
|
1766
1783
|
|
1767
1784
|
##
|
@@ -1771,20 +1788,21 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1771
1788
|
# executable now. See Gem.bin_path.
|
1772
1789
|
|
1773
1790
|
def default_executable # :nodoc:
|
1774
|
-
if defined?(@default_executable)
|
1791
|
+
if defined?(@default_executable) && @default_executable
|
1775
1792
|
result = @default_executable
|
1776
|
-
elsif @executables
|
1793
|
+
elsif @executables && @executables.size == 1
|
1777
1794
|
result = Array(@executables).first
|
1778
1795
|
else
|
1779
1796
|
result = nil
|
1780
1797
|
end
|
1781
1798
|
result
|
1782
1799
|
end
|
1800
|
+
rubygems_deprecate :default_executable
|
1783
1801
|
|
1784
1802
|
##
|
1785
1803
|
# The default value for specification attribute +name+
|
1786
1804
|
|
1787
|
-
def default_value
|
1805
|
+
def default_value(name)
|
1788
1806
|
@@default_value[name]
|
1789
1807
|
end
|
1790
1808
|
|
@@ -1804,17 +1822,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1804
1822
|
#
|
1805
1823
|
# [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]]
|
1806
1824
|
|
1807
|
-
def dependent_gems
|
1825
|
+
def dependent_gems(check_dev=true)
|
1808
1826
|
out = []
|
1809
1827
|
Gem::Specification.each do |spec|
|
1810
|
-
spec.dependencies
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
out << [spec, dep, sats]
|
1828
|
+
deps = check_dev ? spec.dependencies : spec.runtime_dependencies
|
1829
|
+
deps.each do |dep|
|
1830
|
+
next unless satisfies_requirement?(dep)
|
1831
|
+
sats = []
|
1832
|
+
find_all_satisfiers(dep) do |sat|
|
1833
|
+
sats << sat
|
1817
1834
|
end
|
1835
|
+
out << [spec, dep, sats]
|
1818
1836
|
end
|
1819
1837
|
end
|
1820
1838
|
out
|
@@ -1824,13 +1842,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1824
1842
|
# Returns all specs that matches this spec's runtime dependencies.
|
1825
1843
|
|
1826
1844
|
def dependent_specs
|
1827
|
-
runtime_dependencies.map
|
1845
|
+
runtime_dependencies.map(&:to_specs).flatten
|
1828
1846
|
end
|
1829
1847
|
|
1830
1848
|
##
|
1831
1849
|
# A detailed description of this gem. See also #summary
|
1832
1850
|
|
1833
|
-
def description=
|
1851
|
+
def description=(str)
|
1834
1852
|
@description = str.to_s
|
1835
1853
|
end
|
1836
1854
|
|
@@ -1838,7 +1856,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1838
1856
|
# List of dependencies that are used for development
|
1839
1857
|
|
1840
1858
|
def development_dependencies
|
1841
|
-
dependencies.select {
|
1859
|
+
dependencies.select {|d| d.type == :development }
|
1842
1860
|
end
|
1843
1861
|
|
1844
1862
|
##
|
@@ -1849,30 +1867,30 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1849
1867
|
#
|
1850
1868
|
# spec.doc_dir 'ri' # => "/path/to/gem_repo/doc/a-1/ri"
|
1851
1869
|
|
1852
|
-
def doc_dir
|
1853
|
-
@doc_dir ||= File.join base_dir,
|
1870
|
+
def doc_dir(type = nil)
|
1871
|
+
@doc_dir ||= File.join base_dir, "doc", full_name
|
1854
1872
|
|
1855
|
-
if type
|
1873
|
+
if type
|
1856
1874
|
File.join @doc_dir, type
|
1857
1875
|
else
|
1858
1876
|
@doc_dir
|
1859
1877
|
end
|
1860
1878
|
end
|
1861
1879
|
|
1862
|
-
def encode_with
|
1880
|
+
def encode_with(coder) # :nodoc:
|
1863
1881
|
mark_version
|
1864
1882
|
|
1865
|
-
coder.add
|
1866
|
-
coder.add
|
1883
|
+
coder.add "name", @name
|
1884
|
+
coder.add "version", @version
|
1867
1885
|
platform = case @original_platform
|
1868
|
-
when nil,
|
1869
|
-
|
1886
|
+
when nil, "" then
|
1887
|
+
"ruby"
|
1870
1888
|
when String then
|
1871
1889
|
@original_platform
|
1872
1890
|
else
|
1873
1891
|
@original_platform.to_s
|
1874
|
-
|
1875
|
-
coder.add
|
1892
|
+
end
|
1893
|
+
coder.add "platform", platform
|
1876
1894
|
|
1877
1895
|
attributes = @@attributes.map(&:to_s) - %w[name version platform]
|
1878
1896
|
attributes.each do |name|
|
@@ -1880,7 +1898,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1880
1898
|
end
|
1881
1899
|
end
|
1882
1900
|
|
1883
|
-
def eql?
|
1901
|
+
def eql?(other) # :nodoc:
|
1884
1902
|
self.class === other && same_attributes?(other)
|
1885
1903
|
end
|
1886
1904
|
|
@@ -1888,40 +1906,34 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1888
1906
|
# Singular accessor for #executables
|
1889
1907
|
|
1890
1908
|
def executable
|
1891
|
-
val = executables
|
1909
|
+
(val = executables) && val.first
|
1892
1910
|
end
|
1893
1911
|
|
1894
1912
|
##
|
1895
1913
|
# Singular accessor for #executables
|
1896
1914
|
|
1897
|
-
def executable=o
|
1915
|
+
def executable=(o)
|
1898
1916
|
self.executables = [o]
|
1899
1917
|
end
|
1900
1918
|
|
1901
1919
|
##
|
1902
|
-
# Sets executables to +value+, ensuring it is an array.
|
1903
|
-
# use this, push onto the array instead.
|
1920
|
+
# Sets executables to +value+, ensuring it is an array.
|
1904
1921
|
|
1905
|
-
def executables=
|
1906
|
-
# TODO: warn about setting instead of pushing
|
1922
|
+
def executables=(value)
|
1907
1923
|
@executables = Array(value)
|
1908
1924
|
end
|
1909
1925
|
|
1910
1926
|
##
|
1911
|
-
# Sets extensions to +extensions+, ensuring it is an array.
|
1912
|
-
# use this, push onto the array instead.
|
1927
|
+
# Sets extensions to +extensions+, ensuring it is an array.
|
1913
1928
|
|
1914
|
-
def extensions=
|
1915
|
-
# TODO: warn about setting instead of pushing
|
1929
|
+
def extensions=(extensions)
|
1916
1930
|
@extensions = Array extensions
|
1917
1931
|
end
|
1918
1932
|
|
1919
1933
|
##
|
1920
|
-
# Sets extra_rdoc_files to +files+, ensuring it is an array.
|
1921
|
-
# use this, push onto the array instead.
|
1934
|
+
# Sets extra_rdoc_files to +files+, ensuring it is an array.
|
1922
1935
|
|
1923
|
-
def extra_rdoc_files=
|
1924
|
-
# TODO: warn about setting instead of pushing
|
1936
|
+
def extra_rdoc_files=(files)
|
1925
1937
|
@extra_rdoc_files = Array files
|
1926
1938
|
end
|
1927
1939
|
|
@@ -1937,14 +1949,14 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1937
1949
|
##
|
1938
1950
|
# Sets files to +files+, ensuring it is an array.
|
1939
1951
|
|
1940
|
-
def files=
|
1952
|
+
def files=(files)
|
1941
1953
|
@files = Array files
|
1942
1954
|
end
|
1943
1955
|
|
1944
1956
|
##
|
1945
1957
|
# Finds all gems that satisfy +dep+
|
1946
1958
|
|
1947
|
-
def find_all_satisfiers
|
1959
|
+
def find_all_satisfiers(dep)
|
1948
1960
|
Gem::Specification.each do |spec|
|
1949
1961
|
yield spec if spec.satisfies_requirement? dep
|
1950
1962
|
end
|
@@ -1976,8 +1988,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1976
1988
|
end
|
1977
1989
|
|
1978
1990
|
def gems_dir
|
1979
|
-
|
1980
|
-
@gems_dir ||= File.join(loaded_from && base_dir || Gem.dir, "gems")
|
1991
|
+
@gems_dir ||= File.join(base_dir, "gems")
|
1981
1992
|
end
|
1982
1993
|
|
1983
1994
|
##
|
@@ -1988,44 +1999,61 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1988
1999
|
def has_rdoc # :nodoc:
|
1989
2000
|
true
|
1990
2001
|
end
|
2002
|
+
rubygems_deprecate :has_rdoc
|
1991
2003
|
|
1992
2004
|
##
|
1993
2005
|
# Deprecated and ignored.
|
1994
2006
|
#
|
1995
2007
|
# Formerly used to indicate this gem was RDoc-capable.
|
1996
2008
|
|
1997
|
-
def has_rdoc=
|
2009
|
+
def has_rdoc=(ignored) # :nodoc:
|
1998
2010
|
@has_rdoc = true
|
1999
2011
|
end
|
2012
|
+
rubygems_deprecate :has_rdoc=
|
2000
2013
|
|
2001
|
-
|
2014
|
+
alias_method :has_rdoc?, :has_rdoc # :nodoc:
|
2015
|
+
rubygems_deprecate :has_rdoc?
|
2002
2016
|
|
2003
2017
|
##
|
2004
2018
|
# True if this gem has files in test_files
|
2005
2019
|
|
2006
2020
|
def has_unit_tests? # :nodoc:
|
2007
|
-
|
2021
|
+
!test_files.empty?
|
2008
2022
|
end
|
2009
2023
|
|
2010
2024
|
# :stopdoc:
|
2011
|
-
|
2025
|
+
alias_method :has_test_suite?, :has_unit_tests?
|
2012
2026
|
# :startdoc:
|
2013
2027
|
|
2014
2028
|
def hash # :nodoc:
|
2015
2029
|
name.hash ^ version.hash
|
2016
2030
|
end
|
2017
2031
|
|
2018
|
-
def init_with
|
2032
|
+
def init_with(coder) # :nodoc:
|
2019
2033
|
@installed_by_version ||= nil
|
2020
2034
|
yaml_initialize coder.tag, coder.map
|
2021
2035
|
end
|
2022
2036
|
|
2037
|
+
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
|
2038
|
+
# frozen_string_literal: true
|
2039
|
+
|
2040
|
+
def set_nil_attributes_to_nil
|
2041
|
+
#{@@nil_attributes.map {|key| "@#{key} = nil" }.join "; "}
|
2042
|
+
end
|
2043
|
+
private :set_nil_attributes_to_nil
|
2044
|
+
|
2045
|
+
def set_not_nil_attributes_to_default_values
|
2046
|
+
#{@@non_nil_attributes.map {|key| "@#{key} = #{INITIALIZE_CODE_FOR_DEFAULTS[key]}" }.join ";"}
|
2047
|
+
end
|
2048
|
+
private :set_not_nil_attributes_to_default_values
|
2049
|
+
RUBY
|
2050
|
+
|
2023
2051
|
##
|
2024
2052
|
# Specification constructor. Assigns the default values to the attributes
|
2025
2053
|
# and yields itself for further initialization. Optionally takes +name+ and
|
2026
2054
|
# +version+.
|
2027
2055
|
|
2028
|
-
def initialize
|
2056
|
+
def initialize(name = nil, version = nil)
|
2029
2057
|
super()
|
2030
2058
|
@gems_dir = nil
|
2031
2059
|
@base_dir = nil
|
@@ -2035,35 +2063,32 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2035
2063
|
@original_platform = nil
|
2036
2064
|
@installed_by_version = nil
|
2037
2065
|
|
2038
|
-
|
2039
|
-
|
2040
|
-
end
|
2041
|
-
|
2042
|
-
@@non_nil_attributes.each do |key|
|
2043
|
-
default = default_value(key)
|
2044
|
-
value = Dupable[key] ? default.dup : default
|
2045
|
-
instance_variable_set "@#{key}", value
|
2046
|
-
end
|
2066
|
+
set_nil_attributes_to_nil
|
2067
|
+
set_not_nil_attributes_to_default_values
|
2047
2068
|
|
2048
2069
|
@new_platform = Gem::Platform::RUBY
|
2049
2070
|
|
2050
2071
|
self.name = name if name
|
2051
2072
|
self.version = version if version
|
2052
2073
|
|
2074
|
+
if (platform = Gem.platforms.last) && platform != Gem::Platform::RUBY && platform != Gem::Platform.local
|
2075
|
+
self.platform = platform
|
2076
|
+
end
|
2077
|
+
|
2053
2078
|
yield self if block_given?
|
2054
2079
|
end
|
2055
2080
|
|
2056
2081
|
##
|
2057
2082
|
# Duplicates array_attributes from +other_spec+ so state isn't shared.
|
2058
2083
|
|
2059
|
-
def initialize_copy
|
2084
|
+
def initialize_copy(other_spec)
|
2060
2085
|
self.class.array_attributes.each do |name|
|
2061
2086
|
name = :"@#{name}"
|
2062
2087
|
next unless other_spec.instance_variable_defined? name
|
2063
2088
|
|
2064
2089
|
begin
|
2065
2090
|
val = other_spec.instance_variable_get(name)
|
2066
|
-
if val
|
2091
|
+
if val
|
2067
2092
|
instance_variable_set name, val.dup
|
2068
2093
|
elsif Gem.configuration.really_verbose
|
2069
2094
|
warn "WARNING: #{full_name} has an invalid nil value for #{name}"
|
@@ -2080,11 +2105,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2080
2105
|
|
2081
2106
|
def base_dir
|
2082
2107
|
return Gem.dir unless loaded_from
|
2083
|
-
@base_dir ||= if default_gem?
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2087
|
-
|
2108
|
+
@base_dir ||= if default_gem?
|
2109
|
+
File.dirname File.dirname File.dirname loaded_from
|
2110
|
+
else
|
2111
|
+
File.dirname File.dirname loaded_from
|
2112
|
+
end
|
2088
2113
|
end
|
2089
2114
|
|
2090
2115
|
##
|
@@ -2102,7 +2127,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2102
2127
|
if $DEBUG
|
2103
2128
|
super
|
2104
2129
|
else
|
2105
|
-
"
|
2130
|
+
"#{super[0..-2]} #{full_name}>"
|
2106
2131
|
end
|
2107
2132
|
end
|
2108
2133
|
|
@@ -2152,11 +2177,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2152
2177
|
end
|
2153
2178
|
|
2154
2179
|
##
|
2180
|
+
# Track removed method calls to warn about during build time.
|
2155
2181
|
# Warn about unknown attributes while loading a spec.
|
2156
2182
|
|
2157
2183
|
def method_missing(sym, *a, &b) # :nodoc:
|
2158
|
-
if
|
2159
|
-
|
2184
|
+
if REMOVED_METHODS.include?(sym)
|
2185
|
+
removed_method_calls << sym
|
2186
|
+
return
|
2187
|
+
end
|
2188
|
+
|
2189
|
+
if @specification_version > CURRENT_SPECIFICATION_VERSION &&
|
2190
|
+
sym.to_s.end_with?("=")
|
2160
2191
|
warn "ignoring #{sym} loading #{full_name}" if $DEBUG
|
2161
2192
|
else
|
2162
2193
|
super
|
@@ -2168,9 +2199,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2168
2199
|
# probably want to build_extensions
|
2169
2200
|
|
2170
2201
|
def missing_extensions?
|
2171
|
-
return false if default_gem?
|
2172
2202
|
return false if extensions.empty?
|
2173
|
-
return false if
|
2203
|
+
return false if default_gem?
|
2174
2204
|
return false if File.exist? gem_build_complete_path
|
2175
2205
|
|
2176
2206
|
true
|
@@ -2183,7 +2213,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2183
2213
|
# file list.
|
2184
2214
|
|
2185
2215
|
def normalize
|
2186
|
-
if defined?(@extra_rdoc_files)
|
2216
|
+
if defined?(@extra_rdoc_files) && @extra_rdoc_files
|
2187
2217
|
@extra_rdoc_files.uniq!
|
2188
2218
|
@files ||= []
|
2189
2219
|
@files.concat(@extra_rdoc_files)
|
@@ -2208,7 +2238,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2208
2238
|
# platform. For use with legacy gems.
|
2209
2239
|
|
2210
2240
|
def original_name # :nodoc:
|
2211
|
-
if platform == Gem::Platform::RUBY
|
2241
|
+
if platform == Gem::Platform::RUBY || platform.nil?
|
2212
2242
|
"#{@name}-#{@version}"
|
2213
2243
|
else
|
2214
2244
|
"#{@name}-#{@version}-#{@original_platform}"
|
@@ -2226,11 +2256,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2226
2256
|
# The platform this gem runs on. See Gem::Platform for details.
|
2227
2257
|
|
2228
2258
|
def platform
|
2229
|
-
@new_platform ||= Gem::Platform::RUBY
|
2259
|
+
@new_platform ||= Gem::Platform::RUBY # rubocop:disable Naming/MemoizedInstanceVariableName
|
2230
2260
|
end
|
2231
2261
|
|
2232
2262
|
def pretty_print(q) # :nodoc:
|
2233
|
-
q.group 2,
|
2263
|
+
q.group 2, "Gem::Specification.new do |s|", "end" do
|
2234
2264
|
q.breakable
|
2235
2265
|
|
2236
2266
|
attributes = @@attributes - [:name, :version]
|
@@ -2239,22 +2269,22 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2239
2269
|
attributes.unshift :name
|
2240
2270
|
|
2241
2271
|
attributes.each do |attr_name|
|
2242
|
-
current_value =
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2246
|
-
q.text "s.#{attr_name} = "
|
2272
|
+
current_value = send attr_name
|
2273
|
+
current_value = current_value.sort if [:files, :test_files].include? attr_name
|
2274
|
+
next unless current_value != default_value(attr_name) ||
|
2275
|
+
self.class.required_attribute?(attr_name)
|
2247
2276
|
|
2248
|
-
|
2249
|
-
current_value = current_value.utc
|
2277
|
+
q.text "s.#{attr_name} = "
|
2250
2278
|
|
2251
|
-
|
2252
|
-
|
2253
|
-
q.pp current_value
|
2254
|
-
end
|
2279
|
+
if attr_name == :date
|
2280
|
+
current_value = current_value.utc
|
2255
2281
|
|
2256
|
-
q.
|
2282
|
+
q.text "Time.utc(#{current_value.year}, #{current_value.month}, #{current_value.day})"
|
2283
|
+
else
|
2284
|
+
q.pp current_value
|
2257
2285
|
end
|
2286
|
+
|
2287
|
+
q.breakable
|
2258
2288
|
end
|
2259
2289
|
end
|
2260
2290
|
end
|
@@ -2263,8 +2293,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2263
2293
|
# Raise an exception if the version of this spec conflicts with the one
|
2264
2294
|
# that is already loaded (+other+)
|
2265
2295
|
|
2266
|
-
def check_version_conflict
|
2267
|
-
return if
|
2296
|
+
def check_version_conflict(other) # :nodoc:
|
2297
|
+
return if version == other.version
|
2268
2298
|
|
2269
2299
|
# This gem is already loaded. If the currently loaded gem is not in the
|
2270
2300
|
# list of candidate gems, then we have a version conflict.
|
@@ -2272,8 +2302,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2272
2302
|
msg = "can't activate #{full_name}, already activated #{other.full_name}"
|
2273
2303
|
|
2274
2304
|
e = Gem::LoadError.new msg
|
2275
|
-
e.name =
|
2276
|
-
# TODO: e.requirement = dep.requirement
|
2305
|
+
e.name = name
|
2277
2306
|
|
2278
2307
|
raise e
|
2279
2308
|
end
|
@@ -2284,17 +2313,15 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2284
2313
|
# Check the spec for possible conflicts and freak out if there are any.
|
2285
2314
|
|
2286
2315
|
def raise_if_conflicts # :nodoc:
|
2287
|
-
if has_conflicts?
|
2316
|
+
if has_conflicts?
|
2288
2317
|
raise Gem::ConflictError.new self, conflicts
|
2289
2318
|
end
|
2290
2319
|
end
|
2291
2320
|
|
2292
2321
|
##
|
2293
|
-
# Sets rdoc_options to +value+, ensuring it is an array.
|
2294
|
-
# use this, push onto the array instead.
|
2322
|
+
# Sets rdoc_options to +value+, ensuring it is an array.
|
2295
2323
|
|
2296
|
-
def rdoc_options=
|
2297
|
-
# TODO: warn about setting instead of pushing
|
2324
|
+
def rdoc_options=(options)
|
2298
2325
|
@rdoc_options = Array options
|
2299
2326
|
end
|
2300
2327
|
|
@@ -2302,26 +2329,24 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2302
2329
|
# Singular accessor for #require_paths
|
2303
2330
|
|
2304
2331
|
def require_path
|
2305
|
-
val = require_paths
|
2332
|
+
(val = require_paths) && val.first
|
2306
2333
|
end
|
2307
2334
|
|
2308
2335
|
##
|
2309
2336
|
# Singular accessor for #require_paths
|
2310
2337
|
|
2311
|
-
def require_path=
|
2338
|
+
def require_path=(path)
|
2312
2339
|
self.require_paths = Array(path)
|
2313
2340
|
end
|
2314
2341
|
|
2315
2342
|
##
|
2316
|
-
# Set requirements to +req+, ensuring it is an array.
|
2317
|
-
# use this, push onto the array instead.
|
2343
|
+
# Set requirements to +req+, ensuring it is an array.
|
2318
2344
|
|
2319
|
-
def requirements=
|
2320
|
-
# TODO: warn about setting instead of pushing
|
2345
|
+
def requirements=(req)
|
2321
2346
|
@requirements = Array req
|
2322
2347
|
end
|
2323
2348
|
|
2324
|
-
def respond_to_missing?
|
2349
|
+
def respond_to_missing?(m, include_private = false) # :nodoc:
|
2325
2350
|
false
|
2326
2351
|
end
|
2327
2352
|
|
@@ -2329,7 +2354,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2329
2354
|
# Returns the full path to this spec's ri directory.
|
2330
2355
|
|
2331
2356
|
def ri_dir
|
2332
|
-
@ri_dir ||= File.join base_dir,
|
2357
|
+
@ri_dir ||= File.join base_dir, "ri", full_name
|
2333
2358
|
end
|
2334
2359
|
|
2335
2360
|
##
|
@@ -2338,18 +2363,18 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2338
2363
|
|
2339
2364
|
def ruby_code(obj)
|
2340
2365
|
case obj
|
2341
|
-
when String
|
2342
|
-
when Array
|
2343
|
-
when Hash
|
2344
|
-
seg = obj.keys.sort.map {
|
2345
|
-
"{ #{seg.join(
|
2346
|
-
when Gem::Version
|
2347
|
-
when DateLike
|
2348
|
-
when Time
|
2349
|
-
when Numeric
|
2350
|
-
when true, false, nil
|
2351
|
-
when Gem::Platform
|
2352
|
-
when Gem::Requirement
|
2366
|
+
when String then obj.dump + ".freeze"
|
2367
|
+
when Array then "[" + obj.map {|x| ruby_code x }.join(", ") + "]"
|
2368
|
+
when Hash then
|
2369
|
+
seg = obj.keys.sort.map {|k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
|
2370
|
+
"{ #{seg.join(", ")} }"
|
2371
|
+
when Gem::Version then ruby_code(obj.to_s)
|
2372
|
+
when DateLike then obj.strftime("%Y-%m-%d").dump
|
2373
|
+
when Time then obj.strftime("%Y-%m-%d").dump
|
2374
|
+
when Numeric then obj.inspect
|
2375
|
+
when true, false, nil then obj.inspect
|
2376
|
+
when Gem::Platform then "Gem::Platform.new(#{ruby_code obj.to_a})"
|
2377
|
+
when Gem::Requirement then
|
2353
2378
|
list = obj.as_list
|
2354
2379
|
"Gem::Requirement.new(#{ruby_code(list.size == 1 ? obj.to_s : list)})"
|
2355
2380
|
else raise Gem::Exception, "ruby_code case not handled: #{obj.class}"
|
@@ -2368,8 +2393,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2368
2393
|
##
|
2369
2394
|
# True if this gem has the same attributes as +other+.
|
2370
2395
|
|
2371
|
-
def same_attributes?
|
2372
|
-
@@attributes.all? {
|
2396
|
+
def same_attributes?(spec)
|
2397
|
+
@@attributes.all? {|name, _default| send(name) == spec.send(name) }
|
2373
2398
|
end
|
2374
2399
|
|
2375
2400
|
private :same_attributes?
|
@@ -2377,8 +2402,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2377
2402
|
##
|
2378
2403
|
# Checks if this specification meets the requirement of +dependency+.
|
2379
2404
|
|
2380
|
-
def satisfies_requirement?
|
2381
|
-
|
2405
|
+
def satisfies_requirement?(dependency)
|
2406
|
+
@name == dependency.name &&
|
2382
2407
|
dependency.requirement.satisfied_by?(@version)
|
2383
2408
|
end
|
2384
2409
|
|
@@ -2386,7 +2411,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2386
2411
|
# Returns an object you can use to sort specifications in #sort_by.
|
2387
2412
|
|
2388
2413
|
def sort_obj
|
2389
|
-
[@name, @version,
|
2414
|
+
[@name, @version, Gem::Platform.sort_priority(@new_platform)]
|
2390
2415
|
end
|
2391
2416
|
|
2392
2417
|
##
|
@@ -2424,7 +2449,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2424
2449
|
##
|
2425
2450
|
# A short summary of this gem's description.
|
2426
2451
|
|
2427
|
-
def summary=
|
2452
|
+
def summary=(str)
|
2428
2453
|
@summary = str.to_s.strip.
|
2429
2454
|
gsub(/(\w-)\n[ \t]*(\w)/, '\1\2').gsub(/\n[ \t]*/, " ") # so. weird.
|
2430
2455
|
end
|
@@ -2433,13 +2458,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2433
2458
|
# Singular accessor for #test_files
|
2434
2459
|
|
2435
2460
|
def test_file # :nodoc:
|
2436
|
-
val = test_files
|
2461
|
+
(val = test_files) && val.first
|
2437
2462
|
end
|
2438
2463
|
|
2439
2464
|
##
|
2440
2465
|
# Singular mutator for #test_files
|
2441
2466
|
|
2442
|
-
def test_file=
|
2467
|
+
def test_file=(file) # :nodoc:
|
2443
2468
|
self.test_files = [file]
|
2444
2469
|
end
|
2445
2470
|
|
@@ -2451,11 +2476,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2451
2476
|
# Handle the possibility that we have @test_suite_file but not
|
2452
2477
|
# @test_files. This will happen when an old gem is loaded via
|
2453
2478
|
# YAML.
|
2454
|
-
if defined? @test_suite_file
|
2479
|
+
if defined? @test_suite_file
|
2455
2480
|
@test_files = [@test_suite_file].flatten
|
2456
2481
|
@test_suite_file = nil
|
2457
2482
|
end
|
2458
|
-
if defined?(@test_files)
|
2483
|
+
if defined?(@test_files) && @test_files
|
2459
2484
|
@test_files
|
2460
2485
|
else
|
2461
2486
|
@test_files = []
|
@@ -2479,13 +2504,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2479
2504
|
|
2480
2505
|
result << " s.name = #{ruby_code name}"
|
2481
2506
|
result << " s.version = #{ruby_code version}"
|
2482
|
-
unless platform.nil?
|
2507
|
+
unless platform.nil? || platform == Gem::Platform::RUBY
|
2483
2508
|
result << " s.platform = #{ruby_code original_platform}"
|
2484
2509
|
end
|
2485
2510
|
result << ""
|
2486
2511
|
result << " s.required_rubygems_version = #{ruby_code required_rubygems_version} if s.respond_to? :required_rubygems_version="
|
2487
2512
|
|
2488
|
-
if metadata
|
2513
|
+
if metadata && !metadata.empty?
|
2489
2514
|
result << " s.metadata = #{ruby_code metadata} if s.respond_to? :metadata="
|
2490
2515
|
end
|
2491
2516
|
result << " s.require_paths = #{ruby_code raw_require_paths}"
|
@@ -2500,52 +2525,36 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2500
2525
|
:version,
|
2501
2526
|
:has_rdoc,
|
2502
2527
|
:default_executable,
|
2503
|
-
:metadata
|
2528
|
+
:metadata,
|
2529
|
+
:signing_key,
|
2504
2530
|
]
|
2505
2531
|
|
2506
2532
|
@@attributes.each do |attr_name|
|
2507
2533
|
next if handled.include? attr_name
|
2508
|
-
current_value =
|
2509
|
-
if current_value != default_value(attr_name)
|
2510
|
-
self.class.required_attribute? attr_name then
|
2534
|
+
current_value = send(attr_name)
|
2535
|
+
if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name)
|
2511
2536
|
result << " s.#{attr_name} = #{ruby_code current_value}"
|
2512
2537
|
end
|
2513
2538
|
end
|
2514
2539
|
|
2515
|
-
if
|
2540
|
+
if String === signing_key
|
2541
|
+
result << " s.signing_key = #{ruby_code signing_key}"
|
2542
|
+
end
|
2543
|
+
|
2544
|
+
if @installed_by_version
|
2516
2545
|
result << nil
|
2517
|
-
result << " s.installed_by_version =
|
2546
|
+
result << " s.installed_by_version = #{ruby_code Gem::VERSION} if s.respond_to? :installed_by_version"
|
2518
2547
|
end
|
2519
2548
|
|
2520
|
-
unless dependencies.empty?
|
2549
|
+
unless dependencies.empty?
|
2521
2550
|
result << nil
|
2522
|
-
result << "
|
2523
|
-
result << " s.specification_version = #{specification_version}"
|
2551
|
+
result << " s.specification_version = #{specification_version}"
|
2524
2552
|
result << nil
|
2525
2553
|
|
2526
|
-
result << " if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then"
|
2527
|
-
|
2528
2554
|
dependencies.each do |dep|
|
2529
|
-
req = dep.requirements_list.inspect
|
2530
2555
|
dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
|
2531
|
-
result << "
|
2532
|
-
end
|
2533
|
-
|
2534
|
-
result << " else"
|
2535
|
-
|
2536
|
-
dependencies.each do |dep|
|
2537
|
-
version_reqs_param = dep.requirements_list.inspect
|
2538
|
-
result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})"
|
2539
|
-
end
|
2540
|
-
|
2541
|
-
result << ' end'
|
2542
|
-
|
2543
|
-
result << " else"
|
2544
|
-
dependencies.each do |dep|
|
2545
|
-
version_reqs_param = dep.requirements_list.inspect
|
2546
|
-
result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})"
|
2556
|
+
result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{ruby_code dep.requirements_list})"
|
2547
2557
|
end
|
2548
|
-
result << " end"
|
2549
2558
|
end
|
2550
2559
|
|
2551
2560
|
result << "end"
|
@@ -2576,45 +2585,38 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2576
2585
|
end
|
2577
2586
|
|
2578
2587
|
def to_yaml(opts = {}) # :nodoc:
|
2579
|
-
|
2580
|
-
(defined?(Psych) && YAML == Psych) then
|
2581
|
-
# Because the user can switch the YAML engine behind our
|
2582
|
-
# back, we have to check again here to make sure that our
|
2583
|
-
# psych code was properly loaded, and load it if not.
|
2584
|
-
unless Gem.const_defined?(:NoAliasYAMLTree)
|
2585
|
-
require 'rubygems/psych_tree'
|
2586
|
-
end
|
2588
|
+
Gem.load_yaml
|
2587
2589
|
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2590
|
+
# Because the user can switch the YAML engine behind our
|
2591
|
+
# back, we have to check again here to make sure that our
|
2592
|
+
# psych code was properly loaded, and load it if not.
|
2593
|
+
unless Gem.const_defined?(:NoAliasYAMLTree)
|
2594
|
+
require_relative "psych_tree"
|
2595
|
+
end
|
2591
2596
|
|
2592
|
-
|
2593
|
-
|
2597
|
+
builder = Gem::NoAliasYAMLTree.create
|
2598
|
+
builder << self
|
2599
|
+
ast = builder.tree
|
2594
2600
|
|
2595
|
-
|
2601
|
+
require "stringio"
|
2602
|
+
io = StringIO.new
|
2603
|
+
io.set_encoding Encoding::UTF_8
|
2596
2604
|
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
out.map taguri, to_yaml_style do |map|
|
2601
|
-
encode_with map
|
2602
|
-
end
|
2603
|
-
end
|
2604
|
-
end
|
2605
|
+
Psych::Visitors::Emitter.new(io).accept(ast)
|
2606
|
+
|
2607
|
+
io.string.gsub(/ !!null \n/, " \n")
|
2605
2608
|
end
|
2606
2609
|
|
2607
2610
|
##
|
2608
2611
|
# Recursively walk dependencies of this spec, executing the +block+ for each
|
2609
2612
|
# hop.
|
2610
2613
|
|
2611
|
-
def traverse
|
2614
|
+
def traverse(trail = [], visited = {}, &block)
|
2612
2615
|
trail.push(self)
|
2613
2616
|
begin
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2617
|
-
next if visited.has_key?(dep_spec)
|
2617
|
+
runtime_dependencies.each do |dep|
|
2618
|
+
dep.matching_specs(true).each do |dep_spec|
|
2619
|
+
next if visited.key?(dep_spec)
|
2618
2620
|
visited[dep_spec] = true
|
2619
2621
|
trail.push(dep_spec)
|
2620
2622
|
begin
|
@@ -2622,11 +2624,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2622
2624
|
ensure
|
2623
2625
|
trail.pop
|
2624
2626
|
end
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
end
|
2627
|
+
next if result == :next
|
2628
|
+
spec_name = dep_spec.name
|
2629
|
+
dep_spec.traverse(trail, visited, &block) unless
|
2630
|
+
trail.any? {|s| s.name == spec_name }
|
2630
2631
|
end
|
2631
2632
|
end
|
2632
2633
|
ensure
|
@@ -2641,317 +2642,45 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2641
2642
|
# Raises InvalidSpecificationException if the spec does not pass the
|
2642
2643
|
# checks..
|
2643
2644
|
|
2644
|
-
def validate
|
2645
|
-
@warnings = 0
|
2646
|
-
require 'rubygems/user_interaction'
|
2647
|
-
extend Gem::UserInteraction
|
2645
|
+
def validate(packaging = true, strict = false)
|
2648
2646
|
normalize
|
2649
2647
|
|
2650
|
-
|
2651
|
-
|
2652
|
-
|
2653
|
-
|
2654
|
-
unless nil_attributes.empty? then
|
2655
|
-
raise Gem::InvalidSpecificationException,
|
2656
|
-
"#{nil_attributes.join ', '} must not be nil"
|
2657
|
-
end
|
2658
|
-
|
2659
|
-
if packaging and rubygems_version != Gem::VERSION then
|
2660
|
-
raise Gem::InvalidSpecificationException,
|
2661
|
-
"expected RubyGems version #{Gem::VERSION}, was #{rubygems_version}"
|
2662
|
-
end
|
2663
|
-
|
2664
|
-
@@required_attributes.each do |symbol|
|
2665
|
-
unless self.send symbol then
|
2666
|
-
raise Gem::InvalidSpecificationException,
|
2667
|
-
"missing value for attribute #{symbol}"
|
2668
|
-
end
|
2669
|
-
end
|
2670
|
-
|
2671
|
-
unless String === name then
|
2672
|
-
raise Gem::InvalidSpecificationException,
|
2673
|
-
"invalid value for attribute name: \"#{name.inspect}\""
|
2674
|
-
end
|
2675
|
-
|
2676
|
-
if raw_require_paths.empty? then
|
2677
|
-
raise Gem::InvalidSpecificationException,
|
2678
|
-
'specification must have at least one require_path'
|
2679
|
-
end
|
2680
|
-
|
2681
|
-
@files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
|
2682
|
-
@test_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
|
2683
|
-
@executables.delete_if { |x| File.directory?(File.join(@bindir, x)) }
|
2684
|
-
@extra_rdoc_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
|
2685
|
-
@extensions.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
|
2686
|
-
|
2687
|
-
non_files = files.reject { |x| File.file?(x) || File.symlink?(x) }
|
2688
|
-
|
2689
|
-
unless not packaging or non_files.empty? then
|
2690
|
-
raise Gem::InvalidSpecificationException,
|
2691
|
-
"[\"#{non_files.join "\", \""}\"] are not files"
|
2692
|
-
end
|
2693
|
-
|
2694
|
-
if files.include? file_name then
|
2695
|
-
raise Gem::InvalidSpecificationException,
|
2696
|
-
"#{full_name} contains itself (#{file_name}), check your files list"
|
2697
|
-
end
|
2698
|
-
|
2699
|
-
unless specification_version.is_a?(Fixnum)
|
2700
|
-
raise Gem::InvalidSpecificationException,
|
2701
|
-
'specification_version must be a Fixnum (did you mean version?)'
|
2702
|
-
end
|
2703
|
-
|
2704
|
-
case platform
|
2705
|
-
when Gem::Platform, Gem::Platform::RUBY then # ok
|
2706
|
-
else
|
2707
|
-
raise Gem::InvalidSpecificationException,
|
2708
|
-
"invalid platform #{platform.inspect}, see Gem::Platform"
|
2709
|
-
end
|
2710
|
-
|
2711
|
-
self.class.array_attributes.each do |field|
|
2712
|
-
val = self.send field
|
2713
|
-
klass = case field
|
2714
|
-
when :dependencies
|
2715
|
-
Gem::Dependency
|
2716
|
-
else
|
2717
|
-
String
|
2718
|
-
end
|
2719
|
-
|
2720
|
-
unless Array === val and val.all? { |x| x.kind_of?(klass) } then
|
2721
|
-
raise(Gem::InvalidSpecificationException,
|
2722
|
-
"#{field} must be an Array of #{klass}")
|
2723
|
-
end
|
2724
|
-
end
|
2725
|
-
|
2726
|
-
[:authors].each do |field|
|
2727
|
-
val = self.send field
|
2728
|
-
raise Gem::InvalidSpecificationException, "#{field} may not be empty" if
|
2729
|
-
val.empty?
|
2730
|
-
end
|
2731
|
-
|
2732
|
-
unless Hash === metadata
|
2733
|
-
raise Gem::InvalidSpecificationException,
|
2734
|
-
'metadata must be a hash'
|
2735
|
-
end
|
2736
|
-
|
2737
|
-
metadata.keys.each do |k|
|
2738
|
-
if !k.kind_of?(String)
|
2739
|
-
raise Gem::InvalidSpecificationException,
|
2740
|
-
'metadata keys must be a String'
|
2741
|
-
end
|
2742
|
-
|
2743
|
-
if k.size > 128
|
2744
|
-
raise Gem::InvalidSpecificationException,
|
2745
|
-
"metadata key too large (#{k.size} > 128)"
|
2746
|
-
end
|
2747
|
-
end
|
2748
|
-
|
2749
|
-
metadata.values.each do |k|
|
2750
|
-
if !k.kind_of?(String)
|
2751
|
-
raise Gem::InvalidSpecificationException,
|
2752
|
-
'metadata values must be a String'
|
2753
|
-
end
|
2754
|
-
|
2755
|
-
if k.size > 1024
|
2756
|
-
raise Gem::InvalidSpecificationException,
|
2757
|
-
"metadata value too large (#{k.size} > 1024)"
|
2758
|
-
end
|
2759
|
-
end
|
2760
|
-
|
2761
|
-
licenses.each { |license|
|
2762
|
-
if license.length > 64
|
2763
|
-
raise Gem::InvalidSpecificationException,
|
2764
|
-
"each license must be 64 characters or less"
|
2765
|
-
end
|
2766
|
-
|
2767
|
-
if !Gem::Licenses.match?(license)
|
2768
|
-
suggestions = Gem::Licenses.suggestions(license)
|
2769
|
-
message = <<-warning
|
2770
|
-
license value '#{license}' is invalid. Use a license identifier from
|
2771
|
-
http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license.
|
2772
|
-
warning
|
2773
|
-
message += "Did you mean #{suggestions.map { |s| "'#{s}'"}.join(', ')}?\n" unless suggestions.nil?
|
2774
|
-
warning(message)
|
2775
|
-
end
|
2776
|
-
}
|
2777
|
-
|
2778
|
-
warning <<-warning if licenses.empty?
|
2779
|
-
licenses is empty, but is recommended. Use a license identifier from
|
2780
|
-
http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license.
|
2781
|
-
warning
|
2782
|
-
|
2783
|
-
validate_permissions
|
2784
|
-
|
2785
|
-
# reject lazy developers:
|
2786
|
-
|
2787
|
-
lazy = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, '')
|
2788
|
-
|
2789
|
-
unless authors.grep(/FI XME|TO DO/x).empty? then
|
2790
|
-
raise Gem::InvalidSpecificationException, "#{lazy} is not an author"
|
2791
|
-
end
|
2792
|
-
|
2793
|
-
unless Array(email).grep(/FI XME|TO DO/x).empty? then
|
2794
|
-
raise Gem::InvalidSpecificationException, "#{lazy} is not an email"
|
2795
|
-
end
|
2796
|
-
|
2797
|
-
if description =~ /FI XME|TO DO/x then
|
2798
|
-
raise Gem::InvalidSpecificationException, "#{lazy} is not a description"
|
2799
|
-
end
|
2800
|
-
|
2801
|
-
if summary =~ /FI XME|TO DO/x then
|
2802
|
-
raise Gem::InvalidSpecificationException, "#{lazy} is not a summary"
|
2803
|
-
end
|
2804
|
-
|
2805
|
-
if homepage and not homepage.empty? and
|
2806
|
-
homepage !~ /\A[a-z][a-z\d+.-]*:/i then
|
2807
|
-
raise Gem::InvalidSpecificationException,
|
2808
|
-
"\"#{homepage}\" is not a URI"
|
2809
|
-
end
|
2810
|
-
|
2811
|
-
# Warnings
|
2812
|
-
|
2813
|
-
%w[author email homepage summary].each do |attribute|
|
2814
|
-
value = self.send attribute
|
2815
|
-
warning "no #{attribute} specified" if value.nil? or value.empty?
|
2816
|
-
end
|
2817
|
-
|
2818
|
-
if description == summary then
|
2819
|
-
warning 'description and summary are identical'
|
2820
|
-
end
|
2821
|
-
|
2822
|
-
# TODO: raise at some given date
|
2823
|
-
warning "deprecated autorequire specified" if autorequire
|
2824
|
-
|
2825
|
-
executables.each do |executable|
|
2826
|
-
executable_path = File.join(bindir, executable)
|
2827
|
-
shebang = File.read(executable_path, 2) == '#!'
|
2828
|
-
|
2829
|
-
warning "#{executable_path} is missing #! line" unless shebang
|
2830
|
-
end
|
2831
|
-
|
2832
|
-
files.each do |file|
|
2833
|
-
next unless File.symlink?(file)
|
2834
|
-
warning "#{file} is a symlink, which is not supported on all platforms"
|
2835
|
-
end
|
2836
|
-
|
2837
|
-
validate_dependencies
|
2838
|
-
|
2839
|
-
true
|
2840
|
-
ensure
|
2841
|
-
if $! or @warnings > 0 then
|
2842
|
-
alert_warning "See http://guides.rubygems.org/specification-reference/ for help"
|
2843
|
-
end
|
2648
|
+
validation_policy = Gem::SpecificationPolicy.new(self)
|
2649
|
+
validation_policy.packaging = packaging
|
2650
|
+
validation_policy.validate(strict)
|
2844
2651
|
end
|
2845
2652
|
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
seen = Gem::Dependency::TYPES.inject({}) { |types, type| types.merge({ type => {}}) }
|
2854
|
-
|
2855
|
-
error_messages = []
|
2856
|
-
warning_messages = []
|
2857
|
-
dependencies.each do |dep|
|
2858
|
-
if prev = seen[dep.type][dep.name] then
|
2859
|
-
error_messages << <<-MESSAGE
|
2860
|
-
duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
2861
|
-
add_#{dep.type}_dependency '#{dep.name}', '#{dep.requirement}', '#{prev.requirement}'
|
2862
|
-
MESSAGE
|
2863
|
-
end
|
2864
|
-
|
2865
|
-
seen[dep.type][dep.name] = dep
|
2866
|
-
|
2867
|
-
prerelease_dep = dep.requirements_list.any? do |req|
|
2868
|
-
Gem::Requirement.new(req).prerelease?
|
2869
|
-
end
|
2870
|
-
|
2871
|
-
warning_messages << "prerelease dependency on #{dep} is not recommended" if
|
2872
|
-
prerelease_dep && !version.prerelease?
|
2873
|
-
|
2874
|
-
overly_strict = dep.requirement.requirements.length == 1 &&
|
2875
|
-
dep.requirement.requirements.any? do |op, version|
|
2876
|
-
op == '~>' and
|
2877
|
-
not version.prerelease? and
|
2878
|
-
version.segments.length > 2 and
|
2879
|
-
version.segments.first != 0
|
2880
|
-
end
|
2881
|
-
|
2882
|
-
if overly_strict then
|
2883
|
-
_, dep_version = dep.requirement.requirements.first
|
2884
|
-
|
2885
|
-
base = dep_version.segments.first 2
|
2886
|
-
|
2887
|
-
warning_messages << <<-WARNING
|
2888
|
-
pessimistic dependency on #{dep} may be overly strict
|
2889
|
-
if #{dep.name} is semantically versioned, use:
|
2890
|
-
add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}', '>= #{dep_version}'
|
2891
|
-
WARNING
|
2892
|
-
end
|
2893
|
-
|
2894
|
-
open_ended = dep.requirement.requirements.all? do |op, version|
|
2895
|
-
not version.prerelease? and (op == '>' or op == '>=')
|
2896
|
-
end
|
2897
|
-
|
2898
|
-
if open_ended then
|
2899
|
-
op, dep_version = dep.requirement.requirements.first
|
2900
|
-
|
2901
|
-
base = dep_version.segments.first 2
|
2902
|
-
|
2903
|
-
bugfix = if op == '>' then
|
2904
|
-
", '> #{dep_version}'"
|
2905
|
-
elsif op == '>=' and base != dep_version.segments then
|
2906
|
-
", '>= #{dep_version}'"
|
2907
|
-
end
|
2653
|
+
def keep_only_files_and_directories
|
2654
|
+
@executables.delete_if {|x| File.directory?(File.join(@bindir, x)) }
|
2655
|
+
@extensions.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2656
|
+
@extra_rdoc_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2657
|
+
@files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2658
|
+
@test_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
|
2659
|
+
end
|
2908
2660
|
|
2909
|
-
|
2910
|
-
|
2911
|
-
if #{dep.name} is semantically versioned, use:
|
2912
|
-
add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}'#{bugfix}
|
2913
|
-
WARNING
|
2914
|
-
end
|
2915
|
-
end
|
2916
|
-
if error_messages.any?
|
2917
|
-
raise Gem::InvalidSpecificationException, error_messages.join
|
2918
|
-
end
|
2919
|
-
if warning_messages.any?
|
2920
|
-
warning_messages.each { |warning_message| warning warning_message }
|
2921
|
-
end
|
2661
|
+
def validate_metadata
|
2662
|
+
Gem::SpecificationPolicy.new(self).validate_metadata
|
2922
2663
|
end
|
2664
|
+
rubygems_deprecate :validate_metadata
|
2923
2665
|
|
2924
|
-
|
2925
|
-
|
2666
|
+
def validate_dependencies
|
2667
|
+
Gem::SpecificationPolicy.new(self).validate_dependencies
|
2668
|
+
end
|
2669
|
+
rubygems_deprecate :validate_dependencies
|
2926
2670
|
|
2927
2671
|
def validate_permissions
|
2928
|
-
|
2929
|
-
|
2930
|
-
files.each do |file|
|
2931
|
-
next unless File.file?(file)
|
2932
|
-
next if File.stat(file).mode & 0444 == 0444
|
2933
|
-
warning "#{file} is not world-readable"
|
2934
|
-
end
|
2935
|
-
|
2936
|
-
executables.each do |name|
|
2937
|
-
exec = File.join @bindir, name
|
2938
|
-
next unless File.file?(exec)
|
2939
|
-
next if File.stat(exec).executable?
|
2940
|
-
warning "#{exec} is not executable"
|
2941
|
-
end
|
2672
|
+
Gem::SpecificationPolicy.new(self).validate_permissions
|
2942
2673
|
end
|
2674
|
+
rubygems_deprecate :validate_permissions
|
2943
2675
|
|
2944
2676
|
##
|
2945
|
-
# Set the version to +version
|
2946
|
-
# required_rubygems_version if +version+ indicates it is a
|
2947
|
-
# prerelease.
|
2677
|
+
# Set the version to +version+.
|
2948
2678
|
|
2949
|
-
def version=
|
2679
|
+
def version=(version)
|
2950
2680
|
@version = Gem::Version.create(version)
|
2951
|
-
|
2952
|
-
invalidate_memoized_attributes
|
2681
|
+
return if @version.nil?
|
2953
2682
|
|
2954
|
-
|
2683
|
+
invalidate_memoized_attributes
|
2955
2684
|
end
|
2956
2685
|
|
2957
2686
|
def stubbed?
|
@@ -2963,9 +2692,9 @@ open-ended dependency on #{dep} is not recommended
|
|
2963
2692
|
case ivar
|
2964
2693
|
when "date"
|
2965
2694
|
# Force Date to go through the extra coerce logic in date=
|
2966
|
-
self.date = val
|
2695
|
+
self.date = val
|
2967
2696
|
else
|
2968
|
-
instance_variable_set "@#{ivar}", val
|
2697
|
+
instance_variable_set "@#{ivar}", val
|
2969
2698
|
end
|
2970
2699
|
end
|
2971
2700
|
|
@@ -2982,40 +2711,29 @@ open-ended dependency on #{dep} is not recommended
|
|
2982
2711
|
end
|
2983
2712
|
|
2984
2713
|
nil_attributes.each do |attribute|
|
2985
|
-
default =
|
2714
|
+
default = default_value attribute
|
2986
2715
|
|
2987
2716
|
value = case default
|
2988
2717
|
when Time, Numeric, Symbol, true, false, nil then default
|
2989
2718
|
else default.dup
|
2990
|
-
|
2719
|
+
end
|
2991
2720
|
|
2992
2721
|
instance_variable_set "@#{attribute}", value
|
2993
2722
|
end
|
2994
2723
|
|
2995
2724
|
@installed_by_version ||= nil
|
2725
|
+
|
2726
|
+
nil
|
2996
2727
|
end
|
2997
2728
|
|
2998
|
-
def
|
2999
|
-
|
2729
|
+
def flatten_require_paths # :nodoc:
|
2730
|
+
return unless raw_require_paths.first.is_a?(Array)
|
3000
2731
|
|
3001
|
-
|
2732
|
+
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"
|
2733
|
+
raw_require_paths.flatten!
|
3002
2734
|
end
|
3003
2735
|
|
3004
2736
|
def raw_require_paths # :nodoc:
|
3005
2737
|
@require_paths
|
3006
2738
|
end
|
3007
|
-
|
3008
|
-
extend Gem::Deprecate
|
3009
|
-
|
3010
|
-
# TODO:
|
3011
|
-
# deprecate :has_rdoc, :none, 2011, 10
|
3012
|
-
# deprecate :has_rdoc?, :none, 2011, 10
|
3013
|
-
# deprecate :has_rdoc=, :none, 2011, 10
|
3014
|
-
# deprecate :default_executable, :none, 2011, 10
|
3015
|
-
# deprecate :default_executable=, :none, 2011, 10
|
3016
|
-
# deprecate :file_name, :cache_file, 2011, 10
|
3017
|
-
# deprecate :full_gem_path, :cache_file, 2011, 10
|
3018
2739
|
end
|
3019
|
-
|
3020
|
-
# DOC: What is this and why is it here, randomly, at the end of this file?
|
3021
|
-
Gem.clear_paths
|