bundler 2.3.12 → 2.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +367 -1
- data/README.md +2 -2
- data/bundler.gemspec +8 -10
- data/exe/bundle +1 -4
- data/lib/bundler/build_metadata.rb +2 -2
- 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 +3 -1
- data/lib/bundler/cli/console.rb +2 -2
- data/lib/bundler/cli/doctor.rb +4 -6
- data/lib/bundler/cli/gem.rb +62 -40
- data/lib/bundler/cli/init.rb +5 -1
- data/lib/bundler/cli/install.rb +7 -5
- 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 +1 -1
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/cli.rb +52 -7
- data/lib/bundler/compact_index_client/cache.rb +1 -1
- data/lib/bundler/compact_index_client/updater.rb +53 -39
- data/lib/bundler/constants.rb +1 -1
- data/lib/bundler/current_ruby.rb +15 -6
- data/lib/bundler/definition.rb +203 -110
- data/lib/bundler/dependency.rb +21 -84
- data/lib/bundler/digest.rb +1 -1
- data/lib/bundler/dsl.rb +13 -18
- data/lib/bundler/endpoint_specification.rb +6 -10
- data/lib/bundler/env.rb +1 -1
- data/lib/bundler/environment_preserver.rb +1 -0
- data/lib/bundler/errors.rb +15 -15
- data/lib/bundler/feature_flag.rb +0 -1
- data/lib/bundler/fetcher/base.rb +6 -8
- data/lib/bundler/fetcher/compact_index.rb +9 -11
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +2 -5
- data/lib/bundler/fetcher.rb +12 -12
- data/lib/bundler/force_platform.rb +18 -0
- data/lib/bundler/friendly_errors.rb +21 -7
- 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 +11 -49
- data/lib/bundler/injector.rb +8 -3
- data/lib/bundler/inline.rb +9 -21
- data/lib/bundler/installer/gem_installer.rb +14 -1
- data/lib/bundler/installer/parallel_installer.rb +0 -31
- data/lib/bundler/installer/standalone.rb +41 -10
- data/lib/bundler/installer.rb +18 -39
- data/lib/bundler/lazy_specification.rb +53 -48
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +9 -5
- data/lib/bundler/man/bundle-add.1 +13 -5
- data/lib/bundler/man/bundle-add.1.ronn +10 -4
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +7 -1
- data/lib/bundler/man/bundle-cache.1.ronn +7 -0
- 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 +26 -7
- data/lib/bundler/man/bundle-config.1.ronn +17 -7
- 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 +1 -1
- 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 +5 -30
- data/lib/bundler/man/bundle-install.1.ronn +6 -29
- 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 +1 -1
- 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 +1 -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 +92 -81
- data/lib/bundler/man/gemfile.5.ronn +98 -85
- 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 -3
- 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.rb +2 -0
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +8 -9
- data/lib/bundler/resolver/base.rb +77 -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 +42 -70
- data/lib/bundler/resolver.rb +322 -326
- data/lib/bundler/ruby_dsl.rb +1 -1
- data/lib/bundler/ruby_version.rb +5 -5
- data/lib/bundler/rubygems_ext.rb +102 -12
- data/lib/bundler/rubygems_gem_installer.rb +32 -20
- data/lib/bundler/rubygems_integration.rb +12 -34
- data/lib/bundler/runtime.rb +1 -6
- data/lib/bundler/settings.rb +2 -8
- data/lib/bundler/shared_helpers.rb +7 -7
- data/lib/bundler/source/git/git_proxy.rb +193 -67
- data/lib/bundler/source/git.rb +21 -25
- data/lib/bundler/source/metadata.rb +1 -2
- data/lib/bundler/source/path/installer.rb +1 -22
- data/lib/bundler/source/path.rb +6 -6
- data/lib/bundler/source/rubygems.rb +75 -117
- data/lib/bundler/source.rb +3 -4
- data/lib/bundler/source_list.rb +12 -2
- data/lib/bundler/spec_set.rb +52 -34
- data/lib/bundler/stub_specification.rb +5 -3
- data/lib/bundler/templates/Executable +1 -1
- data/lib/bundler/templates/Executable.bundler +4 -9
- data/lib/bundler/templates/Executable.standalone +2 -0
- 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 +6 -4
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -1
- 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-rust.rb.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +10 -0
- 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 +8 -2
- data/lib/bundler/ui/shell.rb +35 -12
- data/lib/bundler/ui/silent.rb +21 -5
- 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 +1350 -408
- 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 +151 -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 +53 -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 +128 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +409 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +240 -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/shell/basic.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/common.rb +64 -16
- data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +27 -7
- data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -2
- data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +13 -7
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +10 -5
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +1 -2
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri.rb +3 -2
- 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 +35 -69
- metadata +45 -34
- data/lib/bundler/dep_proxy.rb +0 -55
- 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 -149
- 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/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +0 -0
data/lib/bundler/definition.rb
CHANGED
@@ -16,7 +16,6 @@ module Bundler
|
|
16
16
|
:locked_deps,
|
17
17
|
:locked_gems,
|
18
18
|
:platforms,
|
19
|
-
:requires,
|
20
19
|
:ruby_version,
|
21
20
|
:lockfile,
|
22
21
|
:gemfiles
|
@@ -70,6 +69,7 @@ module Bundler
|
|
70
69
|
@unlock = unlock
|
71
70
|
@optional_groups = optional_groups
|
72
71
|
@remote = false
|
72
|
+
@prefer_local = false
|
73
73
|
@specs = nil
|
74
74
|
@ruby_version = ruby_version
|
75
75
|
@gemfiles = gemfiles
|
@@ -79,6 +79,7 @@ module Bundler
|
|
79
79
|
@locked_bundler_version = nil
|
80
80
|
@locked_ruby_version = nil
|
81
81
|
@new_platform = nil
|
82
|
+
@removed_platform = nil
|
82
83
|
|
83
84
|
if lockfile && File.exist?(lockfile)
|
84
85
|
@lockfile_contents = Bundler.read_file(lockfile)
|
@@ -87,10 +88,11 @@ module Bundler
|
|
87
88
|
@platforms = @locked_platforms.dup
|
88
89
|
@locked_bundler_version = @locked_gems.bundler_version
|
89
90
|
@locked_ruby_version = @locked_gems.ruby_version
|
91
|
+
@originally_locked_specs = SpecSet.new(@locked_gems.specs)
|
90
92
|
|
91
93
|
if unlock != true
|
92
94
|
@locked_deps = @locked_gems.dependencies
|
93
|
-
@locked_specs =
|
95
|
+
@locked_specs = @originally_locked_specs
|
94
96
|
@locked_sources = @locked_gems.sources
|
95
97
|
else
|
96
98
|
@unlock = {}
|
@@ -104,6 +106,7 @@ module Bundler
|
|
104
106
|
@locked_gems = nil
|
105
107
|
@locked_deps = {}
|
106
108
|
@locked_specs = SpecSet.new([])
|
109
|
+
@originally_locked_specs = @locked_specs
|
107
110
|
@locked_sources = []
|
108
111
|
@locked_platforms = []
|
109
112
|
end
|
@@ -127,7 +130,7 @@ module Bundler
|
|
127
130
|
end
|
128
131
|
@unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
|
129
132
|
|
130
|
-
add_current_platform unless
|
133
|
+
add_current_platform unless Bundler.frozen_bundle?
|
131
134
|
|
132
135
|
converge_path_sources_to_gemspec_sources
|
133
136
|
@path_changes = converge_paths
|
@@ -136,31 +139,18 @@ module Bundler
|
|
136
139
|
if @unlock[:conservative]
|
137
140
|
@unlock[:gems] ||= @dependencies.map(&:name)
|
138
141
|
else
|
139
|
-
eager_unlock =
|
140
|
-
@unlock[:gems] = @locked_specs.for(eager_unlock, false,
|
142
|
+
eager_unlock = (@unlock[:gems] || []).map {|name| Dependency.new(name, ">= 0") }
|
143
|
+
@unlock[:gems] = @locked_specs.for(eager_unlock, false, platforms).map(&:name).uniq
|
141
144
|
end
|
142
145
|
|
143
146
|
@dependency_changes = converge_dependencies
|
144
147
|
@local_changes = converge_locals
|
145
148
|
|
146
|
-
@
|
147
|
-
|
148
|
-
@requires = compute_requires
|
149
|
+
@incomplete_lockfile = check_missing_lockfile_specs
|
149
150
|
end
|
150
151
|
|
151
152
|
def gem_version_promoter
|
152
|
-
@gem_version_promoter ||=
|
153
|
-
locked_specs =
|
154
|
-
if unlocking? && @locked_specs.empty? && !@lockfile_contents.empty?
|
155
|
-
# Definition uses an empty set of locked_specs to indicate all gems
|
156
|
-
# are unlocked, but GemVersionPromoter needs the locked_specs
|
157
|
-
# for conservative comparison.
|
158
|
-
Bundler::SpecSet.new(@locked_gems.specs)
|
159
|
-
else
|
160
|
-
@locked_specs
|
161
|
-
end
|
162
|
-
GemVersionPromoter.new(locked_specs, @unlock[:gems])
|
163
|
-
end
|
153
|
+
@gem_version_promoter ||= GemVersionPromoter.new
|
164
154
|
end
|
165
155
|
|
166
156
|
def resolve_only_locally!
|
@@ -180,6 +170,23 @@ module Bundler
|
|
180
170
|
resolve
|
181
171
|
end
|
182
172
|
|
173
|
+
def resolution_mode=(options)
|
174
|
+
if options["local"]
|
175
|
+
@remote = false
|
176
|
+
else
|
177
|
+
@remote = true
|
178
|
+
@prefer_local = options["prefer-local"]
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def setup_sources_for_resolve
|
183
|
+
if @remote == false
|
184
|
+
sources.cached!
|
185
|
+
else
|
186
|
+
sources.remote!
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
183
190
|
# For given dependency list returns a SpecSet with Gemspec of all the required
|
184
191
|
# dependencies.
|
185
192
|
# 1. The method first resolves the dependencies specified in Gemfile
|
@@ -209,6 +216,7 @@ module Bundler
|
|
209
216
|
true
|
210
217
|
rescue BundlerError => e
|
211
218
|
@resolve = nil
|
219
|
+
@resolver = nil
|
212
220
|
@specs = nil
|
213
221
|
@gem_version_promoter = nil
|
214
222
|
|
@@ -226,7 +234,7 @@ module Bundler
|
|
226
234
|
|
227
235
|
def current_dependencies
|
228
236
|
dependencies.select do |d|
|
229
|
-
d.should_include? && !d.gem_platforms(
|
237
|
+
d.should_include? && !d.gem_platforms([generic_local_platform]).empty?
|
230
238
|
end
|
231
239
|
end
|
232
240
|
|
@@ -234,6 +242,14 @@ module Bundler
|
|
234
242
|
@locked_deps.values
|
235
243
|
end
|
236
244
|
|
245
|
+
def new_deps
|
246
|
+
@new_deps ||= @dependencies - locked_dependencies
|
247
|
+
end
|
248
|
+
|
249
|
+
def deleted_deps
|
250
|
+
@deleted_deps ||= locked_dependencies - @dependencies
|
251
|
+
end
|
252
|
+
|
237
253
|
def specs_for(groups)
|
238
254
|
return specs if groups.empty?
|
239
255
|
deps = dependencies_for(groups)
|
@@ -242,10 +258,9 @@ module Bundler
|
|
242
258
|
|
243
259
|
def dependencies_for(groups)
|
244
260
|
groups.map!(&:to_sym)
|
245
|
-
|
261
|
+
current_dependencies.reject do |d|
|
246
262
|
(d.groups & groups).empty?
|
247
263
|
end
|
248
|
-
expand_dependencies(deps)
|
249
264
|
end
|
250
265
|
|
251
266
|
# Resolve all the dependencies specified in Gemfile. It ensures that
|
@@ -254,20 +269,24 @@ module Bundler
|
|
254
269
|
#
|
255
270
|
# @return [SpecSet] resolved dependencies
|
256
271
|
def resolve
|
257
|
-
@resolve ||=
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
last_resolve
|
272
|
+
@resolve ||= if Bundler.frozen_bundle?
|
273
|
+
Bundler.ui.debug "Frozen, using resolution from the lockfile"
|
274
|
+
@locked_specs
|
275
|
+
elsif !unlocking? && nothing_changed?
|
276
|
+
if deleted_deps.any?
|
277
|
+
Bundler.ui.debug "Some dependencies were deleted, using a subset of the resolution from the lockfile"
|
278
|
+
SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps))
|
265
279
|
else
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
280
|
+
Bundler.ui.debug "Found no changes, using resolution from the lockfile"
|
281
|
+
if @removed_platform || @locked_gems.may_include_redundant_platform_specific_gems?
|
282
|
+
SpecSet.new(filter_specs(@locked_specs, @dependencies))
|
283
|
+
else
|
284
|
+
@locked_specs
|
285
|
+
end
|
270
286
|
end
|
287
|
+
else
|
288
|
+
Bundler.ui.debug "Found changes from the lockfile, re-resolving dependencies because #{change_reason}"
|
289
|
+
start_resolution
|
271
290
|
end
|
272
291
|
end
|
273
292
|
|
@@ -286,11 +305,11 @@ module Bundler
|
|
286
305
|
|
287
306
|
# Convert to \r\n if the existing lock has them
|
288
307
|
# i.e., Windows with `git config core.autocrlf=true`
|
289
|
-
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
|
308
|
+
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
|
290
309
|
|
291
310
|
if @locked_bundler_version
|
292
311
|
locked_major = @locked_bundler_version.segments.first
|
293
|
-
current_major =
|
312
|
+
current_major = Bundler.gem_version.segments.first
|
294
313
|
|
295
314
|
updating_major = locked_major < current_major
|
296
315
|
end
|
@@ -348,7 +367,7 @@ module Bundler
|
|
348
367
|
"bundle config unset deployment"
|
349
368
|
end
|
350
369
|
msg << "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \
|
351
|
-
"freeze \nby running `#{suggested_command}`."
|
370
|
+
"freeze \nby running `#{suggested_command}`." if suggested_command
|
352
371
|
end
|
353
372
|
|
354
373
|
added = []
|
@@ -360,9 +379,6 @@ module Bundler
|
|
360
379
|
added.concat new_platforms.map {|p| "* platform: #{p}" }
|
361
380
|
deleted.concat deleted_platforms.map {|p| "* platform: #{p}" }
|
362
381
|
|
363
|
-
new_deps = @dependencies - locked_dependencies
|
364
|
-
deleted_deps = locked_dependencies - @dependencies
|
365
|
-
|
366
382
|
added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any?
|
367
383
|
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
|
368
384
|
|
@@ -441,7 +457,9 @@ module Bundler
|
|
441
457
|
end
|
442
458
|
|
443
459
|
def remove_platform(platform)
|
444
|
-
|
460
|
+
removed_platform = @platforms.delete(Gem::Platform.new(platform))
|
461
|
+
@removed_platform ||= removed_platform
|
462
|
+
return if removed_platform
|
445
463
|
raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}"
|
446
464
|
end
|
447
465
|
|
@@ -455,7 +473,7 @@ module Bundler
|
|
455
473
|
private :sources
|
456
474
|
|
457
475
|
def nothing_changed?
|
458
|
-
!@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@
|
476
|
+
!@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@incomplete_lockfile
|
459
477
|
end
|
460
478
|
|
461
479
|
def unlocking?
|
@@ -464,6 +482,27 @@ module Bundler
|
|
464
482
|
|
465
483
|
private
|
466
484
|
|
485
|
+
def resolver
|
486
|
+
@resolver ||= Resolver.new(resolution_packages, gem_version_promoter)
|
487
|
+
end
|
488
|
+
|
489
|
+
def expanded_dependencies
|
490
|
+
dependencies + metadata_dependencies
|
491
|
+
end
|
492
|
+
|
493
|
+
def resolution_packages
|
494
|
+
@resolution_packages ||= begin
|
495
|
+
last_resolve = converge_locked_specs
|
496
|
+
remove_ruby_from_platforms_if_necessary!(current_dependencies)
|
497
|
+
packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, :locked_specs => @originally_locked_specs, :unlock => @unlock[:gems], :prerelease => gem_version_promoter.pre?)
|
498
|
+
additional_base_requirements_for_resolve(packages, last_resolve)
|
499
|
+
end
|
500
|
+
end
|
501
|
+
|
502
|
+
def filter_specs(specs, deps)
|
503
|
+
SpecSet.new(specs).for(deps, false, platforms)
|
504
|
+
end
|
505
|
+
|
467
506
|
def materialize(dependencies)
|
468
507
|
specs = resolve.materialize(dependencies)
|
469
508
|
missing_specs = specs.missing_specs
|
@@ -478,19 +517,60 @@ module Bundler
|
|
478
517
|
"removed in order to install."
|
479
518
|
end
|
480
519
|
|
481
|
-
|
520
|
+
missing_specs_list = missing_specs.group_by(&:source).map do |source, missing_specs_for_source|
|
521
|
+
"#{missing_specs_for_source.map(&:full_name).join(", ")} in #{source}"
|
522
|
+
end
|
523
|
+
|
524
|
+
raise GemNotFound, "Could not find #{missing_specs_list.join(" nor ")}"
|
482
525
|
end
|
483
526
|
|
484
|
-
|
485
|
-
|
486
|
-
|
527
|
+
incomplete_specs = specs.incomplete_specs
|
528
|
+
loop do
|
529
|
+
break if incomplete_specs.empty?
|
530
|
+
|
531
|
+
Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
|
532
|
+
setup_sources_for_resolve
|
533
|
+
resolution_packages.delete(incomplete_specs)
|
534
|
+
@resolve = start_resolution
|
535
|
+
specs = resolve.materialize(dependencies)
|
536
|
+
|
537
|
+
still_incomplete_specs = specs.incomplete_specs
|
538
|
+
|
539
|
+
if still_incomplete_specs == incomplete_specs
|
540
|
+
package = resolution_packages.get_package(incomplete_specs.first.name)
|
541
|
+
resolver.raise_not_found! package
|
542
|
+
end
|
543
|
+
|
544
|
+
incomplete_specs = still_incomplete_specs
|
487
545
|
end
|
488
546
|
|
547
|
+
bundler = sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
|
548
|
+
specs["bundler"] = bundler
|
549
|
+
|
489
550
|
specs
|
490
551
|
end
|
491
552
|
|
553
|
+
def start_resolution
|
554
|
+
result = resolver.start
|
555
|
+
|
556
|
+
SpecSet.new(SpecSet.new(result).for(dependencies, false, @platforms))
|
557
|
+
end
|
558
|
+
|
492
559
|
def precompute_source_requirements_for_indirect_dependencies?
|
493
|
-
|
560
|
+
sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
|
561
|
+
end
|
562
|
+
|
563
|
+
def pin_locally_available_names(source_requirements)
|
564
|
+
source_requirements.each_with_object({}) do |(name, original_source), new_source_requirements|
|
565
|
+
local_source = original_source.dup
|
566
|
+
local_source.local_only!
|
567
|
+
|
568
|
+
new_source_requirements[name] = if local_source.specs.search(name).any?
|
569
|
+
local_source
|
570
|
+
else
|
571
|
+
original_source
|
572
|
+
end
|
573
|
+
end
|
494
574
|
end
|
495
575
|
|
496
576
|
def current_ruby_platform_locked?
|
@@ -507,6 +587,8 @@ module Bundler
|
|
507
587
|
end
|
508
588
|
|
509
589
|
def add_current_platform
|
590
|
+
return if current_ruby_platform_locked?
|
591
|
+
|
510
592
|
add_platform(local_platform)
|
511
593
|
end
|
512
594
|
|
@@ -528,12 +610,12 @@ module Bundler
|
|
528
610
|
[@new_platform, "you added a new platform to your gemfile"],
|
529
611
|
[@path_changes, "the gemspecs for path gems changed"],
|
530
612
|
[@local_changes, "the gemspecs for git local gems changed"],
|
531
|
-
[@
|
613
|
+
[@incomplete_lockfile, "your lock file is missing some gems"],
|
532
614
|
].select(&:first).map(&:last).join(", ")
|
533
615
|
end
|
534
616
|
|
535
|
-
def pretty_dep(dep
|
536
|
-
SharedHelpers.pretty_dependency(dep
|
617
|
+
def pretty_dep(dep)
|
618
|
+
SharedHelpers.pretty_dependency(dep)
|
537
619
|
end
|
538
620
|
|
539
621
|
# Check if the specs of the given source changed
|
@@ -583,6 +665,14 @@ module Bundler
|
|
583
665
|
!sources_with_changes.each {|source| @unlock[:sources] << source.name }.empty?
|
584
666
|
end
|
585
667
|
|
668
|
+
def check_missing_lockfile_specs
|
669
|
+
all_locked_specs = @locked_specs.map(&:name) << "bundler"
|
670
|
+
|
671
|
+
@locked_specs.any? do |s|
|
672
|
+
s.dependencies.any? {|dep| !all_locked_specs.include?(dep.name) }
|
673
|
+
end
|
674
|
+
end
|
675
|
+
|
586
676
|
def converge_paths
|
587
677
|
sources.path_sources.any? do |source|
|
588
678
|
specs_changed?(source)
|
@@ -661,7 +751,9 @@ module Bundler
|
|
661
751
|
# commonly happen if the Gemfile has changed since the lockfile was last
|
662
752
|
# generated
|
663
753
|
def converge_locked_specs
|
664
|
-
|
754
|
+
converged = converge_specs(@locked_specs)
|
755
|
+
|
756
|
+
resolve = SpecSet.new(converged.reject {|s| @unlock[:gems].include?(s.name) })
|
665
757
|
|
666
758
|
diff = nil
|
667
759
|
|
@@ -679,22 +771,30 @@ module Bundler
|
|
679
771
|
end
|
680
772
|
|
681
773
|
def converge_specs(specs)
|
682
|
-
deps = []
|
683
774
|
converged = []
|
775
|
+
|
776
|
+
deps = @dependencies.select do |dep|
|
777
|
+
specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
|
778
|
+
end
|
779
|
+
|
780
|
+
@specs_that_changed_sources = []
|
781
|
+
|
684
782
|
specs.each do |s|
|
685
|
-
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
686
783
|
dep = @dependencies.find {|d| s.satisfies?(d) }
|
687
784
|
|
688
|
-
|
689
|
-
|
690
|
-
|
785
|
+
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
786
|
+
s.source = if dep && dep.source
|
787
|
+
gemfile_source = dep.source
|
788
|
+
lockfile_source = s.source
|
691
789
|
|
692
|
-
|
790
|
+
@specs_that_changed_sources << s if gemfile_source != lockfile_source
|
693
791
|
|
694
|
-
|
792
|
+
gemfile_source
|
793
|
+
else
|
794
|
+
sources.get_with_fallback(s.source)
|
795
|
+
end
|
695
796
|
|
696
|
-
|
697
|
-
# then we unlock it.
|
797
|
+
next if @unlock[:sources].include?(s.source.name)
|
698
798
|
|
699
799
|
# Path sources have special logic
|
700
800
|
if s.source.instance_of?(Source::Path) || s.source.instance_of?(Source::Gemspec)
|
@@ -704,19 +804,20 @@ module Bundler
|
|
704
804
|
# if we won't need the source (according to the lockfile),
|
705
805
|
# don't error if the path/git source isn't available
|
706
806
|
next if specs.
|
707
|
-
for(requested_dependencies, false
|
807
|
+
for(requested_dependencies, false).
|
708
808
|
none? {|locked_spec| locked_spec.source == s.source }
|
709
809
|
|
710
810
|
raise
|
711
811
|
end
|
712
812
|
|
713
813
|
new_spec = new_specs[s].first
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
814
|
+
if new_spec
|
815
|
+
s.dependencies.replace(new_spec.dependencies)
|
816
|
+
else
|
817
|
+
# If the spec is no longer in the path source, unlock it. This
|
818
|
+
# commonly happens if the version changed in the gemspec
|
819
|
+
@unlock[:gems] << s.name
|
820
|
+
end
|
720
821
|
end
|
721
822
|
|
722
823
|
if dep.nil? && requested_dependencies.find {|d| s.name == d.name }
|
@@ -726,34 +827,14 @@ module Bundler
|
|
726
827
|
end
|
727
828
|
end
|
728
829
|
|
729
|
-
|
730
|
-
SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
|
830
|
+
filter_specs(converged, deps)
|
731
831
|
end
|
732
832
|
|
733
833
|
def metadata_dependencies
|
734
|
-
@metadata_dependencies ||=
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
]
|
739
|
-
end
|
740
|
-
end
|
741
|
-
|
742
|
-
def expand_dependencies(dependencies, remote = false)
|
743
|
-
deps = []
|
744
|
-
dependencies.each do |dep|
|
745
|
-
dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
|
746
|
-
next unless remote || dep.current_platform?
|
747
|
-
target_platforms = dep.gem_platforms(remote ? @platforms : [generic_local_platform])
|
748
|
-
deps += expand_dependency_with_platforms(dep, target_platforms)
|
749
|
-
end
|
750
|
-
deps
|
751
|
-
end
|
752
|
-
|
753
|
-
def expand_dependency_with_platforms(dep, platforms)
|
754
|
-
platforms.map do |p|
|
755
|
-
DepProxy.get_proxy(dep, p)
|
756
|
-
end
|
834
|
+
@metadata_dependencies ||= [
|
835
|
+
Dependency.new("Ruby\0", Gem.ruby_version),
|
836
|
+
Dependency.new("RubyGems\0", Gem::VERSION),
|
837
|
+
]
|
757
838
|
end
|
758
839
|
|
759
840
|
def source_requirements
|
@@ -761,7 +842,9 @@ module Bundler
|
|
761
842
|
# specs will be available later when the resolver knows where to
|
762
843
|
# look for that gemspec (or its dependencies)
|
763
844
|
source_requirements = if precompute_source_requirements_for_indirect_dependencies?
|
764
|
-
|
845
|
+
all_requirements = source_map.all_requirements
|
846
|
+
all_requirements = pin_locally_available_names(all_requirements) if @prefer_local
|
847
|
+
{ :default => sources.default_source }.merge(all_requirements)
|
765
848
|
else
|
766
849
|
{ :default => Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
|
767
850
|
end
|
@@ -771,11 +854,22 @@ module Bundler
|
|
771
854
|
end
|
772
855
|
source_requirements[:default_bundler] = source_requirements["bundler"] || sources.default_source
|
773
856
|
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
857
|
+
verify_changed_sources!
|
774
858
|
source_requirements
|
775
859
|
end
|
776
860
|
|
861
|
+
def verify_changed_sources!
|
862
|
+
@specs_that_changed_sources.each do |s|
|
863
|
+
if s.source.specs.search(s.name).empty?
|
864
|
+
raise GemNotFound, "Could not find gem '#{s.name}' in #{s.source}"
|
865
|
+
end
|
866
|
+
end
|
867
|
+
end
|
868
|
+
|
777
869
|
def requested_groups
|
778
|
-
groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
870
|
+
values = groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
871
|
+
values &= Bundler.settings[:only] unless Bundler.settings[:only].empty?
|
872
|
+
values
|
779
873
|
end
|
780
874
|
|
781
875
|
def lockfiles_equal?(current, proposed, preserve_unknown_sections)
|
@@ -791,24 +885,23 @@ module Bundler
|
|
791
885
|
current == proposed
|
792
886
|
end
|
793
887
|
|
794
|
-
def
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
# Allow `require: true` as an alias for `require: <name>`
|
799
|
-
file == true ? dep.name : file
|
800
|
-
end
|
801
|
-
requires
|
888
|
+
def additional_base_requirements_for_resolve(resolution_packages, last_resolve)
|
889
|
+
return resolution_packages unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
|
890
|
+
converge_specs(@originally_locked_specs - last_resolve).each do |locked_spec|
|
891
|
+
resolution_packages.base_requirements[locked_spec.name] = Gem::Requirement.new(">= #{locked_spec.version}")
|
802
892
|
end
|
893
|
+
resolution_packages
|
803
894
|
end
|
804
895
|
|
805
|
-
def
|
806
|
-
return
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
896
|
+
def remove_ruby_from_platforms_if_necessary!(dependencies)
|
897
|
+
return if Bundler.frozen_bundle? ||
|
898
|
+
Bundler.local_platform == Gem::Platform::RUBY ||
|
899
|
+
!platforms.include?(Gem::Platform::RUBY) ||
|
900
|
+
(@new_platform && platforms.last == Gem::Platform::RUBY) ||
|
901
|
+
!@originally_locked_specs.incomplete_ruby_specs?(dependencies)
|
902
|
+
|
903
|
+
remove_platform(Gem::Platform::RUBY)
|
904
|
+
add_current_platform
|
812
905
|
end
|
813
906
|
|
814
907
|
def source_map
|