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,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
class <%= config[:minitest_constant_name] %> < Minitest::Test
|
|
6
|
+
def test_that_it_has_a_version_number
|
|
7
|
+
refute_nil ::<%= config[:constant_name] %>::VERSION
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
<%- if config[:ext] == 'rust' -%>
|
|
11
|
+
def test_hello_world
|
|
12
|
+
assert_equal "Hello earth, from Rust!", <%= config[:constant_name] %>.hello("world")
|
|
13
|
+
end
|
|
14
|
+
<%- else -%>
|
|
15
|
+
def test_it_does_something_useful
|
|
16
|
+
assert false
|
|
17
|
+
end
|
|
18
|
+
<%- end -%>
|
|
19
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
class <%= config[:constant_name] %>Test < Test::Unit::TestCase
|
|
6
|
+
test "VERSION" do
|
|
7
|
+
assert do
|
|
8
|
+
::<%= config[:constant_name] %>.const_defined?(:VERSION)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
test "something useful" do
|
|
13
|
+
assert_equal("expected", "actual")
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../ui"
|
|
4
|
+
require "rubygems/user_interaction"
|
|
5
|
+
|
|
6
|
+
module Bundler
|
|
7
|
+
module UI
|
|
8
|
+
class RGProxy < ::Gem::SilentUI
|
|
9
|
+
def initialize(ui)
|
|
10
|
+
@ui = ui
|
|
11
|
+
super()
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def say(message)
|
|
15
|
+
@ui&.debug(message)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../vendored_thor"
|
|
4
|
+
|
|
5
|
+
module Bundler
|
|
6
|
+
module UI
|
|
7
|
+
class Shell
|
|
8
|
+
LEVELS = %w[silent error warn confirm info debug].freeze
|
|
9
|
+
OUTPUT_STREAMS = [:stdout, :stderr].freeze
|
|
10
|
+
|
|
11
|
+
attr_writer :shell
|
|
12
|
+
attr_reader :output_stream
|
|
13
|
+
|
|
14
|
+
def initialize(options = {})
|
|
15
|
+
Thor::Base.shell = options["no-color"] ? Thor::Shell::Basic : nil
|
|
16
|
+
@shell = Thor::Base.shell.new
|
|
17
|
+
@level = ENV["DEBUG"] ? "debug" : "info"
|
|
18
|
+
@warning_history = []
|
|
19
|
+
@output_stream = :stdout
|
|
20
|
+
@thread_safe_logger_key = "logger_level_#{object_id}"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def add_color(string, *color)
|
|
24
|
+
@shell.set_color(string, *color)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def info(msg = nil, newline = nil)
|
|
28
|
+
return unless info?
|
|
29
|
+
|
|
30
|
+
tell_me(msg || yield, nil, newline)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def confirm(msg = nil, newline = nil)
|
|
34
|
+
return unless confirm?
|
|
35
|
+
|
|
36
|
+
tell_me(msg || yield, :green, newline)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def warn(msg = nil, newline = nil, color = :yellow)
|
|
40
|
+
return unless warn?
|
|
41
|
+
return if @warning_history.include? msg
|
|
42
|
+
@warning_history << msg
|
|
43
|
+
|
|
44
|
+
tell_err(msg || yield, color, newline)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def error(msg = nil, newline = nil, color = :red)
|
|
48
|
+
return unless error?
|
|
49
|
+
|
|
50
|
+
tell_err(msg || yield, color, newline)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def debug(msg = nil, newline = nil)
|
|
54
|
+
return unless debug?
|
|
55
|
+
|
|
56
|
+
tell_me(msg || yield, nil, newline)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def info?
|
|
60
|
+
level("info")
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def confirm?
|
|
64
|
+
level("confirm")
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def warn?
|
|
68
|
+
level("warn")
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def error?
|
|
72
|
+
level("error")
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def debug?
|
|
76
|
+
level("debug")
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def quiet?
|
|
80
|
+
level("quiet")
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def ask(msg)
|
|
84
|
+
@shell.ask(msg, :green)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def yes?(msg)
|
|
88
|
+
@shell.yes?(msg, :green)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def no?(msg)
|
|
92
|
+
@shell.no?(msg)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def level=(level)
|
|
96
|
+
raise ArgumentError unless LEVELS.include?(level.to_s)
|
|
97
|
+
@level = level.to_s
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def level(name = nil)
|
|
101
|
+
current_level = Thread.current.thread_variable_get(@thread_safe_logger_key) || @level
|
|
102
|
+
return current_level unless name
|
|
103
|
+
|
|
104
|
+
unless index = LEVELS.index(name)
|
|
105
|
+
raise "#{name.inspect} is not a valid level"
|
|
106
|
+
end
|
|
107
|
+
index <= LEVELS.index(current_level)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def output_stream=(symbol)
|
|
111
|
+
raise ArgumentError unless OUTPUT_STREAMS.include?(symbol)
|
|
112
|
+
@output_stream = symbol
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def trace(e, newline = nil, force = false)
|
|
116
|
+
return unless debug? || force
|
|
117
|
+
msg = "#{e.class}: #{e.message}\n#{e.backtrace.join("\n ")}"
|
|
118
|
+
tell_err(msg, nil, newline)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def silence(&blk)
|
|
122
|
+
with_level("silent", &blk)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def progress(&blk)
|
|
126
|
+
with_output_stream(:stderr, &blk)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def unprinted_warnings
|
|
130
|
+
[]
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
private
|
|
134
|
+
|
|
135
|
+
# valimism
|
|
136
|
+
def tell_me(msg, color = nil, newline = nil)
|
|
137
|
+
return tell_err(msg, color, newline) if output_stream == :stderr
|
|
138
|
+
|
|
139
|
+
msg = word_wrap(msg) if newline.is_a?(Hash) && newline[:wrap]
|
|
140
|
+
if newline.nil?
|
|
141
|
+
@shell.say(msg, color)
|
|
142
|
+
else
|
|
143
|
+
@shell.say(msg, color, newline)
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def tell_err(message, color = nil, newline = nil)
|
|
148
|
+
return if @shell.send(:stderr).closed?
|
|
149
|
+
|
|
150
|
+
newline = !message.to_s.match?(/( |\t)\Z/) if newline.nil?
|
|
151
|
+
message = word_wrap(message) if newline.is_a?(Hash) && newline[:wrap]
|
|
152
|
+
|
|
153
|
+
color = nil if color && !$stderr.tty?
|
|
154
|
+
|
|
155
|
+
buffer = @shell.send(:prepare_message, message, *color)
|
|
156
|
+
buffer << "\n" if newline && !message.to_s.end_with?("\n")
|
|
157
|
+
|
|
158
|
+
@shell.send(:stderr).print(buffer)
|
|
159
|
+
@shell.send(:stderr).flush
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def strip_leading_spaces(text)
|
|
163
|
+
spaces = text[/\A\s+/, 0]
|
|
164
|
+
spaces ? text.gsub(/#{spaces}/, "") : text
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def word_wrap(text, line_width = Thor::Terminal.terminal_width)
|
|
168
|
+
strip_leading_spaces(text).split("\n").collect do |line|
|
|
169
|
+
line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip : line
|
|
170
|
+
end * "\n"
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def with_level(desired_level)
|
|
174
|
+
old_level = level
|
|
175
|
+
Thread.current.thread_variable_set(@thread_safe_logger_key, desired_level)
|
|
176
|
+
|
|
177
|
+
yield
|
|
178
|
+
ensure
|
|
179
|
+
Thread.current.thread_variable_set(@thread_safe_logger_key, old_level)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def with_output_stream(symbol)
|
|
183
|
+
original = output_stream
|
|
184
|
+
self.output_stream = symbol
|
|
185
|
+
yield
|
|
186
|
+
ensure
|
|
187
|
+
@output_stream = original
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bundler
|
|
4
|
+
module UI
|
|
5
|
+
class Silent
|
|
6
|
+
attr_writer :shell
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@warnings = []
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def add_color(string, color)
|
|
13
|
+
string
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def info(message = nil, newline = nil)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def confirm(message = nil, newline = nil)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def warn(message = nil, newline = nil)
|
|
23
|
+
@warnings |= [message]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def error(message = nil, newline = nil)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def debug(message = nil, newline = nil)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def confirm?
|
|
33
|
+
false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def error?
|
|
37
|
+
false
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def debug?
|
|
41
|
+
false
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def info?
|
|
45
|
+
false
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def quiet?
|
|
49
|
+
false
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def warn?
|
|
53
|
+
false
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def output_stream=(_symbol)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def output_stream
|
|
60
|
+
nil
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def ask(message)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def yes?(msg)
|
|
67
|
+
raise "Cannot ask yes? with a silent shell"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def no?(msg)
|
|
71
|
+
raise "Cannot ask no? with a silent shell"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def level=(name)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def level(name = nil)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def trace(message, newline = nil, force = false)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def silence
|
|
84
|
+
yield
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def progress
|
|
88
|
+
yield
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def unprinted_warnings
|
|
92
|
+
@warnings
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
data/lib/bundler/ui.rb
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bundler
|
|
4
|
+
module URICredentialsFilter
|
|
5
|
+
module_function
|
|
6
|
+
|
|
7
|
+
def credential_filtered_uri(uri_to_anonymize)
|
|
8
|
+
return uri_to_anonymize if uri_to_anonymize.nil?
|
|
9
|
+
uri = uri_to_anonymize.dup
|
|
10
|
+
if uri.is_a?(String)
|
|
11
|
+
return uri if File.exist?(uri)
|
|
12
|
+
|
|
13
|
+
require_relative "vendored_uri"
|
|
14
|
+
uri = Gem::URI(uri)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
if uri.userinfo
|
|
18
|
+
# oauth authentication
|
|
19
|
+
if uri.password == "x-oauth-basic" || uri.password == "x" || uri.password.nil?
|
|
20
|
+
# URI as string does not display with password if no user is set
|
|
21
|
+
oauth_designation = uri.password
|
|
22
|
+
uri.user = oauth_designation
|
|
23
|
+
end
|
|
24
|
+
uri.password = nil
|
|
25
|
+
end
|
|
26
|
+
return uri.to_s if uri_to_anonymize.is_a?(String)
|
|
27
|
+
uri
|
|
28
|
+
rescue Gem::URI::InvalidURIError # uri is not canonical uri scheme
|
|
29
|
+
uri
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def credential_filtered_string(str_to_filter, uri)
|
|
33
|
+
return str_to_filter if uri.nil? || str_to_filter.nil?
|
|
34
|
+
str_with_no_credentials = str_to_filter.dup
|
|
35
|
+
anonymous_uri_str = credential_filtered_uri(uri).to_s
|
|
36
|
+
uri_str = uri.to_s
|
|
37
|
+
if anonymous_uri_str != uri_str
|
|
38
|
+
str_with_no_credentials = str_with_no_credentials.gsub(uri_str, anonymous_uri_str)
|
|
39
|
+
end
|
|
40
|
+
str_with_no_credentials
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bundler
|
|
4
|
+
module URINormalizer
|
|
5
|
+
module_function
|
|
6
|
+
|
|
7
|
+
# Normalizes uri to a consistent version, either with or without trailing
|
|
8
|
+
# slash.
|
|
9
|
+
#
|
|
10
|
+
# TODO: Currently gem sources are locked with a trailing slash, while git
|
|
11
|
+
# sources are locked without a trailing slash. This should be normalized but
|
|
12
|
+
# the inconsistency is there for now to avoid changing all lockfiles
|
|
13
|
+
# including GIT sources. We could normalize this on the next major.
|
|
14
|
+
#
|
|
15
|
+
def normalize_suffix(uri, trailing_slash: true)
|
|
16
|
+
if trailing_slash
|
|
17
|
+
uri.end_with?("/") ? uri : "#{uri}/"
|
|
18
|
+
else
|
|
19
|
+
uri.end_with?("/") ? uri.delete_suffix("/") : uri
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Vendored files do not need to be documented
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2011 Mike Perham
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
##
|
|
2
|
+
# The TimedStack manages a pool of homogeneous connections (or any resource
|
|
3
|
+
# you wish to manage). Connections are created lazily up to a given maximum
|
|
4
|
+
# number.
|
|
5
|
+
#
|
|
6
|
+
# Examples:
|
|
7
|
+
#
|
|
8
|
+
# ts = TimedStack.new(1) { MyConnection.new }
|
|
9
|
+
#
|
|
10
|
+
# # fetch a connection
|
|
11
|
+
# conn = ts.pop
|
|
12
|
+
#
|
|
13
|
+
# # return a connection
|
|
14
|
+
# ts.push conn
|
|
15
|
+
#
|
|
16
|
+
# conn = ts.pop
|
|
17
|
+
# ts.pop timeout: 5
|
|
18
|
+
# #=> raises Bundler::ConnectionPool::TimeoutError after 5 seconds
|
|
19
|
+
class Bundler::ConnectionPool::TimedStack
|
|
20
|
+
attr_reader :max
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# Creates a new pool with +size+ connections that are created from the given
|
|
24
|
+
# +block+.
|
|
25
|
+
def initialize(size = 0, &block)
|
|
26
|
+
@create_block = block
|
|
27
|
+
@created = 0
|
|
28
|
+
@que = []
|
|
29
|
+
@max = size
|
|
30
|
+
@mutex = Thread::Mutex.new
|
|
31
|
+
@resource = Thread::ConditionVariable.new
|
|
32
|
+
@shutdown_block = nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
##
|
|
36
|
+
# Returns +obj+ to the stack. +options+ is ignored in TimedStack but may be
|
|
37
|
+
# used by subclasses that extend TimedStack.
|
|
38
|
+
def push(obj, options = {})
|
|
39
|
+
@mutex.synchronize do
|
|
40
|
+
if @shutdown_block
|
|
41
|
+
@created -= 1 unless @created == 0
|
|
42
|
+
@shutdown_block.call(obj)
|
|
43
|
+
else
|
|
44
|
+
store_connection obj, options
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
@resource.broadcast
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
alias_method :<<, :push
|
|
51
|
+
|
|
52
|
+
##
|
|
53
|
+
# Retrieves a connection from the stack. If a connection is available it is
|
|
54
|
+
# immediately returned. If no connection is available within the given
|
|
55
|
+
# timeout a Bundler::ConnectionPool::TimeoutError is raised.
|
|
56
|
+
#
|
|
57
|
+
# +:timeout+ is the only checked entry in +options+ and is preferred over
|
|
58
|
+
# the +timeout+ argument (which will be removed in a future release). Other
|
|
59
|
+
# options may be used by subclasses that extend TimedStack.
|
|
60
|
+
def pop(timeout = 0.5, options = {})
|
|
61
|
+
options, timeout = timeout, 0.5 if Hash === timeout
|
|
62
|
+
timeout = options.fetch :timeout, timeout
|
|
63
|
+
|
|
64
|
+
deadline = current_time + timeout
|
|
65
|
+
@mutex.synchronize do
|
|
66
|
+
loop do
|
|
67
|
+
raise Bundler::ConnectionPool::PoolShuttingDownError if @shutdown_block
|
|
68
|
+
if (conn = try_fetch_connection(options))
|
|
69
|
+
return conn
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
connection = try_create(options)
|
|
73
|
+
return connection if connection
|
|
74
|
+
|
|
75
|
+
to_wait = deadline - current_time
|
|
76
|
+
raise Bundler::ConnectionPool::TimeoutError, "Waited #{timeout} sec, #{length}/#{@max} available" if to_wait <= 0
|
|
77
|
+
@resource.wait(@mutex, to_wait)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
##
|
|
83
|
+
# Shuts down the TimedStack by passing each connection to +block+ and then
|
|
84
|
+
# removing it from the pool. Attempting to checkout a connection after
|
|
85
|
+
# shutdown will raise +Bundler::ConnectionPool::PoolShuttingDownError+ unless
|
|
86
|
+
# +:reload+ is +true+.
|
|
87
|
+
def shutdown(reload: false, &block)
|
|
88
|
+
raise ArgumentError, "shutdown must receive a block" unless block
|
|
89
|
+
|
|
90
|
+
@mutex.synchronize do
|
|
91
|
+
@shutdown_block = block
|
|
92
|
+
@resource.broadcast
|
|
93
|
+
|
|
94
|
+
shutdown_connections
|
|
95
|
+
@shutdown_block = nil if reload
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
##
|
|
100
|
+
# Reaps connections that were checked in more than +idle_seconds+ ago.
|
|
101
|
+
def reap(idle_seconds, &block)
|
|
102
|
+
raise ArgumentError, "reap must receive a block" unless block
|
|
103
|
+
raise ArgumentError, "idle_seconds must be a number" unless idle_seconds.is_a?(Numeric)
|
|
104
|
+
raise Bundler::ConnectionPool::PoolShuttingDownError if @shutdown_block
|
|
105
|
+
|
|
106
|
+
idle.times do
|
|
107
|
+
conn =
|
|
108
|
+
@mutex.synchronize do
|
|
109
|
+
raise Bundler::ConnectionPool::PoolShuttingDownError if @shutdown_block
|
|
110
|
+
|
|
111
|
+
reserve_idle_connection(idle_seconds)
|
|
112
|
+
end
|
|
113
|
+
break unless conn
|
|
114
|
+
|
|
115
|
+
block.call(conn)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
##
|
|
120
|
+
# Returns +true+ if there are no available connections.
|
|
121
|
+
def empty?
|
|
122
|
+
(@created - @que.length) >= @max
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
##
|
|
126
|
+
# The number of connections available on the stack.
|
|
127
|
+
def length
|
|
128
|
+
@max - @created + @que.length
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
##
|
|
132
|
+
# The number of connections created and available on the stack.
|
|
133
|
+
def idle
|
|
134
|
+
@que.length
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
##
|
|
138
|
+
# Reduce the created count
|
|
139
|
+
def decrement_created
|
|
140
|
+
@created -= 1 unless @created == 0
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
private
|
|
144
|
+
|
|
145
|
+
def current_time
|
|
146
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
##
|
|
150
|
+
# This is an extension point for TimedStack and is called with a mutex.
|
|
151
|
+
#
|
|
152
|
+
# This method must returns a connection from the stack if one exists. Allows
|
|
153
|
+
# subclasses with expensive match/search algorithms to avoid double-handling
|
|
154
|
+
# their stack.
|
|
155
|
+
def try_fetch_connection(options = nil)
|
|
156
|
+
connection_stored?(options) && fetch_connection(options)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
##
|
|
160
|
+
# This is an extension point for TimedStack and is called with a mutex.
|
|
161
|
+
#
|
|
162
|
+
# This method must returns true if a connection is available on the stack.
|
|
163
|
+
def connection_stored?(options = nil)
|
|
164
|
+
!@que.empty?
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
##
|
|
168
|
+
# This is an extension point for TimedStack and is called with a mutex.
|
|
169
|
+
#
|
|
170
|
+
# This method must return a connection from the stack.
|
|
171
|
+
def fetch_connection(options = nil)
|
|
172
|
+
@que.pop&.first
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
##
|
|
176
|
+
# This is an extension point for TimedStack and is called with a mutex.
|
|
177
|
+
#
|
|
178
|
+
# This method must shut down all connections on the stack.
|
|
179
|
+
def shutdown_connections(options = nil)
|
|
180
|
+
while (conn = try_fetch_connection(options))
|
|
181
|
+
@created -= 1 unless @created == 0
|
|
182
|
+
@shutdown_block.call(conn)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
##
|
|
187
|
+
# This is an extension point for TimedStack and is called with a mutex.
|
|
188
|
+
#
|
|
189
|
+
# This method returns the oldest idle connection if it has been idle for more than idle_seconds.
|
|
190
|
+
# This requires that the stack is kept in order of checked in time (oldest first).
|
|
191
|
+
def reserve_idle_connection(idle_seconds)
|
|
192
|
+
return unless idle_connections?(idle_seconds)
|
|
193
|
+
|
|
194
|
+
@created -= 1 unless @created == 0
|
|
195
|
+
|
|
196
|
+
@que.shift.first
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
##
|
|
200
|
+
# This is an extension point for TimedStack and is called with a mutex.
|
|
201
|
+
#
|
|
202
|
+
# Returns true if the first connection in the stack has been idle for more than idle_seconds
|
|
203
|
+
def idle_connections?(idle_seconds)
|
|
204
|
+
connection_stored? && (current_time - @que.first.last > idle_seconds)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
##
|
|
208
|
+
# This is an extension point for TimedStack and is called with a mutex.
|
|
209
|
+
#
|
|
210
|
+
# This method must return +obj+ to the stack.
|
|
211
|
+
def store_connection(obj, options = nil)
|
|
212
|
+
@que.push [obj, current_time]
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
##
|
|
216
|
+
# This is an extension point for TimedStack and is called with a mutex.
|
|
217
|
+
#
|
|
218
|
+
# This method must create a connection if and only if the total number of
|
|
219
|
+
# connections allowed has not been met.
|
|
220
|
+
def try_create(options = nil)
|
|
221
|
+
unless @created == @max
|
|
222
|
+
object = @create_block.call
|
|
223
|
+
@created += 1
|
|
224
|
+
object
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
end
|