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,56 @@
|
|
|
1
|
+
class Bundler::ConnectionPool
|
|
2
|
+
class Wrapper < ::BasicObject
|
|
3
|
+
METHODS = [:with, :pool_shutdown, :wrapped_pool]
|
|
4
|
+
|
|
5
|
+
def initialize(options = {}, &block)
|
|
6
|
+
@pool = options.fetch(:pool) { ::Bundler::ConnectionPool.new(options, &block) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def wrapped_pool
|
|
10
|
+
@pool
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def with(&block)
|
|
14
|
+
@pool.with(&block)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def pool_shutdown(&block)
|
|
18
|
+
@pool.shutdown(&block)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def pool_size
|
|
22
|
+
@pool.size
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def pool_available
|
|
26
|
+
@pool.available
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def respond_to?(id, *args)
|
|
30
|
+
METHODS.include?(id) || with { |c| c.respond_to?(id, *args) }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# rubocop:disable Style/MissingRespondToMissing
|
|
34
|
+
if ::RUBY_VERSION >= "3.0.0"
|
|
35
|
+
def method_missing(name, *args, **kwargs, &block)
|
|
36
|
+
with do |connection|
|
|
37
|
+
connection.send(name, *args, **kwargs, &block)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
elsif ::RUBY_VERSION >= "2.7.0"
|
|
41
|
+
ruby2_keywords def method_missing(name, *args, &block)
|
|
42
|
+
with do |connection|
|
|
43
|
+
connection.send(name, *args, &block)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
else
|
|
47
|
+
def method_missing(name, *args, &block)
|
|
48
|
+
with do |connection|
|
|
49
|
+
connection.send(name, *args, &block)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
# rubocop:enable Style/MethodMissingSuper
|
|
54
|
+
# rubocop:enable Style/MissingRespondToMissing
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
require_relative "../../../vendored_timeout"
|
|
2
|
+
require_relative "connection_pool/version"
|
|
3
|
+
|
|
4
|
+
class Bundler::ConnectionPool
|
|
5
|
+
class Error < ::RuntimeError; end
|
|
6
|
+
|
|
7
|
+
class PoolShuttingDownError < ::Bundler::ConnectionPool::Error; end
|
|
8
|
+
|
|
9
|
+
class TimeoutError < ::Gem::Timeout::Error; end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Generic connection pool class for sharing a limited number of objects or network connections
|
|
13
|
+
# among many threads. Note: pool elements are lazily created.
|
|
14
|
+
#
|
|
15
|
+
# Example usage with block (faster):
|
|
16
|
+
#
|
|
17
|
+
# @pool = Bundler::ConnectionPool.new { Redis.new }
|
|
18
|
+
# @pool.with do |redis|
|
|
19
|
+
# redis.lpop('my-list') if redis.llen('my-list') > 0
|
|
20
|
+
# end
|
|
21
|
+
#
|
|
22
|
+
# Using optional timeout override (for that single invocation)
|
|
23
|
+
#
|
|
24
|
+
# @pool.with(timeout: 2.0) do |redis|
|
|
25
|
+
# redis.lpop('my-list') if redis.llen('my-list') > 0
|
|
26
|
+
# end
|
|
27
|
+
#
|
|
28
|
+
# Example usage replacing an existing connection (slower):
|
|
29
|
+
#
|
|
30
|
+
# $redis = Bundler::ConnectionPool.wrap { Redis.new }
|
|
31
|
+
#
|
|
32
|
+
# def do_work
|
|
33
|
+
# $redis.lpop('my-list') if $redis.llen('my-list') > 0
|
|
34
|
+
# end
|
|
35
|
+
#
|
|
36
|
+
# Accepts the following options:
|
|
37
|
+
# - :size - number of connections to pool, defaults to 5
|
|
38
|
+
# - :timeout - amount of time to wait for a connection if none currently available, defaults to 5 seconds
|
|
39
|
+
# - :auto_reload_after_fork - automatically drop all connections after fork, defaults to true
|
|
40
|
+
#
|
|
41
|
+
class Bundler::ConnectionPool
|
|
42
|
+
DEFAULTS = {size: 5, timeout: 5, auto_reload_after_fork: true}.freeze
|
|
43
|
+
|
|
44
|
+
def self.wrap(options, &block)
|
|
45
|
+
Wrapper.new(options, &block)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
if Process.respond_to?(:fork)
|
|
49
|
+
INSTANCES = ObjectSpace::WeakMap.new
|
|
50
|
+
private_constant :INSTANCES
|
|
51
|
+
|
|
52
|
+
def self.after_fork
|
|
53
|
+
INSTANCES.values.each do |pool|
|
|
54
|
+
next unless pool.auto_reload_after_fork
|
|
55
|
+
|
|
56
|
+
# We're on after fork, so we know all other threads are dead.
|
|
57
|
+
# All we need to do is to ensure the main thread doesn't have a
|
|
58
|
+
# checked out connection
|
|
59
|
+
pool.checkin(force: true)
|
|
60
|
+
pool.reload do |connection|
|
|
61
|
+
# Unfortunately we don't know what method to call to close the connection,
|
|
62
|
+
# so we try the most common one.
|
|
63
|
+
connection.close if connection.respond_to?(:close)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
nil
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
if ::Process.respond_to?(:_fork) # MRI 3.1+
|
|
70
|
+
module ForkTracker
|
|
71
|
+
def _fork
|
|
72
|
+
pid = super
|
|
73
|
+
if pid == 0
|
|
74
|
+
Bundler::ConnectionPool.after_fork
|
|
75
|
+
end
|
|
76
|
+
pid
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
Process.singleton_class.prepend(ForkTracker)
|
|
80
|
+
end
|
|
81
|
+
else
|
|
82
|
+
INSTANCES = nil
|
|
83
|
+
private_constant :INSTANCES
|
|
84
|
+
|
|
85
|
+
def self.after_fork
|
|
86
|
+
# noop
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def initialize(options = {}, &block)
|
|
91
|
+
raise ArgumentError, "Connection pool requires a block" unless block
|
|
92
|
+
|
|
93
|
+
options = DEFAULTS.merge(options)
|
|
94
|
+
|
|
95
|
+
@size = Integer(options.fetch(:size))
|
|
96
|
+
@timeout = options.fetch(:timeout)
|
|
97
|
+
@auto_reload_after_fork = options.fetch(:auto_reload_after_fork)
|
|
98
|
+
|
|
99
|
+
@available = TimedStack.new(@size, &block)
|
|
100
|
+
@key = :"pool-#{@available.object_id}"
|
|
101
|
+
@key_count = :"pool-#{@available.object_id}-count"
|
|
102
|
+
@discard_key = :"pool-#{@available.object_id}-discard"
|
|
103
|
+
INSTANCES[self] = self if @auto_reload_after_fork && INSTANCES
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def with(options = {})
|
|
107
|
+
Thread.handle_interrupt(Exception => :never) do
|
|
108
|
+
conn = checkout(options)
|
|
109
|
+
begin
|
|
110
|
+
Thread.handle_interrupt(Exception => :immediate) do
|
|
111
|
+
yield conn
|
|
112
|
+
end
|
|
113
|
+
ensure
|
|
114
|
+
checkin
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
alias_method :then, :with
|
|
119
|
+
|
|
120
|
+
##
|
|
121
|
+
# Marks the current thread's checked-out connection for discard.
|
|
122
|
+
#
|
|
123
|
+
# When a connection is marked for discard, it will not be returned to the pool
|
|
124
|
+
# when checked in. Instead, the connection will be discarded.
|
|
125
|
+
# This is useful when a connection has become invalid or corrupted
|
|
126
|
+
# and should not be reused.
|
|
127
|
+
#
|
|
128
|
+
# Takes an optional block that will be called with the connection to be discarded.
|
|
129
|
+
# The block should perform any necessary clean-up on the connection.
|
|
130
|
+
#
|
|
131
|
+
# @yield [conn]
|
|
132
|
+
# @yieldparam conn [Object] The connection to be discarded.
|
|
133
|
+
# @yieldreturn [void]
|
|
134
|
+
#
|
|
135
|
+
#
|
|
136
|
+
# Note: This only affects the connection currently checked out by the calling thread.
|
|
137
|
+
# The connection will be discarded when +checkin+ is called.
|
|
138
|
+
#
|
|
139
|
+
# @return [void]
|
|
140
|
+
#
|
|
141
|
+
# @example
|
|
142
|
+
# pool.with do |conn|
|
|
143
|
+
# begin
|
|
144
|
+
# conn.execute("SELECT 1")
|
|
145
|
+
# rescue SomeConnectionError
|
|
146
|
+
# pool.discard_current_connection # Mark connection as bad
|
|
147
|
+
# raise
|
|
148
|
+
# end
|
|
149
|
+
# end
|
|
150
|
+
def discard_current_connection(&block)
|
|
151
|
+
::Thread.current[@discard_key] = block || proc { |conn| conn }
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def checkout(options = {})
|
|
155
|
+
if ::Thread.current[@key]
|
|
156
|
+
::Thread.current[@key_count] += 1
|
|
157
|
+
::Thread.current[@key]
|
|
158
|
+
else
|
|
159
|
+
::Thread.current[@key_count] = 1
|
|
160
|
+
::Thread.current[@key] = @available.pop(options[:timeout] || @timeout, options)
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def checkin(force: false)
|
|
165
|
+
if ::Thread.current[@key]
|
|
166
|
+
if ::Thread.current[@key_count] == 1 || force
|
|
167
|
+
if ::Thread.current[@discard_key]
|
|
168
|
+
begin
|
|
169
|
+
@available.decrement_created
|
|
170
|
+
::Thread.current[@discard_key].call(::Thread.current[@key])
|
|
171
|
+
rescue
|
|
172
|
+
nil
|
|
173
|
+
ensure
|
|
174
|
+
::Thread.current[@discard_key] = nil
|
|
175
|
+
end
|
|
176
|
+
else
|
|
177
|
+
@available.push(::Thread.current[@key])
|
|
178
|
+
end
|
|
179
|
+
::Thread.current[@key] = nil
|
|
180
|
+
::Thread.current[@key_count] = nil
|
|
181
|
+
else
|
|
182
|
+
::Thread.current[@key_count] -= 1
|
|
183
|
+
end
|
|
184
|
+
elsif !force
|
|
185
|
+
raise Bundler::ConnectionPool::Error, "no connections are checked out"
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
nil
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
##
|
|
192
|
+
# Shuts down the Bundler::ConnectionPool by passing each connection to +block+ and
|
|
193
|
+
# then removing it from the pool. Attempting to checkout a connection after
|
|
194
|
+
# shutdown will raise +Bundler::ConnectionPool::PoolShuttingDownError+.
|
|
195
|
+
def shutdown(&block)
|
|
196
|
+
@available.shutdown(&block)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
##
|
|
200
|
+
# Reloads the Bundler::ConnectionPool by passing each connection to +block+ and then
|
|
201
|
+
# removing it the pool. Subsequent checkouts will create new connections as
|
|
202
|
+
# needed.
|
|
203
|
+
def reload(&block)
|
|
204
|
+
@available.shutdown(reload: true, &block)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
## Reaps idle connections that have been idle for over +idle_seconds+.
|
|
208
|
+
# +idle_seconds+ defaults to 60.
|
|
209
|
+
def reap(idle_seconds = 60, &block)
|
|
210
|
+
@available.reap(idle_seconds, &block)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Size of this connection pool
|
|
214
|
+
attr_reader :size
|
|
215
|
+
# Automatically drop all connections after fork
|
|
216
|
+
attr_reader :auto_reload_after_fork
|
|
217
|
+
|
|
218
|
+
# Number of pool entries available for checkout at this instant.
|
|
219
|
+
def available
|
|
220
|
+
@available.length
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Number of pool entries created and idle in the pool.
|
|
224
|
+
def idle
|
|
225
|
+
@available.idle
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
require_relative "connection_pool/timed_stack"
|
|
230
|
+
require_relative "connection_pool/wrapper"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
|
4
|
+
|
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
|
6
|
+
software without restriction, provided that you duplicate all of the
|
|
7
|
+
original copyright notices and associated disclaimers.
|
|
8
|
+
|
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
|
10
|
+
you do at least ONE of the following:
|
|
11
|
+
|
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
|
13
|
+
make them Freely Available, such as by posting said
|
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
|
15
|
+
the author to include your modifications in the software.
|
|
16
|
+
|
|
17
|
+
b. use the modified software only within your corporation or
|
|
18
|
+
organization.
|
|
19
|
+
|
|
20
|
+
c. give non-standard binaries non-standard names, with
|
|
21
|
+
instructions on where to get the original software distribution.
|
|
22
|
+
|
|
23
|
+
d. make other distribution arrangements with the author.
|
|
24
|
+
|
|
25
|
+
3. You may distribute the software in object code or binary form,
|
|
26
|
+
provided that you do at least ONE of the following:
|
|
27
|
+
|
|
28
|
+
a. distribute the binaries and library files of the software,
|
|
29
|
+
together with instructions (in the manual page or equivalent)
|
|
30
|
+
on where to get the original distribution.
|
|
31
|
+
|
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
|
33
|
+
the software.
|
|
34
|
+
|
|
35
|
+
c. give non-standard binaries non-standard names, with
|
|
36
|
+
instructions on where to get the original software distribution.
|
|
37
|
+
|
|
38
|
+
d. make other distribution arrangements with the author.
|
|
39
|
+
|
|
40
|
+
4. You may modify and include the part of the software into any other
|
|
41
|
+
software (possibly commercial). But some files in the distribution
|
|
42
|
+
are not written by the author, so that they are not under these terms.
|
|
43
|
+
|
|
44
|
+
For the list of those files and their copying conditions, see the
|
|
45
|
+
file LEGAL.
|
|
46
|
+
|
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
|
48
|
+
output from the software do not automatically fall under the
|
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
|
51
|
+
software.
|
|
52
|
+
|
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
56
|
+
PURPOSE.
|