bundler 1.17.2 → 2.2.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2095 -1251
- data/LICENSE.md +18 -19
- data/README.md +10 -11
- data/bundler.gemspec +10 -28
- data/exe/bundle +22 -3
- 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 +6 -2
- data/lib/bundler/cli/cache.rb +24 -17
- data/lib/bundler/cli/check.rb +4 -2
- data/lib/bundler/cli/clean.rb +1 -1
- data/lib/bundler/cli/common.rb +39 -13
- data/lib/bundler/cli/config.rb +161 -86
- data/lib/bundler/cli/console.rb +1 -1
- data/lib/bundler/cli/doctor.rb +20 -9
- data/lib/bundler/cli/exec.rb +8 -25
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +213 -32
- data/lib/bundler/cli/info.rb +42 -7
- data/lib/bundler/cli/init.rb +2 -2
- data/lib/bundler/cli/inject.rb +1 -1
- data/lib/bundler/cli/install.rb +34 -44
- data/lib/bundler/cli/issue.rb +8 -7
- data/lib/bundler/cli/list.rb +19 -11
- data/lib/bundler/cli/lock.rb +5 -1
- data/lib/bundler/cli/open.rb +11 -8
- data/lib/bundler/cli/outdated.rb +142 -118
- 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 +2 -2
- data/lib/bundler/cli/update.rb +43 -16
- data/lib/bundler/cli.rb +211 -150
- data/lib/bundler/compact_index_client/cache.rb +6 -14
- data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/lib/bundler/compact_index_client/updater.rb +15 -28
- data/lib/bundler/compact_index_client.rb +28 -12
- data/lib/bundler/current_ruby.rb +14 -11
- data/lib/bundler/definition.rb +207 -368
- data/lib/bundler/dep_proxy.rb +16 -9
- data/lib/bundler/dependency.rb +19 -14
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +81 -81
- data/lib/bundler/endpoint_specification.rb +1 -1
- data/lib/bundler/env.rb +9 -14
- data/lib/bundler/environment_preserver.rb +29 -3
- data/lib/bundler/errors.rb +20 -3
- data/lib/bundler/feature_flag.rb +14 -33
- data/lib/bundler/fetcher/base.rb +1 -1
- data/lib/bundler/fetcher/compact_index.rb +28 -14
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +14 -8
- data/lib/bundler/fetcher/index.rb +8 -8
- data/lib/bundler/fetcher.rb +22 -17
- data/lib/bundler/friendly_errors.rb +29 -48
- data/lib/bundler/gem_helper.rb +79 -43
- data/lib/bundler/gem_helpers.rb +38 -29
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +5 -5
- data/lib/bundler/graph.rb +3 -3
- data/lib/bundler/index.rb +9 -9
- data/lib/bundler/injector.rb +33 -13
- data/lib/bundler/inline.rb +41 -30
- data/lib/bundler/installer/gem_installer.rb +9 -18
- data/lib/bundler/installer/parallel_installer.rb +50 -33
- data/lib/bundler/installer/standalone.rb +30 -11
- data/lib/bundler/installer.rb +39 -66
- data/lib/bundler/lazy_specification.rb +63 -28
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +19 -52
- data/lib/bundler/{ssl_certs → man}/.document +0 -0
- data/{man → lib/bundler/man}/bundle-add.1 +10 -2
- data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
- 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 +55 -0
- data/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +15 -15
- data/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
- data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-config.1 +59 -60
- data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +77 -78
- data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-exec.1 +2 -2
- data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-gem.1 +38 -3
- data/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +46 -7
- data/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-init.1 +2 -2
- data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
- data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-install.1 +37 -7
- data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +34 -7
- 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/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-open.1 +1 -1
- data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
- data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
- data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-update.1 +7 -7
- data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +6 -6
- data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
- data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle.1 +7 -3
- data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +5 -2
- data/{man → lib/bundler/man}/gemfile.5 +44 -21
- data/{man → lib/bundler/man}/gemfile.5.ronn +24 -20
- data/{man → lib/bundler/man}/index.txt +1 -1
- data/lib/bundler/match_platform.rb +1 -1
- data/lib/bundler/mirror.rb +5 -5
- data/lib/bundler/plugin/api/source.rb +27 -7
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/dsl.rb +1 -1
- data/lib/bundler/plugin/index.rb +27 -4
- data/lib/bundler/plugin/installer/rubygems.rb +1 -1
- data/lib/bundler/plugin/installer.rb +35 -22
- data/lib/bundler/plugin/source_list.rb +5 -1
- data/lib/bundler/plugin.rb +100 -42
- data/lib/bundler/psyched_yaml.rb +0 -15
- data/lib/bundler/remote_specification.rb +5 -4
- data/lib/bundler/resolver/spec_group.rb +57 -53
- data/lib/bundler/resolver.rb +127 -113
- data/lib/bundler/retry.rb +4 -4
- data/lib/bundler/ruby_version.rb +5 -20
- data/lib/bundler/rubygems_ext.rb +103 -79
- data/lib/bundler/rubygems_gem_installer.rb +69 -8
- data/lib/bundler/rubygems_integration.rb +181 -446
- data/lib/bundler/runtime.rb +24 -34
- data/lib/bundler/settings.rb +159 -110
- data/lib/bundler/setup.rb +11 -12
- data/lib/bundler/shared_helpers.rb +56 -90
- data/lib/bundler/similarity_detector.rb +3 -3
- data/lib/bundler/source/git/git_proxy.rb +106 -105
- data/lib/bundler/source/git.rb +66 -39
- data/lib/bundler/source/metadata.rb +9 -9
- data/lib/bundler/source/path/installer.rb +10 -10
- data/lib/bundler/source/path.rb +23 -12
- data/lib/bundler/source/rubygems/remote.rb +3 -4
- data/lib/bundler/source/rubygems.rb +136 -120
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +27 -6
- data/lib/bundler/source_list.rb +101 -66
- data/lib/bundler/source_map.rb +58 -0
- data/lib/bundler/spec_set.rb +49 -53
- data/lib/bundler/stub_specification.rb +40 -34
- data/lib/bundler/templates/Executable.bundler +24 -15
- data/lib/bundler/templates/Gemfile +1 -1
- data/lib/bundler/templates/gems.rb +1 -1
- 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/Gemfile.tt +19 -2
- data/lib/bundler/templates/newgem/README.md.tt +7 -5
- data/lib/bundler/templates/newgem/Rakefile.tt +23 -5
- data/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +27 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -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 +29 -40
- 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 +2 -0
- data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
- data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
- data/lib/bundler/ui/rg_proxy.rb +1 -1
- data/lib/bundler/ui/shell.rb +7 -11
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/uri_credentials_filter.rb +10 -4
- 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 +57 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +126 -0
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
- data/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +39 -11
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +38 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +4 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +53 -51
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -6
- 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/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 +20 -9
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +28 -13
- 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/error.rb +78 -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 +21 -5
- 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 +65 -8
- 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 +4 -4
- 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/tmpdir/lib/tmpdir.rb +154 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -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 +21 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendored_fileutils.rb +1 -6
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +7 -12
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/vendored_tmpdir.rb +4 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/vendored_uri.rb +4 -0
- data/lib/bundler/version.rb +1 -20
- data/lib/bundler/version_ranges.rb +51 -5
- data/lib/bundler/vlad.rb +2 -2
- data/lib/bundler/worker.rb +21 -8
- data/lib/bundler/yaml_serializer.rb +3 -4
- data/lib/bundler.rb +248 -118
- metadata +115 -190
- 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/gem_remote_fetcher.rb +0 -43
- 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/newgem/test/test_helper.rb.tt +0 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- 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/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.txt +0 -91
- 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 -113
- data/man/gemfile.5.txt +0 -653
data/lib/bundler/definition.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
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
|
@@ -57,10 +56,8 @@ module Bundler
|
|
57
56
|
@unlocking_bundler = false
|
58
57
|
@unlocking = unlock
|
59
58
|
else
|
60
|
-
unlock = unlock.dup
|
61
59
|
@unlocking_bundler = unlock.delete(:bundler)
|
62
|
-
unlock.
|
63
|
-
@unlocking = !unlock.empty?
|
60
|
+
@unlocking = unlock.any? {|_k, v| !Array(v).empty? }
|
64
61
|
end
|
65
62
|
|
66
63
|
@dependencies = dependencies
|
@@ -76,7 +73,7 @@ module Bundler
|
|
76
73
|
@lockfile_contents = String.new
|
77
74
|
@locked_bundler_version = nil
|
78
75
|
@locked_ruby_version = nil
|
79
|
-
@
|
76
|
+
@new_platform = nil
|
80
77
|
|
81
78
|
if lockfile && File.exist?(lockfile)
|
82
79
|
@lockfile_contents = Bundler.read_file(lockfile)
|
@@ -106,27 +103,43 @@ module Bundler
|
|
106
103
|
@locked_platforms = []
|
107
104
|
end
|
108
105
|
|
109
|
-
@
|
106
|
+
locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
|
107
|
+
@multisource_allowed = locked_gem_sources.size == 1 && locked_gem_sources.first.multiple_remotes? && Bundler.frozen_bundle?
|
108
|
+
|
109
|
+
if @multisource_allowed
|
110
|
+
unless sources.aggregate_global_source?
|
111
|
+
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."
|
112
|
+
|
113
|
+
Bundler::SharedHelpers.major_deprecation 2, msg
|
114
|
+
end
|
115
|
+
|
116
|
+
@sources.merged_gem_lockfile_sections!(locked_gem_sources.first)
|
117
|
+
end
|
118
|
+
|
110
119
|
@unlock[:sources] ||= []
|
111
120
|
@unlock[:ruby] ||= if @ruby_version && locked_ruby_version_object
|
112
121
|
@ruby_version.diff(locked_ruby_version_object)
|
113
122
|
end
|
114
123
|
@unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
|
115
124
|
|
116
|
-
add_current_platform unless Bundler.frozen_bundle?
|
125
|
+
add_current_platform unless current_ruby_platform_locked? || Bundler.frozen_bundle?
|
117
126
|
|
118
127
|
converge_path_sources_to_gemspec_sources
|
119
128
|
@path_changes = converge_paths
|
120
129
|
@source_changes = converge_sources
|
121
130
|
|
122
|
-
|
123
|
-
|
124
|
-
|
131
|
+
if @unlock[:conservative]
|
132
|
+
@unlock[:gems] ||= @dependencies.map(&:name)
|
133
|
+
else
|
134
|
+
eager_unlock = expand_dependencies(@unlock[:gems] || [], true)
|
135
|
+
@unlock[:gems] = @locked_specs.for(eager_unlock, false, false).map(&:name)
|
125
136
|
end
|
126
137
|
|
127
138
|
@dependency_changes = converge_dependencies
|
128
139
|
@local_changes = converge_locals
|
129
140
|
|
141
|
+
@locked_specs_incomplete_for_platform = !@locked_specs.for(requested_dependencies & expand_dependencies(locked_dependencies), true, true)
|
142
|
+
|
130
143
|
@requires = compute_requires
|
131
144
|
end
|
132
145
|
|
@@ -145,17 +158,21 @@ module Bundler
|
|
145
158
|
end
|
146
159
|
end
|
147
160
|
|
161
|
+
def resolve_only_locally!
|
162
|
+
@remote = false
|
163
|
+
sources.local_only!
|
164
|
+
resolve
|
165
|
+
end
|
166
|
+
|
148
167
|
def resolve_with_cache!
|
149
|
-
raise "Specs already loaded" if @specs
|
150
168
|
sources.cached!
|
151
|
-
|
169
|
+
resolve
|
152
170
|
end
|
153
171
|
|
154
172
|
def resolve_remotely!
|
155
|
-
raise "Specs already loaded" if @specs
|
156
173
|
@remote = true
|
157
174
|
sources.remote!
|
158
|
-
|
175
|
+
resolve
|
159
176
|
end
|
160
177
|
|
161
178
|
# For given dependency list returns a SpecSet with Gemspec of all the required
|
@@ -165,25 +182,7 @@ module Bundler
|
|
165
182
|
#
|
166
183
|
# @return [Bundler::SpecSet]
|
167
184
|
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
|
185
|
+
@specs ||= materialize(requested_dependencies)
|
187
186
|
end
|
188
187
|
|
189
188
|
def new_specs
|
@@ -194,14 +193,8 @@ module Bundler
|
|
194
193
|
@locked_specs - specs
|
195
194
|
end
|
196
195
|
|
197
|
-
def new_platform?
|
198
|
-
@new_platform
|
199
|
-
end
|
200
|
-
|
201
196
|
def missing_specs
|
202
|
-
|
203
|
-
resolve.materialize(requested_dependencies, missing)
|
204
|
-
missing
|
197
|
+
resolve.materialize(requested_dependencies).missing_specs
|
205
198
|
end
|
206
199
|
|
207
200
|
def missing_specs?
|
@@ -210,7 +203,6 @@ module Bundler
|
|
210
203
|
Bundler.ui.debug "The definition is missing #{missing.map(&:full_name)}"
|
211
204
|
true
|
212
205
|
rescue BundlerError => e
|
213
|
-
@index = nil
|
214
206
|
@resolve = nil
|
215
207
|
@specs = nil
|
216
208
|
@gem_version_promoter = nil
|
@@ -220,21 +212,35 @@ module Bundler
|
|
220
212
|
end
|
221
213
|
|
222
214
|
def requested_specs
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
215
|
+
specs_for(requested_groups)
|
216
|
+
end
|
217
|
+
|
218
|
+
def requested_dependencies
|
219
|
+
dependencies_for(requested_groups)
|
228
220
|
end
|
229
221
|
|
230
222
|
def current_dependencies
|
231
|
-
dependencies.select
|
223
|
+
dependencies.select do |d|
|
224
|
+
d.should_include? && !d.gem_platforms(@platforms).empty?
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
def locked_dependencies
|
229
|
+
@locked_deps.values
|
232
230
|
end
|
233
231
|
|
234
232
|
def specs_for(groups)
|
235
|
-
|
236
|
-
deps
|
237
|
-
|
233
|
+
return specs if groups.empty?
|
234
|
+
deps = dependencies_for(groups)
|
235
|
+
materialize(deps)
|
236
|
+
end
|
237
|
+
|
238
|
+
def dependencies_for(groups)
|
239
|
+
groups.map!(&:to_sym)
|
240
|
+
deps = current_dependencies.reject do |d|
|
241
|
+
(d.groups & groups).empty?
|
242
|
+
end
|
243
|
+
expand_dependencies(deps)
|
238
244
|
end
|
239
245
|
|
240
246
|
# Resolve all the dependencies specified in Gemfile. It ensures that
|
@@ -245,79 +251,23 @@ module Bundler
|
|
245
251
|
def resolve
|
246
252
|
@resolve ||= begin
|
247
253
|
last_resolve = converge_locked_specs
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
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
|
-
end
|
276
|
-
|
277
|
-
double_check_for_index(idx, dependency_names)
|
278
|
-
end
|
279
|
-
end
|
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)
|
254
|
+
if Bundler.frozen_bundle?
|
255
|
+
Bundler.ui.debug "Frozen, using resolution from the lockfile"
|
256
|
+
last_resolve
|
257
|
+
elsif !unlocking? && nothing_changed?
|
258
|
+
Bundler.ui.debug("Found no changes, using resolution from the lockfile")
|
259
|
+
last_resolve
|
260
|
+
else
|
261
|
+
# Run a resolve against the locally available gems
|
262
|
+
Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
|
263
|
+
expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
|
264
|
+
Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
|
304
265
|
end
|
305
|
-
|
306
|
-
break if idxcount == idx.size
|
307
266
|
end
|
308
267
|
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
268
|
|
319
269
|
def spec_git_paths
|
320
|
-
sources.git_sources.map {|s| s.path.
|
270
|
+
sources.git_sources.map {|s| File.realpath(s.path) if File.exist?(s.path) }.compact
|
321
271
|
end
|
322
272
|
|
323
273
|
def groups
|
@@ -385,7 +335,7 @@ module Bundler
|
|
385
335
|
end
|
386
336
|
|
387
337
|
def to_lock
|
388
|
-
|
338
|
+
require_relative "lockfile_generator"
|
389
339
|
LockfileGenerator.generate(self)
|
390
340
|
end
|
391
341
|
|
@@ -396,12 +346,10 @@ module Bundler
|
|
396
346
|
"updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control."
|
397
347
|
|
398
348
|
unless explicit_flag
|
399
|
-
suggested_command = if Bundler.settings.locations("frozen")[:global]
|
400
|
-
"bundle config
|
349
|
+
suggested_command = if Bundler.settings.locations("frozen").keys.&([:global, :local]).any?
|
350
|
+
"bundle config unset frozen"
|
401
351
|
elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
|
402
|
-
"bundle config
|
403
|
-
else
|
404
|
-
"bundle install --no-deployment"
|
352
|
+
"bundle config unset deployment"
|
405
353
|
end
|
406
354
|
msg << "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \
|
407
355
|
"freeze \nby running `#{suggested_command}`."
|
@@ -416,44 +364,26 @@ module Bundler
|
|
416
364
|
added.concat new_platforms.map {|p| "* platform: #{p}" }
|
417
365
|
deleted.concat deleted_platforms.map {|p| "* platform: #{p}" }
|
418
366
|
|
419
|
-
|
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
|
367
|
+
new_deps = @dependencies - locked_dependencies
|
368
|
+
deleted_deps = locked_dependencies - @dependencies
|
442
369
|
|
443
370
|
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
|
371
|
+
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
|
447
372
|
|
448
373
|
both_sources = Hash.new {|h, k| h[k] = [] }
|
449
374
|
@dependencies.each {|d| both_sources[d.name][0] = d }
|
450
|
-
|
375
|
+
locked_dependencies.each {|d| both_sources[d.name][1] = d }
|
376
|
+
|
377
|
+
both_sources.each do |name, (dep, lock_dep)|
|
378
|
+
next if dep.nil? || lock_dep.nil?
|
451
379
|
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
380
|
+
gemfile_source = dep.source || sources.default_source
|
381
|
+
lock_source = lock_dep.source || sources.default_source
|
382
|
+
next if lock_source.include?(gemfile_source)
|
383
|
+
|
384
|
+
gemfile_source_name = dep.source ? gemfile_source.identifier : "no specified source"
|
385
|
+
lockfile_source_name = lock_dep.source ? lock_source.identifier : "no specified source"
|
386
|
+
changed << "* #{name} from `#{lockfile_source_name}` to `#{gemfile_source_name}`"
|
457
387
|
end
|
458
388
|
|
459
389
|
reason = change_reason
|
@@ -497,15 +427,11 @@ module Bundler
|
|
497
427
|
end
|
498
428
|
|
499
429
|
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
|
430
|
+
return if current_platform_locked?
|
505
431
|
|
506
432
|
raise ProductionError, "Your bundle only supports platforms #{@platforms.map(&:to_s)} " \
|
507
|
-
"but your local
|
508
|
-
"
|
433
|
+
"but your local platform is #{Bundler.local_platform}. " \
|
434
|
+
"Add the current platform to the lockfile with `bundle lock --add-platform #{Bundler.local_platform}` and try again."
|
509
435
|
end
|
510
436
|
|
511
437
|
def add_platform(platform)
|
@@ -518,18 +444,10 @@ module Bundler
|
|
518
444
|
raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}"
|
519
445
|
end
|
520
446
|
|
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)
|
447
|
+
def most_specific_locked_platform
|
448
|
+
@platforms.min_by do |bundle_platform|
|
449
|
+
platform_specificity_match(bundle_platform, local_platform)
|
450
|
+
end
|
533
451
|
end
|
534
452
|
|
535
453
|
attr_reader :sources
|
@@ -543,7 +461,52 @@ module Bundler
|
|
543
461
|
@unlocking
|
544
462
|
end
|
545
463
|
|
546
|
-
|
464
|
+
private
|
465
|
+
|
466
|
+
def materialize(dependencies)
|
467
|
+
specs = resolve.materialize(dependencies)
|
468
|
+
missing_specs = specs.missing_specs
|
469
|
+
|
470
|
+
if missing_specs.any?
|
471
|
+
missing_specs.each do |s|
|
472
|
+
locked_gem = @locked_specs[s.name].last
|
473
|
+
next if locked_gem.nil? || locked_gem.version != s.version || !@remote
|
474
|
+
raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
|
475
|
+
"no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
|
476
|
+
"You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
|
477
|
+
"removed in order to install."
|
478
|
+
end
|
479
|
+
|
480
|
+
raise GemNotFound, "Could not find #{missing_specs.map(&:full_name).join(", ")} in any of the sources"
|
481
|
+
end
|
482
|
+
|
483
|
+
unless specs["bundler"].any?
|
484
|
+
bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
|
485
|
+
specs["bundler"] = bundler
|
486
|
+
end
|
487
|
+
|
488
|
+
specs
|
489
|
+
end
|
490
|
+
|
491
|
+
def precompute_source_requirements_for_indirect_dependencies?
|
492
|
+
@remote && sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
|
493
|
+
end
|
494
|
+
|
495
|
+
def current_ruby_platform_locked?
|
496
|
+
return false unless generic_local_platform == Gem::Platform::RUBY
|
497
|
+
|
498
|
+
current_platform_locked?
|
499
|
+
end
|
500
|
+
|
501
|
+
def current_platform_locked?
|
502
|
+
@platforms.any? do |bundle_platform|
|
503
|
+
MatchPlatform.platforms_match?(bundle_platform, Bundler.local_platform)
|
504
|
+
end
|
505
|
+
end
|
506
|
+
|
507
|
+
def add_current_platform
|
508
|
+
add_platform(local_platform)
|
509
|
+
end
|
547
510
|
|
548
511
|
def change_reason
|
549
512
|
if unlocking?
|
@@ -581,9 +544,9 @@ module Bundler
|
|
581
544
|
|
582
545
|
def dependencies_for_source_changed?(source, locked_source = source)
|
583
546
|
deps_for_source = @dependencies.select {|s| s.source == source }
|
584
|
-
locked_deps_for_source =
|
547
|
+
locked_deps_for_source = locked_dependencies.select {|dep| dep.source == locked_source }
|
585
548
|
|
586
|
-
|
549
|
+
deps_for_source.uniq.sort != locked_deps_for_source.sort
|
587
550
|
end
|
588
551
|
|
589
552
|
def specs_for_source_changed?(source)
|
@@ -642,36 +605,11 @@ module Bundler
|
|
642
605
|
end
|
643
606
|
end
|
644
607
|
|
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
608
|
def converge_sources
|
667
|
-
changes = false
|
668
|
-
|
669
|
-
changes |= converge_rubygems_sources
|
670
|
-
|
671
609
|
# Replace the sources from the Gemfile with the sources from the Gemfile.lock,
|
672
610
|
# if they exist in the Gemfile.lock and are `==`. If you can't find an equivalent
|
673
611
|
# source in the Gemfile.lock, use the one from the Gemfile.
|
674
|
-
changes
|
612
|
+
changes = sources.replace_sources!(@locked_sources)
|
675
613
|
|
676
614
|
sources.all_sources.each do |source|
|
677
615
|
# If the source is unlockable and the current command allows an unlock of
|
@@ -689,28 +627,14 @@ module Bundler
|
|
689
627
|
end
|
690
628
|
|
691
629
|
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
|
630
|
+
changes = false
|
631
|
+
|
632
|
+
@dependencies.each do |dep|
|
633
|
+
if dep.source
|
701
634
|
dep.source = sources.get(dep.source)
|
702
635
|
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
636
|
|
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]
|
637
|
+
unless locked_dep = @locked_deps[dep.name]
|
714
638
|
changes = true
|
715
639
|
next
|
716
640
|
end
|
@@ -721,11 +645,11 @@ module Bundler
|
|
721
645
|
# directive, the lockfile dependencies and resolved dependencies end up
|
722
646
|
# with a mismatch on #type. Work around that by setting the type on the
|
723
647
|
# dep from the lockfile.
|
724
|
-
locked_dep.instance_variable_set(:@type,
|
648
|
+
locked_dep.instance_variable_set(:@type, dep.type)
|
725
649
|
|
726
650
|
# We already know the name matches from the hash lookup
|
727
651
|
# so we only need to check the requirement now
|
728
|
-
changes ||=
|
652
|
+
changes ||= dep.requirement != locked_dep.requirement
|
729
653
|
end
|
730
654
|
|
731
655
|
changes
|
@@ -735,209 +659,135 @@ module Bundler
|
|
735
659
|
# commonly happen if the Gemfile has changed since the lockfile was last
|
736
660
|
# generated
|
737
661
|
def converge_locked_specs
|
738
|
-
|
662
|
+
resolve = converge_specs(@locked_specs)
|
739
663
|
|
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]
|
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
|
664
|
+
diff = nil
|
749
665
|
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
@locked_specs.each do |s|
|
754
|
-
@unlock[:gems] << s.name if s.source == dep.source
|
755
|
-
end
|
666
|
+
# Now, we unlock any sources that do not have anymore gems pinned to it
|
667
|
+
sources.all_sources.each do |source|
|
668
|
+
next unless source.respond_to?(:unlock!)
|
756
669
|
|
757
|
-
|
758
|
-
|
670
|
+
unless resolve.any? {|s| s.source == source }
|
671
|
+
diff ||= @locked_specs.to_a - resolve.to_a
|
672
|
+
source.unlock! if diff.any? {|s| s.source == source }
|
759
673
|
end
|
760
674
|
end
|
761
675
|
|
762
|
-
|
676
|
+
resolve
|
677
|
+
end
|
763
678
|
|
679
|
+
def converge_specs(specs)
|
680
|
+
deps = []
|
764
681
|
converged = []
|
765
|
-
|
682
|
+
specs.each do |s|
|
766
683
|
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
767
684
|
dep = @dependencies.find {|d| s.satisfies?(d) }
|
768
|
-
s.source = (dep && dep.source) || sources.get(s.source)
|
769
685
|
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
686
|
+
if dep && (!dep.source || s.source.include?(dep.source))
|
687
|
+
deps << dep
|
688
|
+
end
|
689
|
+
|
690
|
+
s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source unless Bundler.frozen_bundle?
|
774
691
|
|
775
|
-
|
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)
|
692
|
+
next if @unlock[:sources].include?(s.source.name)
|
779
693
|
|
780
694
|
# If the spec is from a path source and it doesn't exist anymore
|
781
695
|
# then we unlock it.
|
782
696
|
|
783
697
|
# Path sources have special logic
|
784
698
|
if s.source.instance_of?(Source::Path) || s.source.instance_of?(Source::Gemspec)
|
785
|
-
|
699
|
+
new_specs = begin
|
786
700
|
s.source.specs
|
787
701
|
rescue PathError, GitError
|
788
702
|
# if we won't need the source (according to the lockfile),
|
789
703
|
# don't error if the path/git source isn't available
|
790
|
-
next if
|
791
|
-
for(requested_dependencies,
|
704
|
+
next if specs.
|
705
|
+
for(requested_dependencies, false, true).
|
792
706
|
none? {|locked_spec| locked_spec.source == s.source }
|
793
707
|
|
794
708
|
raise
|
795
709
|
end
|
796
710
|
|
797
|
-
|
711
|
+
new_spec = new_specs[s].first
|
798
712
|
|
799
713
|
# If the spec is no longer in the path source, unlock it. This
|
800
714
|
# commonly happens if the version changed in the gemspec
|
801
|
-
next unless
|
715
|
+
next unless new_spec
|
802
716
|
|
803
|
-
|
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
|
717
|
+
s.dependencies.replace(new_spec.dependencies)
|
807
718
|
end
|
808
719
|
|
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 }
|
720
|
+
if dep.nil? && requested_dependencies.find {|d| s.name == d.name }
|
721
|
+
@unlock[:gems] << s.name
|
722
|
+
else
|
723
|
+
converged << s
|
825
724
|
end
|
826
725
|
end
|
827
726
|
|
828
|
-
resolve
|
829
|
-
|
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
|
727
|
+
resolve = SpecSet.new(converged)
|
728
|
+
SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
|
848
729
|
end
|
849
730
|
|
850
731
|
def metadata_dependencies
|
851
732
|
@metadata_dependencies ||= begin
|
852
|
-
ruby_versions =
|
853
|
-
if ruby_versions.empty? || !@ruby_version.exact?
|
854
|
-
concat_ruby_version_requirements(RubyVersion.system)
|
855
|
-
concat_ruby_version_requirements(locked_ruby_version_object) unless @unlock[:ruby]
|
856
|
-
end
|
733
|
+
ruby_versions = ruby_version_requirements(@ruby_version)
|
857
734
|
[
|
858
|
-
Dependency.new("
|
859
|
-
Dependency.new("
|
735
|
+
Dependency.new("Ruby\0", ruby_versions),
|
736
|
+
Dependency.new("RubyGems\0", Gem::VERSION),
|
860
737
|
]
|
861
738
|
end
|
862
739
|
end
|
863
740
|
|
864
|
-
def
|
865
|
-
return
|
741
|
+
def ruby_version_requirements(ruby_version)
|
742
|
+
return [] unless ruby_version
|
866
743
|
if ruby_version.patchlevel
|
867
|
-
|
744
|
+
[ruby_version.to_gem_version_with_patchlevel]
|
868
745
|
else
|
869
|
-
|
746
|
+
ruby_version.versions.map do |version|
|
870
747
|
requirement = Gem::Requirement.new(version)
|
871
748
|
if requirement.exact?
|
872
749
|
"~> #{version}.0"
|
873
750
|
else
|
874
751
|
requirement
|
875
752
|
end
|
876
|
-
end
|
753
|
+
end
|
877
754
|
end
|
878
755
|
end
|
879
756
|
|
880
757
|
def expand_dependencies(dependencies, remote = false)
|
881
|
-
sorted_platforms = Resolver.sort_platforms(@platforms)
|
882
758
|
deps = []
|
883
759
|
dependencies.each do |dep|
|
884
760
|
dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
|
885
|
-
next
|
886
|
-
|
887
|
-
|
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
|
761
|
+
next unless remote || dep.current_platform?
|
762
|
+
target_platforms = dep.gem_platforms(remote ? @platforms : [generic_local_platform])
|
763
|
+
deps += expand_dependency_with_platforms(dep, target_platforms)
|
899
764
|
end
|
900
765
|
deps
|
901
766
|
end
|
902
767
|
|
903
|
-
def
|
904
|
-
|
905
|
-
|
906
|
-
|
768
|
+
def expand_dependency_with_platforms(dep, platforms)
|
769
|
+
platforms.map do |p|
|
770
|
+
DepProxy.get_proxy(dep, p)
|
771
|
+
end
|
907
772
|
end
|
908
773
|
|
909
774
|
def source_requirements
|
910
|
-
# Load all specs from remote sources
|
911
|
-
index
|
912
|
-
|
913
775
|
# Record the specs available in each gem's source, so that those
|
914
776
|
# specs will be available later when the resolver knows where to
|
915
777
|
# look for that gemspec (or its dependencies)
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
next unless source = dep.source || default
|
921
|
-
source_requirements[dep.name] = source
|
778
|
+
source_requirements = if precompute_source_requirements_for_indirect_dependencies?
|
779
|
+
{ :default => sources.default_source }.merge(source_map.all_requirements)
|
780
|
+
else
|
781
|
+
{ :default => Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
|
922
782
|
end
|
923
783
|
metadata_dependencies.each do |dep|
|
924
784
|
source_requirements[dep.name] = sources.metadata_source
|
925
785
|
end
|
786
|
+
source_requirements[:default_bundler] = source_requirements["bundler"] || sources.default_source
|
926
787
|
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
927
788
|
source_requirements
|
928
789
|
end
|
929
790
|
|
930
|
-
def pinned_spec_names(skip = nil)
|
931
|
-
pinned_names = []
|
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
|
939
|
-
end
|
940
|
-
|
941
791
|
def requested_groups
|
942
792
|
groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
943
793
|
end
|
@@ -955,12 +805,6 @@ module Bundler
|
|
955
805
|
current == proposed
|
956
806
|
end
|
957
807
|
|
958
|
-
def extract_gem_info(error)
|
959
|
-
# This method will extract the error message like "Could not find foo-1.2.3 in any of the sources"
|
960
|
-
# to an array. The first element will be the gem name (e.g. foo), the second will be the version number.
|
961
|
-
error.message.scan(/Could not find (\w+)-(\d+(?:\.\d+)+)/).flatten
|
962
|
-
end
|
963
|
-
|
964
808
|
def compute_requires
|
965
809
|
dependencies.reduce({}) do |requires, dep|
|
966
810
|
next requires unless dep.should_include?
|
@@ -973,21 +817,16 @@ module Bundler
|
|
973
817
|
end
|
974
818
|
|
975
819
|
def additional_base_requirements_for_resolve
|
976
|
-
return [] unless @locked_gems &&
|
977
|
-
|
978
|
-
@locked_gems.specs.reduce({}) do |requirements, locked_spec|
|
820
|
+
return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
|
821
|
+
converge_specs(@locked_gems.specs).map do |locked_spec|
|
979
822
|
name = locked_spec.name
|
980
|
-
next requirements if @locked_gems.dependencies[name] != dependencies_by_name[name]
|
981
823
|
dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
|
982
|
-
|
983
|
-
|
984
|
-
end.values
|
824
|
+
DepProxy.get_proxy(dep, locked_spec.platform)
|
825
|
+
end
|
985
826
|
end
|
986
827
|
|
987
|
-
def
|
988
|
-
|
989
|
-
|
990
|
-
Bundler.settings[:allow_deployment_source_credential_changes] && source.equivalent_remotes?(sources.rubygems_remotes)
|
828
|
+
def source_map
|
829
|
+
@source_map ||= SourceMap.new(sources, dependencies)
|
991
830
|
end
|
992
831
|
end
|
993
832
|
end
|