bundler 1.17.3 → 2.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3354 -1258
- data/LICENSE.md +18 -19
- data/README.md +10 -15
- data/bundler.gemspec +15 -33
- data/exe/bundle +8 -10
- data/exe/bundler +1 -1
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +5 -13
- data/lib/bundler/capistrano.rb +5 -5
- data/lib/bundler/checksum.rb +254 -0
- data/lib/bundler/ci_detector.rb +75 -0
- data/lib/bundler/cli/add.rb +29 -15
- data/lib/bundler/cli/binstubs.rb +13 -5
- data/lib/bundler/cli/cache.rb +24 -17
- data/lib/bundler/cli/check.rb +7 -5
- data/lib/bundler/cli/clean.rb +1 -1
- data/lib/bundler/cli/common.rb +50 -14
- data/lib/bundler/cli/config.rb +171 -86
- data/lib/bundler/cli/console.rb +3 -6
- data/lib/bundler/cli/doctor.rb +29 -12
- data/lib/bundler/cli/exec.rb +9 -25
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +268 -53
- data/lib/bundler/cli/info.rb +51 -18
- data/lib/bundler/cli/init.rb +7 -3
- data/lib/bundler/cli/inject.rb +2 -2
- data/lib/bundler/cli/install.rb +55 -73
- data/lib/bundler/cli/issue.rb +9 -8
- data/lib/bundler/cli/list.rb +19 -11
- data/lib/bundler/cli/lock.rb +56 -26
- data/lib/bundler/cli/open.rb +10 -7
- data/lib/bundler/cli/outdated.rb +159 -128
- data/lib/bundler/cli/platform.rb +8 -6
- data/lib/bundler/cli/plugin.rb +23 -12
- data/lib/bundler/cli/pristine.rb +39 -26
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/show.rb +7 -7
- data/lib/bundler/cli/update.rb +51 -19
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/cli.rb +399 -390
- data/lib/bundler/compact_index_client/cache.rb +55 -77
- data/lib/bundler/compact_index_client/cache_file.rb +148 -0
- data/lib/bundler/compact_index_client/gem_parser.rb +32 -0
- data/lib/bundler/compact_index_client/parser.rb +84 -0
- data/lib/bundler/compact_index_client/updater.rb +72 -84
- data/lib/bundler/compact_index_client.rb +61 -73
- data/lib/bundler/constants.rb +9 -2
- data/lib/bundler/current_ruby.rb +20 -21
- data/lib/bundler/definition.rb +663 -505
- data/lib/bundler/dependency.rb +38 -71
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +171 -152
- data/lib/bundler/endpoint_specification.rb +43 -17
- data/lib/bundler/env.rb +11 -18
- data/lib/bundler/environment_preserver.rb +17 -8
- data/lib/bundler/errors.rb +115 -14
- data/lib/bundler/feature_flag.rb +15 -39
- data/lib/bundler/fetcher/base.rb +12 -12
- data/lib/bundler/fetcher/compact_index.rb +41 -47
- data/lib/bundler/fetcher/dependency.rb +4 -8
- data/lib/bundler/fetcher/downloader.rb +27 -20
- data/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
- data/lib/bundler/fetcher/index.rb +6 -33
- data/lib/bundler/fetcher.rb +109 -90
- data/lib/bundler/force_platform.rb +16 -0
- data/lib/bundler/friendly_errors.rb +50 -55
- data/lib/bundler/gem_helper.rb +81 -46
- data/lib/bundler/gem_helpers.rb +78 -29
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +68 -109
- data/lib/bundler/graph.rb +11 -11
- data/lib/bundler/index.rb +74 -82
- data/lib/bundler/injector.rb +58 -26
- data/lib/bundler/inline.rb +59 -35
- data/lib/bundler/installer/gem_installer.rb +29 -29
- data/lib/bundler/installer/parallel_installer.rb +38 -68
- data/lib/bundler/installer/standalone.rb +76 -16
- data/lib/bundler/installer.rb +60 -135
- data/lib/bundler/lazy_specification.rb +161 -63
- data/lib/bundler/lockfile_generator.rb +14 -5
- data/lib/bundler/lockfile_parser.rb +150 -109
- data/lib/bundler/man/bundle-add.1 +76 -0
- data/lib/bundler/man/bundle-add.1.ronn +87 -0
- data/{man → lib/bundler/man}/bundle-binstubs.1 +15 -22
- data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +8 -7
- data/lib/bundler/man/bundle-cache.1 +68 -0
- data/lib/bundler/man/bundle-cache.1.ronn +108 -0
- data/{man → lib/bundler/man}/bundle-check.1 +7 -14
- data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +7 -2
- data/{man → lib/bundler/man}/bundle-clean.1 +4 -11
- data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-config.1 +80 -260
- data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +104 -98
- data/lib/bundler/man/bundle-console.1 +33 -0
- data/lib/bundler/man/bundle-console.1.ronn +39 -0
- data/{man → lib/bundler/man}/bundle-doctor.1 +5 -19
- data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +1 -1
- data/lib/bundler/man/bundle-env.1 +9 -0
- data/lib/bundler/man/bundle-env.1.ronn +10 -0
- data/{man → lib/bundler/man}/bundle-exec.1 +20 -78
- data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +12 -10
- 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 +87 -0
- data/lib/bundler/man/bundle-gem.1.ronn +149 -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/{man → lib/bundler/man}/bundle-init.1 +8 -13
- data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +5 -2
- data/lib/bundler/man/bundle-inject.1 +31 -0
- data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +12 -2
- data/{man → lib/bundler/man}/bundle-install.1 +65 -155
- data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +66 -57
- 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/{man → lib/bundler/man}/bundle-list.1 +9 -24
- data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +10 -7
- data/{man → lib/bundler/man}/bundle-lock.1 +25 -34
- data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +25 -4
- data/lib/bundler/man/bundle-open.1 +32 -0
- data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +10 -1
- data/{man → lib/bundler/man}/bundle-outdated.1 +23 -75
- data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +21 -22
- data/lib/bundler/man/bundle-platform.1 +49 -0
- data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
- data/lib/bundler/man/bundle-plugin.1 +58 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +63 -0
- data/{man → lib/bundler/man}/bundle-pristine.1 +5 -16
- data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-remove.1 +4 -14
- data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-show.1 +7 -11
- data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +4 -0
- data/{man → lib/bundler/man}/bundle-update.1 +35 -148
- data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +21 -12
- data/lib/bundler/man/bundle-version.1 +22 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/{man → lib/bundler/man}/bundle-viz.1 +9 -18
- data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +9 -3
- data/{man → lib/bundler/man}/bundle.1 +19 -53
- data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +14 -9
- data/{man → lib/bundler/man}/gemfile.5 +139 -356
- data/{man → lib/bundler/man}/gemfile.5.ronn +134 -97
- data/{man → lib/bundler/man}/index.txt +9 -1
- data/lib/bundler/match_metadata.rb +17 -0
- data/lib/bundler/match_platform.rb +2 -3
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/materialization.rb +59 -0
- data/lib/bundler/mirror.rb +10 -12
- data/lib/bundler/plugin/api/source.rb +34 -18
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/dsl.rb +1 -1
- data/lib/bundler/plugin/events.rb +24 -0
- data/lib/bundler/plugin/index.rb +44 -9
- data/lib/bundler/plugin/installer/git.rb +0 -4
- data/lib/bundler/plugin/installer/path.rb +18 -0
- data/lib/bundler/plugin/installer/rubygems.rb +1 -9
- data/lib/bundler/plugin/installer.rb +63 -27
- data/lib/bundler/plugin/source_list.rb +5 -1
- data/lib/bundler/plugin.rb +131 -45
- data/lib/bundler/process_lock.rb +10 -14
- data/lib/bundler/remote_specification.rb +22 -10
- data/lib/bundler/resolver/base.rb +118 -0
- data/lib/bundler/resolver/candidate.rb +82 -0
- data/lib/bundler/resolver/incompatibility.rb +15 -0
- data/lib/bundler/resolver/package.rb +90 -0
- data/lib/bundler/resolver/root.rb +25 -0
- data/lib/bundler/resolver/spec_group.rb +60 -68
- data/lib/bundler/resolver.rb +454 -303
- data/lib/bundler/retry.rb +6 -6
- data/lib/bundler/ruby_dsl.rb +51 -7
- data/lib/bundler/ruby_version.rb +23 -38
- data/lib/bundler/rubygems_ext.rb +357 -98
- data/lib/bundler/rubygems_gem_installer.rb +131 -65
- data/lib/bundler/rubygems_integration.rb +149 -591
- data/lib/bundler/runtime.rb +51 -51
- data/lib/bundler/safe_marshal.rb +31 -0
- data/lib/bundler/self_manager.rb +206 -0
- data/lib/bundler/settings.rb +271 -135
- data/lib/bundler/setup.rb +23 -12
- data/lib/bundler/shared_helpers.rb +127 -117
- data/lib/bundler/similarity_detector.rb +3 -3
- data/lib/bundler/source/git/git_proxy.rb +326 -127
- data/lib/bundler/source/git.rb +207 -88
- data/lib/bundler/source/metadata.rb +19 -18
- data/lib/bundler/source/path/installer.rb +11 -32
- data/lib/bundler/source/path.rb +39 -38
- data/lib/bundler/source/rubygems/remote.rb +3 -4
- data/lib/bundler/source/rubygems.rb +223 -255
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +33 -11
- data/lib/bundler/source_list.rb +131 -66
- data/lib/bundler/source_map.rb +71 -0
- data/lib/bundler/spec_set.rb +239 -94
- data/lib/bundler/stub_specification.rb +77 -39
- data/lib/bundler/templates/Executable +3 -5
- data/lib/bundler/templates/Executable.bundler +23 -19
- data/lib/bundler/templates/Executable.standalone +4 -4
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +104 -46
- data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +19 -2
- data/lib/bundler/templates/newgem/README.md.tt +18 -16
- data/lib/bundler/templates/newgem/Rakefile.tt +44 -6
- data/lib/bundler/templates/newgem/bin/console.tt +1 -4
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
- data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +1 -1
- data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
- data/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +37 -40
- 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 +2 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
- 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/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
- 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 +2 -2
- data/lib/bundler/ui/shell.rb +64 -23
- data/lib/bundler/ui/silent.rb +33 -6
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/uri_credentials_filter.rb +11 -5
- data/lib/bundler/uri_normalizer.rb +23 -0
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/.document +1 -0
- data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -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 +175 -0
- data/lib/bundler/vendor/fileutils/.document +1 -0
- data/lib/bundler/vendor/fileutils/COPYING +56 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1490 -432
- data/lib/bundler/vendor/net-http-persistent/.document +1 -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 +79 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +362 -484
- data/lib/bundler/vendor/pub_grub/.document +1 -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 +189 -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/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 +411 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -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/.document +1 -0
- data/lib/bundler/vendor/securerandom/COPYING +56 -0
- data/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
- data/lib/bundler/vendor/thor/.document +1 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +4 -3
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +8 -18
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +27 -20
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +34 -13
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +47 -28
- data/lib/bundler/vendor/thor/lib/thor/base.rb +200 -54
- data/lib/bundler/vendor/thor/lib/thor/command.rb +34 -18
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +10 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +74 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +15 -4
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +17 -1
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +35 -15
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +45 -13
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +86 -13
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +51 -40
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +99 -148
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +6 -43
- data/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -49
- 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 +6 -6
- data/lib/bundler/vendor/thor/lib/thor/util.rb +26 -9
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +182 -17
- data/lib/bundler/vendor/tsort/.document +1 -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/.document +1 -0
- data/lib/bundler/vendor/uri/COPYING +56 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +876 -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 +1578 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +125 -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 +546 -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 +1 -6
- data/lib/bundler/vendored_net_http.rb +23 -0
- data/lib/bundler/vendored_persistent.rb +1 -42
- data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
- data/lib/bundler/vendored_securerandom.rb +12 -0
- data/lib/bundler/vendored_thor.rb +2 -2
- 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 +5 -20
- data/lib/bundler/vlad.rb +3 -3
- data/lib/bundler/worker.rb +26 -15
- data/lib/bundler/yaml_serializer.rb +21 -13
- data/lib/bundler.rb +364 -230
- metadata +186 -218
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/package.rb +0 -49
- data/lib/bundler/compatibility_guard.rb +0 -14
- data/lib/bundler/dep_proxy.rb +0 -48
- data/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/psyched_yaml.rb +0 -37
- data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/bundler/templates/gems.rb +0 -8
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -3
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -7
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -81
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -136
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -101
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -12
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/lib/bundler/version_ranges.rb +0 -76
- data/man/bundle-add.1 +0 -58
- data/man/bundle-add.1.txt +0 -52
- data/man/bundle-add.ronn +0 -40
- data/man/bundle-binstubs.1.txt +0 -48
- data/man/bundle-check.1.txt +0 -33
- data/man/bundle-clean.1.txt +0 -26
- data/man/bundle-config.1.txt +0 -529
- data/man/bundle-doctor.1.txt +0 -44
- data/man/bundle-exec.1.txt +0 -178
- data/man/bundle-gem.1 +0 -80
- data/man/bundle-gem.1.txt +0 -91
- data/man/bundle-gem.ronn +0 -78
- data/man/bundle-info.1 +0 -20
- data/man/bundle-info.1.txt +0 -21
- data/man/bundle-info.ronn +0 -17
- data/man/bundle-init.1.txt +0 -34
- data/man/bundle-inject.1 +0 -33
- data/man/bundle-inject.1.txt +0 -32
- data/man/bundle-install.1.txt +0 -396
- data/man/bundle-list.1.txt +0 -43
- data/man/bundle-lock.1.txt +0 -93
- data/man/bundle-open.1 +0 -32
- data/man/bundle-open.1.txt +0 -29
- data/man/bundle-outdated.1.txt +0 -131
- data/man/bundle-package.1 +0 -55
- data/man/bundle-package.1.txt +0 -79
- data/man/bundle-package.ronn +0 -72
- data/man/bundle-platform.1 +0 -61
- data/man/bundle-platform.1.txt +0 -57
- data/man/bundle-pristine.1.txt +0 -44
- data/man/bundle-remove.1.txt +0 -34
- data/man/bundle-show.1.txt +0 -27
- data/man/bundle-update.1.txt +0 -391
- data/man/bundle-viz.1.txt +0 -39
- data/man/bundle.1.txt +0 -116
- data/man/gemfile.5.txt +0 -653
- /data/lib/bundler/{ssl_certs → man}/.document +0 -0
data/lib/bundler/definition.rb
CHANGED
@@ -1,21 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require "set"
|
3
|
+
require_relative "lockfile_parser"
|
5
4
|
|
6
5
|
module Bundler
|
7
6
|
class Definition
|
8
7
|
include GemHelpers
|
9
8
|
|
9
|
+
class << self
|
10
|
+
# Do not create or modify a lockfile (Makes #lock a noop)
|
11
|
+
attr_accessor :no_lock
|
12
|
+
end
|
13
|
+
|
10
14
|
attr_reader(
|
11
15
|
:dependencies,
|
16
|
+
:locked_checksums,
|
12
17
|
:locked_deps,
|
13
18
|
:locked_gems,
|
14
19
|
:platforms,
|
15
|
-
:requires,
|
16
20
|
:ruby_version,
|
17
21
|
:lockfile,
|
18
|
-
:gemfiles
|
22
|
+
:gemfiles,
|
23
|
+
:sources
|
19
24
|
)
|
20
25
|
|
21
26
|
# Given a gemfile and lockfile creates a Bundler definition
|
@@ -57,38 +62,44 @@ module Bundler
|
|
57
62
|
@unlocking_bundler = false
|
58
63
|
@unlocking = unlock
|
59
64
|
else
|
60
|
-
unlock = unlock.dup
|
61
65
|
@unlocking_bundler = unlock.delete(:bundler)
|
62
|
-
unlock.
|
63
|
-
@unlocking = !unlock.empty?
|
66
|
+
@unlocking = unlock.any? {|_k, v| !Array(v).empty? }
|
64
67
|
end
|
65
68
|
|
66
69
|
@dependencies = dependencies
|
67
70
|
@sources = sources
|
68
71
|
@unlock = unlock
|
69
72
|
@optional_groups = optional_groups
|
70
|
-
@
|
73
|
+
@prefer_local = false
|
71
74
|
@specs = nil
|
72
75
|
@ruby_version = ruby_version
|
73
76
|
@gemfiles = gemfiles
|
74
77
|
|
75
78
|
@lockfile = lockfile
|
76
79
|
@lockfile_contents = String.new
|
80
|
+
|
77
81
|
@locked_bundler_version = nil
|
78
|
-
@
|
79
|
-
@locked_specs_incomplete_for_platform = false
|
82
|
+
@resolved_bundler_version = nil
|
80
83
|
|
81
|
-
|
84
|
+
@locked_ruby_version = nil
|
85
|
+
@new_platforms = []
|
86
|
+
@removed_platform = nil
|
87
|
+
|
88
|
+
if lockfile_exists?
|
82
89
|
@lockfile_contents = Bundler.read_file(lockfile)
|
83
90
|
@locked_gems = LockfileParser.new(@lockfile_contents)
|
84
91
|
@locked_platforms = @locked_gems.platforms
|
92
|
+
@most_specific_locked_platform = @locked_gems.most_specific_locked_platform
|
85
93
|
@platforms = @locked_platforms.dup
|
86
94
|
@locked_bundler_version = @locked_gems.bundler_version
|
87
95
|
@locked_ruby_version = @locked_gems.ruby_version
|
96
|
+
@originally_locked_deps = @locked_gems.dependencies
|
97
|
+
@originally_locked_specs = SpecSet.new(@locked_gems.specs)
|
98
|
+
@locked_checksums = @locked_gems.checksums
|
88
99
|
|
89
100
|
if unlock != true
|
90
|
-
@locked_deps = @
|
91
|
-
@locked_specs =
|
101
|
+
@locked_deps = @originally_locked_deps
|
102
|
+
@locked_specs = @originally_locked_specs
|
92
103
|
@locked_sources = @locked_gems.sources
|
93
104
|
else
|
94
105
|
@unlock = {}
|
@@ -98,64 +109,117 @@ module Bundler
|
|
98
109
|
end
|
99
110
|
else
|
100
111
|
@unlock = {}
|
101
|
-
@platforms = []
|
102
112
|
@locked_gems = nil
|
113
|
+
@locked_platforms = []
|
114
|
+
@most_specific_locked_platform = nil
|
115
|
+
@platforms = []
|
103
116
|
@locked_deps = {}
|
104
117
|
@locked_specs = SpecSet.new([])
|
118
|
+
@originally_locked_deps = {}
|
119
|
+
@originally_locked_specs = @locked_specs
|
105
120
|
@locked_sources = []
|
106
|
-
@
|
121
|
+
@locked_checksums = Bundler.feature_flag.lockfile_checksums?
|
122
|
+
end
|
123
|
+
|
124
|
+
locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
|
125
|
+
@multisource_allowed = locked_gem_sources.size == 1 && locked_gem_sources.first.multiple_remotes? && Bundler.frozen_bundle?
|
126
|
+
|
127
|
+
if @multisource_allowed
|
128
|
+
unless sources.aggregate_global_source?
|
129
|
+
msg = "Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. Make sure you run `bundle install` in non frozen mode and commit the result to make your lockfile secure."
|
130
|
+
|
131
|
+
Bundler::SharedHelpers.major_deprecation 2, msg
|
132
|
+
end
|
133
|
+
|
134
|
+
@sources.merged_gem_lockfile_sections!(locked_gem_sources.first)
|
107
135
|
end
|
108
136
|
|
109
|
-
@unlock
|
110
|
-
@unlock[:sources] ||= []
|
137
|
+
@sources_to_unlock = @unlock.delete(:sources) || []
|
111
138
|
@unlock[:ruby] ||= if @ruby_version && locked_ruby_version_object
|
112
139
|
@ruby_version.diff(locked_ruby_version_object)
|
113
140
|
end
|
114
141
|
@unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
|
115
142
|
|
116
|
-
add_current_platform unless Bundler.frozen_bundle?
|
143
|
+
@current_platform_missing = add_current_platform unless Bundler.frozen_bundle?
|
117
144
|
|
118
145
|
converge_path_sources_to_gemspec_sources
|
119
146
|
@path_changes = converge_paths
|
120
147
|
@source_changes = converge_sources
|
121
148
|
|
122
|
-
|
123
|
-
|
124
|
-
|
149
|
+
@explicit_unlocks = @unlock.delete(:gems) || []
|
150
|
+
|
151
|
+
if @unlock[:conservative]
|
152
|
+
@gems_to_unlock = @explicit_unlocks.any? ? @explicit_unlocks : @dependencies.map(&:name)
|
153
|
+
else
|
154
|
+
eager_unlock = @explicit_unlocks.map {|name| Dependency.new(name, ">= 0") }
|
155
|
+
@gems_to_unlock = @locked_specs.for(eager_unlock, platforms).map(&:name).uniq
|
125
156
|
end
|
126
157
|
|
127
158
|
@dependency_changes = converge_dependencies
|
128
159
|
@local_changes = converge_locals
|
129
160
|
|
130
|
-
|
161
|
+
check_lockfile
|
131
162
|
end
|
132
163
|
|
133
164
|
def gem_version_promoter
|
134
|
-
@gem_version_promoter ||=
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
165
|
+
@gem_version_promoter ||= GemVersionPromoter.new
|
166
|
+
end
|
167
|
+
|
168
|
+
def check!
|
169
|
+
# If dependencies have changed, we need to resolve remotely. Otherwise,
|
170
|
+
# since we'll be resolving with a single local source, we may end up
|
171
|
+
# locking gems under the wrong source in the lockfile, and missing lockfile
|
172
|
+
# checksums
|
173
|
+
resolve_remotely! if @dependency_changes
|
174
|
+
|
175
|
+
# Now do a local only resolve, to verify if any gems are missing locally
|
176
|
+
sources.local_only!
|
177
|
+
resolve
|
178
|
+
end
|
179
|
+
|
180
|
+
#
|
181
|
+
# Setup sources according to the given options and the state of the
|
182
|
+
# definition.
|
183
|
+
#
|
184
|
+
# @return [Boolean] Whether fetching remote information will be necessary or not
|
185
|
+
#
|
186
|
+
def setup_domain!(options = {})
|
187
|
+
prefer_local! if options[:"prefer-local"]
|
188
|
+
|
189
|
+
if options[:add_checksums] || (!options[:local] && install_needed?)
|
190
|
+
remotely!
|
191
|
+
true
|
192
|
+
else
|
193
|
+
Bundler.settings.set_command_option(:jobs, 1) unless install_needed? # to avoid the overhead of Bundler::Worker
|
194
|
+
with_cache!
|
195
|
+
false
|
145
196
|
end
|
146
197
|
end
|
147
198
|
|
148
199
|
def resolve_with_cache!
|
149
|
-
|
200
|
+
with_cache!
|
201
|
+
|
202
|
+
resolve
|
203
|
+
end
|
204
|
+
|
205
|
+
def with_cache!
|
206
|
+
sources.local!
|
150
207
|
sources.cached!
|
151
|
-
specs
|
152
208
|
end
|
153
209
|
|
154
210
|
def resolve_remotely!
|
155
|
-
|
156
|
-
|
211
|
+
remotely!
|
212
|
+
|
213
|
+
resolve
|
214
|
+
end
|
215
|
+
|
216
|
+
def remotely!
|
217
|
+
sources.cached!
|
157
218
|
sources.remote!
|
158
|
-
|
219
|
+
end
|
220
|
+
|
221
|
+
def prefer_local!
|
222
|
+
@prefer_local = true
|
159
223
|
end
|
160
224
|
|
161
225
|
# For given dependency list returns a SpecSet with Gemspec of all the required
|
@@ -165,25 +229,7 @@ module Bundler
|
|
165
229
|
#
|
166
230
|
# @return [Bundler::SpecSet]
|
167
231
|
def specs
|
168
|
-
@specs ||=
|
169
|
-
begin
|
170
|
-
specs = resolve.materialize(Bundler.settings[:cache_all_platforms] ? dependencies : requested_dependencies)
|
171
|
-
rescue GemNotFound => e # Handle yanked gem
|
172
|
-
gem_name, gem_version = extract_gem_info(e)
|
173
|
-
locked_gem = @locked_specs[gem_name].last
|
174
|
-
raise if locked_gem.nil? || locked_gem.version.to_s != gem_version || !@remote
|
175
|
-
raise GemNotFound, "Your bundle is locked to #{locked_gem}, but that version could not " \
|
176
|
-
"be found in any of the sources listed in your Gemfile. If you haven't changed sources, " \
|
177
|
-
"that means the author of #{locked_gem} has removed it. You'll need to update your bundle " \
|
178
|
-
"to a version other than #{locked_gem} that hasn't been removed in order to install."
|
179
|
-
end
|
180
|
-
unless specs["bundler"].any?
|
181
|
-
bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
|
182
|
-
specs["bundler"] = bundler
|
183
|
-
end
|
184
|
-
|
185
|
-
specs
|
186
|
-
end
|
232
|
+
@specs ||= materialize(requested_dependencies)
|
187
233
|
end
|
188
234
|
|
189
235
|
def new_specs
|
@@ -194,14 +240,8 @@ module Bundler
|
|
194
240
|
@locked_specs - specs
|
195
241
|
end
|
196
242
|
|
197
|
-
def new_platform?
|
198
|
-
@new_platform
|
199
|
-
end
|
200
|
-
|
201
243
|
def missing_specs
|
202
|
-
|
203
|
-
resolve.materialize(requested_dependencies, missing)
|
204
|
-
missing
|
244
|
+
resolve.missing_specs_for(requested_dependencies)
|
205
245
|
end
|
206
246
|
|
207
247
|
def missing_specs?
|
@@ -210,31 +250,64 @@ module Bundler
|
|
210
250
|
Bundler.ui.debug "The definition is missing #{missing.map(&:full_name)}"
|
211
251
|
true
|
212
252
|
rescue BundlerError => e
|
213
|
-
@index = nil
|
214
253
|
@resolve = nil
|
254
|
+
@resolver = nil
|
255
|
+
@resolution_packages = nil
|
256
|
+
@source_requirements = nil
|
215
257
|
@specs = nil
|
216
|
-
@gem_version_promoter = nil
|
217
258
|
|
218
259
|
Bundler.ui.debug "The definition is missing dependencies, failed to resolve & materialize locally (#{e})"
|
219
260
|
true
|
220
261
|
end
|
221
262
|
|
222
263
|
def requested_specs
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
264
|
+
specs_for(requested_groups)
|
265
|
+
end
|
266
|
+
|
267
|
+
def requested_dependencies
|
268
|
+
dependencies_for(requested_groups)
|
228
269
|
end
|
229
270
|
|
230
271
|
def current_dependencies
|
231
|
-
dependencies
|
272
|
+
filter_relevant(dependencies)
|
273
|
+
end
|
274
|
+
|
275
|
+
def current_locked_dependencies
|
276
|
+
filter_relevant(locked_dependencies)
|
277
|
+
end
|
278
|
+
|
279
|
+
def filter_relevant(dependencies)
|
280
|
+
platforms_array = [generic_local_platform].freeze
|
281
|
+
dependencies.select do |d|
|
282
|
+
d.should_include? && !d.gem_platforms(platforms_array).empty?
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
def locked_dependencies
|
287
|
+
@locked_deps.values
|
288
|
+
end
|
289
|
+
|
290
|
+
def new_deps
|
291
|
+
@new_deps ||= @dependencies - locked_dependencies
|
292
|
+
end
|
293
|
+
|
294
|
+
def deleted_deps
|
295
|
+
@deleted_deps ||= locked_dependencies - @dependencies
|
232
296
|
end
|
233
297
|
|
234
298
|
def specs_for(groups)
|
235
|
-
|
236
|
-
deps
|
237
|
-
|
299
|
+
return specs if groups.empty?
|
300
|
+
deps = dependencies_for(groups)
|
301
|
+
materialize(deps)
|
302
|
+
end
|
303
|
+
|
304
|
+
def dependencies_for(groups)
|
305
|
+
groups.map!(&:to_sym)
|
306
|
+
deps = current_dependencies # always returns a new array
|
307
|
+
deps.select! do |d|
|
308
|
+
d.groups.intersect?(groups)
|
309
|
+
end
|
310
|
+
deps
|
238
311
|
end
|
239
312
|
|
240
313
|
# Resolve all the dependencies specified in Gemfile. It ensures that
|
@@ -243,124 +316,60 @@ module Bundler
|
|
243
316
|
#
|
244
317
|
# @return [SpecSet] resolved dependencies
|
245
318
|
def resolve
|
246
|
-
@resolve ||=
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
319
|
+
@resolve ||= if Bundler.frozen_bundle?
|
320
|
+
Bundler.ui.debug "Frozen, using resolution from the lockfile"
|
321
|
+
@locked_specs
|
322
|
+
elsif no_resolve_needed?
|
323
|
+
if deleted_deps.any?
|
324
|
+
Bundler.ui.debug "Some dependencies were deleted, using a subset of the resolution from the lockfile"
|
325
|
+
SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps))
|
326
|
+
else
|
327
|
+
Bundler.ui.debug "Found no changes, using resolution from the lockfile"
|
328
|
+
if @removed_platform || @locked_gems.may_include_redundant_platform_specific_gems?
|
329
|
+
SpecSet.new(filter_specs(@locked_specs, @dependencies))
|
255
330
|
else
|
256
|
-
|
257
|
-
Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
|
258
|
-
last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
|
331
|
+
@locked_specs
|
259
332
|
end
|
260
|
-
|
261
|
-
# filter out gems that _can_ be installed on multiple platforms, but don't need
|
262
|
-
# to be
|
263
|
-
resolve.for(expand_dependencies(dependencies, true), [], false, false, false)
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
def index
|
268
|
-
@index ||= Index.build do |idx|
|
269
|
-
dependency_names = @dependencies.map(&:name)
|
270
|
-
|
271
|
-
sources.all_sources.each do |source|
|
272
|
-
source.dependency_names = dependency_names - pinned_spec_names(source)
|
273
|
-
idx.add_source source.specs
|
274
|
-
dependency_names.concat(source.unmet_deps).uniq!
|
275
333
|
end
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
# Suppose the gem Foo depends on the gem Bar. Foo exists in Source A. Bar has some versions that exist in both
|
282
|
-
# sources A and B. At this point, the API request will have found all the versions of Bar in source A,
|
283
|
-
# but will not have found any versions of Bar from source B, which is a problem if the requested version
|
284
|
-
# of Foo specifically depends on a version of Bar that is only found in source B. This ensures that for
|
285
|
-
# each spec we found, we add all possible versions from all sources to the index.
|
286
|
-
def double_check_for_index(idx, dependency_names)
|
287
|
-
pinned_names = pinned_spec_names
|
288
|
-
loop do
|
289
|
-
idxcount = idx.size
|
290
|
-
|
291
|
-
names = :names # do this so we only have to traverse to get dependency_names from the index once
|
292
|
-
unmet_dependency_names = lambda do
|
293
|
-
return names unless names == :names
|
294
|
-
new_names = sources.all_sources.map(&:dependency_names_to_double_check)
|
295
|
-
return names = nil if new_names.compact!
|
296
|
-
names = new_names.flatten(1).concat(dependency_names)
|
297
|
-
names.uniq!
|
298
|
-
names -= pinned_names
|
299
|
-
names
|
300
|
-
end
|
301
|
-
|
302
|
-
sources.all_sources.each do |source|
|
303
|
-
source.double_check_for(unmet_dependency_names)
|
334
|
+
else
|
335
|
+
if lockfile_exists?
|
336
|
+
Bundler.ui.debug "Found changes from the lockfile, re-resolving dependencies because #{change_reason}"
|
337
|
+
else
|
338
|
+
Bundler.ui.debug "Resolving dependencies because there's no lockfile"
|
304
339
|
end
|
305
340
|
|
306
|
-
|
341
|
+
start_resolution
|
307
342
|
end
|
308
343
|
end
|
309
|
-
private :double_check_for_index
|
310
|
-
|
311
|
-
def has_rubygems_remotes?
|
312
|
-
sources.rubygems_sources.any? {|s| s.remotes.any? }
|
313
|
-
end
|
314
|
-
|
315
|
-
def has_local_dependencies?
|
316
|
-
!sources.path_sources.empty? || !sources.git_sources.empty?
|
317
|
-
end
|
318
344
|
|
319
345
|
def spec_git_paths
|
320
|
-
sources.git_sources.
|
346
|
+
sources.git_sources.filter_map {|s| File.realpath(s.path) if File.exist?(s.path) }
|
321
347
|
end
|
322
348
|
|
323
349
|
def groups
|
324
|
-
dependencies.
|
350
|
+
dependencies.flat_map(&:groups).uniq
|
325
351
|
end
|
326
352
|
|
327
|
-
def lock(
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
if @locked_bundler_version
|
335
|
-
locked_major = @locked_bundler_version.segments.first
|
336
|
-
current_major = Gem::Version.create(Bundler::VERSION).segments.first
|
353
|
+
def lock(file_or_preserve_unknown_sections = false, preserve_unknown_sections_or_unused = false)
|
354
|
+
if [true, false, nil].include?(file_or_preserve_unknown_sections)
|
355
|
+
target_lockfile = lockfile
|
356
|
+
preserve_unknown_sections = file_or_preserve_unknown_sections
|
357
|
+
else
|
358
|
+
target_lockfile = file_or_preserve_unknown_sections
|
359
|
+
preserve_unknown_sections = preserve_unknown_sections_or_unused
|
337
360
|
|
338
|
-
|
339
|
-
|
340
|
-
|
361
|
+
suggestion = if target_lockfile == lockfile
|
362
|
+
"To fix this warning, remove it from the `Definition#lock` call."
|
363
|
+
else
|
364
|
+
"Instead, instantiate a new definition passing `#{target_lockfile}`, and call `lock` without a file argument on that definition"
|
341
365
|
end
|
342
|
-
end
|
343
|
-
|
344
|
-
preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
|
345
|
-
|
346
|
-
return if file && File.exist?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
|
347
|
-
|
348
|
-
if Bundler.frozen_bundle?
|
349
|
-
Bundler.ui.error "Cannot write a changed lockfile while frozen."
|
350
|
-
return
|
351
|
-
end
|
352
366
|
|
353
|
-
|
354
|
-
File.open(p, "wb") {|f| f.puts(contents) }
|
355
|
-
end
|
356
|
-
end
|
367
|
+
msg = "`Definition#lock` was passed a target file argument. #{suggestion}"
|
357
368
|
|
358
|
-
|
359
|
-
if @locked_bundler_version && @locked_bundler_version < Gem::Version.new(Bundler::VERSION)
|
360
|
-
new_version = Bundler::VERSION
|
369
|
+
Bundler::SharedHelpers.major_deprecation 2, msg
|
361
370
|
end
|
362
371
|
|
363
|
-
|
372
|
+
write_lock(target_lockfile, preserve_unknown_sections)
|
364
373
|
end
|
365
374
|
|
366
375
|
def locked_ruby_version
|
@@ -384,28 +393,19 @@ module Bundler
|
|
384
393
|
end
|
385
394
|
end
|
386
395
|
|
396
|
+
def bundler_version_to_lock
|
397
|
+
@resolved_bundler_version || Bundler.gem_version
|
398
|
+
end
|
399
|
+
|
387
400
|
def to_lock
|
388
|
-
|
401
|
+
require_relative "lockfile_generator"
|
389
402
|
LockfileGenerator.generate(self)
|
390
403
|
end
|
391
404
|
|
392
405
|
def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
|
393
|
-
|
394
|
-
msg << "You are trying to install in deployment mode after changing\n" \
|
395
|
-
"your Gemfile. Run `bundle install` elsewhere and add the\n" \
|
396
|
-
"updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control."
|
406
|
+
return unless Bundler.frozen_bundle?
|
397
407
|
|
398
|
-
unless
|
399
|
-
suggested_command = if Bundler.settings.locations("frozen")[:global]
|
400
|
-
"bundle config --delete frozen"
|
401
|
-
elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
|
402
|
-
"bundle config --delete deployment"
|
403
|
-
else
|
404
|
-
"bundle install --no-deployment"
|
405
|
-
end
|
406
|
-
msg << "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \
|
407
|
-
"freeze \nby running `#{suggested_command}`."
|
408
|
-
end
|
408
|
+
raise ProductionError, "Frozen mode is set, but there's no lockfile" unless lockfile_exists?
|
409
409
|
|
410
410
|
added = []
|
411
411
|
deleted = []
|
@@ -416,52 +416,40 @@ module Bundler
|
|
416
416
|
added.concat new_platforms.map {|p| "* platform: #{p}" }
|
417
417
|
deleted.concat deleted_platforms.map {|p| "* platform: #{p}" }
|
418
418
|
|
419
|
-
gemfile_sources = sources.lock_sources
|
420
|
-
|
421
|
-
new_sources = gemfile_sources - @locked_sources
|
422
|
-
deleted_sources = @locked_sources - gemfile_sources
|
423
|
-
|
424
|
-
new_deps = @dependencies - @locked_deps.values
|
425
|
-
deleted_deps = @locked_deps.values - @dependencies
|
426
|
-
|
427
|
-
# Check if it is possible that the source is only changed thing
|
428
|
-
if (new_deps.empty? && deleted_deps.empty?) && (!new_sources.empty? && !deleted_sources.empty?)
|
429
|
-
new_sources.reject! {|source| (source.path? && source.path.exist?) || equivalent_rubygems_remotes?(source) }
|
430
|
-
deleted_sources.reject! {|source| (source.path? && source.path.exist?) || equivalent_rubygems_remotes?(source) }
|
431
|
-
end
|
432
|
-
|
433
|
-
if @locked_sources != gemfile_sources
|
434
|
-
if new_sources.any?
|
435
|
-
added.concat new_sources.map {|source| "* source: #{source}" }
|
436
|
-
end
|
437
|
-
|
438
|
-
if deleted_sources.any?
|
439
|
-
deleted.concat deleted_sources.map {|source| "* source: #{source}" }
|
440
|
-
end
|
441
|
-
end
|
442
|
-
|
443
419
|
added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any?
|
444
|
-
if deleted_deps.any?
|
445
|
-
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" }
|
446
|
-
end
|
420
|
+
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
|
447
421
|
|
448
422
|
both_sources = Hash.new {|h, k| h[k] = [] }
|
449
|
-
|
450
|
-
|
423
|
+
current_dependencies.each {|d| both_sources[d.name][0] = d }
|
424
|
+
current_locked_dependencies.each {|d| both_sources[d.name][1] = d }
|
425
|
+
|
426
|
+
both_sources.each do |name, (dep, lock_dep)|
|
427
|
+
next if dep.nil? || lock_dep.nil?
|
428
|
+
|
429
|
+
gemfile_source = dep.source || default_source
|
430
|
+
lock_source = lock_dep.source || default_source
|
431
|
+
next if lock_source.include?(gemfile_source)
|
451
432
|
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
lockfile_source_name = lock_source || "no specified source"
|
456
|
-
changed << "* #{name} from `#{gemfile_source_name}` to `#{lockfile_source_name}`"
|
433
|
+
gemfile_source_name = dep.source ? gemfile_source.to_gemfile : "no specified source"
|
434
|
+
lockfile_source_name = lock_dep.source ? lock_source.to_gemfile : "no specified source"
|
435
|
+
changed << "* #{name} from `#{lockfile_source_name}` to `#{gemfile_source_name}`"
|
457
436
|
end
|
458
437
|
|
459
|
-
reason = change_reason
|
460
|
-
msg
|
438
|
+
reason = nothing_changed? ? "some dependencies were deleted from your gemfile" : change_reason
|
439
|
+
msg = String.new
|
440
|
+
msg << "#{reason.capitalize.strip}, but the lockfile can't be updated because frozen mode is set"
|
461
441
|
msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
|
462
442
|
msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
|
463
443
|
msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
|
464
|
-
msg << "\n"
|
444
|
+
msg << "\n\nRun `bundle install` elsewhere and add the updated #{SharedHelpers.relative_gemfile_path} to version control.\n"
|
445
|
+
|
446
|
+
unless explicit_flag
|
447
|
+
suggested_command = unless Bundler.settings.locations("frozen").keys.include?(:env)
|
448
|
+
"bundle config set frozen false"
|
449
|
+
end
|
450
|
+
msg << "If this is a development machine, remove the #{SharedHelpers.relative_lockfile_path} " \
|
451
|
+
"freeze by running `#{suggested_command}`." if suggested_command
|
452
|
+
end
|
465
453
|
|
466
454
|
raise ProductionError, msg if added.any? || deleted.any? || changed.any? || !nothing_changed?
|
467
455
|
end
|
@@ -497,78 +485,324 @@ module Bundler
|
|
497
485
|
end
|
498
486
|
|
499
487
|
def validate_platforms!
|
500
|
-
return if
|
501
|
-
Bundler.rubygems.platforms.any? do |local_platform|
|
502
|
-
MatchPlatform.platforms_match?(bundle_platform, local_platform)
|
503
|
-
end
|
504
|
-
end
|
488
|
+
return if current_platform_locked?
|
505
489
|
|
506
490
|
raise ProductionError, "Your bundle only supports platforms #{@platforms.map(&:to_s)} " \
|
507
|
-
"but your local
|
508
|
-
"
|
491
|
+
"but your local platform is #{local_platform}. " \
|
492
|
+
"Add the current platform to the lockfile with\n`bundle lock --add-platform #{local_platform}` and try again."
|
493
|
+
end
|
494
|
+
|
495
|
+
def normalize_platforms
|
496
|
+
@platforms = resolve.normalize_platforms!(current_dependencies, platforms)
|
497
|
+
|
498
|
+
@resolve = SpecSet.new(resolve.for(current_dependencies, @platforms))
|
509
499
|
end
|
510
500
|
|
511
501
|
def add_platform(platform)
|
512
|
-
|
513
|
-
|
502
|
+
return if @platforms.include?(platform)
|
503
|
+
|
504
|
+
@new_platforms << platform
|
505
|
+
@platforms << platform
|
514
506
|
end
|
515
507
|
|
516
508
|
def remove_platform(platform)
|
517
|
-
|
509
|
+
removed_platform = @platforms.delete(Gem::Platform.new(platform))
|
510
|
+
@removed_platform ||= removed_platform
|
511
|
+
return if removed_platform
|
518
512
|
raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}"
|
519
513
|
end
|
520
514
|
|
521
|
-
def
|
522
|
-
|
523
|
-
add_platform(current_platform) if Bundler.feature_flag.specific_platform?
|
524
|
-
add_platform(generic(current_platform))
|
515
|
+
def nothing_changed?
|
516
|
+
!something_changed?
|
525
517
|
end
|
526
518
|
|
527
|
-
def
|
528
|
-
|
519
|
+
def no_resolve_needed?
|
520
|
+
!resolve_needed?
|
529
521
|
end
|
530
522
|
|
531
|
-
def
|
532
|
-
|
523
|
+
def unlocking?
|
524
|
+
@unlocking
|
533
525
|
end
|
534
526
|
|
535
|
-
|
536
|
-
private :sources
|
527
|
+
attr_writer :source_requirements
|
537
528
|
|
538
|
-
def
|
539
|
-
|
529
|
+
def add_checksums
|
530
|
+
@locked_checksums = true
|
531
|
+
|
532
|
+
setup_domain!(add_checksums: true)
|
533
|
+
|
534
|
+
specs # force materialization to real specifications, so that checksums are fetched
|
540
535
|
end
|
541
536
|
|
542
|
-
|
543
|
-
|
537
|
+
private
|
538
|
+
|
539
|
+
def install_needed?
|
540
|
+
resolve_needed? || missing_specs?
|
544
541
|
end
|
545
542
|
|
546
|
-
|
543
|
+
def something_changed?
|
544
|
+
return true unless lockfile_exists?
|
547
545
|
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
546
|
+
@source_changes ||
|
547
|
+
@dependency_changes ||
|
548
|
+
@current_platform_missing ||
|
549
|
+
@new_platforms.any? ||
|
550
|
+
@path_changes ||
|
551
|
+
@local_changes ||
|
552
|
+
@missing_lockfile_dep ||
|
553
|
+
@unlocking_bundler ||
|
554
|
+
@locked_spec_with_missing_deps ||
|
555
|
+
@locked_spec_with_invalid_deps
|
556
|
+
end
|
557
|
+
|
558
|
+
def resolve_needed?
|
559
|
+
unlocking? || something_changed?
|
560
|
+
end
|
561
|
+
|
562
|
+
def should_add_extra_platforms?
|
563
|
+
!lockfile_exists? && generic_local_platform_is_ruby? && !Bundler.settings[:force_ruby_platform]
|
564
|
+
end
|
565
|
+
|
566
|
+
def lockfile_exists?
|
567
|
+
lockfile && File.exist?(lockfile)
|
568
|
+
end
|
569
|
+
|
570
|
+
def write_lock(file, preserve_unknown_sections)
|
571
|
+
return if Definition.no_lock || file.nil?
|
572
|
+
|
573
|
+
contents = to_lock
|
574
|
+
|
575
|
+
# Convert to \r\n if the existing lock has them
|
576
|
+
# i.e., Windows with `git config core.autocrlf=true`
|
577
|
+
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
|
578
|
+
|
579
|
+
if @locked_bundler_version
|
580
|
+
locked_major = @locked_bundler_version.segments.first
|
581
|
+
current_major = bundler_version_to_lock.segments.first
|
582
|
+
|
583
|
+
updating_major = locked_major < current_major
|
584
|
+
end
|
585
|
+
|
586
|
+
preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
|
587
|
+
|
588
|
+
if File.exist?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
|
589
|
+
return if Bundler.frozen_bundle?
|
590
|
+
SharedHelpers.filesystem_access(file) { FileUtils.touch(file) }
|
591
|
+
return
|
592
|
+
end
|
593
|
+
|
594
|
+
if Bundler.frozen_bundle?
|
595
|
+
Bundler.ui.error "Cannot write a changed lockfile while frozen."
|
596
|
+
return
|
597
|
+
end
|
598
|
+
|
599
|
+
SharedHelpers.filesystem_access(file) do |p|
|
600
|
+
File.open(p, "wb") {|f| f.puts(contents) }
|
601
|
+
end
|
602
|
+
end
|
603
|
+
|
604
|
+
def resolver
|
605
|
+
@resolver ||= Resolver.new(resolution_packages, gem_version_promoter, @most_specific_locked_platform)
|
606
|
+
end
|
607
|
+
|
608
|
+
def expanded_dependencies
|
609
|
+
dependencies_with_bundler + metadata_dependencies
|
610
|
+
end
|
611
|
+
|
612
|
+
def dependencies_with_bundler
|
613
|
+
return dependencies unless @unlocking_bundler
|
614
|
+
return dependencies if dependencies.any? {|d| d.name == "bundler" }
|
615
|
+
|
616
|
+
[Dependency.new("bundler", @unlocking_bundler)] + dependencies
|
617
|
+
end
|
618
|
+
|
619
|
+
def resolution_packages
|
620
|
+
@resolution_packages ||= begin
|
621
|
+
last_resolve = converge_locked_specs
|
622
|
+
remove_invalid_platforms!
|
623
|
+
packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @gems_to_unlock, prerelease: gem_version_promoter.pre?, prefer_local: @prefer_local)
|
624
|
+
packages = additional_base_requirements_to_prevent_downgrades(packages, last_resolve)
|
625
|
+
packages = additional_base_requirements_to_force_updates(packages)
|
626
|
+
packages
|
627
|
+
end
|
628
|
+
end
|
629
|
+
|
630
|
+
def filter_specs(specs, deps, skips: [])
|
631
|
+
SpecSet.new(specs).for(deps, platforms, skips: skips)
|
632
|
+
end
|
633
|
+
|
634
|
+
def materialize(dependencies)
|
635
|
+
# Tracks potential endless loops trying to re-resolve.
|
636
|
+
# TODO: Remove as dead code if not reports are received in a while
|
637
|
+
incorrect_spec = nil
|
638
|
+
|
639
|
+
specs = begin
|
640
|
+
resolve.materialize(dependencies)
|
641
|
+
rescue IncorrectLockfileDependencies => e
|
642
|
+
spec = e.spec
|
643
|
+
raise "Infinite loop while fixing lockfile dependencies" if incorrect_spec == spec
|
644
|
+
|
645
|
+
incorrect_spec = spec
|
646
|
+
reresolve_without([spec])
|
647
|
+
retry
|
648
|
+
end
|
649
|
+
|
650
|
+
missing_specs = resolve.missing_specs
|
651
|
+
|
652
|
+
if missing_specs.any?
|
653
|
+
missing_specs.each do |s|
|
654
|
+
locked_gem = @locked_specs[s.name].last
|
655
|
+
next if locked_gem.nil? || locked_gem.version != s.version || sources.local_mode?
|
656
|
+
|
657
|
+
message = if sources.implicit_global_source?
|
658
|
+
"Because your Gemfile specifies no global remote source, your bundle is locked to " \
|
659
|
+
"#{locked_gem} from #{locked_gem.source}. However, #{locked_gem} is not installed. You'll " \
|
660
|
+
"need to either add a global remote source to your Gemfile or make sure #{locked_gem} is " \
|
661
|
+
"available locally before rerunning Bundler."
|
553
662
|
else
|
554
|
-
|
555
|
-
"#{
|
663
|
+
"Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
|
664
|
+
"no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
|
665
|
+
"You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
|
666
|
+
"removed in order to install."
|
556
667
|
end
|
557
|
-
|
668
|
+
|
669
|
+
raise GemNotFound, message
|
670
|
+
end
|
671
|
+
|
672
|
+
missing_specs_list = missing_specs.group_by(&:source).map do |source, missing_specs_for_source|
|
673
|
+
"#{missing_specs_for_source.map(&:full_name).join(", ")} in #{source}"
|
674
|
+
end
|
675
|
+
|
676
|
+
raise GemNotFound, "Could not find #{missing_specs_list.join(" nor ")}"
|
677
|
+
end
|
678
|
+
|
679
|
+
partially_missing_specs = resolve.partially_missing_specs
|
680
|
+
|
681
|
+
if partially_missing_specs.any? && !sources.local_mode?
|
682
|
+
Bundler.ui.warn "Some locked specs have possibly been yanked (#{partially_missing_specs.map(&:full_name).join(", ")}). Ignoring them..."
|
683
|
+
|
684
|
+
resolve.delete(partially_missing_specs)
|
685
|
+
end
|
686
|
+
|
687
|
+
incomplete_specs = resolve.incomplete_specs
|
688
|
+
loop do
|
689
|
+
break if incomplete_specs.empty?
|
690
|
+
|
691
|
+
Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
|
692
|
+
sources.remote!
|
693
|
+
reresolve_without(incomplete_specs)
|
694
|
+
specs = resolve.materialize(dependencies)
|
695
|
+
|
696
|
+
still_incomplete_specs = resolve.incomplete_specs
|
697
|
+
|
698
|
+
if still_incomplete_specs == incomplete_specs
|
699
|
+
package = resolution_packages.get_package(incomplete_specs.first.name)
|
700
|
+
resolver.raise_not_found! package
|
701
|
+
end
|
702
|
+
|
703
|
+
incomplete_specs = still_incomplete_specs
|
704
|
+
end
|
705
|
+
|
706
|
+
insecurely_materialized_specs = resolve.insecurely_materialized_specs
|
707
|
+
|
708
|
+
if insecurely_materialized_specs.any?
|
709
|
+
Bundler.ui.warn "The following platform specific gems are getting installed, yet the lockfile includes only their generic ruby version:\n" \
|
710
|
+
" * #{insecurely_materialized_specs.map(&:full_name).join("\n * ")}\n" \
|
711
|
+
"Please run `bundle lock --normalize-platforms` and commit the resulting lockfile.\n" \
|
712
|
+
"Alternatively, you may run `bundle lock --add-platform <list-of-platforms-that-you-want-to-support>`"
|
713
|
+
end
|
714
|
+
|
715
|
+
bundler = sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
|
716
|
+
specs["bundler"] = bundler
|
717
|
+
|
718
|
+
specs
|
719
|
+
end
|
720
|
+
|
721
|
+
def reresolve_without(incomplete_specs)
|
722
|
+
resolution_packages.delete(incomplete_specs)
|
723
|
+
@resolve = start_resolution
|
724
|
+
end
|
725
|
+
|
726
|
+
def start_resolution
|
727
|
+
local_platform_needed_for_resolvability = @most_specific_non_local_locked_ruby_platform && !@platforms.include?(local_platform)
|
728
|
+
@platforms << local_platform if local_platform_needed_for_resolvability
|
729
|
+
add_platform(Gem::Platform::RUBY) if RUBY_ENGINE == "truffleruby"
|
730
|
+
|
731
|
+
result = SpecSet.new(resolver.start)
|
732
|
+
|
733
|
+
@resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
|
734
|
+
|
735
|
+
if @most_specific_non_local_locked_ruby_platform
|
736
|
+
if spec_set_incomplete_for_platform?(result, @most_specific_non_local_locked_ruby_platform)
|
737
|
+
@platforms.delete(@most_specific_non_local_locked_ruby_platform)
|
738
|
+
elsif local_platform_needed_for_resolvability
|
739
|
+
@platforms.delete(local_platform)
|
740
|
+
end
|
741
|
+
end
|
742
|
+
|
743
|
+
@platforms = result.add_extra_platforms!(platforms) if should_add_extra_platforms?
|
744
|
+
|
745
|
+
SpecSet.new(result.for(dependencies, @platforms | [Gem::Platform::RUBY]))
|
746
|
+
end
|
747
|
+
|
748
|
+
def precompute_source_requirements_for_indirect_dependencies?
|
749
|
+
sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
|
750
|
+
end
|
751
|
+
|
752
|
+
def current_platform_locked?
|
753
|
+
@platforms.any? do |bundle_platform|
|
754
|
+
MatchPlatform.platforms_match?(bundle_platform, local_platform)
|
755
|
+
end
|
756
|
+
end
|
757
|
+
|
758
|
+
def add_current_platform
|
759
|
+
return if @platforms.include?(local_platform)
|
760
|
+
|
761
|
+
@most_specific_non_local_locked_ruby_platform = find_most_specific_locked_ruby_platform
|
762
|
+
return if @most_specific_non_local_locked_ruby_platform
|
763
|
+
|
764
|
+
@platforms << local_platform
|
765
|
+
true
|
766
|
+
end
|
767
|
+
|
768
|
+
def find_most_specific_locked_ruby_platform
|
769
|
+
return unless generic_local_platform_is_ruby? && current_platform_locked?
|
770
|
+
|
771
|
+
@most_specific_locked_platform
|
772
|
+
end
|
773
|
+
|
774
|
+
def change_reason
|
775
|
+
if unlocking?
|
776
|
+
unlock_targets = if @gems_to_unlock.any?
|
777
|
+
["gems", @gems_to_unlock]
|
778
|
+
elsif @sources_to_unlock.any?
|
779
|
+
["sources", @sources_to_unlock]
|
780
|
+
end
|
781
|
+
|
782
|
+
unlock_reason = if unlock_targets
|
783
|
+
"#{unlock_targets.first}: (#{unlock_targets.last.join(", ")})"
|
784
|
+
else
|
785
|
+
@unlock[:ruby] ? "ruby" : ""
|
786
|
+
end
|
787
|
+
|
558
788
|
return "bundler is unlocking #{unlock_reason}"
|
559
789
|
end
|
560
790
|
[
|
561
791
|
[@source_changes, "the list of sources changed"],
|
562
792
|
[@dependency_changes, "the dependencies in your gemfile changed"],
|
563
|
-
[@
|
793
|
+
[@current_platform_missing, "your lockfile does not include the current platform"],
|
794
|
+
[@new_platforms.any?, "you added a new platform to your gemfile"],
|
564
795
|
[@path_changes, "the gemspecs for path gems changed"],
|
565
796
|
[@local_changes, "the gemspecs for git local gems changed"],
|
566
|
-
[@
|
797
|
+
[@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""],
|
798
|
+
[@unlocking_bundler, "an update to the version of Bundler itself was requested"],
|
799
|
+
[@locked_spec_with_missing_deps, "your lock file includes \"#{@locked_spec_with_missing_deps}\" but not some of its dependencies"],
|
800
|
+
[@locked_spec_with_invalid_deps, "your lockfile does not satisfy dependencies of \"#{@locked_spec_with_invalid_deps}\""],
|
567
801
|
].select(&:first).map(&:last).join(", ")
|
568
802
|
end
|
569
803
|
|
570
|
-
def pretty_dep(dep
|
571
|
-
SharedHelpers.pretty_dependency(dep
|
804
|
+
def pretty_dep(dep)
|
805
|
+
SharedHelpers.pretty_dependency(dep)
|
572
806
|
end
|
573
807
|
|
574
808
|
# Check if the specs of the given source changed
|
@@ -581,17 +815,16 @@ module Bundler
|
|
581
815
|
|
582
816
|
def dependencies_for_source_changed?(source, locked_source = source)
|
583
817
|
deps_for_source = @dependencies.select {|s| s.source == source }
|
584
|
-
locked_deps_for_source =
|
818
|
+
locked_deps_for_source = locked_dependencies.select {|dep| dep.source == locked_source }
|
585
819
|
|
586
|
-
|
820
|
+
deps_for_source.uniq.sort != locked_deps_for_source.sort
|
587
821
|
end
|
588
822
|
|
589
823
|
def specs_for_source_changed?(source)
|
590
824
|
locked_index = Index.new
|
591
825
|
locked_index.use(@locked_specs.select {|s| source.can_lock?(s) })
|
592
826
|
|
593
|
-
|
594
|
-
locked_index != source.specs
|
827
|
+
!locked_index.subset?(source.specs)
|
595
828
|
rescue PathError, GitError => e
|
596
829
|
Bundler.ui.debug "Assuming that #{source} has not changed since fetching its specs errored (#{e})"
|
597
830
|
false
|
@@ -605,9 +838,9 @@ module Bundler
|
|
605
838
|
|
606
839
|
Bundler.settings.local_overrides.map do |k, v|
|
607
840
|
spec = @dependencies.find {|s| s.name == k }
|
608
|
-
source = spec
|
609
|
-
if source
|
610
|
-
source.unlock! if @
|
841
|
+
source = spec&.source
|
842
|
+
if source&.respond_to?(:local_override!)
|
843
|
+
source.unlock! if @gems_to_unlock.include?(spec.name)
|
611
844
|
locals << [source, source.local_override!(v)]
|
612
845
|
end
|
613
846
|
end
|
@@ -615,7 +848,40 @@ module Bundler
|
|
615
848
|
sources_with_changes = locals.select do |source, changed|
|
616
849
|
changed || specs_changed?(source)
|
617
850
|
end.map(&:first)
|
618
|
-
!sources_with_changes.each {|source| @
|
851
|
+
!sources_with_changes.each {|source| @sources_to_unlock << source.name }.empty?
|
852
|
+
end
|
853
|
+
|
854
|
+
def check_lockfile
|
855
|
+
@missing_lockfile_dep = nil
|
856
|
+
|
857
|
+
@locked_spec_with_invalid_deps = nil
|
858
|
+
@locked_spec_with_missing_deps = nil
|
859
|
+
|
860
|
+
missing = []
|
861
|
+
invalid = []
|
862
|
+
|
863
|
+
@locked_specs.each do |s|
|
864
|
+
validation = @locked_specs.validate_deps(s)
|
865
|
+
|
866
|
+
missing << s if validation == :missing
|
867
|
+
invalid << s if validation == :invalid
|
868
|
+
end
|
869
|
+
|
870
|
+
if missing.any?
|
871
|
+
@locked_specs.delete(missing)
|
872
|
+
|
873
|
+
@locked_spec_with_missing_deps = missing.first.name
|
874
|
+
elsif !@dependency_changes
|
875
|
+
@missing_lockfile_dep = current_dependencies.find do |d|
|
876
|
+
@locked_specs[d.name].empty? && d.name != "bundler"
|
877
|
+
end&.name
|
878
|
+
end
|
879
|
+
|
880
|
+
if invalid.any?
|
881
|
+
@locked_specs.delete(invalid)
|
882
|
+
|
883
|
+
@locked_spec_with_invalid_deps = invalid.first.name
|
884
|
+
end
|
619
885
|
end
|
620
886
|
|
621
887
|
def converge_paths
|
@@ -642,44 +908,24 @@ module Bundler
|
|
642
908
|
end
|
643
909
|
end
|
644
910
|
|
645
|
-
def converge_rubygems_sources
|
646
|
-
return false if Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
|
647
|
-
|
648
|
-
changes = false
|
649
|
-
|
650
|
-
# Get the RubyGems sources from the Gemfile.lock
|
651
|
-
locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
|
652
|
-
# Get the RubyGems remotes from the Gemfile
|
653
|
-
actual_remotes = sources.rubygems_remotes
|
654
|
-
|
655
|
-
# If there is a RubyGems source in both
|
656
|
-
if !locked_gem_sources.empty? && !actual_remotes.empty?
|
657
|
-
locked_gem_sources.each do |locked_gem|
|
658
|
-
# Merge the remotes from the Gemfile into the Gemfile.lock
|
659
|
-
changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
|
660
|
-
end
|
661
|
-
end
|
662
|
-
|
663
|
-
changes
|
664
|
-
end
|
665
|
-
|
666
911
|
def converge_sources
|
667
|
-
changes = false
|
668
|
-
|
669
|
-
changes |= converge_rubygems_sources
|
670
|
-
|
671
912
|
# Replace the sources from the Gemfile with the sources from the Gemfile.lock,
|
672
913
|
# if they exist in the Gemfile.lock and are `==`. If you can't find an equivalent
|
673
914
|
# source in the Gemfile.lock, use the one from the Gemfile.
|
674
|
-
changes
|
915
|
+
changes = sources.replace_sources!(@locked_sources)
|
675
916
|
|
676
917
|
sources.all_sources.each do |source|
|
918
|
+
# has to be done separately, because we want to keep the locked checksum
|
919
|
+
# store for a source, even when doing a full update
|
920
|
+
if @locked_checksums && @locked_gems && locked_source = @locked_gems.sources.find {|s| s == source && !s.equal?(source) }
|
921
|
+
source.checksum_store.merge!(locked_source.checksum_store)
|
922
|
+
end
|
677
923
|
# If the source is unlockable and the current command allows an unlock of
|
678
924
|
# the source (for example, you are doing a `bundle update <foo>` of a git-pinned
|
679
925
|
# gem), unlock it. For git sources, this means to unlock the revision, which
|
680
926
|
# will cause the `ref` used to be the most recent for the branch (or master) if
|
681
927
|
# an explicit `ref` is not used.
|
682
|
-
if source.respond_to?(:unlock!) && @
|
928
|
+
if source.respond_to?(:unlock!) && @sources_to_unlock.include?(source.name)
|
683
929
|
source.unlock!
|
684
930
|
changes = true
|
685
931
|
end
|
@@ -689,28 +935,14 @@ module Bundler
|
|
689
935
|
end
|
690
936
|
|
691
937
|
def converge_dependencies
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
# after locked_source and sources don't match, we still use locked_source.
|
697
|
-
if frozen && !locked_source.nil? &&
|
698
|
-
locked_source.respond_to?(:source) && locked_source.source.instance_of?(Source::Path) && locked_source.source.path.exist?
|
699
|
-
dep.source = locked_source.source
|
700
|
-
elsif dep.source
|
938
|
+
changes = false
|
939
|
+
|
940
|
+
@dependencies.each do |dep|
|
941
|
+
if dep.source
|
701
942
|
dep.source = sources.get(dep.source)
|
702
943
|
end
|
703
|
-
if dep.source.is_a?(Source::Gemspec)
|
704
|
-
dep.platforms.concat(@platforms.map {|p| Dependency::REVERSE_PLATFORM_MAP[p] }.flatten(1)).uniq!
|
705
|
-
end
|
706
|
-
end
|
707
944
|
|
708
|
-
|
709
|
-
# We want to know if all match, but don't want to check all entries
|
710
|
-
# This means we need to return false if any dependency doesn't match
|
711
|
-
# the lock or doesn't exist in the lock.
|
712
|
-
@dependencies.each do |dependency|
|
713
|
-
unless locked_dep = @locked_deps[dependency.name]
|
945
|
+
unless locked_dep = @originally_locked_deps[dep.name]
|
714
946
|
changes = true
|
715
947
|
next
|
716
948
|
end
|
@@ -721,11 +953,11 @@ module Bundler
|
|
721
953
|
# directive, the lockfile dependencies and resolved dependencies end up
|
722
954
|
# with a mismatch on #type. Work around that by setting the type on the
|
723
955
|
# dep from the lockfile.
|
724
|
-
locked_dep.instance_variable_set(:@type,
|
956
|
+
locked_dep.instance_variable_set(:@type, dep.type)
|
725
957
|
|
726
958
|
# We already know the name matches from the hash lookup
|
727
959
|
# so we only need to check the requirement now
|
728
|
-
changes ||=
|
960
|
+
changes ||= dep.requirement != locked_dep.requirement
|
729
961
|
end
|
730
962
|
|
731
963
|
changes
|
@@ -735,85 +967,11 @@ module Bundler
|
|
735
967
|
# commonly happen if the Gemfile has changed since the lockfile was last
|
736
968
|
# generated
|
737
969
|
def converge_locked_specs
|
738
|
-
|
739
|
-
|
740
|
-
# Build a list of dependencies that are the same in the Gemfile
|
741
|
-
# and Gemfile.lock. If the Gemfile modified a dependency, but
|
742
|
-
# the gem in the Gemfile.lock still satisfies it, this is fine
|
743
|
-
# too.
|
744
|
-
@dependencies.each do |dep|
|
745
|
-
locked_dep = @locked_deps[dep.name]
|
746
|
-
|
747
|
-
# If the locked_dep doesn't match the dependency we're looking for then we ignore the locked_dep
|
748
|
-
locked_dep = nil unless locked_dep == dep
|
749
|
-
|
750
|
-
if in_locked_deps?(dep, locked_dep) || satisfies_locked_spec?(dep)
|
751
|
-
deps << dep
|
752
|
-
elsif dep.source.is_a?(Source::Path) && dep.current_platform? && (!locked_dep || dep.source != locked_dep.source)
|
753
|
-
@locked_specs.each do |s|
|
754
|
-
@unlock[:gems] << s.name if s.source == dep.source
|
755
|
-
end
|
756
|
-
|
757
|
-
dep.source.unlock! if dep.source.respond_to?(:unlock!)
|
758
|
-
dep.source.specs.each {|s| @unlock[:gems] << s.name }
|
759
|
-
end
|
760
|
-
end
|
761
|
-
|
762
|
-
unlock_source_unlocks_spec = Bundler.feature_flag.unlock_source_unlocks_spec?
|
763
|
-
|
764
|
-
converged = []
|
765
|
-
@locked_specs.each do |s|
|
766
|
-
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
767
|
-
dep = @dependencies.find {|d| s.satisfies?(d) }
|
768
|
-
s.source = (dep && dep.source) || sources.get(s.source)
|
769
|
-
|
770
|
-
# Don't add a spec to the list if its source is expired. For example,
|
771
|
-
# if you change a Git gem to RubyGems.
|
772
|
-
next if s.source.nil?
|
773
|
-
next if @unlock[:sources].include?(s.source.name)
|
774
|
-
|
775
|
-
# XXX This is a backwards-compatibility fix to preserve the ability to
|
776
|
-
# unlock a single gem by passing its name via `--source`. See issue #3759
|
777
|
-
# TODO: delete in Bundler 2
|
778
|
-
next if unlock_source_unlocks_spec && @unlock[:sources].include?(s.name)
|
779
|
-
|
780
|
-
# If the spec is from a path source and it doesn't exist anymore
|
781
|
-
# then we unlock it.
|
782
|
-
|
783
|
-
# Path sources have special logic
|
784
|
-
if s.source.instance_of?(Source::Path) || s.source.instance_of?(Source::Gemspec)
|
785
|
-
other_sources_specs = begin
|
786
|
-
s.source.specs
|
787
|
-
rescue PathError, GitError
|
788
|
-
# if we won't need the source (according to the lockfile),
|
789
|
-
# don't error if the path/git source isn't available
|
790
|
-
next if @locked_specs.
|
791
|
-
for(requested_dependencies, [], false, true, false).
|
792
|
-
none? {|locked_spec| locked_spec.source == s.source }
|
793
|
-
|
794
|
-
raise
|
795
|
-
end
|
796
|
-
|
797
|
-
other = other_sources_specs[s].first
|
798
|
-
|
799
|
-
# If the spec is no longer in the path source, unlock it. This
|
800
|
-
# commonly happens if the version changed in the gemspec
|
801
|
-
next unless other
|
802
|
-
|
803
|
-
deps2 = other.dependencies.select {|d| d.type != :development }
|
804
|
-
runtime_dependencies = s.dependencies.select {|d| d.type != :development }
|
805
|
-
# If the dependencies of the path source have changed, unlock it
|
806
|
-
next unless runtime_dependencies.sort == deps2.sort
|
807
|
-
end
|
808
|
-
|
809
|
-
converged << s
|
810
|
-
end
|
970
|
+
converged = converge_specs(@locked_specs)
|
811
971
|
|
812
972
|
resolve = SpecSet.new(converged)
|
813
|
-
|
814
|
-
|
815
|
-
resolve = resolve.for(expanded_deps, @unlock[:gems], false, false, false)
|
816
|
-
diff = nil
|
973
|
+
|
974
|
+
diff = nil
|
817
975
|
|
818
976
|
# Now, we unlock any sources that do not have anymore gems pinned to it
|
819
977
|
sources.all_sources.each do |source|
|
@@ -828,125 +986,107 @@ module Bundler
|
|
828
986
|
resolve
|
829
987
|
end
|
830
988
|
|
831
|
-
def
|
832
|
-
|
833
|
-
|
834
|
-
# that the Gemfile dep does.
|
835
|
-
locked_dep && locked_dep.source && dep.source && locked_dep.source.include?(dep.source)
|
836
|
-
end
|
989
|
+
def converge_specs(specs)
|
990
|
+
converged = []
|
991
|
+
deps = []
|
837
992
|
|
838
|
-
|
839
|
-
|
840
|
-
|
993
|
+
specs.each do |s|
|
994
|
+
name = s.name
|
995
|
+
dep = @dependencies.find {|d| s.satisfies?(d) }
|
996
|
+
lockfile_source = s.source
|
841
997
|
|
842
|
-
|
843
|
-
|
844
|
-
def expanded_dependencies
|
845
|
-
@expanded_dependencies ||= begin
|
846
|
-
expand_dependencies(dependencies + metadata_dependencies, @remote)
|
847
|
-
end
|
848
|
-
end
|
998
|
+
if dep
|
999
|
+
gemfile_source = dep.source || default_source
|
849
1000
|
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
1001
|
+
deps << dep if !dep.source || lockfile_source.include?(dep.source) || new_deps.include?(dep)
|
1002
|
+
|
1003
|
+
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
1004
|
+
s.source = gemfile_source
|
1005
|
+
else
|
1006
|
+
# Replace the locked dependency's source with the default source, if the locked source is no longer in the Gemfile
|
1007
|
+
s.source = default_source unless sources.get(lockfile_source)
|
856
1008
|
end
|
857
|
-
[
|
858
|
-
Dependency.new("ruby\0", ruby_versions),
|
859
|
-
Dependency.new("rubygems\0", Gem::VERSION),
|
860
|
-
]
|
861
|
-
end
|
862
|
-
end
|
863
1009
|
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
"~> #{version}.0"
|
1010
|
+
source = s.source
|
1011
|
+
next if @sources_to_unlock.include?(source.name)
|
1012
|
+
|
1013
|
+
# Path sources have special logic
|
1014
|
+
if source.instance_of?(Source::Path) || source.instance_of?(Source::Gemspec) || (source.instance_of?(Source::Git) && !@gems_to_unlock.include?(name) && deps.include?(dep))
|
1015
|
+
new_spec = source.specs[s].first
|
1016
|
+
if new_spec
|
1017
|
+
s.runtime_dependencies.replace(new_spec.runtime_dependencies)
|
873
1018
|
else
|
874
|
-
|
1019
|
+
# If the spec is no longer in the path source, unlock it. This
|
1020
|
+
# commonly happens if the version changed in the gemspec
|
1021
|
+
@gems_to_unlock << name
|
875
1022
|
end
|
876
|
-
end)
|
877
|
-
end
|
878
|
-
end
|
879
|
-
|
880
|
-
def expand_dependencies(dependencies, remote = false)
|
881
|
-
sorted_platforms = Resolver.sort_platforms(@platforms)
|
882
|
-
deps = []
|
883
|
-
dependencies.each do |dep|
|
884
|
-
dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
|
885
|
-
next if !remote && !dep.current_platform?
|
886
|
-
platforms = dep.gem_platforms(sorted_platforms)
|
887
|
-
if platforms.empty? && !Bundler.settings[:disable_platform_warnings]
|
888
|
-
mapped_platforms = dep.platforms.map {|p| Dependency::PLATFORM_MAP[p] }
|
889
|
-
Bundler.ui.warn \
|
890
|
-
"The dependency #{dep} will be unused by any of the platforms Bundler is installing for. " \
|
891
|
-
"Bundler is installing for #{@platforms.join ", "} but the dependency " \
|
892
|
-
"is only for #{mapped_platforms.join ", "}. " \
|
893
|
-
"To add those platforms to the bundle, " \
|
894
|
-
"run `bundle lock --add-platform #{mapped_platforms.join " "}`."
|
895
1023
|
end
|
896
|
-
|
897
|
-
|
1024
|
+
|
1025
|
+
if dep.nil? && requested_dep = requested_dependencies.find {|d| name == d.name }
|
1026
|
+
@gems_to_unlock << name
|
1027
|
+
deps << requested_dep
|
898
1028
|
end
|
1029
|
+
|
1030
|
+
converged << s
|
899
1031
|
end
|
900
|
-
|
1032
|
+
|
1033
|
+
filter_specs(converged, deps, skips: @gems_to_unlock)
|
901
1034
|
end
|
902
1035
|
|
903
|
-
def
|
904
|
-
|
905
|
-
|
906
|
-
|
1036
|
+
def metadata_dependencies
|
1037
|
+
@metadata_dependencies ||= [
|
1038
|
+
Dependency.new("Ruby\0", Bundler::RubyVersion.system.gem_version),
|
1039
|
+
Dependency.new("RubyGems\0", Gem::VERSION),
|
1040
|
+
]
|
907
1041
|
end
|
908
1042
|
|
909
1043
|
def source_requirements
|
910
|
-
|
911
|
-
|
1044
|
+
@source_requirements ||= find_source_requirements
|
1045
|
+
end
|
912
1046
|
|
1047
|
+
def find_source_requirements
|
913
1048
|
# Record the specs available in each gem's source, so that those
|
914
1049
|
# specs will be available later when the resolver knows where to
|
915
1050
|
# look for that gemspec (or its dependencies)
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
source_requirements[dep.name] = source
|
1051
|
+
source_requirements = if precompute_source_requirements_for_indirect_dependencies?
|
1052
|
+
all_requirements = source_map.all_requirements
|
1053
|
+
{ default: default_source }.merge(all_requirements)
|
1054
|
+
else
|
1055
|
+
{ default: Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
|
922
1056
|
end
|
1057
|
+
source_requirements.merge!(source_map.locked_requirements) if nothing_changed?
|
923
1058
|
metadata_dependencies.each do |dep|
|
924
1059
|
source_requirements[dep.name] = sources.metadata_source
|
925
1060
|
end
|
926
|
-
|
1061
|
+
|
1062
|
+
default_bundler_source = source_requirements["bundler"] || default_source
|
1063
|
+
|
1064
|
+
if @unlocking_bundler
|
1065
|
+
default_bundler_source.add_dependency_names("bundler")
|
1066
|
+
else
|
1067
|
+
source_requirements[:default_bundler] = default_bundler_source
|
1068
|
+
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
1069
|
+
end
|
1070
|
+
|
927
1071
|
source_requirements
|
928
1072
|
end
|
929
1073
|
|
930
|
-
def
|
931
|
-
|
932
|
-
default = Bundler.feature_flag.lockfile_uses_separate_rubygems_sources? && sources.default_source
|
933
|
-
@dependencies.each do |dep|
|
934
|
-
next unless dep_source = dep.source || default
|
935
|
-
next if dep_source == skip
|
936
|
-
pinned_names << dep.name
|
937
|
-
end
|
938
|
-
pinned_names
|
1074
|
+
def default_source
|
1075
|
+
sources.default_source
|
939
1076
|
end
|
940
1077
|
|
941
1078
|
def requested_groups
|
942
|
-
groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
1079
|
+
values = groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
1080
|
+
values &= Bundler.settings[:only] unless Bundler.settings[:only].empty?
|
1081
|
+
values
|
943
1082
|
end
|
944
1083
|
|
945
1084
|
def lockfiles_equal?(current, proposed, preserve_unknown_sections)
|
946
1085
|
if preserve_unknown_sections
|
947
1086
|
sections_to_ignore = LockfileParser.sections_to_ignore(@locked_bundler_version)
|
948
1087
|
sections_to_ignore += LockfileParser.unknown_sections_in_lockfile(current)
|
949
|
-
sections_to_ignore
|
1088
|
+
sections_to_ignore << LockfileParser::RUBY
|
1089
|
+
sections_to_ignore << LockfileParser::BUNDLED unless @unlocking_bundler
|
950
1090
|
pattern = /#{Regexp.union(sections_to_ignore)}\n(\s{2,}.*\n)+/
|
951
1091
|
whitespace_cleanup = /\n{2,}/
|
952
1092
|
current = current.gsub(pattern, "\n").gsub(whitespace_cleanup, "\n\n").strip
|
@@ -955,39 +1095,57 @@ module Bundler
|
|
955
1095
|
current == proposed
|
956
1096
|
end
|
957
1097
|
|
958
|
-
def
|
959
|
-
|
960
|
-
|
961
|
-
|
1098
|
+
def additional_base_requirements_to_prevent_downgrades(resolution_packages, last_resolve)
|
1099
|
+
return resolution_packages unless @locked_gems && !sources.expired_sources?(@locked_gems.sources)
|
1100
|
+
converge_specs(@originally_locked_specs - last_resolve).each do |locked_spec|
|
1101
|
+
next if locked_spec.source.is_a?(Source::Path)
|
1102
|
+
resolution_packages.base_requirements[locked_spec.name] = Gem::Requirement.new(">= #{locked_spec.version}")
|
1103
|
+
end
|
1104
|
+
resolution_packages
|
962
1105
|
end
|
963
1106
|
|
964
|
-
def
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
end
|
971
|
-
requires
|
1107
|
+
def additional_base_requirements_to_force_updates(resolution_packages)
|
1108
|
+
return resolution_packages if @explicit_unlocks.empty?
|
1109
|
+
full_update = dup_for_full_unlock.resolve
|
1110
|
+
@explicit_unlocks.each do |name|
|
1111
|
+
version = full_update.version_for(name)
|
1112
|
+
resolution_packages.base_requirements[name] = Gem::Requirement.new("= #{version}") if version
|
972
1113
|
end
|
1114
|
+
resolution_packages
|
973
1115
|
end
|
974
1116
|
|
975
|
-
def
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
end.values
|
1117
|
+
def dup_for_full_unlock
|
1118
|
+
unlocked_definition = self.class.new(@lockfile, @dependencies, @sources, true, @ruby_version, @optional_groups, @gemfiles)
|
1119
|
+
unlocked_definition.source_requirements = source_requirements
|
1120
|
+
unlocked_definition.gem_version_promoter.tap do |gvp|
|
1121
|
+
gvp.level = gem_version_promoter.level
|
1122
|
+
gvp.strict = gem_version_promoter.strict
|
1123
|
+
gvp.pre = gem_version_promoter.pre
|
1124
|
+
end
|
1125
|
+
unlocked_definition
|
985
1126
|
end
|
986
1127
|
|
987
|
-
def
|
988
|
-
return
|
1128
|
+
def remove_invalid_platforms!
|
1129
|
+
return if Bundler.frozen_bundle?
|
1130
|
+
|
1131
|
+
platforms.reverse_each do |platform|
|
1132
|
+
next if local_platform == platform ||
|
1133
|
+
@new_platforms.include?(platform) ||
|
1134
|
+
@path_changes ||
|
1135
|
+
@dependency_changes ||
|
1136
|
+
@locked_spec_with_invalid_deps ||
|
1137
|
+
!spec_set_incomplete_for_platform?(@originally_locked_specs, platform)
|
1138
|
+
|
1139
|
+
remove_platform(platform)
|
1140
|
+
end
|
1141
|
+
end
|
1142
|
+
|
1143
|
+
def spec_set_incomplete_for_platform?(spec_set, platform)
|
1144
|
+
spec_set.incomplete_for_platform?(current_dependencies, platform)
|
1145
|
+
end
|
989
1146
|
|
990
|
-
|
1147
|
+
def source_map
|
1148
|
+
@source_map ||= SourceMap.new(sources, dependencies, @locked_specs)
|
991
1149
|
end
|
992
1150
|
end
|
993
1151
|
end
|