bundler 1.17.3 → 2.4.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2786 -1256
- data/LICENSE.md +18 -19
- data/README.md +10 -14
- data/bundler.gemspec +13 -33
- data/exe/bundle +15 -8
- data/exe/bundler +1 -1
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +4 -12
- data/lib/bundler/capistrano.rb +4 -4
- data/lib/bundler/cli/add.rb +28 -16
- data/lib/bundler/cli/binstubs.rb +12 -4
- data/lib/bundler/cli/cache.rb +24 -17
- data/lib/bundler/cli/check.rb +5 -3
- data/lib/bundler/cli/clean.rb +1 -1
- data/lib/bundler/cli/common.rb +41 -13
- data/lib/bundler/cli/config.rb +170 -86
- data/lib/bundler/cli/console.rb +3 -3
- data/lib/bundler/cli/doctor.rb +27 -10
- data/lib/bundler/cli/exec.rb +8 -25
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +261 -48
- data/lib/bundler/cli/info.rb +53 -9
- data/lib/bundler/cli/init.rb +7 -3
- data/lib/bundler/cli/inject.rb +1 -1
- data/lib/bundler/cli/install.rb +39 -67
- data/lib/bundler/cli/issue.rb +8 -7
- data/lib/bundler/cli/list.rb +19 -11
- data/lib/bundler/cli/lock.rb +11 -4
- data/lib/bundler/cli/open.rb +14 -9
- data/lib/bundler/cli/outdated.rb +153 -122
- data/lib/bundler/cli/platform.rb +8 -6
- data/lib/bundler/cli/plugin.rb +19 -2
- data/lib/bundler/cli/pristine.rb +6 -1
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/show.rb +3 -3
- data/lib/bundler/cli/update.rb +49 -18
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/cli.rb +269 -165
- data/lib/bundler/compact_index_client/cache.rb +7 -24
- data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/lib/bundler/compact_index_client/updater.rb +58 -57
- data/lib/bundler/compact_index_client.rb +28 -18
- data/lib/bundler/constants.rb +1 -1
- data/lib/bundler/current_ruby.rb +26 -11
- data/lib/bundler/definition.rb +432 -464
- data/lib/bundler/dependency.rb +29 -71
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +85 -117
- data/lib/bundler/endpoint_specification.rb +16 -14
- data/lib/bundler/env.rb +11 -16
- data/lib/bundler/environment_preserver.rb +32 -5
- data/lib/bundler/errors.rb +31 -14
- data/lib/bundler/feature_flag.rb +12 -33
- data/lib/bundler/fetcher/base.rb +7 -9
- data/lib/bundler/fetcher/compact_index.rb +47 -40
- data/lib/bundler/fetcher/dependency.rb +3 -7
- data/lib/bundler/fetcher/downloader.rb +17 -12
- data/lib/bundler/fetcher/index.rb +5 -32
- data/lib/bundler/fetcher.rb +51 -43
- data/lib/bundler/force_platform.rb +18 -0
- data/lib/bundler/friendly_errors.rb +49 -54
- data/lib/bundler/gem_helper.rb +81 -46
- data/lib/bundler/gem_helpers.rb +44 -28
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +54 -99
- data/lib/bundler/graph.rb +5 -5
- data/lib/bundler/index.rb +16 -54
- data/lib/bundler/injector.rb +51 -17
- data/lib/bundler/inline.rb +28 -29
- data/lib/bundler/installer/gem_installer.rb +22 -23
- data/lib/bundler/installer/parallel_installer.rb +39 -52
- data/lib/bundler/installer/standalone.rb +62 -12
- data/lib/bundler/installer.rb +47 -98
- data/lib/bundler/lazy_specification.rb +88 -52
- data/lib/bundler/lockfile_generator.rb +4 -4
- data/lib/bundler/lockfile_parser.rb +41 -72
- data/{man → lib/bundler/man}/bundle-add.1 +29 -5
- data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +22 -4
- data/{man → lib/bundler/man}/bundle-binstubs.1 +6 -4
- data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
- data/lib/bundler/man/bundle-cache.1 +61 -0
- data/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +24 -17
- data/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/{man → lib/bundler/man}/bundle-clean.1 +2 -2
- data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-config.1 +78 -63
- data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +96 -88
- data/lib/bundler/man/bundle-console.1 +53 -0
- data/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/{man → lib/bundler/man}/bundle-exec.1 +6 -6
- data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +6 -6
- data/lib/bundler/man/bundle-gem.1 +105 -0
- data/lib/bundler/man/bundle-gem.1.ronn +117 -0
- data/lib/bundler/man/bundle-help.1 +13 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/{man → lib/bundler/man}/bundle-info.1 +3 -3
- data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +3 -3
- data/{man → lib/bundler/man}/bundle-init.1 +6 -2
- data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +3 -1
- data/{man → lib/bundler/man}/bundle-inject.1 +5 -2
- data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
- data/{man → lib/bundler/man}/bundle-install.1 +42 -37
- data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +42 -38
- data/{man → lib/bundler/man}/bundle-list.1 +7 -7
- data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
- data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/{man → lib/bundler/man}/bundle-open.1 +22 -2
- data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +9 -1
- data/{man → lib/bundler/man}/bundle-outdated.1 +15 -18
- data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +13 -19
- data/{man → lib/bundler/man}/bundle-platform.1 +16 -6
- data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
- data/lib/bundler/man/bundle-plugin.1 +81 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/{man → lib/bundler/man}/bundle-update.1 +8 -8
- data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +8 -7
- data/lib/bundler/man/bundle-version.1 +35 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/{man → lib/bundler/man}/bundle-viz.1 +4 -1
- data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +2 -0
- data/{man → lib/bundler/man}/bundle.1 +17 -12
- data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +14 -9
- data/{man → lib/bundler/man}/gemfile.5 +139 -92
- data/{man → lib/bundler/man}/gemfile.5.ronn +118 -96
- data/{man → lib/bundler/man}/index.txt +5 -1
- data/lib/bundler/match_metadata.rb +13 -0
- data/lib/bundler/match_platform.rb +1 -2
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/mirror.rb +10 -12
- data/lib/bundler/plugin/api/source.rb +29 -15
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/dsl.rb +1 -1
- data/lib/bundler/plugin/index.rb +32 -9
- data/lib/bundler/plugin/installer/git.rb +0 -4
- data/lib/bundler/plugin/installer/rubygems.rb +1 -9
- data/lib/bundler/plugin/installer.rb +40 -24
- data/lib/bundler/plugin/source_list.rb +5 -1
- data/lib/bundler/plugin.rb +103 -43
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +12 -9
- data/lib/bundler/resolver/base.rb +107 -0
- data/lib/bundler/resolver/candidate.rb +94 -0
- data/lib/bundler/resolver/incompatibility.rb +15 -0
- data/lib/bundler/resolver/package.rb +72 -0
- data/lib/bundler/resolver/root.rb +25 -0
- data/lib/bundler/resolver/spec_group.rb +49 -73
- data/lib/bundler/resolver.rb +355 -301
- data/lib/bundler/retry.rb +4 -4
- data/lib/bundler/ruby_dsl.rb +7 -1
- data/lib/bundler/ruby_version.rb +12 -40
- data/lib/bundler/rubygems_ext.rb +237 -92
- data/lib/bundler/rubygems_gem_installer.rb +87 -21
- data/lib/bundler/rubygems_integration.rb +180 -516
- data/lib/bundler/runtime.rb +26 -41
- data/lib/bundler/safe_marshal.rb +31 -0
- data/lib/bundler/self_manager.rb +168 -0
- data/lib/bundler/settings.rb +164 -120
- data/lib/bundler/setup.rb +14 -12
- data/lib/bundler/shared_helpers.rb +62 -103
- data/lib/bundler/similarity_detector.rb +3 -3
- data/lib/bundler/source/git/git_proxy.rb +292 -128
- data/lib/bundler/source/git.rb +114 -64
- data/lib/bundler/source/metadata.rb +9 -9
- data/lib/bundler/source/path/installer.rb +11 -32
- data/lib/bundler/source/path.rb +29 -18
- data/lib/bundler/source/rubygems/remote.rb +3 -4
- data/lib/bundler/source/rubygems.rb +181 -208
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +31 -11
- data/lib/bundler/source_list.rb +108 -67
- data/lib/bundler/source_map.rb +71 -0
- data/lib/bundler/spec_set.rb +96 -72
- data/lib/bundler/stub_specification.rb +45 -37
- data/lib/bundler/templates/Executable +3 -5
- data/lib/bundler/templates/Executable.bundler +22 -18
- 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 +57 -47
- data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +22 -2
- data/lib/bundler/templates/newgem/README.md.tt +13 -15
- data/lib/bundler/templates/newgem/Rakefile.tt +43 -5
- 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 -41
- data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -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 +39 -20
- data/lib/bundler/ui/silent.rb +21 -5
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/uri_credentials_filter.rb +10 -4
- 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 +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 +128 -0
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1493 -425
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -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 +302 -462
- 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 +60 -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/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +25 -14
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +20 -10
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +34 -15
- data/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
- data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +83 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- 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/arguments.rb +7 -3
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +40 -6
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +88 -13
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +16 -9
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +729 -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 +1587 -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 +539 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +119 -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_persistent.rb +2 -39
- data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/vendored_uri.rb +4 -0
- data/lib/bundler/version.rb +5 -20
- data/lib/bundler/vlad.rb +2 -2
- data/lib/bundler/worker.rb +26 -15
- data/lib/bundler/yaml_serializer.rb +3 -4
- data/lib/bundler.rb +285 -190
- metadata +157 -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.txt +0 -52
- 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.txt +0 -21
- data/man/bundle-init.1.txt +0 -34
- 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.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-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/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- /data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- /data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- /data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- /data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- /data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
data/lib/bundler/definition.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
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,
|
12
16
|
:locked_deps,
|
13
17
|
:locked_gems,
|
14
18
|
:platforms,
|
15
|
-
:requires,
|
16
19
|
:ruby_version,
|
17
20
|
:lockfile,
|
18
21
|
:gemfiles
|
@@ -57,10 +60,8 @@ module Bundler
|
|
57
60
|
@unlocking_bundler = false
|
58
61
|
@unlocking = unlock
|
59
62
|
else
|
60
|
-
unlock = unlock.dup
|
61
63
|
@unlocking_bundler = unlock.delete(:bundler)
|
62
|
-
unlock.
|
63
|
-
@unlocking = !unlock.empty?
|
64
|
+
@unlocking = unlock.any? {|_k, v| !Array(v).empty? }
|
64
65
|
end
|
65
66
|
|
66
67
|
@dependencies = dependencies
|
@@ -68,15 +69,20 @@ module Bundler
|
|
68
69
|
@unlock = unlock
|
69
70
|
@optional_groups = optional_groups
|
70
71
|
@remote = false
|
72
|
+
@prefer_local = false
|
71
73
|
@specs = nil
|
72
74
|
@ruby_version = ruby_version
|
73
75
|
@gemfiles = gemfiles
|
74
76
|
|
75
77
|
@lockfile = lockfile
|
76
78
|
@lockfile_contents = String.new
|
79
|
+
|
77
80
|
@locked_bundler_version = nil
|
78
|
-
@
|
79
|
-
|
81
|
+
@resolved_bundler_version = nil
|
82
|
+
|
83
|
+
@locked_ruby_version = nil
|
84
|
+
@new_platform = nil
|
85
|
+
@removed_platform = nil
|
80
86
|
|
81
87
|
if lockfile && File.exist?(lockfile)
|
82
88
|
@lockfile_contents = Bundler.read_file(lockfile)
|
@@ -85,10 +91,11 @@ module Bundler
|
|
85
91
|
@platforms = @locked_platforms.dup
|
86
92
|
@locked_bundler_version = @locked_gems.bundler_version
|
87
93
|
@locked_ruby_version = @locked_gems.ruby_version
|
94
|
+
@originally_locked_specs = SpecSet.new(@locked_gems.specs)
|
88
95
|
|
89
96
|
if unlock != true
|
90
97
|
@locked_deps = @locked_gems.dependencies
|
91
|
-
@locked_specs =
|
98
|
+
@locked_specs = @originally_locked_specs
|
92
99
|
@locked_sources = @locked_gems.sources
|
93
100
|
else
|
94
101
|
@unlock = {}
|
@@ -102,11 +109,24 @@ module Bundler
|
|
102
109
|
@locked_gems = nil
|
103
110
|
@locked_deps = {}
|
104
111
|
@locked_specs = SpecSet.new([])
|
112
|
+
@originally_locked_specs = @locked_specs
|
105
113
|
@locked_sources = []
|
106
114
|
@locked_platforms = []
|
107
115
|
end
|
108
116
|
|
109
|
-
@
|
117
|
+
locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
|
118
|
+
@multisource_allowed = locked_gem_sources.size == 1 && locked_gem_sources.first.multiple_remotes? && Bundler.frozen_bundle?
|
119
|
+
|
120
|
+
if @multisource_allowed
|
121
|
+
unless sources.aggregate_global_source?
|
122
|
+
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."
|
123
|
+
|
124
|
+
Bundler::SharedHelpers.major_deprecation 2, msg
|
125
|
+
end
|
126
|
+
|
127
|
+
@sources.merged_gem_lockfile_sections!(locked_gem_sources.first)
|
128
|
+
end
|
129
|
+
|
110
130
|
@unlock[:sources] ||= []
|
111
131
|
@unlock[:ruby] ||= if @ruby_version && locked_ruby_version_object
|
112
132
|
@ruby_version.diff(locked_ruby_version_object)
|
@@ -119,43 +139,55 @@ module Bundler
|
|
119
139
|
@path_changes = converge_paths
|
120
140
|
@source_changes = converge_sources
|
121
141
|
|
122
|
-
|
123
|
-
|
124
|
-
|
142
|
+
if @unlock[:conservative]
|
143
|
+
@unlock[:gems] ||= @dependencies.map(&:name)
|
144
|
+
else
|
145
|
+
eager_unlock = (@unlock[:gems] || []).map {|name| Dependency.new(name, ">= 0") }
|
146
|
+
@unlock[:gems] = @locked_specs.for(eager_unlock, false, platforms).map(&:name).uniq
|
125
147
|
end
|
126
148
|
|
127
149
|
@dependency_changes = converge_dependencies
|
128
150
|
@local_changes = converge_locals
|
129
151
|
|
130
|
-
@
|
152
|
+
@missing_lockfile_dep = check_missing_lockfile_dep
|
131
153
|
end
|
132
154
|
|
133
155
|
def gem_version_promoter
|
134
|
-
@gem_version_promoter ||=
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
else
|
142
|
-
@locked_specs
|
143
|
-
end
|
144
|
-
GemVersionPromoter.new(locked_specs, @unlock[:gems])
|
145
|
-
end
|
156
|
+
@gem_version_promoter ||= GemVersionPromoter.new
|
157
|
+
end
|
158
|
+
|
159
|
+
def resolve_only_locally!
|
160
|
+
@remote = false
|
161
|
+
sources.local_only!
|
162
|
+
resolve
|
146
163
|
end
|
147
164
|
|
148
165
|
def resolve_with_cache!
|
149
|
-
raise "Specs already loaded" if @specs
|
150
166
|
sources.cached!
|
151
|
-
|
167
|
+
resolve
|
152
168
|
end
|
153
169
|
|
154
170
|
def resolve_remotely!
|
155
|
-
raise "Specs already loaded" if @specs
|
156
171
|
@remote = true
|
157
172
|
sources.remote!
|
158
|
-
|
173
|
+
resolve
|
174
|
+
end
|
175
|
+
|
176
|
+
def resolution_mode=(options)
|
177
|
+
if options["local"]
|
178
|
+
@remote = false
|
179
|
+
else
|
180
|
+
@remote = true
|
181
|
+
@prefer_local = options["prefer-local"]
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def setup_sources_for_resolve
|
186
|
+
if @remote == false
|
187
|
+
sources.cached!
|
188
|
+
else
|
189
|
+
sources.remote!
|
190
|
+
end
|
159
191
|
end
|
160
192
|
|
161
193
|
# For given dependency list returns a SpecSet with Gemspec of all the required
|
@@ -165,25 +197,7 @@ module Bundler
|
|
165
197
|
#
|
166
198
|
# @return [Bundler::SpecSet]
|
167
199
|
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
|
200
|
+
@specs ||= materialize(requested_dependencies)
|
187
201
|
end
|
188
202
|
|
189
203
|
def new_specs
|
@@ -194,14 +208,8 @@ module Bundler
|
|
194
208
|
@locked_specs - specs
|
195
209
|
end
|
196
210
|
|
197
|
-
def new_platform?
|
198
|
-
@new_platform
|
199
|
-
end
|
200
|
-
|
201
211
|
def missing_specs
|
202
|
-
|
203
|
-
resolve.materialize(requested_dependencies, missing)
|
204
|
-
missing
|
212
|
+
resolve.materialize(requested_dependencies).missing_specs
|
205
213
|
end
|
206
214
|
|
207
215
|
def missing_specs?
|
@@ -210,8 +218,9 @@ module Bundler
|
|
210
218
|
Bundler.ui.debug "The definition is missing #{missing.map(&:full_name)}"
|
211
219
|
true
|
212
220
|
rescue BundlerError => e
|
213
|
-
@index = nil
|
214
221
|
@resolve = nil
|
222
|
+
@resolver = nil
|
223
|
+
@resolution_packages = nil
|
215
224
|
@specs = nil
|
216
225
|
@gem_version_promoter = nil
|
217
226
|
|
@@ -220,104 +229,81 @@ module Bundler
|
|
220
229
|
end
|
221
230
|
|
222
231
|
def requested_specs
|
223
|
-
|
224
|
-
groups = requested_groups
|
225
|
-
groups.map!(&:to_sym)
|
226
|
-
specs_for(groups)
|
227
|
-
end
|
232
|
+
specs_for(requested_groups)
|
228
233
|
end
|
229
234
|
|
230
|
-
def
|
231
|
-
|
235
|
+
def requested_dependencies
|
236
|
+
dependencies_for(requested_groups)
|
232
237
|
end
|
233
238
|
|
234
|
-
def
|
235
|
-
|
236
|
-
deps.delete_if {|d| !d.should_include? }
|
237
|
-
specs.for(expand_dependencies(deps))
|
239
|
+
def current_dependencies
|
240
|
+
filter_relevant(dependencies)
|
238
241
|
end
|
239
242
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
#
|
244
|
-
# @return [SpecSet] resolved dependencies
|
245
|
-
def resolve
|
246
|
-
@resolve ||= begin
|
247
|
-
last_resolve = converge_locked_specs
|
248
|
-
resolve =
|
249
|
-
if Bundler.frozen_bundle?
|
250
|
-
Bundler.ui.debug "Frozen, using resolution from the lockfile"
|
251
|
-
last_resolve
|
252
|
-
elsif !unlocking? && nothing_changed?
|
253
|
-
Bundler.ui.debug("Found no changes, using resolution from the lockfile")
|
254
|
-
last_resolve
|
255
|
-
else
|
256
|
-
# Run a resolve against the locally available gems
|
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)
|
259
|
-
end
|
243
|
+
def current_locked_dependencies
|
244
|
+
filter_relevant(locked_dependencies)
|
245
|
+
end
|
260
246
|
|
261
|
-
|
262
|
-
|
263
|
-
|
247
|
+
def filter_relevant(dependencies)
|
248
|
+
dependencies.select do |d|
|
249
|
+
d.should_include? && !d.gem_platforms([generic_local_platform]).empty?
|
264
250
|
end
|
265
251
|
end
|
266
252
|
|
267
|
-
def
|
268
|
-
@
|
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
|
-
end
|
276
|
-
|
277
|
-
double_check_for_index(idx, dependency_names)
|
278
|
-
end
|
253
|
+
def locked_dependencies
|
254
|
+
@locked_deps.values
|
279
255
|
end
|
280
256
|
|
281
|
-
|
282
|
-
|
283
|
-
|
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
|
257
|
+
def new_deps
|
258
|
+
@new_deps ||= @dependencies - locked_dependencies
|
259
|
+
end
|
301
260
|
|
302
|
-
|
303
|
-
|
304
|
-
|
261
|
+
def deleted_deps
|
262
|
+
@deleted_deps ||= locked_dependencies - @dependencies
|
263
|
+
end
|
305
264
|
|
306
|
-
|
307
|
-
|
265
|
+
def specs_for(groups)
|
266
|
+
return specs if groups.empty?
|
267
|
+
deps = dependencies_for(groups)
|
268
|
+
materialize(deps)
|
308
269
|
end
|
309
|
-
private :double_check_for_index
|
310
270
|
|
311
|
-
def
|
312
|
-
|
271
|
+
def dependencies_for(groups)
|
272
|
+
groups.map!(&:to_sym)
|
273
|
+
current_dependencies.reject do |d|
|
274
|
+
(d.groups & groups).empty?
|
275
|
+
end
|
313
276
|
end
|
314
277
|
|
315
|
-
|
316
|
-
|
278
|
+
# Resolve all the dependencies specified in Gemfile. It ensures that
|
279
|
+
# dependencies that have been already resolved via locked file and are fresh
|
280
|
+
# are reused when resolving dependencies
|
281
|
+
#
|
282
|
+
# @return [SpecSet] resolved dependencies
|
283
|
+
def resolve
|
284
|
+
@resolve ||= if Bundler.frozen_bundle?
|
285
|
+
Bundler.ui.debug "Frozen, using resolution from the lockfile"
|
286
|
+
@locked_specs
|
287
|
+
elsif no_resolve_needed?
|
288
|
+
if deleted_deps.any?
|
289
|
+
Bundler.ui.debug "Some dependencies were deleted, using a subset of the resolution from the lockfile"
|
290
|
+
SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps))
|
291
|
+
else
|
292
|
+
Bundler.ui.debug "Found no changes, using resolution from the lockfile"
|
293
|
+
if @removed_platform || @locked_gems.may_include_redundant_platform_specific_gems?
|
294
|
+
SpecSet.new(filter_specs(@locked_specs, @dependencies))
|
295
|
+
else
|
296
|
+
@locked_specs
|
297
|
+
end
|
298
|
+
end
|
299
|
+
else
|
300
|
+
Bundler.ui.debug "Found changes from the lockfile, re-resolving dependencies because #{change_reason}"
|
301
|
+
start_resolution
|
302
|
+
end
|
317
303
|
end
|
318
304
|
|
319
305
|
def spec_git_paths
|
320
|
-
sources.git_sources.map {|s| s.path.
|
306
|
+
sources.git_sources.map {|s| File.realpath(s.path) if File.exist?(s.path) }.compact
|
321
307
|
end
|
322
308
|
|
323
309
|
def groups
|
@@ -325,20 +311,19 @@ module Bundler
|
|
325
311
|
end
|
326
312
|
|
327
313
|
def lock(file, preserve_unknown_sections = false)
|
314
|
+
return if Definition.no_lock
|
315
|
+
|
328
316
|
contents = to_lock
|
329
317
|
|
330
318
|
# Convert to \r\n if the existing lock has them
|
331
319
|
# i.e., Windows with `git config core.autocrlf=true`
|
332
|
-
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
|
320
|
+
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
|
333
321
|
|
334
322
|
if @locked_bundler_version
|
335
323
|
locked_major = @locked_bundler_version.segments.first
|
336
|
-
current_major =
|
324
|
+
current_major = bundler_version_to_lock.segments.first
|
337
325
|
|
338
|
-
|
339
|
-
Bundler.ui.warn "Warning: the lockfile is being updated to Bundler #{current_major}, " \
|
340
|
-
"after which you will be unable to return to Bundler #{@locked_bundler_version.segments.first}."
|
341
|
-
end
|
326
|
+
updating_major = locked_major < current_major
|
342
327
|
end
|
343
328
|
|
344
329
|
preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
|
@@ -355,14 +340,6 @@ module Bundler
|
|
355
340
|
end
|
356
341
|
end
|
357
342
|
|
358
|
-
def locked_bundler_version
|
359
|
-
if @locked_bundler_version && @locked_bundler_version < Gem::Version.new(Bundler::VERSION)
|
360
|
-
new_version = Bundler::VERSION
|
361
|
-
end
|
362
|
-
|
363
|
-
new_version || @locked_bundler_version || Bundler::VERSION
|
364
|
-
end
|
365
|
-
|
366
343
|
def locked_ruby_version
|
367
344
|
return unless ruby_version
|
368
345
|
if @unlock[:ruby] || !@locked_ruby_version
|
@@ -384,29 +361,16 @@ module Bundler
|
|
384
361
|
end
|
385
362
|
end
|
386
363
|
|
364
|
+
def bundler_version_to_lock
|
365
|
+
@resolved_bundler_version || Bundler.gem_version
|
366
|
+
end
|
367
|
+
|
387
368
|
def to_lock
|
388
|
-
|
369
|
+
require_relative "lockfile_generator"
|
389
370
|
LockfileGenerator.generate(self)
|
390
371
|
end
|
391
372
|
|
392
373
|
def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
|
393
|
-
msg = String.new
|
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."
|
397
|
-
|
398
|
-
unless explicit_flag
|
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
|
409
|
-
|
410
374
|
added = []
|
411
375
|
deleted = []
|
412
376
|
changed = []
|
@@ -416,52 +380,40 @@ module Bundler
|
|
416
380
|
added.concat new_platforms.map {|p| "* platform: #{p}" }
|
417
381
|
deleted.concat deleted_platforms.map {|p| "* platform: #{p}" }
|
418
382
|
|
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
383
|
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
|
384
|
+
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
|
447
385
|
|
448
386
|
both_sources = Hash.new {|h, k| h[k] = [] }
|
449
|
-
|
450
|
-
|
387
|
+
current_dependencies.each {|d| both_sources[d.name][0] = d }
|
388
|
+
current_locked_dependencies.each {|d| both_sources[d.name][1] = d }
|
389
|
+
|
390
|
+
both_sources.each do |name, (dep, lock_dep)|
|
391
|
+
next if dep.nil? || lock_dep.nil?
|
392
|
+
|
393
|
+
gemfile_source = dep.source || default_source
|
394
|
+
lock_source = lock_dep.source || default_source
|
395
|
+
next if lock_source.include?(gemfile_source)
|
451
396
|
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
lockfile_source_name = lock_source || "no specified source"
|
456
|
-
changed << "* #{name} from `#{gemfile_source_name}` to `#{lockfile_source_name}`"
|
397
|
+
gemfile_source_name = dep.source ? gemfile_source.to_gemfile : "no specified source"
|
398
|
+
lockfile_source_name = lock_dep.source ? lock_source.to_gemfile : "no specified source"
|
399
|
+
changed << "* #{name} from `#{lockfile_source_name}` to `#{gemfile_source_name}`"
|
457
400
|
end
|
458
401
|
|
459
402
|
reason = change_reason
|
460
|
-
msg
|
403
|
+
msg = String.new
|
404
|
+
msg << "#{reason.capitalize.strip}, but the lockfile can't be updated because frozen mode is set"
|
461
405
|
msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
|
462
406
|
msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
|
463
407
|
msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
|
464
|
-
msg << "\n"
|
408
|
+
msg << "\n\nRun `bundle install` elsewhere and add the updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control.\n"
|
409
|
+
|
410
|
+
unless explicit_flag
|
411
|
+
suggested_command = unless Bundler.settings.locations("frozen").keys.include?(:env)
|
412
|
+
"bundle config set frozen false"
|
413
|
+
end
|
414
|
+
msg << "If this is a development machine, remove the #{Bundler.default_gemfile.relative_path_from(SharedHelpers.pwd)} " \
|
415
|
+
"freeze by running `#{suggested_command}`." if suggested_command
|
416
|
+
end
|
465
417
|
|
466
418
|
raise ProductionError, msg if added.any? || deleted.any? || changed.any? || !nothing_changed?
|
467
419
|
end
|
@@ -497,15 +449,11 @@ module Bundler
|
|
497
449
|
end
|
498
450
|
|
499
451
|
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
|
452
|
+
return if current_platform_locked?
|
505
453
|
|
506
454
|
raise ProductionError, "Your bundle only supports platforms #{@platforms.map(&:to_s)} " \
|
507
|
-
"but your local
|
508
|
-
"
|
455
|
+
"but your local platform is #{Bundler.local_platform}. " \
|
456
|
+
"Add the current platform to the lockfile with\n`bundle lock --add-platform #{Bundler.local_platform}` and try again."
|
509
457
|
end
|
510
458
|
|
511
459
|
def add_platform(platform)
|
@@ -514,36 +462,153 @@ module Bundler
|
|
514
462
|
end
|
515
463
|
|
516
464
|
def remove_platform(platform)
|
517
|
-
|
465
|
+
removed_platform = @platforms.delete(Gem::Platform.new(platform))
|
466
|
+
@removed_platform ||= removed_platform
|
467
|
+
return if removed_platform
|
518
468
|
raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}"
|
519
469
|
end
|
520
470
|
|
521
|
-
def
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
end
|
526
|
-
|
527
|
-
def find_resolved_spec(current_spec)
|
528
|
-
specs.find_by_name_and_platform(current_spec.name, current_spec.platform)
|
529
|
-
end
|
530
|
-
|
531
|
-
def find_indexed_specs(current_spec)
|
532
|
-
index[current_spec.name].select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)
|
471
|
+
def most_specific_locked_platform
|
472
|
+
@platforms.min_by do |bundle_platform|
|
473
|
+
platform_specificity_match(bundle_platform, local_platform)
|
474
|
+
end
|
533
475
|
end
|
534
476
|
|
535
477
|
attr_reader :sources
|
536
478
|
private :sources
|
537
479
|
|
538
480
|
def nothing_changed?
|
539
|
-
!@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@
|
481
|
+
!@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@missing_lockfile_dep && !@unlocking_bundler
|
482
|
+
end
|
483
|
+
|
484
|
+
def no_resolve_needed?
|
485
|
+
!unlocking? && nothing_changed?
|
540
486
|
end
|
541
487
|
|
542
488
|
def unlocking?
|
543
489
|
@unlocking
|
544
490
|
end
|
545
491
|
|
546
|
-
|
492
|
+
private
|
493
|
+
|
494
|
+
def resolver
|
495
|
+
@resolver ||= Resolver.new(resolution_packages, gem_version_promoter)
|
496
|
+
end
|
497
|
+
|
498
|
+
def expanded_dependencies
|
499
|
+
dependencies_with_bundler + metadata_dependencies
|
500
|
+
end
|
501
|
+
|
502
|
+
def dependencies_with_bundler
|
503
|
+
return dependencies unless @unlocking_bundler
|
504
|
+
return dependencies if dependencies.map(&:name).include?("bundler")
|
505
|
+
|
506
|
+
[Dependency.new("bundler", @unlocking_bundler)] + dependencies
|
507
|
+
end
|
508
|
+
|
509
|
+
def resolution_packages
|
510
|
+
@resolution_packages ||= begin
|
511
|
+
last_resolve = converge_locked_specs
|
512
|
+
remove_ruby_from_platforms_if_necessary!(current_dependencies)
|
513
|
+
packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, :locked_specs => @originally_locked_specs, :unlock => @unlock[:gems], :prerelease => gem_version_promoter.pre?)
|
514
|
+
additional_base_requirements_for_resolve(packages, last_resolve)
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
def filter_specs(specs, deps)
|
519
|
+
SpecSet.new(specs).for(deps, false, platforms)
|
520
|
+
end
|
521
|
+
|
522
|
+
def materialize(dependencies)
|
523
|
+
specs = resolve.materialize(dependencies)
|
524
|
+
missing_specs = specs.missing_specs
|
525
|
+
|
526
|
+
if missing_specs.any?
|
527
|
+
missing_specs.each do |s|
|
528
|
+
locked_gem = @locked_specs[s.name].last
|
529
|
+
next if locked_gem.nil? || locked_gem.version != s.version || !@remote
|
530
|
+
raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
|
531
|
+
"no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
|
532
|
+
"You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
|
533
|
+
"removed in order to install."
|
534
|
+
end
|
535
|
+
|
536
|
+
missing_specs_list = missing_specs.group_by(&:source).map do |source, missing_specs_for_source|
|
537
|
+
"#{missing_specs_for_source.map(&:full_name).join(", ")} in #{source}"
|
538
|
+
end
|
539
|
+
|
540
|
+
raise GemNotFound, "Could not find #{missing_specs_list.join(" nor ")}"
|
541
|
+
end
|
542
|
+
|
543
|
+
incomplete_specs = specs.incomplete_specs
|
544
|
+
loop do
|
545
|
+
break if incomplete_specs.empty?
|
546
|
+
|
547
|
+
Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
|
548
|
+
setup_sources_for_resolve
|
549
|
+
resolution_packages.delete(incomplete_specs)
|
550
|
+
@resolve = start_resolution
|
551
|
+
specs = resolve.materialize(dependencies)
|
552
|
+
|
553
|
+
still_incomplete_specs = specs.incomplete_specs
|
554
|
+
|
555
|
+
if still_incomplete_specs == incomplete_specs
|
556
|
+
package = resolution_packages.get_package(incomplete_specs.first.name)
|
557
|
+
resolver.raise_not_found! package
|
558
|
+
end
|
559
|
+
|
560
|
+
incomplete_specs = still_incomplete_specs
|
561
|
+
end
|
562
|
+
|
563
|
+
bundler = sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
|
564
|
+
specs["bundler"] = bundler
|
565
|
+
|
566
|
+
specs
|
567
|
+
end
|
568
|
+
|
569
|
+
def start_resolution
|
570
|
+
result = resolver.start
|
571
|
+
|
572
|
+
@resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
|
573
|
+
|
574
|
+
SpecSet.new(SpecSet.new(result).for(dependencies, false, @platforms))
|
575
|
+
end
|
576
|
+
|
577
|
+
def precompute_source_requirements_for_indirect_dependencies?
|
578
|
+
sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
|
579
|
+
end
|
580
|
+
|
581
|
+
def pin_locally_available_names(source_requirements)
|
582
|
+
source_requirements.each_with_object({}) do |(name, original_source), new_source_requirements|
|
583
|
+
local_source = original_source.dup
|
584
|
+
local_source.local_only!
|
585
|
+
|
586
|
+
new_source_requirements[name] = if local_source.specs.search(name).any?
|
587
|
+
local_source
|
588
|
+
else
|
589
|
+
original_source
|
590
|
+
end
|
591
|
+
end
|
592
|
+
end
|
593
|
+
|
594
|
+
def current_ruby_platform_locked?
|
595
|
+
return false unless generic_local_platform == Gem::Platform::RUBY
|
596
|
+
return false if Bundler.settings[:force_ruby_platform] && !@platforms.include?(Gem::Platform::RUBY)
|
597
|
+
|
598
|
+
current_platform_locked?
|
599
|
+
end
|
600
|
+
|
601
|
+
def current_platform_locked?
|
602
|
+
@platforms.any? do |bundle_platform|
|
603
|
+
MatchPlatform.platforms_match?(bundle_platform, Bundler.local_platform)
|
604
|
+
end
|
605
|
+
end
|
606
|
+
|
607
|
+
def add_current_platform
|
608
|
+
return if current_ruby_platform_locked?
|
609
|
+
|
610
|
+
add_platform(local_platform)
|
611
|
+
end
|
547
612
|
|
548
613
|
def change_reason
|
549
614
|
if unlocking?
|
@@ -563,12 +628,13 @@ module Bundler
|
|
563
628
|
[@new_platform, "you added a new platform to your gemfile"],
|
564
629
|
[@path_changes, "the gemspecs for path gems changed"],
|
565
630
|
[@local_changes, "the gemspecs for git local gems changed"],
|
566
|
-
[@
|
631
|
+
[@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""],
|
632
|
+
[@unlocking_bundler, "an update to the version of Bundler itself was requested"],
|
567
633
|
].select(&:first).map(&:last).join(", ")
|
568
634
|
end
|
569
635
|
|
570
|
-
def pretty_dep(dep
|
571
|
-
SharedHelpers.pretty_dependency(dep
|
636
|
+
def pretty_dep(dep)
|
637
|
+
SharedHelpers.pretty_dependency(dep)
|
572
638
|
end
|
573
639
|
|
574
640
|
# Check if the specs of the given source changed
|
@@ -581,9 +647,9 @@ module Bundler
|
|
581
647
|
|
582
648
|
def dependencies_for_source_changed?(source, locked_source = source)
|
583
649
|
deps_for_source = @dependencies.select {|s| s.source == source }
|
584
|
-
locked_deps_for_source =
|
650
|
+
locked_deps_for_source = locked_dependencies.select {|dep| dep.source == locked_source }
|
585
651
|
|
586
|
-
|
652
|
+
deps_for_source.uniq.sort != locked_deps_for_source.sort
|
587
653
|
end
|
588
654
|
|
589
655
|
def specs_for_source_changed?(source)
|
@@ -605,8 +671,8 @@ module Bundler
|
|
605
671
|
|
606
672
|
Bundler.settings.local_overrides.map do |k, v|
|
607
673
|
spec = @dependencies.find {|s| s.name == k }
|
608
|
-
source = spec
|
609
|
-
if source
|
674
|
+
source = spec&.source
|
675
|
+
if source&.respond_to?(:local_override!)
|
610
676
|
source.unlock! if @unlock[:gems].include?(spec.name)
|
611
677
|
locals << [source, source.local_override!(v)]
|
612
678
|
end
|
@@ -618,6 +684,26 @@ module Bundler
|
|
618
684
|
!sources_with_changes.each {|source| @unlock[:sources] << source.name }.empty?
|
619
685
|
end
|
620
686
|
|
687
|
+
def check_missing_lockfile_dep
|
688
|
+
all_locked_specs = @locked_specs.map(&:name) << "bundler"
|
689
|
+
|
690
|
+
missing = @locked_specs.select do |s|
|
691
|
+
s.dependencies.any? {|dep| !all_locked_specs.include?(dep.name) }
|
692
|
+
end
|
693
|
+
|
694
|
+
if missing.any?
|
695
|
+
@locked_specs.delete(missing)
|
696
|
+
|
697
|
+
return missing.first.name
|
698
|
+
end
|
699
|
+
|
700
|
+
return if @dependency_changes
|
701
|
+
|
702
|
+
current_dependencies.find do |d|
|
703
|
+
@locked_specs[d.name].empty? && d.name != "bundler"
|
704
|
+
end&.name
|
705
|
+
end
|
706
|
+
|
621
707
|
def converge_paths
|
622
708
|
sources.path_sources.any? do |source|
|
623
709
|
specs_changed?(source)
|
@@ -642,36 +728,11 @@ module Bundler
|
|
642
728
|
end
|
643
729
|
end
|
644
730
|
|
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
731
|
def converge_sources
|
667
|
-
changes = false
|
668
|
-
|
669
|
-
changes |= converge_rubygems_sources
|
670
|
-
|
671
732
|
# Replace the sources from the Gemfile with the sources from the Gemfile.lock,
|
672
733
|
# if they exist in the Gemfile.lock and are `==`. If you can't find an equivalent
|
673
734
|
# source in the Gemfile.lock, use the one from the Gemfile.
|
674
|
-
changes
|
735
|
+
changes = sources.replace_sources!(@locked_sources)
|
675
736
|
|
676
737
|
sources.all_sources.each do |source|
|
677
738
|
# If the source is unlockable and the current command allows an unlock of
|
@@ -689,28 +750,16 @@ module Bundler
|
|
689
750
|
end
|
690
751
|
|
691
752
|
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
|
753
|
+
changes = false
|
754
|
+
|
755
|
+
@dependencies.each do |dep|
|
756
|
+
if dep.source
|
701
757
|
dep.source = sources.get(dep.source)
|
702
758
|
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
759
|
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
# the lock or doesn't exist in the lock.
|
712
|
-
@dependencies.each do |dependency|
|
713
|
-
unless locked_dep = @locked_deps[dependency.name]
|
760
|
+
next if unlocking?
|
761
|
+
|
762
|
+
unless locked_dep = @locked_deps[dep.name]
|
714
763
|
changes = true
|
715
764
|
next
|
716
765
|
end
|
@@ -721,11 +770,11 @@ module Bundler
|
|
721
770
|
# directive, the lockfile dependencies and resolved dependencies end up
|
722
771
|
# with a mismatch on #type. Work around that by setting the type on the
|
723
772
|
# dep from the lockfile.
|
724
|
-
locked_dep.instance_variable_set(:@type,
|
773
|
+
locked_dep.instance_variable_set(:@type, dep.type)
|
725
774
|
|
726
775
|
# We already know the name matches from the hash lookup
|
727
776
|
# so we only need to check the requirement now
|
728
|
-
changes ||=
|
777
|
+
changes ||= dep.requirement != locked_dep.requirement
|
729
778
|
end
|
730
779
|
|
731
780
|
changes
|
@@ -735,218 +784,146 @@ module Bundler
|
|
735
784
|
# commonly happen if the Gemfile has changed since the lockfile was last
|
736
785
|
# generated
|
737
786
|
def converge_locked_specs
|
738
|
-
|
787
|
+
converged = converge_specs(@locked_specs)
|
739
788
|
|
740
|
-
|
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]
|
789
|
+
resolve = SpecSet.new(converged.reject {|s| @unlock[:gems].include?(s.name) })
|
746
790
|
|
747
|
-
|
748
|
-
locked_dep = nil unless locked_dep == dep
|
791
|
+
diff = nil
|
749
792
|
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
@locked_specs.each do |s|
|
754
|
-
@unlock[:gems] << s.name if s.source == dep.source
|
755
|
-
end
|
793
|
+
# Now, we unlock any sources that do not have anymore gems pinned to it
|
794
|
+
sources.all_sources.each do |source|
|
795
|
+
next unless source.respond_to?(:unlock!)
|
756
796
|
|
757
|
-
|
758
|
-
|
797
|
+
unless resolve.any? {|s| s.source == source }
|
798
|
+
diff ||= @locked_specs.to_a - resolve.to_a
|
799
|
+
source.unlock! if diff.any? {|s| s.source == source }
|
759
800
|
end
|
760
801
|
end
|
761
802
|
|
762
|
-
|
803
|
+
resolve
|
804
|
+
end
|
763
805
|
|
806
|
+
def converge_specs(specs)
|
764
807
|
converged = []
|
765
|
-
|
766
|
-
|
808
|
+
deps = []
|
809
|
+
|
810
|
+
@specs_that_changed_sources = []
|
811
|
+
|
812
|
+
specs.each do |s|
|
813
|
+
name = s.name
|
767
814
|
dep = @dependencies.find {|d| s.satisfies?(d) }
|
768
|
-
|
815
|
+
lockfile_source = s.source
|
769
816
|
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
817
|
+
if dep
|
818
|
+
gemfile_source = dep.source || default_source
|
819
|
+
|
820
|
+
@specs_that_changed_sources << s if gemfile_source != lockfile_source
|
821
|
+
deps << dep if !dep.source || lockfile_source.include?(dep.source)
|
822
|
+
@unlock[:gems] << name if lockfile_source.include?(dep.source) && lockfile_source != gemfile_source
|
774
823
|
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
824
|
+
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
825
|
+
s.source = gemfile_source
|
826
|
+
else
|
827
|
+
# Replace the locked dependency's source with the default source, if the locked source is no longer in the Gemfile
|
828
|
+
s.source = default_source unless sources.get(lockfile_source)
|
829
|
+
end
|
779
830
|
|
780
|
-
|
781
|
-
# then we unlock it.
|
831
|
+
next if @unlock[:sources].include?(s.source.name)
|
782
832
|
|
783
833
|
# Path sources have special logic
|
784
834
|
if s.source.instance_of?(Source::Path) || s.source.instance_of?(Source::Gemspec)
|
785
|
-
|
835
|
+
new_specs = begin
|
786
836
|
s.source.specs
|
787
|
-
rescue PathError
|
837
|
+
rescue PathError
|
788
838
|
# if we won't need the source (according to the lockfile),
|
789
|
-
# don't error if the path
|
790
|
-
next if
|
791
|
-
for(requested_dependencies,
|
839
|
+
# don't error if the path source isn't available
|
840
|
+
next if specs.
|
841
|
+
for(requested_dependencies, false).
|
792
842
|
none? {|locked_spec| locked_spec.source == s.source }
|
793
843
|
|
794
844
|
raise
|
795
845
|
end
|
796
846
|
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
# If the dependencies of the path source have changed, unlock it
|
806
|
-
next unless runtime_dependencies.sort == deps2.sort
|
847
|
+
new_spec = new_specs[s].first
|
848
|
+
if new_spec
|
849
|
+
s.dependencies.replace(new_spec.dependencies)
|
850
|
+
else
|
851
|
+
# If the spec is no longer in the path source, unlock it. This
|
852
|
+
# commonly happens if the version changed in the gemspec
|
853
|
+
@unlock[:gems] << name
|
854
|
+
end
|
807
855
|
end
|
808
856
|
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
expanded_deps = expand_dependencies(deps, true)
|
814
|
-
@locked_specs_incomplete_for_platform = !resolve.for(expanded_deps, @unlock[:gems], true, true)
|
815
|
-
resolve = resolve.for(expanded_deps, @unlock[:gems], false, false, false)
|
816
|
-
diff = nil
|
817
|
-
|
818
|
-
# Now, we unlock any sources that do not have anymore gems pinned to it
|
819
|
-
sources.all_sources.each do |source|
|
820
|
-
next unless source.respond_to?(:unlock!)
|
821
|
-
|
822
|
-
unless resolve.any? {|s| s.source == source }
|
823
|
-
diff ||= @locked_specs.to_a - resolve.to_a
|
824
|
-
source.unlock! if diff.any? {|s| s.source == source }
|
857
|
+
if dep.nil? && requested_dependencies.find {|d| name == d.name }
|
858
|
+
@unlock[:gems] << s.name
|
859
|
+
else
|
860
|
+
converged << s
|
825
861
|
end
|
826
862
|
end
|
827
863
|
|
828
|
-
|
829
|
-
end
|
830
|
-
|
831
|
-
def in_locked_deps?(dep, locked_dep)
|
832
|
-
# Because the lockfile can't link a dep to a specific remote, we need to
|
833
|
-
# treat sources as equivalent anytime the locked dep has all the remotes
|
834
|
-
# that the Gemfile dep does.
|
835
|
-
locked_dep && locked_dep.source && dep.source && locked_dep.source.include?(dep.source)
|
836
|
-
end
|
837
|
-
|
838
|
-
def satisfies_locked_spec?(dep)
|
839
|
-
@locked_specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
|
840
|
-
end
|
841
|
-
|
842
|
-
# This list of dependencies is only used in #resolve, so it's OK to add
|
843
|
-
# the metadata dependencies here
|
844
|
-
def expanded_dependencies
|
845
|
-
@expanded_dependencies ||= begin
|
846
|
-
expand_dependencies(dependencies + metadata_dependencies, @remote)
|
847
|
-
end
|
864
|
+
filter_specs(converged, deps)
|
848
865
|
end
|
849
866
|
|
850
867
|
def metadata_dependencies
|
851
|
-
@metadata_dependencies ||=
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
concat_ruby_version_requirements(locked_ruby_version_object) unless @unlock[:ruby]
|
856
|
-
end
|
857
|
-
[
|
858
|
-
Dependency.new("ruby\0", ruby_versions),
|
859
|
-
Dependency.new("rubygems\0", Gem::VERSION),
|
860
|
-
]
|
861
|
-
end
|
862
|
-
end
|
863
|
-
|
864
|
-
def concat_ruby_version_requirements(ruby_version, ruby_versions = [])
|
865
|
-
return ruby_versions unless ruby_version
|
866
|
-
if ruby_version.patchlevel
|
867
|
-
ruby_versions << ruby_version.to_gem_version_with_patchlevel
|
868
|
-
else
|
869
|
-
ruby_versions.concat(ruby_version.versions.map do |version|
|
870
|
-
requirement = Gem::Requirement.new(version)
|
871
|
-
if requirement.exact?
|
872
|
-
"~> #{version}.0"
|
873
|
-
else
|
874
|
-
requirement
|
875
|
-
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
|
-
end
|
896
|
-
platforms.each do |p|
|
897
|
-
deps << DepProxy.new(dep, p) if remote || p == generic_local_platform
|
898
|
-
end
|
899
|
-
end
|
900
|
-
deps
|
901
|
-
end
|
902
|
-
|
903
|
-
def requested_dependencies
|
904
|
-
groups = requested_groups
|
905
|
-
groups.map!(&:to_sym)
|
906
|
-
dependencies.reject {|d| !d.should_include? || (d.groups & groups).empty? }
|
868
|
+
@metadata_dependencies ||= [
|
869
|
+
Dependency.new("Ruby\0", Gem.ruby_version),
|
870
|
+
Dependency.new("RubyGems\0", Gem::VERSION),
|
871
|
+
]
|
907
872
|
end
|
908
873
|
|
909
874
|
def source_requirements
|
910
|
-
# Load all specs from remote sources
|
911
|
-
index
|
912
|
-
|
913
875
|
# Record the specs available in each gem's source, so that those
|
914
876
|
# specs will be available later when the resolver knows where to
|
915
877
|
# look for that gemspec (or its dependencies)
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
878
|
+
source_requirements = if precompute_source_requirements_for_indirect_dependencies?
|
879
|
+
all_requirements = source_map.all_requirements
|
880
|
+
all_requirements = pin_locally_available_names(all_requirements) if @prefer_local
|
881
|
+
{ :default => default_source }.merge(all_requirements)
|
882
|
+
else
|
883
|
+
{ :default => Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
|
922
884
|
end
|
885
|
+
source_requirements.merge!(source_map.locked_requirements) unless @remote
|
923
886
|
metadata_dependencies.each do |dep|
|
924
887
|
source_requirements[dep.name] = sources.metadata_source
|
925
888
|
end
|
926
|
-
|
889
|
+
|
890
|
+
default_bundler_source = source_requirements["bundler"] || default_source
|
891
|
+
|
892
|
+
if @unlocking_bundler
|
893
|
+
default_bundler_source.add_dependency_names("bundler")
|
894
|
+
else
|
895
|
+
source_requirements[:default_bundler] = default_bundler_source
|
896
|
+
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
897
|
+
end
|
898
|
+
|
899
|
+
verify_changed_sources!
|
927
900
|
source_requirements
|
928
901
|
end
|
929
902
|
|
930
|
-
def
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
903
|
+
def default_source
|
904
|
+
sources.default_source
|
905
|
+
end
|
906
|
+
|
907
|
+
def verify_changed_sources!
|
908
|
+
@specs_that_changed_sources.each do |s|
|
909
|
+
if s.source.specs.search(s.name).empty?
|
910
|
+
raise GemNotFound, "Could not find gem '#{s.name}' in #{s.source}"
|
911
|
+
end
|
937
912
|
end
|
938
|
-
pinned_names
|
939
913
|
end
|
940
914
|
|
941
915
|
def requested_groups
|
942
|
-
groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
916
|
+
values = groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
917
|
+
values &= Bundler.settings[:only] unless Bundler.settings[:only].empty?
|
918
|
+
values
|
943
919
|
end
|
944
920
|
|
945
921
|
def lockfiles_equal?(current, proposed, preserve_unknown_sections)
|
946
922
|
if preserve_unknown_sections
|
947
923
|
sections_to_ignore = LockfileParser.sections_to_ignore(@locked_bundler_version)
|
948
924
|
sections_to_ignore += LockfileParser.unknown_sections_in_lockfile(current)
|
949
|
-
sections_to_ignore
|
925
|
+
sections_to_ignore << LockfileParser::RUBY
|
926
|
+
sections_to_ignore << LockfileParser::BUNDLED unless @unlocking_bundler
|
950
927
|
pattern = /#{Regexp.union(sections_to_ignore)}\n(\s{2,}.*\n)+/
|
951
928
|
whitespace_cleanup = /\n{2,}/
|
952
929
|
current = current.gsub(pattern, "\n").gsub(whitespace_cleanup, "\n\n").strip
|
@@ -955,39 +932,30 @@ module Bundler
|
|
955
932
|
current == proposed
|
956
933
|
end
|
957
934
|
|
958
|
-
def
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
def compute_requires
|
965
|
-
dependencies.reduce({}) do |requires, dep|
|
966
|
-
next requires unless dep.should_include?
|
967
|
-
requires[dep.name] = Array(dep.autorequire || dep.name).map do |file|
|
968
|
-
# Allow `require: true` as an alias for `require: <name>`
|
969
|
-
file == true ? dep.name : file
|
970
|
-
end
|
971
|
-
requires
|
935
|
+
def additional_base_requirements_for_resolve(resolution_packages, last_resolve)
|
936
|
+
return resolution_packages unless @locked_gems && !sources.expired_sources?(@locked_gems.sources)
|
937
|
+
converge_specs(@originally_locked_specs - last_resolve).each do |locked_spec|
|
938
|
+
next if locked_spec.source.is_a?(Source::Path)
|
939
|
+
resolution_packages.base_requirements[locked_spec.name] = Gem::Requirement.new(">= #{locked_spec.version}")
|
972
940
|
end
|
941
|
+
resolution_packages
|
973
942
|
end
|
974
943
|
|
975
|
-
def
|
976
|
-
return
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
requirements
|
984
|
-
end.values
|
985
|
-
end
|
944
|
+
def remove_ruby_from_platforms_if_necessary!(dependencies)
|
945
|
+
return if Bundler.frozen_bundle? ||
|
946
|
+
Bundler.local_platform == Gem::Platform::RUBY ||
|
947
|
+
!platforms.include?(Gem::Platform::RUBY) ||
|
948
|
+
(@new_platform && platforms.last == Gem::Platform::RUBY) ||
|
949
|
+
@path_changes ||
|
950
|
+
@dependency_changes ||
|
951
|
+
!@originally_locked_specs.incomplete_ruby_specs?(dependencies)
|
986
952
|
|
987
|
-
|
988
|
-
|
953
|
+
remove_platform(Gem::Platform::RUBY)
|
954
|
+
add_current_platform
|
955
|
+
end
|
989
956
|
|
990
|
-
|
957
|
+
def source_map
|
958
|
+
@source_map ||= SourceMap.new(sources, dependencies, @locked_specs)
|
991
959
|
end
|
992
960
|
end
|
993
961
|
end
|