bundler-clone 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,270 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "force_platform"
|
|
4
|
+
|
|
5
|
+
module Bundler
|
|
6
|
+
class LazySpecification
|
|
7
|
+
include MatchMetadata
|
|
8
|
+
include MatchPlatform
|
|
9
|
+
include ForcePlatform
|
|
10
|
+
|
|
11
|
+
attr_reader :name, :version, :platform, :materialization
|
|
12
|
+
attr_accessor :source, :remote, :force_ruby_platform, :dependencies, :required_ruby_version, :required_rubygems_version
|
|
13
|
+
|
|
14
|
+
#
|
|
15
|
+
# For backwards compatibility with existing lockfiles, if the most specific
|
|
16
|
+
# locked platform is not a specific platform like x86_64-linux or
|
|
17
|
+
# universal-java-11, then we keep the previous behaviour of resolving the
|
|
18
|
+
# best platform variant at materiliazation time. For previous bundler
|
|
19
|
+
# versions (before 2.2.0) this was always the case (except when the lockfile
|
|
20
|
+
# only included non-ruby platforms), but we're also keeping this behaviour
|
|
21
|
+
# on newer bundlers unless users generate the lockfile from scratch or
|
|
22
|
+
# explicitly add a more specific platform.
|
|
23
|
+
#
|
|
24
|
+
attr_accessor :most_specific_locked_platform
|
|
25
|
+
|
|
26
|
+
alias_method :runtime_dependencies, :dependencies
|
|
27
|
+
|
|
28
|
+
def self.from_spec(s)
|
|
29
|
+
lazy_spec = new(s.name, s.version, s.platform, s.source)
|
|
30
|
+
lazy_spec.dependencies = s.runtime_dependencies
|
|
31
|
+
lazy_spec.required_ruby_version = s.required_ruby_version
|
|
32
|
+
lazy_spec.required_rubygems_version = s.required_rubygems_version
|
|
33
|
+
lazy_spec
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def initialize(name, version, platform, source = nil, **materialization_options)
|
|
37
|
+
@name = name
|
|
38
|
+
@version = version
|
|
39
|
+
@dependencies = []
|
|
40
|
+
@required_ruby_version = Gem::Requirement.default
|
|
41
|
+
@required_rubygems_version = Gem::Requirement.default
|
|
42
|
+
@platform = platform || Gem::Platform::RUBY
|
|
43
|
+
|
|
44
|
+
@original_source = source
|
|
45
|
+
@source = source
|
|
46
|
+
@materialization_options = materialization_options
|
|
47
|
+
|
|
48
|
+
@force_ruby_platform = default_force_ruby_platform
|
|
49
|
+
@most_specific_locked_platform = nil
|
|
50
|
+
@materialization = nil
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def missing?
|
|
54
|
+
@materialization == self
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def incomplete?
|
|
58
|
+
@materialization.nil?
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def source_changed?
|
|
62
|
+
@original_source != source
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def full_name
|
|
66
|
+
@full_name ||= if platform == Gem::Platform::RUBY
|
|
67
|
+
"#{@name}-#{@version}"
|
|
68
|
+
else
|
|
69
|
+
"#{@name}-#{@version}-#{platform}"
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def lock_name
|
|
74
|
+
@lock_name ||= name_tuple.lock_name
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def name_tuple
|
|
78
|
+
Gem::NameTuple.new(@name, @version, @platform)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def ==(other)
|
|
82
|
+
full_name == other.full_name
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def eql?(other)
|
|
86
|
+
full_name.eql?(other.full_name)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def hash
|
|
90
|
+
full_name.hash
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
##
|
|
94
|
+
# Does this locked specification satisfy +dependency+?
|
|
95
|
+
#
|
|
96
|
+
# NOTE: Rubygems default requirement is ">= 0", which doesn't match
|
|
97
|
+
# prereleases of 0 versions, like "0.0.0.dev" or "0.0.0.SNAPSHOT". However,
|
|
98
|
+
# bundler users expect those to work. We need to make sure that Gemfile
|
|
99
|
+
# dependencies without explicit requirements (which use ">= 0" under the
|
|
100
|
+
# hood by default) are still valid for locked specs using this kind of
|
|
101
|
+
# versions. The method implements an ad-hoc fix for that. A better solution
|
|
102
|
+
# might be to change default rubygems requirement of dependencies to be ">=
|
|
103
|
+
# 0.A" but that's a major refactoring likely to break things. Hopefully we
|
|
104
|
+
# can attempt it in the future.
|
|
105
|
+
#
|
|
106
|
+
|
|
107
|
+
def satisfies?(dependency)
|
|
108
|
+
effective_requirement = dependency.requirement == Gem::Requirement.default ? Gem::Requirement.new(">= 0.A") : dependency.requirement
|
|
109
|
+
|
|
110
|
+
@name == dependency.name && effective_requirement.satisfied_by?(Gem::Version.new(@version))
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def to_lock
|
|
114
|
+
out = String.new
|
|
115
|
+
out << " #{lock_name}\n"
|
|
116
|
+
|
|
117
|
+
dependencies.sort_by(&:to_s).uniq.each do |dep|
|
|
118
|
+
next if dep.type == :development
|
|
119
|
+
out << " #{dep.to_lock}\n"
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
out
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def materialize_for_cache
|
|
126
|
+
source.remote!
|
|
127
|
+
|
|
128
|
+
materialize(self, &:first)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def materialized_for_installation
|
|
132
|
+
@materialization = materialize_for_installation
|
|
133
|
+
|
|
134
|
+
self unless incomplete?
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def materialize_for_installation
|
|
138
|
+
source.local!
|
|
139
|
+
|
|
140
|
+
if use_exact_resolved_specifications?
|
|
141
|
+
spec = materialize(self) {|specs| choose_compatible(specs, fallback_to_non_installable: false) }
|
|
142
|
+
return spec if spec
|
|
143
|
+
|
|
144
|
+
# Exact spec is incompatible; in frozen mode, try to find a compatible platform variant
|
|
145
|
+
# In non-frozen mode, return nil to trigger re-resolution and lockfile update
|
|
146
|
+
if Bundler.frozen_bundle?
|
|
147
|
+
materialize([name, version]) {|specs| resolve_best_platform(specs) }
|
|
148
|
+
end
|
|
149
|
+
else
|
|
150
|
+
materialize([name, version]) {|specs| resolve_best_platform(specs) }
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def inspect
|
|
155
|
+
"#<#{self.class} @name=\"#{name}\" (#{full_name.delete_prefix("#{name}-")})>"
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def to_s
|
|
159
|
+
lock_name
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def git_version
|
|
163
|
+
return unless source.is_a?(Bundler::Source::Git)
|
|
164
|
+
" #{source.revision[0..6]}"
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def force_ruby_platform!
|
|
168
|
+
@force_ruby_platform = true
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def replace_source_with!(gemfile_source)
|
|
172
|
+
return unless gemfile_source.can_lock?(self)
|
|
173
|
+
|
|
174
|
+
@source = gemfile_source
|
|
175
|
+
|
|
176
|
+
true
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
private
|
|
180
|
+
|
|
181
|
+
def use_exact_resolved_specifications?
|
|
182
|
+
!source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Try platforms in order of preference until finding a compatible spec.
|
|
186
|
+
# Used for legacy lockfiles and as a fallback when the exact locked spec
|
|
187
|
+
# is incompatible. Falls back to frozen bundle behavior if none match.
|
|
188
|
+
def resolve_best_platform(specs)
|
|
189
|
+
find_compatible_platform_spec(specs) || frozen_bundle_fallback(specs)
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def find_compatible_platform_spec(specs)
|
|
193
|
+
candidate_platforms.each do |plat|
|
|
194
|
+
candidates = MatchPlatform.select_best_platform_match(specs, plat)
|
|
195
|
+
spec = choose_compatible(candidates, fallback_to_non_installable: false)
|
|
196
|
+
return spec if spec
|
|
197
|
+
end
|
|
198
|
+
nil
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Platforms to try in order of preference. Ruby platform is last since it
|
|
202
|
+
# requires compilation, but works when precompiled gems are incompatible.
|
|
203
|
+
def candidate_platforms
|
|
204
|
+
target = source.is_a?(Source::Path) ? platform : Bundler.local_platform
|
|
205
|
+
[target, platform, Gem::Platform::RUBY].uniq
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# In frozen mode, accept any candidate. Will error at install time.
|
|
209
|
+
# When target differs from locked platform, prefer locked platform's candidates
|
|
210
|
+
# to preserve lockfile integrity.
|
|
211
|
+
def frozen_bundle_fallback(specs)
|
|
212
|
+
target = source.is_a?(Source::Path) ? platform : Bundler.local_platform
|
|
213
|
+
fallback_platform = target == platform ? target : platform
|
|
214
|
+
candidates = MatchPlatform.select_best_platform_match(specs, fallback_platform)
|
|
215
|
+
choose_compatible(candidates)
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
def ruby_platform_materializes_to_ruby_platform?
|
|
219
|
+
generic_platform = Bundler.generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY
|
|
220
|
+
|
|
221
|
+
(most_specific_locked_platform != generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def materialize(query)
|
|
225
|
+
matching_specs = source.specs.search(query)
|
|
226
|
+
return self if matching_specs.empty?
|
|
227
|
+
|
|
228
|
+
yield matching_specs
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# If in frozen mode, we fallback to a non-installable candidate because by
|
|
232
|
+
# doing this we avoid re-resolving and potentially end up changing the
|
|
233
|
+
# lockfile, which is not allowed. In that case, we will give a proper error
|
|
234
|
+
# about the mismatch higher up the stack, right before trying to install the
|
|
235
|
+
# bad gem.
|
|
236
|
+
def choose_compatible(candidates, fallback_to_non_installable: Bundler.frozen_bundle?)
|
|
237
|
+
search = candidates.reverse.find do |spec|
|
|
238
|
+
spec.is_a?(StubSpecification) || spec.matches_current_metadata?
|
|
239
|
+
end
|
|
240
|
+
if search.nil? && fallback_to_non_installable
|
|
241
|
+
search = candidates.last
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
if search
|
|
245
|
+
validate_dependencies(search) if search.platform == platform
|
|
246
|
+
|
|
247
|
+
search.locked_platform = platform if search.instance_of?(RemoteSpecification) || search.instance_of?(EndpointSpecification)
|
|
248
|
+
end
|
|
249
|
+
search
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Validate dependencies of this locked spec are consistent with dependencies
|
|
253
|
+
# of the actual spec that was materialized.
|
|
254
|
+
#
|
|
255
|
+
# Note that unless we are in strict mode (which we set during installation)
|
|
256
|
+
# we don't validate dependencies of locally installed gems but
|
|
257
|
+
# accept what's in the lockfile instead for performance, since loading
|
|
258
|
+
# dependencies of locally installed gems would mean evaluating all gemspecs,
|
|
259
|
+
# which would affect `bundler/setup` performance.
|
|
260
|
+
def validate_dependencies(spec)
|
|
261
|
+
if !@materialization_options[:strict] && spec.is_a?(StubSpecification)
|
|
262
|
+
spec.dependencies = dependencies
|
|
263
|
+
else
|
|
264
|
+
if !source.is_a?(Source::Path) && spec.runtime_dependencies.sort != dependencies.sort
|
|
265
|
+
raise IncorrectLockfileDependencies.new(self)
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bundler
|
|
4
|
+
class LockfileGenerator
|
|
5
|
+
attr_reader :definition
|
|
6
|
+
attr_reader :out
|
|
7
|
+
|
|
8
|
+
# @private
|
|
9
|
+
def initialize(definition)
|
|
10
|
+
@definition = definition
|
|
11
|
+
@out = String.new
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.generate(definition)
|
|
15
|
+
new(definition).generate!
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def generate!
|
|
19
|
+
add_sources
|
|
20
|
+
add_platforms
|
|
21
|
+
add_dependencies
|
|
22
|
+
add_checksums
|
|
23
|
+
add_locked_ruby_version
|
|
24
|
+
add_bundled_with
|
|
25
|
+
|
|
26
|
+
out
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def add_sources
|
|
32
|
+
definition.sources.lock_sources.each_with_index do |source, idx|
|
|
33
|
+
out << "\n" unless idx.zero?
|
|
34
|
+
|
|
35
|
+
# Add the source header
|
|
36
|
+
out << source.to_lock
|
|
37
|
+
|
|
38
|
+
# Find all specs for this source
|
|
39
|
+
specs = definition.resolve.select {|s| source.can_lock?(s) }
|
|
40
|
+
add_specs(specs)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def add_specs(specs)
|
|
45
|
+
# This needs to be sorted by full name so that
|
|
46
|
+
# gems with the same name, but different platform
|
|
47
|
+
# are ordered consistently
|
|
48
|
+
specs.sort_by(&:full_name).each do |spec|
|
|
49
|
+
next if spec.name == "bundler"
|
|
50
|
+
out << spec.to_lock
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def add_platforms
|
|
55
|
+
add_section("PLATFORMS", definition.platforms)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def add_dependencies
|
|
59
|
+
out << "\nDEPENDENCIES\n"
|
|
60
|
+
|
|
61
|
+
handled = []
|
|
62
|
+
definition.dependencies.sort_by(&:to_s).each do |dep|
|
|
63
|
+
next if handled.include?(dep.name)
|
|
64
|
+
out << dep.to_lock << "\n"
|
|
65
|
+
handled << dep.name
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def add_checksums
|
|
70
|
+
return unless definition.locked_checksums
|
|
71
|
+
checksums = definition.resolve.map do |spec|
|
|
72
|
+
spec.source.checksum_store.to_lock(spec)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
add_section("CHECKSUMS", checksums + bundler_checksum)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def add_locked_ruby_version
|
|
79
|
+
return unless locked_ruby_version = definition.locked_ruby_version
|
|
80
|
+
add_section("RUBY VERSION", locked_ruby_version.to_s)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def add_bundled_with
|
|
84
|
+
add_section("BUNDLED WITH", definition.bundler_version_to_lock.to_s)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def add_section(name, value)
|
|
88
|
+
out << "\n#{name}\n"
|
|
89
|
+
case value
|
|
90
|
+
when Array
|
|
91
|
+
value.map(&:to_s).sort.each do |val|
|
|
92
|
+
out << " #{val}\n"
|
|
93
|
+
end
|
|
94
|
+
when Hash
|
|
95
|
+
value.to_a.sort_by {|k, _| k.to_s }.each do |key, val|
|
|
96
|
+
out << " #{key}: #{val}\n"
|
|
97
|
+
end
|
|
98
|
+
when String
|
|
99
|
+
out << " #{value}\n"
|
|
100
|
+
else
|
|
101
|
+
raise ArgumentError, "#{value.inspect} can't be serialized in a lockfile"
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def bundler_checksum
|
|
106
|
+
return [] if Bundler.gem_version.to_s.end_with?(".dev") || ENV["SKIP_BUNDLER_CHECKSUM"]
|
|
107
|
+
|
|
108
|
+
bundler_spec = definition.sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
|
|
109
|
+
return [] unless File.exist?(bundler_spec.cache_file)
|
|
110
|
+
|
|
111
|
+
require "rubygems/package"
|
|
112
|
+
|
|
113
|
+
package = Gem::Package.new(bundler_spec.cache_file)
|
|
114
|
+
definition.sources.metadata_source.checksum_store.register(bundler_spec, Checksum.from_gem_package(package))
|
|
115
|
+
|
|
116
|
+
[definition.sources.metadata_source.checksum_store.to_lock(bundler_spec)]
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "shared_helpers"
|
|
4
|
+
|
|
5
|
+
module Bundler
|
|
6
|
+
class LockfileParser
|
|
7
|
+
class Position
|
|
8
|
+
attr_reader :line, :column
|
|
9
|
+
def initialize(line, column)
|
|
10
|
+
@line = line
|
|
11
|
+
@column = column
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def advance!(string)
|
|
15
|
+
lines = string.count("\n")
|
|
16
|
+
if lines > 0
|
|
17
|
+
@line += lines
|
|
18
|
+
@column = string.length - string.rindex("\n")
|
|
19
|
+
else
|
|
20
|
+
@column += string.length
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def to_s
|
|
25
|
+
"#{line}:#{column}"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
attr_reader(
|
|
30
|
+
:sources,
|
|
31
|
+
:metadata_source,
|
|
32
|
+
:dependencies,
|
|
33
|
+
:specs,
|
|
34
|
+
:platforms,
|
|
35
|
+
:most_specific_locked_platform,
|
|
36
|
+
:bundler_version,
|
|
37
|
+
:ruby_version,
|
|
38
|
+
:checksums,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
BUNDLED = "BUNDLED WITH"
|
|
42
|
+
DEPENDENCIES = "DEPENDENCIES"
|
|
43
|
+
CHECKSUMS = "CHECKSUMS"
|
|
44
|
+
PLATFORMS = "PLATFORMS"
|
|
45
|
+
RUBY = "RUBY VERSION"
|
|
46
|
+
GIT = "GIT"
|
|
47
|
+
GEM = "GEM"
|
|
48
|
+
PATH = "PATH"
|
|
49
|
+
PLUGIN = "PLUGIN SOURCE"
|
|
50
|
+
SPECS = " specs:"
|
|
51
|
+
OPTIONS = /^ ([a-z]+): (.*)$/i
|
|
52
|
+
SOURCE = [GIT, GEM, PATH, PLUGIN].freeze
|
|
53
|
+
|
|
54
|
+
SECTIONS_BY_VERSION_INTRODUCED = {
|
|
55
|
+
Gem::Version.create("1.0") => [DEPENDENCIES, PLATFORMS, GIT, GEM, PATH].freeze,
|
|
56
|
+
Gem::Version.create("1.10") => [BUNDLED].freeze,
|
|
57
|
+
Gem::Version.create("1.12") => [RUBY].freeze,
|
|
58
|
+
Gem::Version.create("1.13") => [PLUGIN].freeze,
|
|
59
|
+
Gem::Version.create("2.5.0") => [CHECKSUMS].freeze,
|
|
60
|
+
}.freeze
|
|
61
|
+
|
|
62
|
+
KNOWN_SECTIONS = SECTIONS_BY_VERSION_INTRODUCED.values.flatten!.freeze
|
|
63
|
+
|
|
64
|
+
ENVIRONMENT_VERSION_SECTIONS = [BUNDLED, RUBY].freeze
|
|
65
|
+
deprecate_constant(:ENVIRONMENT_VERSION_SECTIONS)
|
|
66
|
+
|
|
67
|
+
def self.sections_in_lockfile(lockfile_contents)
|
|
68
|
+
sections = lockfile_contents.scan(/^\w[\w ]*$/)
|
|
69
|
+
sections.uniq!
|
|
70
|
+
sections
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def self.unknown_sections_in_lockfile(lockfile_contents)
|
|
74
|
+
sections_in_lockfile(lockfile_contents) - KNOWN_SECTIONS
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def self.sections_to_ignore(base_version = nil)
|
|
78
|
+
base_version &&= base_version.release
|
|
79
|
+
base_version ||= Gem::Version.create("1.0")
|
|
80
|
+
attributes = []
|
|
81
|
+
SECTIONS_BY_VERSION_INTRODUCED.each do |version, introduced|
|
|
82
|
+
next if version <= base_version
|
|
83
|
+
attributes += introduced
|
|
84
|
+
end
|
|
85
|
+
attributes
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def self.bundled_with
|
|
89
|
+
lockfile = Bundler.default_lockfile
|
|
90
|
+
return unless lockfile.file?
|
|
91
|
+
|
|
92
|
+
lockfile_contents = Bundler.read_file(lockfile)
|
|
93
|
+
return unless lockfile_contents.include?(BUNDLED)
|
|
94
|
+
|
|
95
|
+
lockfile_contents.split(BUNDLED).last.strip
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def initialize(lockfile, strict: false)
|
|
99
|
+
@platforms = []
|
|
100
|
+
@sources = []
|
|
101
|
+
@metadata_source = Source::Metadata.new
|
|
102
|
+
@dependencies = {}
|
|
103
|
+
@parse_method = nil
|
|
104
|
+
@specs = {}
|
|
105
|
+
@lockfile_path = begin
|
|
106
|
+
SharedHelpers.relative_lockfile_path
|
|
107
|
+
rescue GemfileNotFound
|
|
108
|
+
"Gemfile.lock"
|
|
109
|
+
end
|
|
110
|
+
@pos = Position.new(1, 1)
|
|
111
|
+
@strict = strict
|
|
112
|
+
|
|
113
|
+
if lockfile.match?(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
|
|
114
|
+
raise LockfileError, "Your #{@lockfile_path} contains merge conflicts.\n" \
|
|
115
|
+
"Run `git checkout HEAD -- #{@lockfile_path}` first to get a clean lock."
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
@valid = lockfile.strip.empty? ||
|
|
119
|
+
lockfile.split(/(?:\r?\n)+/).any? {|l| KNOWN_SECTIONS.include?(l) }
|
|
120
|
+
|
|
121
|
+
unless @valid
|
|
122
|
+
SharedHelpers.feature_deprecated!(
|
|
123
|
+
"Your #{@lockfile_path} does not appear to be a valid lockfile. " \
|
|
124
|
+
"Run `rm #{@lockfile_path}` and then `bundle install` to generate a new lockfile. " \
|
|
125
|
+
"This will raise a LockfileError in a future version of Bundler."
|
|
126
|
+
)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
lockfile.split(/((?:\r?\n)+)/) do |line|
|
|
130
|
+
# split alternates between the line and the following whitespace
|
|
131
|
+
next @pos.advance!(line) if line.match?(/^\s*$/)
|
|
132
|
+
|
|
133
|
+
if SOURCE.include?(line)
|
|
134
|
+
@parse_method = :parse_source
|
|
135
|
+
parse_source(line)
|
|
136
|
+
elsif line == DEPENDENCIES
|
|
137
|
+
@parse_method = :parse_dependency
|
|
138
|
+
elsif line == CHECKSUMS
|
|
139
|
+
# This is a temporary solution to make this feature disabled by default
|
|
140
|
+
# for all gemfiles that don't already explicitly include the feature.
|
|
141
|
+
@checksums = true
|
|
142
|
+
@parse_method = :parse_checksum
|
|
143
|
+
elsif line == PLATFORMS
|
|
144
|
+
@parse_method = :parse_platform
|
|
145
|
+
elsif line == RUBY
|
|
146
|
+
@parse_method = :parse_ruby
|
|
147
|
+
elsif line == BUNDLED
|
|
148
|
+
@parse_method = :parse_bundled_with
|
|
149
|
+
elsif /^[^\s]/.match?(line)
|
|
150
|
+
@parse_method = nil
|
|
151
|
+
elsif @parse_method
|
|
152
|
+
send(@parse_method, line)
|
|
153
|
+
end
|
|
154
|
+
@pos.advance!(line)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if @platforms.include?(Gem::Platform::X64_MINGW_LEGACY)
|
|
158
|
+
SharedHelpers.feature_deprecated!("Found x64-mingw32 in lockfile, which is deprecated and will be removed in the future.")
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
@most_specific_locked_platform = @platforms.min_by do |bundle_platform|
|
|
162
|
+
Gem::Platform.platform_specificity_match(bundle_platform, Bundler.local_platform)
|
|
163
|
+
end
|
|
164
|
+
@specs = @specs.values.sort_by!(&:full_name).each do |spec|
|
|
165
|
+
spec.most_specific_locked_platform = @most_specific_locked_platform
|
|
166
|
+
end
|
|
167
|
+
rescue ArgumentError => e
|
|
168
|
+
Bundler.ui.debug(e)
|
|
169
|
+
raise LockfileError, "Your lockfile is unreadable. Run `rm #{@lockfile_path}` " \
|
|
170
|
+
"and then `bundle install` to generate a new lockfile. The error occurred while " \
|
|
171
|
+
"evaluating #{@lockfile_path}:#{@pos}"
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def may_include_redundant_platform_specific_gems?
|
|
175
|
+
bundler_version.nil? || bundler_version < Gem::Version.new("1.16.2")
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def valid?
|
|
179
|
+
@valid
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
private
|
|
183
|
+
|
|
184
|
+
TYPES = {
|
|
185
|
+
GIT => Bundler::Source::Git,
|
|
186
|
+
GEM => Bundler::Source::Rubygems,
|
|
187
|
+
PATH => Bundler::Source::Path,
|
|
188
|
+
PLUGIN => Bundler::Plugin,
|
|
189
|
+
}.freeze
|
|
190
|
+
|
|
191
|
+
def parse_source(line)
|
|
192
|
+
case line
|
|
193
|
+
when SPECS
|
|
194
|
+
return unless TYPES.key?(@type)
|
|
195
|
+
@current_source = TYPES[@type].from_lock(@opts)
|
|
196
|
+
@sources << @current_source
|
|
197
|
+
when OPTIONS
|
|
198
|
+
value = $2
|
|
199
|
+
value = true if value == "true"
|
|
200
|
+
value = false if value == "false"
|
|
201
|
+
|
|
202
|
+
key = $1
|
|
203
|
+
|
|
204
|
+
if @opts[key]
|
|
205
|
+
@opts[key] = Array(@opts[key])
|
|
206
|
+
@opts[key] << value
|
|
207
|
+
else
|
|
208
|
+
@opts[key] = value
|
|
209
|
+
end
|
|
210
|
+
when *SOURCE
|
|
211
|
+
@current_source = nil
|
|
212
|
+
@opts = {}
|
|
213
|
+
@type = line
|
|
214
|
+
else
|
|
215
|
+
parse_spec(line)
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
space = / /
|
|
220
|
+
NAME_VERSION = /
|
|
221
|
+
^(#{space}{2}|#{space}{4}|#{space}{6})(?!#{space}) # Exactly 2, 4, or 6 spaces at the start of the line
|
|
222
|
+
(.*?) # Name
|
|
223
|
+
(?:#{space}\(([^-]*) # Space, followed by version
|
|
224
|
+
(?:-(.*))?\))? # Optional platform
|
|
225
|
+
(!)? # Optional pinned marker
|
|
226
|
+
(?:#{space}([^ ]+))? # Optional checksum
|
|
227
|
+
$ # Line end
|
|
228
|
+
/xo
|
|
229
|
+
|
|
230
|
+
def parse_dependency(line)
|
|
231
|
+
return unless line =~ NAME_VERSION
|
|
232
|
+
spaces = $1
|
|
233
|
+
return unless spaces.size == 2
|
|
234
|
+
name = -$2
|
|
235
|
+
version = $3
|
|
236
|
+
pinned = $5
|
|
237
|
+
|
|
238
|
+
version = version.split(",").each(&:strip!) if version
|
|
239
|
+
|
|
240
|
+
dep = Bundler::Dependency.new(name, version)
|
|
241
|
+
|
|
242
|
+
if pinned && dep.name != "bundler"
|
|
243
|
+
spec = @specs.find {|_, v| v.name == dep.name }
|
|
244
|
+
dep.source = spec.last.source if spec
|
|
245
|
+
|
|
246
|
+
# Path sources need to know what the default name / version
|
|
247
|
+
# to use in the case that there are no gemspecs present. A fake
|
|
248
|
+
# gemspec is created based on the version set on the dependency
|
|
249
|
+
# TODO: Use the version from the spec instead of from the dependency
|
|
250
|
+
if version && version.size == 1 && version.first =~ /^\s*= (.+)\s*$/ && dep.source.is_a?(Bundler::Source::Path)
|
|
251
|
+
dep.source.name = name
|
|
252
|
+
dep.source.version = $1
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
@dependencies[dep.name] = dep
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
def parse_checksum(line)
|
|
260
|
+
return unless line =~ NAME_VERSION
|
|
261
|
+
|
|
262
|
+
spaces = $1
|
|
263
|
+
return unless spaces.size == 2
|
|
264
|
+
checksums = $6
|
|
265
|
+
name = $2
|
|
266
|
+
version = $3
|
|
267
|
+
platform = $4
|
|
268
|
+
|
|
269
|
+
version = Gem::Version.new(version)
|
|
270
|
+
platform = platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
|
|
271
|
+
full_name = Gem::NameTuple.new(name, version, platform).full_name
|
|
272
|
+
spec = @specs[full_name]
|
|
273
|
+
|
|
274
|
+
if name == "bundler"
|
|
275
|
+
spec ||= LazySpecification.new(name, version, platform, @metadata_source)
|
|
276
|
+
end
|
|
277
|
+
return unless spec
|
|
278
|
+
|
|
279
|
+
if checksums
|
|
280
|
+
checksums.split(",") do |lock_checksum|
|
|
281
|
+
column = line.index(lock_checksum) + 1
|
|
282
|
+
checksum = Checksum.from_lock(lock_checksum, "#{@lockfile_path}:#{@pos.line}:#{column}")
|
|
283
|
+
spec.source.checksum_store.register(spec, checksum)
|
|
284
|
+
end
|
|
285
|
+
else
|
|
286
|
+
spec.source.checksum_store.register(spec, nil)
|
|
287
|
+
end
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
def parse_spec(line)
|
|
291
|
+
return unless line =~ NAME_VERSION
|
|
292
|
+
spaces = $1
|
|
293
|
+
name = -$2
|
|
294
|
+
version = $3
|
|
295
|
+
|
|
296
|
+
if spaces.size == 4
|
|
297
|
+
# only load platform for non-dependency (spec) line
|
|
298
|
+
platform = $4
|
|
299
|
+
|
|
300
|
+
version = Gem::Version.new(version)
|
|
301
|
+
platform = platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
|
|
302
|
+
@current_spec = LazySpecification.new(name, version, platform, @current_source, strict: @strict)
|
|
303
|
+
@current_source.add_dependency_names(name)
|
|
304
|
+
|
|
305
|
+
@specs[@current_spec.full_name] = @current_spec
|
|
306
|
+
elsif spaces.size == 6
|
|
307
|
+
version = version.split(",").each(&:strip!) if version
|
|
308
|
+
dep = Gem::Dependency.new(name, version)
|
|
309
|
+
@current_spec.dependencies << dep
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
def parse_platform(line)
|
|
314
|
+
@platforms << Gem::Platform.new($1.strip) if line =~ /^ (.*)$/
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
def parse_bundled_with(line)
|
|
318
|
+
line.strip!
|
|
319
|
+
return unless Gem::Version.correct?(line)
|
|
320
|
+
@bundler_version = Gem::Version.create(line)
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def parse_ruby(line)
|
|
324
|
+
line.strip!
|
|
325
|
+
@ruby_version = line
|
|
326
|
+
end
|
|
327
|
+
end
|
|
328
|
+
end
|