bundler 2.2.33 → 2.4.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +682 -1
- data/README.md +3 -6
- data/bundler.gemspec +8 -10
- data/exe/bundle +12 -24
- data/exe/bundler +1 -1
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +3 -3
- data/lib/bundler/cli/add.rb +1 -1
- data/lib/bundler/cli/binstubs.rb +5 -1
- data/lib/bundler/cli/check.rb +1 -1
- data/lib/bundler/cli/common.rb +4 -2
- data/lib/bundler/cli/config.rb +10 -1
- data/lib/bundler/cli/console.rb +2 -2
- data/lib/bundler/cli/doctor.rb +7 -1
- data/lib/bundler/cli/gem.rb +73 -41
- data/lib/bundler/cli/info.rb +11 -2
- data/lib/bundler/cli/init.rb +6 -2
- data/lib/bundler/cli/install.rb +15 -33
- data/lib/bundler/cli/lock.rb +8 -5
- data/lib/bundler/cli/open.rb +6 -4
- data/lib/bundler/cli/outdated.rb +13 -6
- data/lib/bundler/cli/platform.rb +2 -2
- data/lib/bundler/cli/show.rb +1 -1
- data/lib/bundler/cli/update.rb +6 -2
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/cli.rb +63 -20
- data/lib/bundler/compact_index_client/cache.rb +1 -10
- data/lib/bundler/compact_index_client/updater.rb +53 -39
- data/lib/bundler/compact_index_client.rb +0 -6
- data/lib/bundler/constants.rb +1 -1
- data/lib/bundler/current_ruby.rb +18 -6
- data/lib/bundler/definition.rb +289 -165
- data/lib/bundler/dependency.rb +24 -71
- data/lib/bundler/digest.rb +1 -1
- data/lib/bundler/dsl.rb +13 -45
- data/lib/bundler/endpoint_specification.rb +15 -13
- data/lib/bundler/env.rb +2 -2
- data/lib/bundler/environment_preserver.rb +3 -2
- data/lib/bundler/errors.rb +15 -15
- data/lib/bundler/feature_flag.rb +0 -2
- data/lib/bundler/fetcher/base.rb +6 -8
- data/lib/bundler/fetcher/compact_index.rb +18 -25
- data/lib/bundler/fetcher/dependency.rb +2 -6
- data/lib/bundler/fetcher/downloader.rb +2 -5
- data/lib/bundler/fetcher/index.rb +0 -26
- data/lib/bundler/fetcher.rb +22 -29
- data/lib/bundler/force_platform.rb +18 -0
- data/lib/bundler/friendly_errors.rb +21 -7
- data/lib/bundler/gem_helper.rb +2 -2
- data/lib/bundler/gem_helpers.rb +9 -2
- data/lib/bundler/gem_version_promoter.rb +53 -98
- data/lib/bundler/graph.rb +3 -3
- data/lib/bundler/index.rb +13 -51
- data/lib/bundler/injector.rb +18 -4
- data/lib/bundler/inline.rb +9 -21
- data/lib/bundler/installer/gem_installer.rb +13 -5
- data/lib/bundler/installer/parallel_installer.rb +3 -33
- data/lib/bundler/installer/standalone.rb +42 -11
- data/lib/bundler/installer.rb +21 -45
- data/lib/bundler/lazy_specification.rb +55 -54
- data/lib/bundler/lockfile_generator.rb +3 -3
- data/lib/bundler/lockfile_parser.rb +29 -27
- data/lib/bundler/man/bundle-add.1 +21 -5
- data/lib/bundler/man/bundle-add.1.ronn +16 -4
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +9 -3
- data/lib/bundler/man/bundle-cache.1.ronn +9 -2
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +2 -2
- data/lib/bundler/man/bundle-clean.1.ronn +1 -1
- data/lib/bundler/man/bundle-config.1 +32 -16
- data/lib/bundler/man/bundle-config.1.ronn +29 -20
- data/lib/bundler/man/bundle-console.1 +53 -0
- data/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +6 -6
- data/lib/bundler/man/bundle-exec.1.ronn +6 -6
- data/lib/bundler/man/bundle-gem.1 +27 -37
- data/lib/bundler/man/bundle-gem.1.ronn +5 -5
- data/lib/bundler/man/bundle-help.1 +13 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +5 -1
- data/lib/bundler/man/bundle-init.1.ronn +2 -0
- data/lib/bundler/man/bundle-inject.1 +5 -2
- data/lib/bundler/man/bundle-inject.1.ronn +3 -1
- data/lib/bundler/man/bundle-install.1 +6 -31
- data/lib/bundler/man/bundle-install.1.ronn +8 -31
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-open.1 +22 -2
- data/lib/bundler/man/bundle-open.1.ronn +9 -1
- data/lib/bundler/man/bundle-outdated.1 +15 -18
- data/lib/bundler/man/bundle-outdated.1.ronn +13 -19
- data/lib/bundler/man/bundle-platform.1 +16 -6
- data/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/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-show.1 +1 -1
- data/lib/bundler/man/bundle-update.1 +2 -2
- data/lib/bundler/man/bundle-update.1.ronn +2 -1
- data/lib/bundler/man/bundle-version.1 +35 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/lib/bundler/man/bundle-viz.1 +4 -1
- data/lib/bundler/man/bundle-viz.1.ronn +2 -0
- data/lib/bundler/man/bundle.1 +15 -10
- data/lib/bundler/man/bundle.1.ronn +12 -7
- data/lib/bundler/man/gemfile.5 +94 -83
- data/lib/bundler/man/gemfile.5.ronn +100 -87
- data/lib/bundler/man/index.txt +4 -0
- data/lib/bundler/match_metadata.rb +13 -0
- data/lib/bundler/match_platform.rb +0 -1
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/mirror.rb +5 -7
- data/lib/bundler/plugin/api/source.rb +3 -9
- data/lib/bundler/plugin/index.rb +4 -4
- data/lib/bundler/plugin/installer/git.rb +0 -4
- data/lib/bundler/plugin/installer/rubygems.rb +0 -8
- data/lib/bundler/plugin/installer.rb +6 -3
- data/lib/bundler/plugin.rb +3 -1
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +7 -5
- 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 +43 -71
- data/lib/bundler/resolver.rb +342 -302
- data/lib/bundler/ruby_dsl.rb +1 -1
- data/lib/bundler/ruby_version.rb +6 -19
- data/lib/bundler/rubygems_ext.rb +149 -28
- data/lib/bundler/rubygems_gem_installer.rb +32 -20
- data/lib/bundler/rubygems_integration.rb +24 -95
- data/lib/bundler/runtime.rb +2 -7
- data/lib/bundler/safe_marshal.rb +31 -0
- data/lib/bundler/self_manager.rb +168 -0
- data/lib/bundler/settings.rb +7 -12
- data/lib/bundler/setup.rb +4 -1
- data/lib/bundler/shared_helpers.rb +15 -22
- data/lib/bundler/source/git/git_proxy.rb +237 -74
- data/lib/bundler/source/git.rb +54 -38
- data/lib/bundler/source/metadata.rb +3 -4
- data/lib/bundler/source/path/installer.rb +1 -22
- data/lib/bundler/source/path.rb +7 -7
- data/lib/bundler/source/rubygems.rb +85 -128
- data/lib/bundler/source.rb +4 -5
- data/lib/bundler/source_list.rb +12 -2
- data/lib/bundler/source_map.rb +15 -2
- data/lib/bundler/spec_set.rb +62 -34
- data/lib/bundler/stub_specification.rb +5 -3
- data/lib/bundler/templates/Executable +3 -5
- data/lib/bundler/templates/Executable.bundler +6 -11
- data/lib/bundler/templates/Executable.standalone +4 -4
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +3 -0
- data/lib/bundler/templates/newgem/README.md.tt +7 -11
- data/lib/bundler/templates/newgem/Rakefile.tt +22 -2
- data/lib/bundler/templates/newgem/bin/console.tt +0 -4
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -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 +11 -1
- data/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +13 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +11 -4
- data/lib/bundler/templates/newgem/standard.yml.tt +1 -0
- data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
- data/lib/bundler/ui/shell.rb +36 -13
- data/lib/bundler/ui/silent.rb +21 -5
- data/lib/bundler/uri_normalizer.rb +23 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +3 -3
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +0 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +3 -1
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1351 -409
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
- 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/lib/thor/actions/file_manipulation.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
- 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 +9 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +23 -5
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/tsort/lib/tsort.rb +318 -319
- data/lib/bundler/vendor/uri/lib/uri/common.rb +76 -91
- data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +32 -13
- data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
- data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +16 -23
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +12 -18
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- 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 +3 -3
- data/lib/bundler/vendored_persistent.rb +1 -33
- data/lib/bundler/{vendored_tmpdir.rb → vendored_pub_grub.rb} +1 -1
- data/lib/bundler/version.rb +5 -1
- data/lib/bundler/worker.rb +5 -7
- data/lib/bundler.rb +47 -82
- metadata +52 -38
- data/lib/bundler/dep_proxy.rb +0 -55
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/psyched_yaml.rb +0 -22
- data/lib/bundler/templates/gems.rb +0 -8
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -5
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
- data/lib/bundler/vendor/molinillo/LICENSE +0 -9
- 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 -88
- 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 -164
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
- 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 -112
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
- 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 -11
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
- data/lib/bundler/vendored_molinillo.rb +0 -4
- data/lib/bundler/version_ranges.rb +0 -122
data/lib/bundler/definition.rb
CHANGED
@@ -6,12 +6,16 @@ module Bundler
|
|
6
6
|
class Definition
|
7
7
|
include GemHelpers
|
8
8
|
|
9
|
+
class << self
|
10
|
+
# Do not create or modify a lockfile (Makes #lock a noop)
|
11
|
+
attr_accessor :no_lock
|
12
|
+
end
|
13
|
+
|
9
14
|
attr_reader(
|
10
15
|
:dependencies,
|
11
16
|
:locked_deps,
|
12
17
|
:locked_gems,
|
13
18
|
:platforms,
|
14
|
-
:requires,
|
15
19
|
:ruby_version,
|
16
20
|
:lockfile,
|
17
21
|
:gemfiles
|
@@ -65,15 +69,20 @@ module Bundler
|
|
65
69
|
@unlock = unlock
|
66
70
|
@optional_groups = optional_groups
|
67
71
|
@remote = false
|
72
|
+
@prefer_local = false
|
68
73
|
@specs = nil
|
69
74
|
@ruby_version = ruby_version
|
70
75
|
@gemfiles = gemfiles
|
71
76
|
|
72
77
|
@lockfile = lockfile
|
73
78
|
@lockfile_contents = String.new
|
79
|
+
|
74
80
|
@locked_bundler_version = nil
|
75
|
-
@
|
81
|
+
@resolved_bundler_version = nil
|
82
|
+
|
83
|
+
@locked_ruby_version = nil
|
76
84
|
@new_platform = nil
|
85
|
+
@removed_platform = nil
|
77
86
|
|
78
87
|
if lockfile && File.exist?(lockfile)
|
79
88
|
@lockfile_contents = Bundler.read_file(lockfile)
|
@@ -82,10 +91,11 @@ module Bundler
|
|
82
91
|
@platforms = @locked_platforms.dup
|
83
92
|
@locked_bundler_version = @locked_gems.bundler_version
|
84
93
|
@locked_ruby_version = @locked_gems.ruby_version
|
94
|
+
@originally_locked_specs = SpecSet.new(@locked_gems.specs)
|
85
95
|
|
86
96
|
if unlock != true
|
87
97
|
@locked_deps = @locked_gems.dependencies
|
88
|
-
@locked_specs =
|
98
|
+
@locked_specs = @originally_locked_specs
|
89
99
|
@locked_sources = @locked_gems.sources
|
90
100
|
else
|
91
101
|
@unlock = {}
|
@@ -99,6 +109,7 @@ module Bundler
|
|
99
109
|
@locked_gems = nil
|
100
110
|
@locked_deps = {}
|
101
111
|
@locked_specs = SpecSet.new([])
|
112
|
+
@originally_locked_specs = @locked_specs
|
102
113
|
@locked_sources = []
|
103
114
|
@locked_platforms = []
|
104
115
|
end
|
@@ -122,7 +133,7 @@ module Bundler
|
|
122
133
|
end
|
123
134
|
@unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
|
124
135
|
|
125
|
-
add_current_platform unless
|
136
|
+
add_current_platform unless Bundler.frozen_bundle?
|
126
137
|
|
127
138
|
converge_path_sources_to_gemspec_sources
|
128
139
|
@path_changes = converge_paths
|
@@ -131,31 +142,18 @@ module Bundler
|
|
131
142
|
if @unlock[:conservative]
|
132
143
|
@unlock[:gems] ||= @dependencies.map(&:name)
|
133
144
|
else
|
134
|
-
eager_unlock =
|
135
|
-
@unlock[:gems] = @locked_specs.for(eager_unlock, false,
|
145
|
+
eager_unlock = (@unlock[:gems] || []).map {|name| Dependency.new(name, ">= 0") }
|
146
|
+
@unlock[:gems] = @locked_specs.for(eager_unlock, false, platforms).map(&:name).uniq
|
136
147
|
end
|
137
148
|
|
138
149
|
@dependency_changes = converge_dependencies
|
139
150
|
@local_changes = converge_locals
|
140
151
|
|
141
|
-
@
|
142
|
-
|
143
|
-
@requires = compute_requires
|
152
|
+
@missing_lockfile_dep = check_missing_lockfile_dep
|
144
153
|
end
|
145
154
|
|
146
155
|
def gem_version_promoter
|
147
|
-
@gem_version_promoter ||=
|
148
|
-
locked_specs =
|
149
|
-
if unlocking? && @locked_specs.empty? && !@lockfile_contents.empty?
|
150
|
-
# Definition uses an empty set of locked_specs to indicate all gems
|
151
|
-
# are unlocked, but GemVersionPromoter needs the locked_specs
|
152
|
-
# for conservative comparison.
|
153
|
-
Bundler::SpecSet.new(@locked_gems.specs)
|
154
|
-
else
|
155
|
-
@locked_specs
|
156
|
-
end
|
157
|
-
GemVersionPromoter.new(locked_specs, @unlock[:gems])
|
158
|
-
end
|
156
|
+
@gem_version_promoter ||= GemVersionPromoter.new
|
159
157
|
end
|
160
158
|
|
161
159
|
def resolve_only_locally!
|
@@ -175,6 +173,23 @@ module Bundler
|
|
175
173
|
resolve
|
176
174
|
end
|
177
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
|
191
|
+
end
|
192
|
+
|
178
193
|
# For given dependency list returns a SpecSet with Gemspec of all the required
|
179
194
|
# dependencies.
|
180
195
|
# 1. The method first resolves the dependencies specified in Gemfile
|
@@ -204,6 +219,8 @@ module Bundler
|
|
204
219
|
true
|
205
220
|
rescue BundlerError => e
|
206
221
|
@resolve = nil
|
222
|
+
@resolver = nil
|
223
|
+
@resolution_packages = nil
|
207
224
|
@specs = nil
|
208
225
|
@gem_version_promoter = nil
|
209
226
|
|
@@ -220,8 +237,16 @@ module Bundler
|
|
220
237
|
end
|
221
238
|
|
222
239
|
def current_dependencies
|
240
|
+
filter_relevant(dependencies)
|
241
|
+
end
|
242
|
+
|
243
|
+
def current_locked_dependencies
|
244
|
+
filter_relevant(locked_dependencies)
|
245
|
+
end
|
246
|
+
|
247
|
+
def filter_relevant(dependencies)
|
223
248
|
dependencies.select do |d|
|
224
|
-
d.should_include? && !d.gem_platforms(
|
249
|
+
d.should_include? && !d.gem_platforms([generic_local_platform]).empty?
|
225
250
|
end
|
226
251
|
end
|
227
252
|
|
@@ -229,6 +254,14 @@ module Bundler
|
|
229
254
|
@locked_deps.values
|
230
255
|
end
|
231
256
|
|
257
|
+
def new_deps
|
258
|
+
@new_deps ||= @dependencies - locked_dependencies
|
259
|
+
end
|
260
|
+
|
261
|
+
def deleted_deps
|
262
|
+
@deleted_deps ||= locked_dependencies - @dependencies
|
263
|
+
end
|
264
|
+
|
232
265
|
def specs_for(groups)
|
233
266
|
return specs if groups.empty?
|
234
267
|
deps = dependencies_for(groups)
|
@@ -237,10 +270,9 @@ module Bundler
|
|
237
270
|
|
238
271
|
def dependencies_for(groups)
|
239
272
|
groups.map!(&:to_sym)
|
240
|
-
|
273
|
+
current_dependencies.reject do |d|
|
241
274
|
(d.groups & groups).empty?
|
242
275
|
end
|
243
|
-
expand_dependencies(deps)
|
244
276
|
end
|
245
277
|
|
246
278
|
# Resolve all the dependencies specified in Gemfile. It ensures that
|
@@ -249,20 +281,24 @@ module Bundler
|
|
249
281
|
#
|
250
282
|
# @return [SpecSet] resolved dependencies
|
251
283
|
def resolve
|
252
|
-
@resolve ||=
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
last_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))
|
260
291
|
else
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
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
|
265
298
|
end
|
299
|
+
else
|
300
|
+
Bundler.ui.debug "Found changes from the lockfile, re-resolving dependencies because #{change_reason}"
|
301
|
+
start_resolution
|
266
302
|
end
|
267
303
|
end
|
268
304
|
|
@@ -275,20 +311,19 @@ module Bundler
|
|
275
311
|
end
|
276
312
|
|
277
313
|
def lock(file, preserve_unknown_sections = false)
|
314
|
+
return if Definition.no_lock
|
315
|
+
|
278
316
|
contents = to_lock
|
279
317
|
|
280
318
|
# Convert to \r\n if the existing lock has them
|
281
319
|
# i.e., Windows with `git config core.autocrlf=true`
|
282
|
-
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
|
320
|
+
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
|
283
321
|
|
284
322
|
if @locked_bundler_version
|
285
323
|
locked_major = @locked_bundler_version.segments.first
|
286
|
-
current_major =
|
324
|
+
current_major = bundler_version_to_lock.segments.first
|
287
325
|
|
288
|
-
|
289
|
-
Bundler.ui.warn "Warning: the lockfile is being updated to Bundler #{current_major}, " \
|
290
|
-
"after which you will be unable to return to Bundler #{@locked_bundler_version.segments.first}."
|
291
|
-
end
|
326
|
+
updating_major = locked_major < current_major
|
292
327
|
end
|
293
328
|
|
294
329
|
preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
|
@@ -305,14 +340,6 @@ module Bundler
|
|
305
340
|
end
|
306
341
|
end
|
307
342
|
|
308
|
-
def locked_bundler_version
|
309
|
-
if @locked_bundler_version && @locked_bundler_version < Gem::Version.new(Bundler::VERSION)
|
310
|
-
new_version = Bundler::VERSION
|
311
|
-
end
|
312
|
-
|
313
|
-
new_version || @locked_bundler_version || Bundler::VERSION
|
314
|
-
end
|
315
|
-
|
316
343
|
def locked_ruby_version
|
317
344
|
return unless ruby_version
|
318
345
|
if @unlock[:ruby] || !@locked_ruby_version
|
@@ -334,27 +361,16 @@ module Bundler
|
|
334
361
|
end
|
335
362
|
end
|
336
363
|
|
364
|
+
def bundler_version_to_lock
|
365
|
+
@resolved_bundler_version || Bundler.gem_version
|
366
|
+
end
|
367
|
+
|
337
368
|
def to_lock
|
338
369
|
require_relative "lockfile_generator"
|
339
370
|
LockfileGenerator.generate(self)
|
340
371
|
end
|
341
372
|
|
342
373
|
def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
|
343
|
-
msg = String.new
|
344
|
-
msg << "You are trying to install in deployment mode after changing\n" \
|
345
|
-
"your Gemfile. Run `bundle install` elsewhere and add the\n" \
|
346
|
-
"updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control."
|
347
|
-
|
348
|
-
unless explicit_flag
|
349
|
-
suggested_command = if Bundler.settings.locations("frozen").keys.&([:global, :local]).any?
|
350
|
-
"bundle config unset frozen"
|
351
|
-
elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
|
352
|
-
"bundle config unset deployment"
|
353
|
-
end
|
354
|
-
msg << "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \
|
355
|
-
"freeze \nby running `#{suggested_command}`."
|
356
|
-
end
|
357
|
-
|
358
374
|
added = []
|
359
375
|
deleted = []
|
360
376
|
changed = []
|
@@ -364,15 +380,12 @@ module Bundler
|
|
364
380
|
added.concat new_platforms.map {|p| "* platform: #{p}" }
|
365
381
|
deleted.concat deleted_platforms.map {|p| "* platform: #{p}" }
|
366
382
|
|
367
|
-
new_deps = @dependencies - locked_dependencies
|
368
|
-
deleted_deps = locked_dependencies - @dependencies
|
369
|
-
|
370
383
|
added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any?
|
371
384
|
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
|
372
385
|
|
373
386
|
both_sources = Hash.new {|h, k| h[k] = [] }
|
374
|
-
|
375
|
-
|
387
|
+
current_dependencies.each {|d| both_sources[d.name][0] = d }
|
388
|
+
current_locked_dependencies.each {|d| both_sources[d.name][1] = d }
|
376
389
|
|
377
390
|
both_sources.each do |name, (dep, lock_dep)|
|
378
391
|
next if dep.nil? || lock_dep.nil?
|
@@ -381,17 +394,26 @@ module Bundler
|
|
381
394
|
lock_source = lock_dep.source || sources.default_source
|
382
395
|
next if lock_source.include?(gemfile_source)
|
383
396
|
|
384
|
-
gemfile_source_name = dep.source ? gemfile_source.
|
385
|
-
lockfile_source_name = lock_dep.source ? lock_source.
|
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"
|
386
399
|
changed << "* #{name} from `#{lockfile_source_name}` to `#{gemfile_source_name}`"
|
387
400
|
end
|
388
401
|
|
389
402
|
reason = change_reason
|
390
|
-
msg
|
403
|
+
msg = String.new
|
404
|
+
msg << "#{reason.capitalize.strip}, but the lockfile can't be updated because frozen mode is set"
|
391
405
|
msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
|
392
406
|
msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
|
393
407
|
msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
|
394
|
-
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
|
395
417
|
|
396
418
|
raise ProductionError, msg if added.any? || deleted.any? || changed.any? || !nothing_changed?
|
397
419
|
end
|
@@ -431,7 +453,7 @@ module Bundler
|
|
431
453
|
|
432
454
|
raise ProductionError, "Your bundle only supports platforms #{@platforms.map(&:to_s)} " \
|
433
455
|
"but your local platform is #{Bundler.local_platform}. " \
|
434
|
-
"Add the current platform to the lockfile with
|
456
|
+
"Add the current platform to the lockfile with\n`bundle lock --add-platform #{Bundler.local_platform}` and try again."
|
435
457
|
end
|
436
458
|
|
437
459
|
def add_platform(platform)
|
@@ -440,7 +462,9 @@ module Bundler
|
|
440
462
|
end
|
441
463
|
|
442
464
|
def remove_platform(platform)
|
443
|
-
|
465
|
+
removed_platform = @platforms.delete(Gem::Platform.new(platform))
|
466
|
+
@removed_platform ||= removed_platform
|
467
|
+
return if removed_platform
|
444
468
|
raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}"
|
445
469
|
end
|
446
470
|
|
@@ -454,7 +478,11 @@ module Bundler
|
|
454
478
|
private :sources
|
455
479
|
|
456
480
|
def nothing_changed?
|
457
|
-
!@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?
|
458
486
|
end
|
459
487
|
|
460
488
|
def unlocking?
|
@@ -463,6 +491,34 @@ module Bundler
|
|
463
491
|
|
464
492
|
private
|
465
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
|
+
|
466
522
|
def materialize(dependencies)
|
467
523
|
specs = resolve.materialize(dependencies)
|
468
524
|
missing_specs = specs.missing_specs
|
@@ -477,23 +533,67 @@ module Bundler
|
|
477
533
|
"removed in order to install."
|
478
534
|
end
|
479
535
|
|
480
|
-
|
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 ")}"
|
481
541
|
end
|
482
542
|
|
483
|
-
|
484
|
-
|
485
|
-
|
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
|
486
561
|
end
|
487
562
|
|
563
|
+
bundler = sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
|
564
|
+
specs["bundler"] = bundler
|
565
|
+
|
488
566
|
specs
|
489
567
|
end
|
490
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
|
+
|
491
577
|
def precompute_source_requirements_for_indirect_dependencies?
|
492
|
-
|
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
|
493
592
|
end
|
494
593
|
|
495
594
|
def current_ruby_platform_locked?
|
496
595
|
return false unless generic_local_platform == Gem::Platform::RUBY
|
596
|
+
return false if Bundler.settings[:force_ruby_platform] && !@platforms.include?(Gem::Platform::RUBY)
|
497
597
|
|
498
598
|
current_platform_locked?
|
499
599
|
end
|
@@ -505,6 +605,8 @@ module Bundler
|
|
505
605
|
end
|
506
606
|
|
507
607
|
def add_current_platform
|
608
|
+
return if current_ruby_platform_locked?
|
609
|
+
|
508
610
|
add_platform(local_platform)
|
509
611
|
end
|
510
612
|
|
@@ -526,12 +628,13 @@ module Bundler
|
|
526
628
|
[@new_platform, "you added a new platform to your gemfile"],
|
527
629
|
[@path_changes, "the gemspecs for path gems changed"],
|
528
630
|
[@local_changes, "the gemspecs for git local gems changed"],
|
529
|
-
[@
|
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"],
|
530
633
|
].select(&:first).map(&:last).join(", ")
|
531
634
|
end
|
532
635
|
|
533
|
-
def pretty_dep(dep
|
534
|
-
SharedHelpers.pretty_dependency(dep
|
636
|
+
def pretty_dep(dep)
|
637
|
+
SharedHelpers.pretty_dependency(dep)
|
535
638
|
end
|
536
639
|
|
537
640
|
# Check if the specs of the given source changed
|
@@ -581,6 +684,26 @@ module Bundler
|
|
581
684
|
!sources_with_changes.each {|source| @unlock[:sources] << source.name }.empty?
|
582
685
|
end
|
583
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
|
+
|
584
707
|
def converge_paths
|
585
708
|
sources.path_sources.any? do |source|
|
586
709
|
specs_changed?(source)
|
@@ -634,6 +757,8 @@ module Bundler
|
|
634
757
|
dep.source = sources.get(dep.source)
|
635
758
|
end
|
636
759
|
|
760
|
+
next if unlocking?
|
761
|
+
|
637
762
|
unless locked_dep = @locked_deps[dep.name]
|
638
763
|
changes = true
|
639
764
|
next
|
@@ -659,7 +784,9 @@ module Bundler
|
|
659
784
|
# commonly happen if the Gemfile has changed since the lockfile was last
|
660
785
|
# generated
|
661
786
|
def converge_locked_specs
|
662
|
-
|
787
|
+
converged = converge_specs(@locked_specs)
|
788
|
+
|
789
|
+
resolve = SpecSet.new(converged.reject {|s| @unlock[:gems].include?(s.name) })
|
663
790
|
|
664
791
|
diff = nil
|
665
792
|
|
@@ -677,22 +804,30 @@ module Bundler
|
|
677
804
|
end
|
678
805
|
|
679
806
|
def converge_specs(specs)
|
680
|
-
deps = []
|
681
807
|
converged = []
|
808
|
+
|
809
|
+
deps = @dependencies.select do |dep|
|
810
|
+
specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
|
811
|
+
end
|
812
|
+
|
813
|
+
@specs_that_changed_sources = []
|
814
|
+
|
682
815
|
specs.each do |s|
|
683
|
-
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
684
816
|
dep = @dependencies.find {|d| s.satisfies?(d) }
|
685
817
|
|
686
|
-
|
687
|
-
|
688
|
-
|
818
|
+
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
819
|
+
s.source = if dep && dep.source
|
820
|
+
gemfile_source = dep.source
|
821
|
+
lockfile_source = s.source
|
689
822
|
|
690
|
-
|
823
|
+
@specs_that_changed_sources << s if gemfile_source != lockfile_source
|
691
824
|
|
692
|
-
|
825
|
+
gemfile_source
|
826
|
+
else
|
827
|
+
sources.get_with_fallback(s.source)
|
828
|
+
end
|
693
829
|
|
694
|
-
|
695
|
-
# then we unlock it.
|
830
|
+
next if @unlock[:sources].include?(s.source.name)
|
696
831
|
|
697
832
|
# Path sources have special logic
|
698
833
|
if s.source.instance_of?(Source::Path) || s.source.instance_of?(Source::Gemspec)
|
@@ -702,19 +837,20 @@ module Bundler
|
|
702
837
|
# if we won't need the source (according to the lockfile),
|
703
838
|
# don't error if the path/git source isn't available
|
704
839
|
next if specs.
|
705
|
-
for(requested_dependencies, false
|
840
|
+
for(requested_dependencies, false).
|
706
841
|
none? {|locked_spec| locked_spec.source == s.source }
|
707
842
|
|
708
843
|
raise
|
709
844
|
end
|
710
845
|
|
711
846
|
new_spec = new_specs[s].first
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
847
|
+
if new_spec
|
848
|
+
s.dependencies.replace(new_spec.dependencies)
|
849
|
+
else
|
850
|
+
# If the spec is no longer in the path source, unlock it. This
|
851
|
+
# commonly happens if the version changed in the gemspec
|
852
|
+
@unlock[:gems] << s.name
|
853
|
+
end
|
718
854
|
end
|
719
855
|
|
720
856
|
if dep.nil? && requested_dependencies.find {|d| s.name == d.name }
|
@@ -724,51 +860,14 @@ module Bundler
|
|
724
860
|
end
|
725
861
|
end
|
726
862
|
|
727
|
-
|
728
|
-
SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
|
863
|
+
filter_specs(converged, deps)
|
729
864
|
end
|
730
865
|
|
731
866
|
def metadata_dependencies
|
732
|
-
@metadata_dependencies ||=
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
Dependency.new("RubyGems\0", Gem::VERSION),
|
737
|
-
]
|
738
|
-
end
|
739
|
-
end
|
740
|
-
|
741
|
-
def ruby_version_requirements(ruby_version)
|
742
|
-
return [] unless ruby_version
|
743
|
-
if ruby_version.patchlevel
|
744
|
-
[ruby_version.to_gem_version_with_patchlevel]
|
745
|
-
else
|
746
|
-
ruby_version.versions.map do |version|
|
747
|
-
requirement = Gem::Requirement.new(version)
|
748
|
-
if requirement.exact?
|
749
|
-
"~> #{version}.0"
|
750
|
-
else
|
751
|
-
requirement
|
752
|
-
end
|
753
|
-
end
|
754
|
-
end
|
755
|
-
end
|
756
|
-
|
757
|
-
def expand_dependencies(dependencies, remote = false)
|
758
|
-
deps = []
|
759
|
-
dependencies.each do |dep|
|
760
|
-
dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
|
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)
|
764
|
-
end
|
765
|
-
deps
|
766
|
-
end
|
767
|
-
|
768
|
-
def expand_dependency_with_platforms(dep, platforms)
|
769
|
-
platforms.map do |p|
|
770
|
-
DepProxy.get_proxy(dep, p)
|
771
|
-
end
|
867
|
+
@metadata_dependencies ||= [
|
868
|
+
Dependency.new("Ruby\0", Gem.ruby_version),
|
869
|
+
Dependency.new("RubyGems\0", Gem::VERSION),
|
870
|
+
]
|
772
871
|
end
|
773
872
|
|
774
873
|
def source_requirements
|
@@ -776,27 +875,50 @@ module Bundler
|
|
776
875
|
# specs will be available later when the resolver knows where to
|
777
876
|
# look for that gemspec (or its dependencies)
|
778
877
|
source_requirements = if precompute_source_requirements_for_indirect_dependencies?
|
779
|
-
|
878
|
+
all_requirements = source_map.all_requirements
|
879
|
+
all_requirements = pin_locally_available_names(all_requirements) if @prefer_local
|
880
|
+
{ :default => sources.default_source }.merge(all_requirements)
|
780
881
|
else
|
781
882
|
{ :default => Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
|
782
883
|
end
|
884
|
+
source_requirements.merge!(source_map.locked_requirements) unless @remote
|
783
885
|
metadata_dependencies.each do |dep|
|
784
886
|
source_requirements[dep.name] = sources.metadata_source
|
785
887
|
end
|
786
|
-
|
787
|
-
source_requirements["bundler"]
|
888
|
+
|
889
|
+
default_bundler_source = source_requirements["bundler"] || sources.default_source
|
890
|
+
|
891
|
+
if @unlocking_bundler
|
892
|
+
default_bundler_source.add_dependency_names("bundler")
|
893
|
+
else
|
894
|
+
source_requirements[:default_bundler] = default_bundler_source
|
895
|
+
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
896
|
+
end
|
897
|
+
|
898
|
+
verify_changed_sources!
|
788
899
|
source_requirements
|
789
900
|
end
|
790
901
|
|
902
|
+
def verify_changed_sources!
|
903
|
+
@specs_that_changed_sources.each do |s|
|
904
|
+
if s.source.specs.search(s.name).empty?
|
905
|
+
raise GemNotFound, "Could not find gem '#{s.name}' in #{s.source}"
|
906
|
+
end
|
907
|
+
end
|
908
|
+
end
|
909
|
+
|
791
910
|
def requested_groups
|
792
|
-
groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
911
|
+
values = groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
912
|
+
values &= Bundler.settings[:only] unless Bundler.settings[:only].empty?
|
913
|
+
values
|
793
914
|
end
|
794
915
|
|
795
916
|
def lockfiles_equal?(current, proposed, preserve_unknown_sections)
|
796
917
|
if preserve_unknown_sections
|
797
918
|
sections_to_ignore = LockfileParser.sections_to_ignore(@locked_bundler_version)
|
798
919
|
sections_to_ignore += LockfileParser.unknown_sections_in_lockfile(current)
|
799
|
-
sections_to_ignore
|
920
|
+
sections_to_ignore << LockfileParser::RUBY
|
921
|
+
sections_to_ignore << LockfileParser::BUNDLED unless @unlocking_bundler
|
800
922
|
pattern = /#{Regexp.union(sections_to_ignore)}\n(\s{2,}.*\n)+/
|
801
923
|
whitespace_cleanup = /\n{2,}/
|
802
924
|
current = current.gsub(pattern, "\n").gsub(whitespace_cleanup, "\n\n").strip
|
@@ -805,28 +927,30 @@ module Bundler
|
|
805
927
|
current == proposed
|
806
928
|
end
|
807
929
|
|
808
|
-
def
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
file == true ? dep.name : file
|
814
|
-
end
|
815
|
-
requires
|
930
|
+
def additional_base_requirements_for_resolve(resolution_packages, last_resolve)
|
931
|
+
return resolution_packages unless @locked_gems && !sources.expired_sources?(@locked_gems.sources)
|
932
|
+
converge_specs(@originally_locked_specs - last_resolve).each do |locked_spec|
|
933
|
+
next if locked_spec.source.is_a?(Source::Path)
|
934
|
+
resolution_packages.base_requirements[locked_spec.name] = Gem::Requirement.new(">= #{locked_spec.version}")
|
816
935
|
end
|
936
|
+
resolution_packages
|
817
937
|
end
|
818
938
|
|
819
|
-
def
|
820
|
-
return
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
939
|
+
def remove_ruby_from_platforms_if_necessary!(dependencies)
|
940
|
+
return if Bundler.frozen_bundle? ||
|
941
|
+
Bundler.local_platform == Gem::Platform::RUBY ||
|
942
|
+
!platforms.include?(Gem::Platform::RUBY) ||
|
943
|
+
(@new_platform && platforms.last == Gem::Platform::RUBY) ||
|
944
|
+
@path_changes ||
|
945
|
+
@dependency_changes ||
|
946
|
+
!@originally_locked_specs.incomplete_ruby_specs?(dependencies)
|
947
|
+
|
948
|
+
remove_platform(Gem::Platform::RUBY)
|
949
|
+
add_current_platform
|
826
950
|
end
|
827
951
|
|
828
952
|
def source_map
|
829
|
-
@source_map ||= SourceMap.new(sources, dependencies)
|
953
|
+
@source_map ||= SourceMap.new(sources, dependencies, @locked_specs)
|
830
954
|
end
|
831
955
|
end
|
832
956
|
end
|