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,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rubygems/resolver/api_set/gem_parser"
|
|
4
|
+
|
|
5
|
+
module Bundler
|
|
6
|
+
class CompactIndexClient
|
|
7
|
+
class Cache
|
|
8
|
+
attr_reader :directory
|
|
9
|
+
|
|
10
|
+
def initialize(directory, fetcher = nil)
|
|
11
|
+
@directory = Pathname.new(directory).expand_path
|
|
12
|
+
@updater = Updater.new(fetcher) if fetcher
|
|
13
|
+
@mutex = Thread::Mutex.new
|
|
14
|
+
@endpoints = Set.new
|
|
15
|
+
|
|
16
|
+
@info_root = mkdir("info")
|
|
17
|
+
@special_characters_info_root = mkdir("info-special-characters")
|
|
18
|
+
@info_etag_root = mkdir("info-etags")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def names
|
|
22
|
+
fetch("names", names_path, names_etag_path)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def versions
|
|
26
|
+
fetch("versions", versions_path, versions_etag_path)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def info(name, remote_checksum = nil)
|
|
30
|
+
path = info_path(name)
|
|
31
|
+
|
|
32
|
+
if remote_checksum && remote_checksum != SharedHelpers.checksum_for_file(path, :MD5)
|
|
33
|
+
fetch("info/#{name}", path, info_etag_path(name))
|
|
34
|
+
else
|
|
35
|
+
Bundler::CompactIndexClient.debug { "update skipped info/#{name} (#{remote_checksum ? "versions index checksum is nil" : "versions index checksum matches local"})" }
|
|
36
|
+
read(path)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def reset!
|
|
41
|
+
@mutex.synchronize { @endpoints.clear }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def names_path = directory.join("names")
|
|
47
|
+
def names_etag_path = directory.join("names.etag")
|
|
48
|
+
def versions_path = directory.join("versions")
|
|
49
|
+
def versions_etag_path = directory.join("versions.etag")
|
|
50
|
+
|
|
51
|
+
def info_path(name)
|
|
52
|
+
name = name.to_s
|
|
53
|
+
# TODO: converge this into the info_root by hashing all filenames like info_etag_path
|
|
54
|
+
if /[^a-z0-9_-]/.match?(name)
|
|
55
|
+
name += "-#{SharedHelpers.digest(:MD5).hexdigest(name).downcase}"
|
|
56
|
+
@special_characters_info_root.join(name)
|
|
57
|
+
else
|
|
58
|
+
@info_root.join(name)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def info_etag_path(name)
|
|
63
|
+
name = name.to_s
|
|
64
|
+
@info_etag_root.join("#{name}-#{SharedHelpers.digest(:MD5).hexdigest(name).downcase}")
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def mkdir(name)
|
|
68
|
+
directory.join(name).tap do |dir|
|
|
69
|
+
SharedHelpers.filesystem_access(dir) do
|
|
70
|
+
FileUtils.mkdir_p(dir)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def fetch(remote_path, path, etag_path)
|
|
76
|
+
if already_fetched?(remote_path)
|
|
77
|
+
Bundler::CompactIndexClient.debug { "already fetched #{remote_path}" }
|
|
78
|
+
else
|
|
79
|
+
Bundler::CompactIndexClient.debug { "fetching #{remote_path}" }
|
|
80
|
+
@updater&.update(remote_path, path, etag_path)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
read(path)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def already_fetched?(remote_path)
|
|
87
|
+
@mutex.synchronize { !@endpoints.add?(remote_path) }
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def read(path)
|
|
91
|
+
return unless path.file?
|
|
92
|
+
SharedHelpers.filesystem_access(path, :read, &:read)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../vendored_fileutils"
|
|
4
|
+
require "rubygems/package"
|
|
5
|
+
|
|
6
|
+
module Bundler
|
|
7
|
+
class CompactIndexClient
|
|
8
|
+
# write cache files in a way that is robust to concurrent modifications
|
|
9
|
+
# if digests are given, the checksums will be verified
|
|
10
|
+
class CacheFile
|
|
11
|
+
DEFAULT_FILE_MODE = 0o644
|
|
12
|
+
private_constant :DEFAULT_FILE_MODE
|
|
13
|
+
|
|
14
|
+
class Error < RuntimeError; end
|
|
15
|
+
class ClosedError < Error; end
|
|
16
|
+
|
|
17
|
+
class DigestMismatchError < Error
|
|
18
|
+
def initialize(digests, expected_digests)
|
|
19
|
+
super "Calculated checksums #{digests.inspect} did not match expected #{expected_digests.inspect}."
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Initialize with a copy of the original file, then yield the instance.
|
|
24
|
+
def self.copy(path, &block)
|
|
25
|
+
new(path) do |file|
|
|
26
|
+
file.initialize_digests
|
|
27
|
+
|
|
28
|
+
SharedHelpers.filesystem_access(path, :read) do
|
|
29
|
+
path.open("rb") do |s|
|
|
30
|
+
file.open {|f| IO.copy_stream(s, f) }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
yield file
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Write data to a temp file, then replace the original file with it verifying the digests if given.
|
|
39
|
+
def self.write(path, data, digests = nil)
|
|
40
|
+
return unless data
|
|
41
|
+
new(path) do |file|
|
|
42
|
+
file.digests = digests
|
|
43
|
+
file.write(data)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
attr_reader :original_path, :path
|
|
48
|
+
|
|
49
|
+
def initialize(original_path, &block)
|
|
50
|
+
@original_path = original_path
|
|
51
|
+
@perm = original_path.file? ? original_path.stat.mode : DEFAULT_FILE_MODE
|
|
52
|
+
@path = original_path.sub(/$/, ".#{$$}.tmp")
|
|
53
|
+
return unless block_given?
|
|
54
|
+
begin
|
|
55
|
+
yield self
|
|
56
|
+
ensure
|
|
57
|
+
close
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def size
|
|
62
|
+
path.size
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# initialize the digests using CompactIndexClient::SUPPORTED_DIGESTS, or a subset based on keys.
|
|
66
|
+
def initialize_digests(keys = nil)
|
|
67
|
+
@digests = keys ? SUPPORTED_DIGESTS.slice(*keys) : SUPPORTED_DIGESTS.dup
|
|
68
|
+
@digests.transform_values! {|algo_class| SharedHelpers.digest(algo_class).new }
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# reset the digests so they don't contain any previously read data
|
|
72
|
+
def reset_digests
|
|
73
|
+
@digests&.each_value(&:reset)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# set the digests that will be verified at the end
|
|
77
|
+
def digests=(expected_digests)
|
|
78
|
+
@expected_digests = expected_digests
|
|
79
|
+
|
|
80
|
+
if @expected_digests.nil?
|
|
81
|
+
@digests = nil
|
|
82
|
+
elsif @digests
|
|
83
|
+
@digests = @digests.slice(*@expected_digests.keys)
|
|
84
|
+
else
|
|
85
|
+
initialize_digests(@expected_digests.keys)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def digests?
|
|
90
|
+
@digests&.any?
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Open the temp file for writing, reusing original permissions, yielding the IO object.
|
|
94
|
+
def open(write_mode = "wb", perm = @perm, &block)
|
|
95
|
+
raise ClosedError, "Cannot reopen closed file" if @closed
|
|
96
|
+
SharedHelpers.filesystem_access(path, :write) do
|
|
97
|
+
path.open(write_mode, perm) do |f|
|
|
98
|
+
yield digests? ? Gem::Package::DigestIO.new(f, @digests) : f
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Returns false without appending when no digests since appending is too error prone to do without digests.
|
|
104
|
+
def append(data)
|
|
105
|
+
return false unless digests?
|
|
106
|
+
open("a") {|f| f.write data }
|
|
107
|
+
verify && commit
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def write(data)
|
|
111
|
+
reset_digests
|
|
112
|
+
open {|f| f.write data }
|
|
113
|
+
commit!
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def commit!
|
|
117
|
+
verify || raise(DigestMismatchError.new(@base64digests, @expected_digests))
|
|
118
|
+
commit
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Verify the digests, returning true on match, false on mismatch.
|
|
122
|
+
def verify
|
|
123
|
+
return true unless @expected_digests && digests?
|
|
124
|
+
@base64digests = @digests.transform_values!(&:base64digest)
|
|
125
|
+
@digests = nil
|
|
126
|
+
@base64digests.all? {|algo, digest| @expected_digests[algo] == digest }
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Replace the original file with the temp file without verifying digests.
|
|
130
|
+
# The file is permanently closed.
|
|
131
|
+
def commit
|
|
132
|
+
raise ClosedError, "Cannot commit closed file" if @closed
|
|
133
|
+
SharedHelpers.filesystem_access(original_path, :write) do
|
|
134
|
+
FileUtils.mv(path, original_path)
|
|
135
|
+
end
|
|
136
|
+
@closed = true
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Remove the temp file without replacing the original file.
|
|
140
|
+
# The file is permanently closed.
|
|
141
|
+
def close
|
|
142
|
+
return if @closed
|
|
143
|
+
FileUtils.remove_file(path) if @path&.file?
|
|
144
|
+
@closed = true
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bundler
|
|
4
|
+
class CompactIndexClient
|
|
5
|
+
class Parser
|
|
6
|
+
# `compact_index` - an object responding to #names, #versions, #info(name, checksum),
|
|
7
|
+
# returning the file contents as a string
|
|
8
|
+
def initialize(compact_index)
|
|
9
|
+
@compact_index = compact_index
|
|
10
|
+
@info_checksums = nil
|
|
11
|
+
@versions_by_name = nil
|
|
12
|
+
@available = nil
|
|
13
|
+
@gem_parser = nil
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def names
|
|
17
|
+
lines(@compact_index.names)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def versions
|
|
21
|
+
@versions_by_name ||= Hash.new {|hash, key| hash[key] = [] }
|
|
22
|
+
@info_checksums = {}
|
|
23
|
+
|
|
24
|
+
lines(@compact_index.versions).each do |line|
|
|
25
|
+
name, versions_string, checksum = line.split(" ", 3)
|
|
26
|
+
@info_checksums[name] = checksum || ""
|
|
27
|
+
versions_string.split(",") do |version|
|
|
28
|
+
delete = version.delete_prefix!("-")
|
|
29
|
+
version = version.split("-", 2).unshift(name)
|
|
30
|
+
if delete
|
|
31
|
+
@versions_by_name[name].delete(version)
|
|
32
|
+
else
|
|
33
|
+
@versions_by_name[name] << version
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
@versions_by_name
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def info(name)
|
|
42
|
+
data = @compact_index.info(name, info_checksums[name])
|
|
43
|
+
lines(data).map {|line| gem_parser.parse(line).unshift(name) }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def available?
|
|
47
|
+
return @available unless @available.nil?
|
|
48
|
+
@available = !info_checksums.empty?
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
def info_checksums
|
|
54
|
+
@info_checksums ||= lines(@compact_index.versions).each_with_object({}) do |line, checksums|
|
|
55
|
+
parse_version_checksum(line, checksums)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def lines(data)
|
|
60
|
+
return [] if data.nil? || data.empty?
|
|
61
|
+
lines = data.split("\n")
|
|
62
|
+
header = lines.index("---")
|
|
63
|
+
header ? lines[header + 1..-1] : lines
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def gem_parser
|
|
67
|
+
@gem_parser ||= Gem::Resolver::APISet::GemParser.new
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# This is mostly the same as `split(" ", 3)` but it avoids allocating extra objects.
|
|
71
|
+
# This method gets called at least once for every gem when parsing versions.
|
|
72
|
+
def parse_version_checksum(line, checksums)
|
|
73
|
+
return unless (name_end = line.index(" ")) # Artifactory bug causes blank lines in artifactor index files
|
|
74
|
+
checksum_start = line.index(" ", name_end + 1)
|
|
75
|
+
return unless checksum_start
|
|
76
|
+
checksum_start += 1
|
|
77
|
+
|
|
78
|
+
checksum_end = line.size - checksum_start
|
|
79
|
+
|
|
80
|
+
line.freeze # allows slicing into the string to not allocate a copy of the line
|
|
81
|
+
name = line[0, name_end]
|
|
82
|
+
checksum = line[checksum_start, checksum_end]
|
|
83
|
+
checksums[name.freeze] = checksum # freeze name since it is used as a hash key
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bundler
|
|
4
|
+
class CompactIndexClient
|
|
5
|
+
class Updater
|
|
6
|
+
class MismatchedChecksumError < Error
|
|
7
|
+
def initialize(path, message)
|
|
8
|
+
super "The checksum of /#{path} does not match the checksum provided by the server! Something is wrong. #{message}"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def initialize(fetcher)
|
|
13
|
+
@fetcher = fetcher
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def update(remote_path, local_path, etag_path)
|
|
17
|
+
append(remote_path, local_path, etag_path) || replace(remote_path, local_path, etag_path)
|
|
18
|
+
rescue CacheFile::DigestMismatchError => e
|
|
19
|
+
raise MismatchedChecksumError.new(remote_path, e.message)
|
|
20
|
+
rescue Zlib::GzipFile::Error
|
|
21
|
+
raise Bundler::HTTPError
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def append(remote_path, local_path, etag_path)
|
|
27
|
+
return false unless local_path.file? && local_path.size.nonzero?
|
|
28
|
+
|
|
29
|
+
CacheFile.copy(local_path) do |file|
|
|
30
|
+
etag = etag_path.read.tap(&:chomp!) if etag_path.file?
|
|
31
|
+
|
|
32
|
+
# Subtract a byte to ensure the range won't be empty.
|
|
33
|
+
# Avoids 416 (Range Not Satisfiable) responses.
|
|
34
|
+
response = @fetcher.call(remote_path, request_headers(etag, file.size - 1))
|
|
35
|
+
break true if response.is_a?(Gem::Net::HTTPNotModified)
|
|
36
|
+
|
|
37
|
+
file.digests = parse_digests(response)
|
|
38
|
+
# server may ignore Range and return the full response
|
|
39
|
+
if response.is_a?(Gem::Net::HTTPPartialContent)
|
|
40
|
+
tail = response.body.byteslice(1..-1)
|
|
41
|
+
break false unless tail && file.append(tail)
|
|
42
|
+
else
|
|
43
|
+
file.write(response.body)
|
|
44
|
+
end
|
|
45
|
+
CacheFile.write(etag_path, etag_from_response(response))
|
|
46
|
+
true
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# request without range header to get the full file or a 304 Not Modified
|
|
51
|
+
def replace(remote_path, local_path, etag_path)
|
|
52
|
+
etag = etag_path.read.tap(&:chomp!) if etag_path.file?
|
|
53
|
+
response = @fetcher.call(remote_path, request_headers(etag))
|
|
54
|
+
return true if response.is_a?(Gem::Net::HTTPNotModified)
|
|
55
|
+
CacheFile.write(local_path, response.body, parse_digests(response))
|
|
56
|
+
CacheFile.write(etag_path, etag_from_response(response))
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def request_headers(etag, range_start = nil)
|
|
60
|
+
headers = {}
|
|
61
|
+
headers["Range"] = "bytes=#{range_start}-" if range_start
|
|
62
|
+
headers["If-None-Match"] = %("#{etag}") if etag
|
|
63
|
+
headers
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def etag_for_request(etag_path)
|
|
67
|
+
etag_path.read.tap(&:chomp!) if etag_path.file?
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def etag_from_response(response)
|
|
71
|
+
return unless response["ETag"]
|
|
72
|
+
etag = response["ETag"].delete_prefix("W/")
|
|
73
|
+
return if etag.delete_prefix!('"') && !etag.delete_suffix!('"')
|
|
74
|
+
etag
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Unwraps and returns a Hash of digest algorithms and base64 values
|
|
78
|
+
# according to RFC 8941 Structured Field Values for HTTP.
|
|
79
|
+
# https://www.rfc-editor.org/rfc/rfc8941#name-parsing-a-byte-sequence
|
|
80
|
+
# Ignores unsupported algorithms.
|
|
81
|
+
def parse_digests(response)
|
|
82
|
+
return unless header = response["Repr-Digest"] || response["Digest"]
|
|
83
|
+
digests = {}
|
|
84
|
+
header.split(",") do |param|
|
|
85
|
+
algorithm, value = param.split("=", 2)
|
|
86
|
+
algorithm.strip!
|
|
87
|
+
algorithm.downcase!
|
|
88
|
+
next unless SUPPORTED_DIGESTS.key?(algorithm)
|
|
89
|
+
next unless value = byte_sequence(value)
|
|
90
|
+
digests[algorithm] = value
|
|
91
|
+
end
|
|
92
|
+
digests.empty? ? nil : digests
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Unwrap surrounding colons (byte sequence)
|
|
96
|
+
# The wrapping characters must be matched or we return nil.
|
|
97
|
+
# Also handles quotes because right now rubygems.org sends them.
|
|
98
|
+
def byte_sequence(value)
|
|
99
|
+
return if value.delete_prefix!(":") && !value.delete_suffix!(":")
|
|
100
|
+
return if value.delete_prefix!('"') && !value.delete_suffix!('"')
|
|
101
|
+
value
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "set"
|
|
4
|
+
|
|
5
|
+
module Bundler
|
|
6
|
+
# The CompactIndexClient is responsible for fetching and parsing the compact index.
|
|
7
|
+
#
|
|
8
|
+
# The compact index is a set of caching optimized files that are used to fetch gem information.
|
|
9
|
+
# The files are:
|
|
10
|
+
# - names: a list of all gem names
|
|
11
|
+
# - versions: a list of all gem versions
|
|
12
|
+
# - info/[gem]: a list of all versions of a gem
|
|
13
|
+
#
|
|
14
|
+
# The client is instantiated with:
|
|
15
|
+
# - `directory`: the root directory where the cache files are stored.
|
|
16
|
+
# - `fetcher`: (optional) an object that responds to #call(uri_path, headers) and returns an http response.
|
|
17
|
+
# If the `fetcher` is not provided, the client will only read cached files from disk.
|
|
18
|
+
#
|
|
19
|
+
# The client is organized into:
|
|
20
|
+
# - `Updater`: updates the cached files on disk using the fetcher.
|
|
21
|
+
# - `Cache`: calls the updater, caches files, read and return them from disk
|
|
22
|
+
# - `Parser`: parses the compact index file data
|
|
23
|
+
# - `CacheFile`: a concurrency safe file reader/writer that verifies checksums
|
|
24
|
+
#
|
|
25
|
+
# The client is intended to optimize memory usage and performance.
|
|
26
|
+
# It is called 100s or 1000s of times, parsing files with hundreds of thousands of lines.
|
|
27
|
+
# It may be called concurrently without global interpreter lock in some Rubies.
|
|
28
|
+
# As a result, some methods may look more complex than necessary to save memory or time.
|
|
29
|
+
class CompactIndexClient
|
|
30
|
+
SUPPORTED_DIGESTS = { "sha-256" => :SHA256 }.freeze
|
|
31
|
+
DEBUG_MUTEX = Thread::Mutex.new
|
|
32
|
+
|
|
33
|
+
# info returns an Array of INFO Arrays. Each INFO Array has the following indices:
|
|
34
|
+
INFO_NAME = 0
|
|
35
|
+
INFO_VERSION = 1
|
|
36
|
+
INFO_PLATFORM = 2
|
|
37
|
+
INFO_DEPS = 3
|
|
38
|
+
INFO_REQS = 4
|
|
39
|
+
|
|
40
|
+
def self.debug
|
|
41
|
+
return unless ENV["DEBUG_COMPACT_INDEX"]
|
|
42
|
+
DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class Error < StandardError; end
|
|
46
|
+
|
|
47
|
+
require_relative "compact_index_client/cache"
|
|
48
|
+
require_relative "compact_index_client/cache_file"
|
|
49
|
+
require_relative "compact_index_client/parser"
|
|
50
|
+
require_relative "compact_index_client/updater"
|
|
51
|
+
|
|
52
|
+
def initialize(directory, fetcher = nil)
|
|
53
|
+
@cache = Cache.new(directory, fetcher)
|
|
54
|
+
@parser = Parser.new(@cache)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def names
|
|
58
|
+
Bundler::CompactIndexClient.debug { "names" }
|
|
59
|
+
@parser.names
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def versions
|
|
63
|
+
Bundler::CompactIndexClient.debug { "versions" }
|
|
64
|
+
@parser.versions
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def dependencies(names)
|
|
68
|
+
Bundler::CompactIndexClient.debug { "dependencies(#{names})" }
|
|
69
|
+
names.map {|name| info(name) }
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def info(name)
|
|
73
|
+
Bundler::CompactIndexClient.debug { "info(#{name})" }
|
|
74
|
+
@parser.info(name)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def latest_version(name)
|
|
78
|
+
Bundler::CompactIndexClient.debug { "latest_version(#{name})" }
|
|
79
|
+
@parser.info(name).map {|d| Gem::Version.new(d[INFO_VERSION]) }.max
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def available?
|
|
83
|
+
Bundler::CompactIndexClient.debug { "available?" }
|
|
84
|
+
@parser.available?
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def reset!
|
|
88
|
+
Bundler::CompactIndexClient.debug { "reset!" }
|
|
89
|
+
@cache.reset!
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rbconfig"
|
|
4
|
+
|
|
5
|
+
module Bundler
|
|
6
|
+
WINDOWS = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw)/
|
|
7
|
+
deprecate_constant :WINDOWS
|
|
8
|
+
|
|
9
|
+
FREEBSD = RbConfig::CONFIG["host_os"].to_s.include?("bsd")
|
|
10
|
+
deprecate_constant :FREEBSD
|
|
11
|
+
|
|
12
|
+
NULL = File::NULL
|
|
13
|
+
deprecate_constant :NULL
|
|
14
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "rubygems_ext"
|
|
4
|
+
|
|
5
|
+
module Bundler
|
|
6
|
+
# Returns current version of Ruby
|
|
7
|
+
#
|
|
8
|
+
# @return [CurrentRuby] Current version of Ruby
|
|
9
|
+
def self.current_ruby
|
|
10
|
+
@current_ruby ||= CurrentRuby.new
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class CurrentRuby
|
|
14
|
+
ALL_RUBY_VERSIONS = [*18..27, *30..34, *40..41].freeze
|
|
15
|
+
KNOWN_MINOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.reverse.join(".") }.freeze
|
|
16
|
+
KNOWN_MAJOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.last.to_s }.uniq.freeze
|
|
17
|
+
PLATFORM_MAP = {
|
|
18
|
+
ruby: [Gem::Platform::RUBY, CurrentRuby::ALL_RUBY_VERSIONS],
|
|
19
|
+
mri: [Gem::Platform::RUBY, CurrentRuby::ALL_RUBY_VERSIONS],
|
|
20
|
+
rbx: [Gem::Platform::RUBY],
|
|
21
|
+
truffleruby: [Gem::Platform::RUBY],
|
|
22
|
+
jruby: [Gem::Platform::JAVA, [18, 19]],
|
|
23
|
+
windows: [Gem::Platform::WINDOWS, CurrentRuby::ALL_RUBY_VERSIONS],
|
|
24
|
+
# deprecated
|
|
25
|
+
mswin: [Gem::Platform::MSWIN, CurrentRuby::ALL_RUBY_VERSIONS],
|
|
26
|
+
mswin64: [Gem::Platform::MSWIN64, CurrentRuby::ALL_RUBY_VERSIONS - [18]],
|
|
27
|
+
mingw: [Gem::Platform::UNIVERSAL_MINGW, CurrentRuby::ALL_RUBY_VERSIONS],
|
|
28
|
+
x64_mingw: [Gem::Platform::UNIVERSAL_MINGW, CurrentRuby::ALL_RUBY_VERSIONS - [18, 19]],
|
|
29
|
+
}.each_with_object({}) do |(platform, spec), hash|
|
|
30
|
+
hash[platform] = spec[0]
|
|
31
|
+
spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] }
|
|
32
|
+
end.freeze
|
|
33
|
+
|
|
34
|
+
def ruby?
|
|
35
|
+
return true if Bundler::MatchPlatform.generic_local_platform_is_ruby?
|
|
36
|
+
|
|
37
|
+
!windows? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby")
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def mri?
|
|
41
|
+
!windows? && RUBY_ENGINE == "ruby"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def rbx?
|
|
45
|
+
ruby? && RUBY_ENGINE == "rbx"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def jruby?
|
|
49
|
+
RUBY_ENGINE == "jruby"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def maglev?
|
|
53
|
+
removed_message =
|
|
54
|
+
"`CurrentRuby#maglev?` was removed with no replacement. Please use the " \
|
|
55
|
+
"built-in Ruby `RUBY_ENGINE` constant to check the Ruby implementation you are running on."
|
|
56
|
+
SharedHelpers.feature_removed!(removed_message)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def truffleruby?
|
|
60
|
+
RUBY_ENGINE == "truffleruby"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def windows?
|
|
64
|
+
Gem.win_platform?
|
|
65
|
+
end
|
|
66
|
+
alias_method :mswin?, :windows?
|
|
67
|
+
alias_method :mswin64?, :windows?
|
|
68
|
+
alias_method :mingw?, :windows?
|
|
69
|
+
alias_method :x64_mingw?, :windows?
|
|
70
|
+
|
|
71
|
+
(KNOWN_MINOR_VERSIONS + KNOWN_MAJOR_VERSIONS).each do |version|
|
|
72
|
+
trimmed_version = version.tr(".", "")
|
|
73
|
+
define_method(:"on_#{trimmed_version}?") do
|
|
74
|
+
RUBY_VERSION.start_with?("#{version}.")
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
PLATFORM_MAP.keys.each do |platform|
|
|
78
|
+
define_method(:"#{platform}_#{trimmed_version}?") do
|
|
79
|
+
send(:"#{platform}?") && send(:"on_#{trimmed_version}?")
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
define_method(:"maglev_#{trimmed_version}?") do
|
|
84
|
+
removed_message =
|
|
85
|
+
"`CurrentRuby##{__method__}` was removed with no replacement. Please use the " \
|
|
86
|
+
"built-in Ruby `RUBY_ENGINE` and `RUBY_VERSION` constants to perform a similar check."
|
|
87
|
+
|
|
88
|
+
SharedHelpers.feature_removed!(removed_message)
|
|
89
|
+
|
|
90
|
+
send(:"maglev?") && send(:"on_#{trimmed_version}?")
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|