bundler-plus 4.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5670 -0
- data/LICENSE.md +22 -0
- data/README.md +58 -0
- data/bundler.gemspec +46 -0
- data/exe/bundle +29 -0
- data/exe/bundler +4 -0
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +44 -0
- data/lib/bundler/capistrano.rb +4 -0
- data/lib/bundler/checksum.rb +270 -0
- data/lib/bundler/ci_detector.rb +75 -0
- data/lib/bundler/cli/add.rb +62 -0
- data/lib/bundler/cli/binstubs.rb +57 -0
- data/lib/bundler/cli/cache.rb +32 -0
- data/lib/bundler/cli/check.rb +40 -0
- data/lib/bundler/cli/clean.rb +25 -0
- data/lib/bundler/cli/common.rb +161 -0
- data/lib/bundler/cli/config.rb +208 -0
- data/lib/bundler/cli/console.rb +47 -0
- data/lib/bundler/cli/doctor/diagnose.rb +167 -0
- data/lib/bundler/cli/doctor/ssl.rb +249 -0
- data/lib/bundler/cli/doctor.rb +33 -0
- data/lib/bundler/cli/exec.rb +114 -0
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +493 -0
- data/lib/bundler/cli/info.rb +83 -0
- data/lib/bundler/cli/init.rb +51 -0
- data/lib/bundler/cli/install.rb +127 -0
- data/lib/bundler/cli/issue.rb +41 -0
- data/lib/bundler/cli/list.rb +97 -0
- data/lib/bundler/cli/lock.rb +94 -0
- data/lib/bundler/cli/open.rb +29 -0
- data/lib/bundler/cli/outdated.rb +337 -0
- data/lib/bundler/cli/platform.rb +48 -0
- data/lib/bundler/cli/plugin.rb +39 -0
- data/lib/bundler/cli/pristine.rb +64 -0
- data/lib/bundler/cli/remove.rb +17 -0
- data/lib/bundler/cli/show.rb +71 -0
- data/lib/bundler/cli/update.rb +125 -0
- data/lib/bundler/cli.rb +829 -0
- data/lib/bundler/compact_index_client/cache.rb +96 -0
- data/lib/bundler/compact_index_client/cache_file.rb +148 -0
- data/lib/bundler/compact_index_client/parser.rb +87 -0
- data/lib/bundler/compact_index_client/updater.rb +105 -0
- data/lib/bundler/compact_index_client.rb +92 -0
- data/lib/bundler/constants.rb +14 -0
- data/lib/bundler/current_ruby.rb +94 -0
- data/lib/bundler/definition.rb +1304 -0
- data/lib/bundler/dependency.rb +151 -0
- data/lib/bundler/deployment.rb +6 -0
- data/lib/bundler/deprecate.rb +44 -0
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +642 -0
- data/lib/bundler/endpoint_specification.rb +184 -0
- data/lib/bundler/env.rb +148 -0
- data/lib/bundler/environment_preserver.rb +69 -0
- data/lib/bundler/errors.rb +277 -0
- data/lib/bundler/feature_flag.rb +20 -0
- data/lib/bundler/fetcher/base.rb +55 -0
- data/lib/bundler/fetcher/compact_index.rb +133 -0
- data/lib/bundler/fetcher/dependency.rb +85 -0
- data/lib/bundler/fetcher/downloader.rb +116 -0
- data/lib/bundler/fetcher/gem_remote_fetcher.rb +24 -0
- data/lib/bundler/fetcher/index.rb +25 -0
- data/lib/bundler/fetcher.rb +365 -0
- data/lib/bundler/force_platform.rb +16 -0
- data/lib/bundler/friendly_errors.rb +127 -0
- data/lib/bundler/gem_helper.rb +237 -0
- data/lib/bundler/gem_tasks.rb +7 -0
- data/lib/bundler/gem_version_promoter.rb +147 -0
- data/lib/bundler/index.rb +203 -0
- data/lib/bundler/injector.rb +284 -0
- data/lib/bundler/inline.rb +106 -0
- data/lib/bundler/installer/gem_installer.rb +88 -0
- data/lib/bundler/installer/parallel_installer.rb +280 -0
- data/lib/bundler/installer/standalone.rb +113 -0
- data/lib/bundler/installer.rb +241 -0
- data/lib/bundler/lazy_specification.rb +270 -0
- data/lib/bundler/lockfile_generator.rb +119 -0
- data/lib/bundler/lockfile_parser.rb +328 -0
- data/lib/bundler/man/.document +1 -0
- data/lib/bundler/man/bundle-add.1 +79 -0
- data/lib/bundler/man/bundle-add.1.ronn +92 -0
- data/lib/bundler/man/bundle-binstubs.1 +30 -0
- data/lib/bundler/man/bundle-binstubs.1.ronn +42 -0
- data/lib/bundler/man/bundle-cache.1 +56 -0
- data/lib/bundler/man/bundle-cache.1.ronn +95 -0
- data/lib/bundler/man/bundle-check.1 +21 -0
- data/lib/bundler/man/bundle-check.1.ronn +26 -0
- data/lib/bundler/man/bundle-clean.1 +17 -0
- data/lib/bundler/man/bundle-clean.1.ronn +18 -0
- data/lib/bundler/man/bundle-config.1 +339 -0
- data/lib/bundler/man/bundle-config.1.ronn +455 -0
- data/lib/bundler/man/bundle-console.1 +33 -0
- data/lib/bundler/man/bundle-console.1.ronn +39 -0
- data/lib/bundler/man/bundle-doctor.1 +69 -0
- data/lib/bundler/man/bundle-doctor.1.ronn +77 -0
- data/lib/bundler/man/bundle-env.1 +9 -0
- data/lib/bundler/man/bundle-env.1.ronn +10 -0
- data/lib/bundler/man/bundle-exec.1 +104 -0
- data/lib/bundler/man/bundle-exec.1.ronn +150 -0
- data/lib/bundler/man/bundle-fund.1 +22 -0
- data/lib/bundler/man/bundle-fund.1.ronn +25 -0
- data/lib/bundler/man/bundle-gem.1 +107 -0
- data/lib/bundler/man/bundle-gem.1.ronn +150 -0
- data/lib/bundler/man/bundle-help.1 +9 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/lib/bundler/man/bundle-info.1 +17 -0
- data/lib/bundler/man/bundle-info.1.ronn +21 -0
- data/lib/bundler/man/bundle-init.1 +20 -0
- data/lib/bundler/man/bundle-init.1.ronn +32 -0
- data/lib/bundler/man/bundle-install.1 +178 -0
- data/lib/bundler/man/bundle-install.1.ronn +314 -0
- data/lib/bundler/man/bundle-issue.1 +45 -0
- data/lib/bundler/man/bundle-issue.1.ronn +37 -0
- data/lib/bundler/man/bundle-licenses.1 +9 -0
- data/lib/bundler/man/bundle-licenses.1.ronn +10 -0
- data/lib/bundler/man/bundle-list.1 +40 -0
- data/lib/bundler/man/bundle-list.1.ronn +41 -0
- data/lib/bundler/man/bundle-lock.1 +75 -0
- data/lib/bundler/man/bundle-lock.1.ronn +115 -0
- data/lib/bundler/man/bundle-open.1 +32 -0
- data/lib/bundler/man/bundle-open.1.ronn +28 -0
- data/lib/bundler/man/bundle-outdated.1 +106 -0
- data/lib/bundler/man/bundle-outdated.1.ronn +117 -0
- data/lib/bundler/man/bundle-platform.1 +49 -0
- data/lib/bundler/man/bundle-platform.1.ronn +49 -0
- data/lib/bundler/man/bundle-plugin.1 +76 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +84 -0
- data/lib/bundler/man/bundle-pristine.1 +23 -0
- data/lib/bundler/man/bundle-pristine.1.ronn +34 -0
- data/lib/bundler/man/bundle-remove.1 +15 -0
- data/lib/bundler/man/bundle-remove.1.ronn +16 -0
- data/lib/bundler/man/bundle-show.1 +16 -0
- data/lib/bundler/man/bundle-show.1.ronn +21 -0
- data/lib/bundler/man/bundle-update.1 +284 -0
- data/lib/bundler/man/bundle-update.1.ronn +367 -0
- data/lib/bundler/man/bundle-version.1 +22 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/lib/bundler/man/bundle.1 +93 -0
- data/lib/bundler/man/bundle.1.ronn +107 -0
- data/lib/bundler/man/gemfile.5 +503 -0
- data/lib/bundler/man/gemfile.5.ronn +586 -0
- data/lib/bundler/man/index.txt +31 -0
- data/lib/bundler/match_metadata.rb +30 -0
- data/lib/bundler/match_platform.rb +42 -0
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/materialization.rb +59 -0
- data/lib/bundler/mirror.rb +221 -0
- data/lib/bundler/plugin/api/source.rb +330 -0
- data/lib/bundler/plugin/api.rb +81 -0
- data/lib/bundler/plugin/dsl.rb +53 -0
- data/lib/bundler/plugin/events.rb +85 -0
- data/lib/bundler/plugin/index.rb +203 -0
- data/lib/bundler/plugin/installer/git.rb +34 -0
- data/lib/bundler/plugin/installer/path.rb +26 -0
- data/lib/bundler/plugin/installer/rubygems.rb +19 -0
- data/lib/bundler/plugin/installer.rb +123 -0
- data/lib/bundler/plugin/source_list.rb +31 -0
- data/lib/bundler/plugin/unloaded_source.rb +25 -0
- data/lib/bundler/plugin.rb +387 -0
- data/lib/bundler/process_lock.rb +20 -0
- data/lib/bundler/remote_specification.rb +126 -0
- data/lib/bundler/resolver/base.rb +127 -0
- data/lib/bundler/resolver/candidate.rb +85 -0
- data/lib/bundler/resolver/incompatibility.rb +15 -0
- data/lib/bundler/resolver/package.rb +95 -0
- data/lib/bundler/resolver/root.rb +25 -0
- data/lib/bundler/resolver/spec_group.rb +74 -0
- data/lib/bundler/resolver/strategy.rb +43 -0
- data/lib/bundler/resolver.rb +603 -0
- data/lib/bundler/retry.rb +92 -0
- data/lib/bundler/ruby_dsl.rb +67 -0
- data/lib/bundler/ruby_version.rb +135 -0
- data/lib/bundler/rubygems_ext.rb +503 -0
- data/lib/bundler/rubygems_gem_installer.rb +206 -0
- data/lib/bundler/rubygems_integration.rb +456 -0
- data/lib/bundler/runtime.rb +331 -0
- data/lib/bundler/safe_marshal.rb +31 -0
- data/lib/bundler/self_manager.rb +197 -0
- data/lib/bundler/settings/validator.rb +86 -0
- data/lib/bundler/settings.rb +585 -0
- data/lib/bundler/setup.rb +39 -0
- data/lib/bundler/shared_helpers.rb +392 -0
- data/lib/bundler/source/gemspec.rb +19 -0
- data/lib/bundler/source/git/git_proxy.rb +509 -0
- data/lib/bundler/source/git.rb +451 -0
- data/lib/bundler/source/metadata.rb +67 -0
- data/lib/bundler/source/path/installer.rb +53 -0
- data/lib/bundler/source/path.rb +256 -0
- data/lib/bundler/source/rubygems/remote.rb +86 -0
- data/lib/bundler/source/rubygems.rb +606 -0
- data/lib/bundler/source/rubygems_aggregate.rb +71 -0
- data/lib/bundler/source.rb +120 -0
- data/lib/bundler/source_list.rb +240 -0
- data/lib/bundler/source_map.rb +72 -0
- data/lib/bundler/spec_set.rb +390 -0
- data/lib/bundler/stub_specification.rb +147 -0
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Executable.standalone +14 -0
- data/lib/bundler/templates/Gemfile +5 -0
- data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +10 -0
- data/lib/bundler/templates/newgem/Cargo.toml.tt +13 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +24 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
- data/lib/bundler/templates/newgem/README.md.tt +49 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +72 -0
- data/lib/bundler/templates/newgem/bin/console.tt +11 -0
- data/lib/bundler/templates/newgem/bin/setup.tt +8 -0
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +37 -0
- data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +22 -0
- data/lib/bundler/templates/newgem/ext/newgem/build.rs.tt +5 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +23 -0
- data/lib/bundler/templates/newgem/github/workflows/build-gems.yml.tt +69 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +48 -0
- data/lib/bundler/templates/newgem/gitignore.tt +23 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +27 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +15 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +58 -0
- data/lib/bundler/templates/newgem/rspec.tt +3 -0
- data/lib/bundler/templates/newgem/rubocop.yml.tt +8 -0
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +19 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +15 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +19 -0
- data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/lib/bundler/ui/rg_proxy.rb +19 -0
- data/lib/bundler/ui/shell.rb +191 -0
- data/lib/bundler/ui/silent.rb +96 -0
- data/lib/bundler/ui.rb +9 -0
- data/lib/bundler/uri_credentials_filter.rb +43 -0
- data/lib/bundler/uri_normalizer.rb +23 -0
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +227 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +230 -0
- data/lib/bundler/vendor/fileutils/COPYING +56 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +2701 -0
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +41 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +65 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +80 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1153 -0
- data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +169 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +61 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +423 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +236 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/lib/bundler/vendor/securerandom/COPYING +56 -0
- data/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +105 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +61 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +108 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +143 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +407 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +130 -0
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +340 -0
- data/lib/bundler/vendor/thor/lib/thor/base.rb +825 -0
- data/lib/bundler/vendor/thor/lib/thor/command.rb +151 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +107 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +106 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +292 -0
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +37 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +86 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +195 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +178 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +294 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +72 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +335 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +384 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +112 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +81 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +118 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
- data/lib/bundler/vendor/thor/lib/thor/util.rb +285 -0
- data/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
- data/lib/bundler/vendor/thor/lib/thor.rb +674 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +455 -0
- data/lib/bundler/vendor/uri/COPYING +56 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +922 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +100 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1592 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +137 -0
- data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +22 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +293 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +547 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +206 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendored_fileutils.rb +4 -0
- data/lib/bundler/vendored_net_http.rb +23 -0
- data/lib/bundler/vendored_persistent.rb +11 -0
- data/lib/bundler/vendored_pub_grub.rb +4 -0
- data/lib/bundler/vendored_securerandom.rb +12 -0
- data/lib/bundler/vendored_thor.rb +8 -0
- data/lib/bundler/vendored_timeout.rb +12 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/vendored_uri.rb +21 -0
- data/lib/bundler/version.rb +21 -0
- data/lib/bundler/vlad.rb +4 -0
- data/lib/bundler/worker.rb +125 -0
- data/lib/bundler/yaml_serializer.rb +98 -0
- data/lib/bundler.rb +691 -0
- metadata +409 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "plugin/api"
|
|
4
|
+
|
|
5
|
+
module Bundler
|
|
6
|
+
module Plugin
|
|
7
|
+
autoload :DSL, File.expand_path("plugin/dsl", __dir__)
|
|
8
|
+
autoload :Events, File.expand_path("plugin/events", __dir__)
|
|
9
|
+
autoload :Index, File.expand_path("plugin/index", __dir__)
|
|
10
|
+
autoload :Installer, File.expand_path("plugin/installer", __dir__)
|
|
11
|
+
autoload :SourceList, File.expand_path("plugin/source_list", __dir__)
|
|
12
|
+
autoload :UnloadedSource, File.expand_path("plugin/unloaded_source", __dir__)
|
|
13
|
+
|
|
14
|
+
class MalformattedPlugin < PluginError; end
|
|
15
|
+
class UndefinedCommandError < PluginError; end
|
|
16
|
+
class UnknownSourceError < PluginError; end
|
|
17
|
+
class PluginInstallError < PluginError; end
|
|
18
|
+
|
|
19
|
+
PLUGIN_FILE_NAME = "plugins.rb"
|
|
20
|
+
|
|
21
|
+
module_function
|
|
22
|
+
|
|
23
|
+
def reset!
|
|
24
|
+
instance_variables.each {|i| remove_instance_variable(i) }
|
|
25
|
+
|
|
26
|
+
@sources = {}
|
|
27
|
+
@commands = {}
|
|
28
|
+
@hooks_by_event = Hash.new {|h, k| h[k] = [] }
|
|
29
|
+
@loaded_plugin_names = []
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
reset!
|
|
33
|
+
|
|
34
|
+
# Installs a new plugin by the given name
|
|
35
|
+
#
|
|
36
|
+
# @param [Array<String>] names the name of plugin to be installed
|
|
37
|
+
# @param [Hash] options various parameters as described in description.
|
|
38
|
+
# Refer to cli/plugin for available options
|
|
39
|
+
def install(names, options)
|
|
40
|
+
raise InvalidOption, "You cannot specify `--branch` and `--ref` at the same time." if options["branch"] && options["ref"]
|
|
41
|
+
|
|
42
|
+
specs = Installer.new.install(names, options)
|
|
43
|
+
|
|
44
|
+
save_plugins names, specs
|
|
45
|
+
rescue PluginError
|
|
46
|
+
specs_to_delete = specs.select {|k, _v| names.include?(k) && !index.commands.values.include?(k) }
|
|
47
|
+
specs_to_delete.each_value {|spec| Bundler.rm_rf(spec.full_gem_path) }
|
|
48
|
+
|
|
49
|
+
raise
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Uninstalls plugins by the given names
|
|
53
|
+
#
|
|
54
|
+
# @param [Array<String>] names the names of plugins to be uninstalled
|
|
55
|
+
def uninstall(names, options)
|
|
56
|
+
if names.empty? && !options[:all]
|
|
57
|
+
Bundler.ui.error "No plugins to uninstall. Specify at least 1 plugin to uninstall.\n"\
|
|
58
|
+
"Use --all option to uninstall all the installed plugins."
|
|
59
|
+
return
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
names = index.installed_plugins if options[:all]
|
|
63
|
+
if names.any?
|
|
64
|
+
names.each do |name|
|
|
65
|
+
if index.installed?(name)
|
|
66
|
+
path = index.plugin_path(name).to_s
|
|
67
|
+
Bundler.rm_rf(path) if index.installed_in_plugin_root?(name)
|
|
68
|
+
index.unregister_plugin(name)
|
|
69
|
+
Bundler.ui.info "Uninstalled plugin #{name}"
|
|
70
|
+
else
|
|
71
|
+
Bundler.ui.error "Plugin #{name} is not installed \n"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
else
|
|
75
|
+
Bundler.ui.info "No plugins installed"
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# List installed plugins and commands
|
|
80
|
+
#
|
|
81
|
+
def list
|
|
82
|
+
installed_plugins = index.installed_plugins
|
|
83
|
+
if installed_plugins.any?
|
|
84
|
+
output = String.new
|
|
85
|
+
installed_plugins.each do |plugin|
|
|
86
|
+
output << "#{plugin}\n"
|
|
87
|
+
output << "-----\n"
|
|
88
|
+
index.plugin_commands(plugin).each do |command|
|
|
89
|
+
output << " #{command}\n"
|
|
90
|
+
end
|
|
91
|
+
output << "\n"
|
|
92
|
+
end
|
|
93
|
+
else
|
|
94
|
+
output = "No plugins installed"
|
|
95
|
+
end
|
|
96
|
+
Bundler.ui.info output
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Evaluates the Gemfile with a limited DSL and installs the plugins
|
|
100
|
+
# specified by plugin method
|
|
101
|
+
#
|
|
102
|
+
# @param [Pathname] gemfile path
|
|
103
|
+
# @param [Proc] block that can be evaluated for (inline) Gemfile
|
|
104
|
+
def gemfile_install(gemfile = nil, &inline)
|
|
105
|
+
Bundler.settings.temporary(frozen: false, deployment: false) do
|
|
106
|
+
builder = DSL.new
|
|
107
|
+
if block_given?
|
|
108
|
+
builder.instance_eval(&inline)
|
|
109
|
+
else
|
|
110
|
+
builder.eval_gemfile(gemfile)
|
|
111
|
+
end
|
|
112
|
+
builder.check_primary_source_safety
|
|
113
|
+
definition = builder.to_definition(nil, true)
|
|
114
|
+
|
|
115
|
+
return if definition.dependencies.empty?
|
|
116
|
+
|
|
117
|
+
plugins = definition.dependencies.map(&:name)
|
|
118
|
+
installed_specs = Installer.new.install_definition(definition)
|
|
119
|
+
|
|
120
|
+
save_plugins plugins, installed_specs, builder.inferred_plugins
|
|
121
|
+
end
|
|
122
|
+
rescue RuntimeError => e
|
|
123
|
+
unless e.is_a?(GemfileError)
|
|
124
|
+
Bundler.ui.error "Failed to install plugin: #{e.message}\n #{e.backtrace[0]}"
|
|
125
|
+
end
|
|
126
|
+
raise
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# The index object used to store the details about the plugin
|
|
130
|
+
def index
|
|
131
|
+
@index ||= Index.new
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# The directory root for all plugin related data
|
|
135
|
+
#
|
|
136
|
+
# If run in an app, points to local root, in app_config_path
|
|
137
|
+
# Otherwise, points to global root, in Bundler.user_bundle_path("plugin")
|
|
138
|
+
def root
|
|
139
|
+
@root ||= if SharedHelpers.in_bundle?
|
|
140
|
+
local_root
|
|
141
|
+
else
|
|
142
|
+
global_root
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def local_root
|
|
147
|
+
Bundler.app_config_path.join("plugin")
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# The global directory root for all plugin related data
|
|
151
|
+
def global_root
|
|
152
|
+
Bundler.user_bundle_path("plugin")
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# The cache directory for plugin stuffs
|
|
156
|
+
def cache
|
|
157
|
+
@cache ||= root.join("cache")
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# To be called via the API to register to handle a command
|
|
161
|
+
def add_command(command, cls)
|
|
162
|
+
@commands[command] = cls
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Checks if any plugin handles the command
|
|
166
|
+
def command?(command)
|
|
167
|
+
!index.command_plugin(command).nil?
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# To be called from Cli class to pass the command and argument to
|
|
171
|
+
# appropriate plugin class
|
|
172
|
+
def exec_command(command, args)
|
|
173
|
+
raise UndefinedCommandError, "Command `#{command}` not found" unless command? command
|
|
174
|
+
|
|
175
|
+
load_plugin index.command_plugin(command) unless @commands.key? command
|
|
176
|
+
|
|
177
|
+
@commands[command].new.exec(command, args)
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# To be called via the API to register to handle a source plugin
|
|
181
|
+
def add_source(source, cls)
|
|
182
|
+
@sources[source] = cls
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Checks if any plugin declares the source
|
|
186
|
+
def source?(name)
|
|
187
|
+
!index.source_plugin(name.to_s).nil?
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# @return [Class] that handles the source. The class includes API::Source
|
|
191
|
+
def source(name)
|
|
192
|
+
raise UnknownSourceError, "Source #{name} not found" unless source? name
|
|
193
|
+
|
|
194
|
+
load_plugin(index.source_plugin(name)) unless @sources.key? name
|
|
195
|
+
|
|
196
|
+
@sources[name]
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# @param [Hash] The options that are present in the lockfile
|
|
200
|
+
# @return [API::Source] the instance of the class that handles the source
|
|
201
|
+
# type passed in locked_opts
|
|
202
|
+
def from_lock(locked_opts)
|
|
203
|
+
opts = locked_opts.merge("uri" => locked_opts["remote"])
|
|
204
|
+
# use an inert placeholder when the plugin handling this source is not
|
|
205
|
+
# installed, so that the lockfile can still be parsed
|
|
206
|
+
return UnloadedSource.new(opts) unless source?(locked_opts["type"])
|
|
207
|
+
|
|
208
|
+
src = source(locked_opts["type"])
|
|
209
|
+
|
|
210
|
+
src.new(opts)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# To be called via the API to register a hooks and corresponding block that
|
|
214
|
+
# will be called to handle the hook
|
|
215
|
+
def add_hook(event, &block)
|
|
216
|
+
unless Events.defined_event?(event)
|
|
217
|
+
raise ArgumentError, "Event '#{event}' not defined in Bundler::Plugin::Events"
|
|
218
|
+
end
|
|
219
|
+
@hooks_by_event[event.to_s] << block
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Runs all the hooks that are registered for the passed event
|
|
223
|
+
#
|
|
224
|
+
# It passes the passed arguments and block to the block registered with
|
|
225
|
+
# the api.
|
|
226
|
+
#
|
|
227
|
+
# @param [String] event
|
|
228
|
+
def hook(event, *args, &arg_blk)
|
|
229
|
+
return unless Bundler.settings[:plugins]
|
|
230
|
+
unless Events.defined_event?(event)
|
|
231
|
+
raise ArgumentError, "Event '#{event}' not defined in Bundler::Plugin::Events"
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
plugins = index.hook_plugins(event)
|
|
235
|
+
return unless plugins.any?
|
|
236
|
+
|
|
237
|
+
plugins.each {|name| load_plugin(name) }
|
|
238
|
+
|
|
239
|
+
@hooks_by_event[event].each {|blk| blk.call(*args, &arg_blk) }
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# currently only intended for specs
|
|
243
|
+
#
|
|
244
|
+
# @return [String, nil] installed path
|
|
245
|
+
def installed?(plugin)
|
|
246
|
+
Index.new.installed?(plugin)
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# @return [true, false] whether the plugin is loaded
|
|
250
|
+
def loaded?(plugin)
|
|
251
|
+
@loaded_plugin_names.include?(plugin)
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# Post installation processing and registering with index
|
|
255
|
+
#
|
|
256
|
+
# @param [Array<String>] plugins list to be installed
|
|
257
|
+
# @param [Hash] specs of plugins mapped to installation path (currently they
|
|
258
|
+
# contain all the installed specs, including plugins)
|
|
259
|
+
# @param [Array<String>] names of inferred source plugins that can be ignored
|
|
260
|
+
def save_plugins(plugins, specs, optional_plugins = [])
|
|
261
|
+
plugins.each do |name|
|
|
262
|
+
spec = specs[name]
|
|
263
|
+
|
|
264
|
+
# It's possible that the `plugin` found in the Gemfile don't appear in the specs. For instance when
|
|
265
|
+
# calling `BUNDLE_WITHOUT=default bundle install`, the plugins will not get installed.
|
|
266
|
+
next if spec.nil?
|
|
267
|
+
next if index.up_to_date?(spec)
|
|
268
|
+
|
|
269
|
+
save_plugin(name, spec, optional_plugins.include?(name))
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Checks if the gem is good to be a plugin
|
|
274
|
+
#
|
|
275
|
+
# At present it only checks whether it contains plugins.rb file
|
|
276
|
+
#
|
|
277
|
+
# @param [Pathname] plugin_path the path plugin is installed at
|
|
278
|
+
# @raise [MalformattedPlugin] if plugins.rb file is not found
|
|
279
|
+
def validate_plugin!(plugin_path)
|
|
280
|
+
plugin_file = plugin_path.join(PLUGIN_FILE_NAME)
|
|
281
|
+
raise MalformattedPlugin, "#{PLUGIN_FILE_NAME} was not found in the plugin." unless plugin_file.file?
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Validates and registers a plugin.
|
|
285
|
+
#
|
|
286
|
+
# @param [String] name the name of the plugin
|
|
287
|
+
# @param [Specification] spec of installed plugin
|
|
288
|
+
# @param [Boolean] optional_plugin, removed if there is conflict with any
|
|
289
|
+
# other plugin (used for default source plugins)
|
|
290
|
+
#
|
|
291
|
+
# @raise [PluginInstallError] if validation or registration raises any error
|
|
292
|
+
def save_plugin(name, spec, optional_plugin = false)
|
|
293
|
+
validate_plugin! Pathname.new(spec.full_gem_path)
|
|
294
|
+
installed = register_plugin(name, spec, optional_plugin)
|
|
295
|
+
Bundler.ui.info "Installed plugin #{name}" if installed
|
|
296
|
+
rescue PluginError => e
|
|
297
|
+
raise PluginInstallError, "Failed to install plugin `#{spec.name}`, due to #{e.class} (#{e.message})"
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# Runs the plugins.rb file in an isolated namespace, records the plugin
|
|
301
|
+
# actions it registers for and then passes the data to index to be stored.
|
|
302
|
+
#
|
|
303
|
+
# @param [String] name the name of the plugin
|
|
304
|
+
# @param [Specification] spec of installed plugin
|
|
305
|
+
# @param [Boolean] optional_plugin, removed if there is conflict with any
|
|
306
|
+
# other plugin (used for default source plugins)
|
|
307
|
+
#
|
|
308
|
+
# @raise [MalformattedPlugin] if plugins.rb raises any error
|
|
309
|
+
def register_plugin(name, spec, optional_plugin = false)
|
|
310
|
+
commands = @commands
|
|
311
|
+
sources = @sources
|
|
312
|
+
hooks = @hooks_by_event
|
|
313
|
+
|
|
314
|
+
@commands = {}
|
|
315
|
+
@sources = {}
|
|
316
|
+
@hooks_by_event = Hash.new {|h, k| h[k] = [] }
|
|
317
|
+
|
|
318
|
+
load_paths = spec.load_paths
|
|
319
|
+
Gem.add_to_load_path(*load_paths)
|
|
320
|
+
path = Pathname.new spec.full_gem_path
|
|
321
|
+
|
|
322
|
+
begin
|
|
323
|
+
load path.join(PLUGIN_FILE_NAME), true
|
|
324
|
+
rescue StandardError => e
|
|
325
|
+
raise MalformattedPlugin, "#{e.class}: #{e.message}"
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
if optional_plugin && @sources.keys.any? {|s| source? s }
|
|
329
|
+
Bundler.rm_rf(path)
|
|
330
|
+
false
|
|
331
|
+
else
|
|
332
|
+
index.register_plugin(name, path.to_s, load_paths, @commands.keys,
|
|
333
|
+
@sources.keys, @hooks_by_event.keys)
|
|
334
|
+
true
|
|
335
|
+
end
|
|
336
|
+
ensure
|
|
337
|
+
@commands = commands
|
|
338
|
+
@sources = sources
|
|
339
|
+
@hooks_by_event = hooks
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Executes the plugins.rb file
|
|
343
|
+
#
|
|
344
|
+
# @param [String] name of the plugin
|
|
345
|
+
def load_plugin(name)
|
|
346
|
+
return unless name && !name.empty?
|
|
347
|
+
return if loaded?(name)
|
|
348
|
+
|
|
349
|
+
# Need to ensure before this that plugin root where the rest of gems
|
|
350
|
+
# are installed to be on load path to support plugin deps. Currently not
|
|
351
|
+
# done to avoid conflicts
|
|
352
|
+
path = index.plugin_path(name)
|
|
353
|
+
|
|
354
|
+
paths = index.load_paths(name)
|
|
355
|
+
invalid_paths = paths.reject {|p| File.directory?(p) }
|
|
356
|
+
|
|
357
|
+
if invalid_paths.any?
|
|
358
|
+
Bundler.ui.warn <<~MESSAGE
|
|
359
|
+
The following plugin paths don't exist: #{invalid_paths.join(", ")}.
|
|
360
|
+
|
|
361
|
+
This can happen if the plugin was installed with a different version of Ruby that has since been uninstalled.
|
|
362
|
+
|
|
363
|
+
If you would like to reinstall the plugin, run:
|
|
364
|
+
|
|
365
|
+
bundler plugin uninstall #{name} && bundler plugin install #{name}
|
|
366
|
+
|
|
367
|
+
Continuing without installing plugin #{name}.
|
|
368
|
+
MESSAGE
|
|
369
|
+
|
|
370
|
+
return
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
Gem.add_to_load_path(*paths)
|
|
374
|
+
|
|
375
|
+
load path.join(PLUGIN_FILE_NAME)
|
|
376
|
+
|
|
377
|
+
@loaded_plugin_names << name
|
|
378
|
+
rescue RuntimeError => e
|
|
379
|
+
Bundler.ui.error "Failed loading plugin #{name}: #{e.message}"
|
|
380
|
+
raise
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
class << self
|
|
384
|
+
private :load_plugin, :register_plugin, :save_plugins, :validate_plugin!
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bundler
|
|
4
|
+
class ProcessLock
|
|
5
|
+
def self.lock(bundle_path = Bundler.bundle_path, &block)
|
|
6
|
+
lock_file_path = File.join(bundle_path, "bundler.lock")
|
|
7
|
+
base_lock_file_path = lock_file_path.delete_suffix(".lock")
|
|
8
|
+
|
|
9
|
+
require "fileutils" if Bundler.rubygems.provides?("< 3.6.0")
|
|
10
|
+
|
|
11
|
+
begin
|
|
12
|
+
SharedHelpers.filesystem_access(lock_file_path, :write) do
|
|
13
|
+
Gem.open_file_with_lock(base_lock_file_path, &block)
|
|
14
|
+
end
|
|
15
|
+
rescue PermissionError
|
|
16
|
+
block.call
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bundler
|
|
4
|
+
# Represents a lazily loaded gem specification, where the full specification
|
|
5
|
+
# is on the source server in rubygems' "quick" index. The proxy object is to
|
|
6
|
+
# be seeded with what we're given from the source's abbreviated index - the
|
|
7
|
+
# full specification will only be fetched when necessary.
|
|
8
|
+
class RemoteSpecification
|
|
9
|
+
include MatchRemoteMetadata
|
|
10
|
+
include MatchPlatform
|
|
11
|
+
include Comparable
|
|
12
|
+
|
|
13
|
+
attr_reader :name, :version, :platform
|
|
14
|
+
attr_writer :dependencies
|
|
15
|
+
attr_accessor :source, :remote, :locked_platform, :created_at
|
|
16
|
+
|
|
17
|
+
def initialize(name, version, platform, spec_fetcher)
|
|
18
|
+
@name = name
|
|
19
|
+
@version = Gem::Version.create version
|
|
20
|
+
@original_platform = platform || Gem::Platform::RUBY
|
|
21
|
+
@platform = Gem::Platform.new(platform)
|
|
22
|
+
@spec_fetcher = spec_fetcher
|
|
23
|
+
@dependencies = nil
|
|
24
|
+
@locked_platform = nil
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def insecurely_materialized?
|
|
28
|
+
@locked_platform.to_s != @platform.to_s
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Needed before installs, since the arch matters then and quick
|
|
32
|
+
# specs don't bother to include the arch in the platform string
|
|
33
|
+
def fetch_platform
|
|
34
|
+
@platform = _remote_specification.platform
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def full_name
|
|
38
|
+
@full_name ||= if @platform == Gem::Platform::RUBY
|
|
39
|
+
"#{@name}-#{@version}"
|
|
40
|
+
else
|
|
41
|
+
"#{@name}-#{@version}-#{@platform}"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Compare this specification against another object. Using sort_obj
|
|
46
|
+
# is compatible with Gem::Specification and other Bundler or RubyGems
|
|
47
|
+
# objects. Otherwise, use the default Object comparison.
|
|
48
|
+
def <=>(other)
|
|
49
|
+
if other.respond_to?(:sort_obj)
|
|
50
|
+
sort_obj <=> other.sort_obj
|
|
51
|
+
else
|
|
52
|
+
super
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Because Rubyforge cannot be trusted to provide valid specifications
|
|
57
|
+
# once the remote gem is downloaded, the backend specification will
|
|
58
|
+
# be swapped out.
|
|
59
|
+
def __swap__(spec)
|
|
60
|
+
raise APIResponseInvalidDependenciesError unless spec.dependencies.all? {|d| d.is_a?(Gem::Dependency) }
|
|
61
|
+
|
|
62
|
+
SharedHelpers.ensure_same_dependencies(self, dependencies, spec.dependencies)
|
|
63
|
+
@_remote_specification = spec
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Create a delegate used for sorting. This strategy is copied from
|
|
67
|
+
# RubyGems 2.23 and ensures that Bundler's specifications can be
|
|
68
|
+
# compared and sorted with RubyGems' own specifications.
|
|
69
|
+
#
|
|
70
|
+
# @see #<=>
|
|
71
|
+
# @see Gem::Specification#sort_obj
|
|
72
|
+
#
|
|
73
|
+
# @return [Array] an object you can use to compare and sort this
|
|
74
|
+
# specification against other specifications
|
|
75
|
+
def sort_obj
|
|
76
|
+
[@name, @version, @platform == Gem::Platform::RUBY ? -1 : 1]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def to_s
|
|
80
|
+
"#<#{self.class} name=#{name} version=#{version} platform=#{platform}>"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def dependencies
|
|
84
|
+
@dependencies ||= begin
|
|
85
|
+
deps = method_missing(:dependencies)
|
|
86
|
+
|
|
87
|
+
# allow us to handle when the specs dependencies are an array of array of string
|
|
88
|
+
# in order to delay the crash to `#__swap__` where it results in a friendlier error
|
|
89
|
+
# see https://github.com/rubygems/bundler/issues/5797
|
|
90
|
+
deps = deps.map {|d| d.is_a?(Gem::Dependency) ? d : Gem::Dependency.new(*d) }
|
|
91
|
+
|
|
92
|
+
deps
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def runtime_dependencies
|
|
97
|
+
dependencies.select(&:runtime?)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def git_version
|
|
101
|
+
return unless loaded_from && source.is_a?(Bundler::Source::Git)
|
|
102
|
+
" #{source.revision[0..6]}"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
private
|
|
106
|
+
|
|
107
|
+
def to_ary
|
|
108
|
+
nil
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def _remote_specification
|
|
112
|
+
@_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @original_platform])
|
|
113
|
+
@_remote_specification || raise(GemspecError, "Gemspec data for #{full_name} was" \
|
|
114
|
+
" missing from the server!")
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def method_missing(method, *args, &blk)
|
|
118
|
+
_remote_specification.send(method, *args, &blk)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def respond_to?(method, include_all = false)
|
|
122
|
+
super || _remote_specification.respond_to?(method, include_all)
|
|
123
|
+
end
|
|
124
|
+
public :respond_to?
|
|
125
|
+
end
|
|
126
|
+
end
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "package"
|
|
4
|
+
|
|
5
|
+
module Bundler
|
|
6
|
+
class Resolver
|
|
7
|
+
class Base
|
|
8
|
+
attr_reader :packages, :requirements, :source_requirements, :locked_specs
|
|
9
|
+
|
|
10
|
+
def initialize(source_requirements, dependencies, base, platforms, options)
|
|
11
|
+
@explicit_unlocks = options.delete(:explicit_unlocks) || []
|
|
12
|
+
@source_requirements = source_requirements
|
|
13
|
+
@locked_specs = options[:locked_specs]
|
|
14
|
+
|
|
15
|
+
@base = base
|
|
16
|
+
|
|
17
|
+
@packages = Hash.new do |hash, name|
|
|
18
|
+
hash[name] = Package.new(name, platforms, **options)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
@requirements = dependencies.filter_map do |dep|
|
|
22
|
+
dep_platforms = dep.gem_platforms(platforms)
|
|
23
|
+
|
|
24
|
+
# Dependencies scoped to external platforms are ignored
|
|
25
|
+
next if dep_platforms.empty?
|
|
26
|
+
|
|
27
|
+
name = dep.name
|
|
28
|
+
|
|
29
|
+
@packages[name] = Package.new(name, dep_platforms, **options.merge(dependency: dep))
|
|
30
|
+
|
|
31
|
+
dep
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def [](name)
|
|
36
|
+
@base[name]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def delete(specs)
|
|
40
|
+
@base.delete(specs)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def get_package(name)
|
|
44
|
+
@packages[name]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Gems the user named on a `bundle update GEM` / `bundle lock --update GEM`
|
|
48
|
+
# command line. These are the only ones meant to move off their locked
|
|
49
|
+
# version, so cooldown keeps applying to them while every other locked gem
|
|
50
|
+
# stays exempt.
|
|
51
|
+
def explicitly_unlocked?(name)
|
|
52
|
+
@explicit_unlocks.include?(name)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def base_requirements
|
|
56
|
+
@base_requirements ||= build_base_requirements
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def unlock_names(names)
|
|
60
|
+
indirect_pins = indirect_pins(names)
|
|
61
|
+
|
|
62
|
+
if indirect_pins.any?
|
|
63
|
+
loosen_names(indirect_pins)
|
|
64
|
+
else
|
|
65
|
+
pins = pins(names)
|
|
66
|
+
|
|
67
|
+
if pins.any?
|
|
68
|
+
loosen_names(pins)
|
|
69
|
+
else
|
|
70
|
+
unrestrict_names(names)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def include_prereleases(names)
|
|
76
|
+
names.each do |name|
|
|
77
|
+
get_package(name).consider_prereleases!
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def include_remote_specs(names)
|
|
82
|
+
names.each do |name|
|
|
83
|
+
get_package(name).consider_remote_versions!
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
private
|
|
88
|
+
|
|
89
|
+
def indirect_pins(names)
|
|
90
|
+
names.select {|name| @base_requirements[name].exact? && @requirements.none? {|dep| dep.name == name } }
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def pins(names)
|
|
94
|
+
names.select {|name| @base_requirements[name].exact? }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def loosen_names(names)
|
|
98
|
+
names.each do |name|
|
|
99
|
+
version = @base_requirements[name].requirements.first[1]
|
|
100
|
+
|
|
101
|
+
@base_requirements[name] = Gem::Requirement.new(">= #{version}")
|
|
102
|
+
|
|
103
|
+
@base.delete_by_name(name)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def unrestrict_names(names)
|
|
108
|
+
names.each do |name|
|
|
109
|
+
@base_requirements.delete(name)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def build_base_requirements
|
|
114
|
+
base_requirements = {}
|
|
115
|
+
@base.each do |ls|
|
|
116
|
+
if ls.source_changed? && ls.source.specs.search(ls.name).empty?
|
|
117
|
+
raise GemNotFound, "Could not find gem '#{ls.name}' in #{ls.source}"
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
req = Gem::Requirement.new(ls.version)
|
|
121
|
+
base_requirements[ls.name] = req
|
|
122
|
+
end
|
|
123
|
+
base_requirements
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|