bundler 1.10.6 → 1.11.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop.yml +105 -0
- data/.rubocop_todo.yml +120 -0
- data/.travis.yml +8 -23
- data/CHANGELOG.md +69 -0
- data/CODE_OF_CONDUCT.md +6 -4
- data/DEVELOPMENT.md +4 -5
- data/README.md +2 -2
- data/Rakefile +70 -87
- data/bin/rake +14 -0
- data/bin/rspec +10 -0
- data/bin/rubocop +11 -0
- data/bundler.gemspec +17 -15
- data/exe/bundle +20 -0
- data/{bin → exe}/bundle_ruby +6 -4
- data/exe/bundler +20 -0
- data/lib/bundler.rb +98 -119
- data/lib/bundler/capistrano.rb +2 -2
- data/lib/bundler/cli.rb +85 -74
- data/lib/bundler/cli/binstubs.rb +1 -2
- data/lib/bundler/cli/cache.rb +0 -1
- data/lib/bundler/cli/check.rb +7 -5
- data/lib/bundler/cli/clean.rb +0 -1
- data/lib/bundler/cli/common.rb +6 -7
- data/lib/bundler/cli/config.rb +69 -56
- data/lib/bundler/cli/console.rb +8 -8
- data/lib/bundler/cli/exec.rb +4 -3
- data/lib/bundler/cli/gem.rb +50 -39
- data/lib/bundler/cli/init.rb +5 -6
- data/lib/bundler/cli/inject.rb +1 -2
- data/lib/bundler/cli/install.rb +18 -21
- data/lib/bundler/cli/lock.rb +8 -3
- data/lib/bundler/cli/open.rb +4 -5
- data/lib/bundler/cli/outdated.rb +7 -8
- data/lib/bundler/cli/package.rb +1 -1
- data/lib/bundler/cli/platform.rb +2 -3
- data/lib/bundler/cli/show.rb +9 -9
- data/lib/bundler/cli/update.rb +2 -3
- data/lib/bundler/cli/viz.rb +1 -2
- data/lib/bundler/constants.rb +1 -1
- data/lib/bundler/current_ruby.rb +38 -3
- data/lib/bundler/definition.rb +83 -88
- data/lib/bundler/dep_proxy.rb +11 -9
- data/lib/bundler/dependency.rb +26 -11
- data/lib/bundler/deployment.rb +2 -2
- data/lib/bundler/deprecate.rb +3 -3
- data/lib/bundler/dsl.rb +63 -44
- data/lib/bundler/env.rb +19 -12
- data/lib/bundler/environment.rb +1 -2
- data/lib/bundler/errors.rb +82 -0
- data/lib/bundler/fetcher.rb +45 -39
- data/lib/bundler/fetcher/base.rb +20 -7
- data/lib/bundler/fetcher/dependency.rb +5 -5
- data/lib/bundler/fetcher/downloader.rb +1 -2
- data/lib/bundler/fetcher/index.rb +4 -7
- data/lib/bundler/friendly_errors.rb +15 -8
- data/lib/bundler/gem_helper.rb +44 -35
- data/lib/bundler/gem_helpers.rb +7 -8
- data/lib/bundler/gem_remote_fetcher.rb +41 -0
- data/lib/bundler/gem_tasks.rb +4 -1
- data/lib/bundler/graph.rb +25 -24
- data/lib/bundler/index.rb +21 -18
- data/lib/bundler/injector.rb +2 -4
- data/lib/bundler/inline.rb +3 -3
- data/lib/bundler/installer.rb +57 -144
- data/lib/bundler/installer/gem_installer.rb +76 -0
- data/lib/bundler/installer/parallel_installer.rb +22 -13
- data/lib/bundler/installer/standalone.rb +48 -0
- data/lib/bundler/lazy_specification.rb +3 -4
- data/lib/bundler/lockfile_parser.rb +21 -19
- data/lib/bundler/match_platform.rb +4 -4
- data/lib/bundler/psyched_yaml.rb +3 -3
- data/lib/bundler/remote_specification.rb +1 -1
- data/lib/bundler/resolver.rb +93 -88
- data/lib/bundler/retry.rb +9 -10
- data/lib/bundler/ruby_dsl.rb +1 -1
- data/lib/bundler/ruby_version.rb +7 -10
- data/lib/bundler/rubygems_ext.rb +32 -27
- data/lib/bundler/{gem_installer.rb → rubygems_gem_installer.rb} +2 -2
- data/lib/bundler/rubygems_integration.rb +85 -70
- data/lib/bundler/runtime.rb +57 -61
- data/lib/bundler/settings.rb +27 -26
- data/lib/bundler/setup.rb +3 -3
- data/lib/bundler/shared_helpers.rb +45 -20
- data/lib/bundler/similarity_detector.rb +19 -21
- data/lib/bundler/source.rb +4 -5
- data/lib/bundler/source/git.rb +29 -31
- data/lib/bundler/source/git/git_proxy.rb +52 -26
- data/lib/bundler/source/path.rb +25 -28
- data/lib/bundler/source/path/installer.rb +4 -4
- data/lib/bundler/source/rubygems.rb +62 -48
- data/lib/bundler/source/rubygems/remote.rb +3 -3
- data/lib/bundler/source_list.rb +4 -4
- data/lib/bundler/spec_set.rb +17 -15
- data/lib/bundler/ssl_certs/certificate_manager.rb +5 -6
- data/lib/bundler/stub_specification.rb +2 -2
- data/lib/bundler/templates/Executable +5 -5
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +42 -6
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +4 -2
- data/lib/bundler/templates/newgem/bin/setup.tt +2 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/ui/rg_proxy.rb +2 -2
- data/lib/bundler/ui/shell.rb +10 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +82 -71
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +40 -21
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -0
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +3 -3
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/vlad.rb +1 -1
- data/lib/bundler/worker.rb +4 -5
- data/man/bundle-config.ronn +4 -2
- data/man/bundle-gem.ronn +77 -0
- data/man/bundle-install.ronn +13 -6
- data/man/bundle-lock.ronn +47 -0
- data/man/bundle.ronn +1 -1
- data/man/gemfile.5.ronn +8 -0
- data/man/index.txt +1 -0
- metadata +37 -8
- data/bin/bundle +0 -21
- data/bin/bundler +0 -21
data/lib/bundler/definition.rb
CHANGED
@@ -19,14 +19,11 @@ module Bundler
|
|
19
19
|
unlock ||= {}
|
20
20
|
gemfile = Pathname.new(gemfile).expand_path
|
21
21
|
|
22
|
-
unless gemfile.file?
|
23
|
-
raise GemfileNotFound, "#{gemfile} not found"
|
24
|
-
end
|
22
|
+
raise GemfileNotFound, "#{gemfile} not found" unless gemfile.file?
|
25
23
|
|
26
24
|
Dsl.evaluate(gemfile, lockfile, unlock)
|
27
25
|
end
|
28
26
|
|
29
|
-
|
30
27
|
#
|
31
28
|
# How does the new system work?
|
32
29
|
#
|
@@ -62,7 +59,7 @@ module Bundler
|
|
62
59
|
if lockfile && File.exist?(lockfile)
|
63
60
|
@lockfile_contents = Bundler.read_file(lockfile)
|
64
61
|
locked = LockfileParser.new(@lockfile_contents)
|
65
|
-
@platforms
|
62
|
+
@platforms = locked.platforms
|
66
63
|
@locked_bundler_version = locked.bundler_version
|
67
64
|
|
68
65
|
if unlock != true
|
@@ -86,13 +83,13 @@ module Bundler
|
|
86
83
|
@unlock[:gems] ||= []
|
87
84
|
@unlock[:sources] ||= []
|
88
85
|
|
89
|
-
current_platform = Bundler.rubygems.platforms.map {
|
86
|
+
current_platform = Bundler.rubygems.platforms.map {|p| generic(p) }.compact.last
|
90
87
|
@new_platform = !@platforms.include?(current_platform)
|
91
88
|
@platforms |= [current_platform]
|
92
89
|
|
93
90
|
@path_changes = converge_paths
|
94
91
|
eager_unlock = expand_dependencies(@unlock[:gems])
|
95
|
-
@unlock[:gems] = @locked_specs.for(eager_unlock).map
|
92
|
+
@unlock[:gems] = @locked_specs.for(eager_unlock).map(&:name)
|
96
93
|
|
97
94
|
@source_changes = converge_sources
|
98
95
|
@dependency_changes = converge_dependencies
|
@@ -110,7 +107,7 @@ module Bundler
|
|
110
107
|
# with a mismatch on #type.
|
111
108
|
# Test coverage to catch a regression on this is in gemspec_spec.rb
|
112
109
|
@dependencies.each do |d|
|
113
|
-
if ld = @locked_deps.find {
|
110
|
+
if ld = @locked_deps.find {|l| l.name == d.name }
|
114
111
|
ld.instance_variable_set(:@type, d.type)
|
115
112
|
end
|
116
113
|
end
|
@@ -141,7 +138,7 @@ module Bundler
|
|
141
138
|
|
142
139
|
unless specs["bundler"].any?
|
143
140
|
local = Bundler.settings[:frozen] ? rubygems_index : index
|
144
|
-
bundler = local.search(Gem::Dependency.new(
|
141
|
+
bundler = local.search(Gem::Dependency.new("bundler", VERSION)).last
|
145
142
|
specs["bundler"] = bundler if bundler
|
146
143
|
end
|
147
144
|
|
@@ -170,18 +167,18 @@ module Bundler
|
|
170
167
|
def requested_specs
|
171
168
|
@requested_specs ||= begin
|
172
169
|
groups = requested_groups
|
173
|
-
groups.map!
|
170
|
+
groups.map!(&:to_sym)
|
174
171
|
specs_for(groups)
|
175
172
|
end
|
176
173
|
end
|
177
174
|
|
178
175
|
def current_dependencies
|
179
|
-
dependencies.reject {
|
176
|
+
dependencies.reject {|d| !d.should_include? }
|
180
177
|
end
|
181
178
|
|
182
179
|
def specs_for(groups)
|
183
|
-
deps = dependencies.select {
|
184
|
-
deps.delete_if {
|
180
|
+
deps = dependencies.select {|d| (d.groups & groups).any? }
|
181
|
+
deps.delete_if {|d| !d.should_include? }
|
185
182
|
specs.for(expand_dependencies(deps))
|
186
183
|
end
|
187
184
|
|
@@ -197,14 +194,15 @@ module Bundler
|
|
197
194
|
last_resolve
|
198
195
|
else
|
199
196
|
# Run a resolve against the locally available gems
|
200
|
-
|
197
|
+
requested_ruby_version = ruby_version.version if ruby_version
|
198
|
+
last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, requested_ruby_version)
|
201
199
|
end
|
202
200
|
end
|
203
201
|
end
|
204
202
|
|
205
203
|
def index
|
206
204
|
@index ||= Index.build do |idx|
|
207
|
-
dependency_names = @dependencies.map
|
205
|
+
dependency_names = @dependencies.map(&:name)
|
208
206
|
|
209
207
|
sources.all_sources.each do |source|
|
210
208
|
source.dependency_names = dependency_names.dup
|
@@ -238,7 +236,7 @@ module Bundler
|
|
238
236
|
end
|
239
237
|
|
240
238
|
def groups
|
241
|
-
dependencies.map
|
239
|
+
dependencies.map(&:groups).flatten.uniq
|
242
240
|
end
|
243
241
|
|
244
242
|
def lock(file, preserve_bundled_with = false)
|
@@ -266,12 +264,9 @@ module Bundler
|
|
266
264
|
return
|
267
265
|
end
|
268
266
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
"There was an error while trying to write to Gemfile.lock. It is likely that \n" \
|
273
|
-
"you need to allow write permissions for the file at path: \n" \
|
274
|
-
"#{File.expand_path(file)}"
|
267
|
+
SharedHelpers.filesystem_access(file) do |p|
|
268
|
+
File.open(p, "wb") {|f| f.puts(contents) }
|
269
|
+
end
|
275
270
|
end
|
276
271
|
|
277
272
|
# Returns the version of Bundler that is creating or has created
|
@@ -292,13 +287,13 @@ module Bundler
|
|
292
287
|
out << source.to_lock
|
293
288
|
# Find all specs for this source
|
294
289
|
resolve.
|
295
|
-
select {
|
290
|
+
select {|s| source.can_lock?(s) }.
|
296
291
|
# This needs to be sorted by full name so that
|
297
292
|
# gems with the same name, but different platform
|
298
293
|
# are ordered consistently
|
299
|
-
sort_by
|
294
|
+
sort_by(&:full_name).
|
300
295
|
each do |spec|
|
301
|
-
next if spec.name ==
|
296
|
+
next if spec.name == "bundler"
|
302
297
|
out << spec.to_lock
|
303
298
|
end
|
304
299
|
out << "\n"
|
@@ -306,7 +301,7 @@ module Bundler
|
|
306
301
|
|
307
302
|
out << "PLATFORMS\n"
|
308
303
|
|
309
|
-
platforms.map
|
304
|
+
platforms.map(&:to_s).sort.each do |p|
|
310
305
|
out << " #{p}\n"
|
311
306
|
end
|
312
307
|
|
@@ -314,12 +309,10 @@ module Bundler
|
|
314
309
|
out << "DEPENDENCIES\n"
|
315
310
|
|
316
311
|
handled = []
|
317
|
-
dependencies.
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
out << dep.to_lock
|
322
|
-
handled << dep.name
|
312
|
+
dependencies.sort_by(&:to_s).each do |dep|
|
313
|
+
next if handled.include?(dep.name)
|
314
|
+
out << dep.to_lock
|
315
|
+
handled << dep.name
|
323
316
|
end
|
324
317
|
|
325
318
|
# Record the version of Bundler that was used to create the lockfile
|
@@ -332,10 +325,10 @@ module Bundler
|
|
332
325
|
def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
|
333
326
|
msg = "You are trying to install in deployment mode after changing\n" \
|
334
327
|
"your Gemfile. Run `bundle install` elsewhere and add the\n" \
|
335
|
-
"updated
|
328
|
+
"updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control."
|
336
329
|
|
337
330
|
unless explicit_flag
|
338
|
-
msg += "\n\nIf this is a development machine, remove the
|
331
|
+
msg += "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \
|
339
332
|
"freeze \nby running `bundle install --no-deployment`."
|
340
333
|
end
|
341
334
|
|
@@ -349,40 +342,37 @@ module Bundler
|
|
349
342
|
deleted_sources = @locked_sources - gemfile_sources
|
350
343
|
|
351
344
|
if new_sources.any?
|
352
|
-
added.concat new_sources.map {
|
345
|
+
added.concat new_sources.map {|source| "* source: #{source}" }
|
353
346
|
end
|
354
347
|
|
355
348
|
if deleted_sources.any?
|
356
|
-
deleted.concat deleted_sources.map {
|
349
|
+
deleted.concat deleted_sources.map {|source| "* source: #{source}" }
|
357
350
|
end
|
358
351
|
end
|
359
352
|
|
360
353
|
new_deps = @dependencies - @locked_deps
|
361
354
|
deleted_deps = @locked_deps - @dependencies
|
362
355
|
|
363
|
-
if new_deps.any?
|
364
|
-
added.concat new_deps.map { |d| "* #{pretty_dep(d)}" }
|
365
|
-
end
|
356
|
+
added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any?
|
366
357
|
|
367
358
|
if deleted_deps.any?
|
368
|
-
deleted.concat deleted_deps.map {
|
359
|
+
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" }
|
369
360
|
end
|
370
361
|
|
371
|
-
both_sources = Hash.new {
|
372
|
-
@dependencies.each {
|
373
|
-
@locked_deps.each {
|
362
|
+
both_sources = Hash.new {|h, k| h[k] = [] }
|
363
|
+
@dependencies.each {|d| both_sources[d.name][0] = d }
|
364
|
+
@locked_deps.each {|d| both_sources[d.name][1] = d.source }
|
374
365
|
|
375
366
|
both_sources.each do |name, (dep, lock_source)|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
end
|
367
|
+
next unless (dep.nil? && !lock_source.nil?) || (!dep.nil? && !lock_source.nil? && !lock_source.can_lock?(dep))
|
368
|
+
gemfile_source_name = (dep && dep.source) || "no specified source"
|
369
|
+
lockfile_source_name = lock_source || "no specified source"
|
370
|
+
changed << "* #{name} from `#{gemfile_source_name}` to `#{lockfile_source_name}`"
|
381
371
|
end
|
382
372
|
|
383
|
-
msg << "\n\nYou have added to the Gemfile:\n"
|
373
|
+
msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
|
384
374
|
msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
|
385
|
-
msg << "\n\nYou have changed in the Gemfile:\n"
|
375
|
+
msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
|
386
376
|
msg << "\n"
|
387
377
|
|
388
378
|
raise ProductionError, msg if added.any? || deleted.any? || changed.any?
|
@@ -395,18 +385,18 @@ module Bundler
|
|
395
385
|
problem, expected, actual = diff
|
396
386
|
|
397
387
|
msg = case problem
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
388
|
+
when :engine
|
389
|
+
"Your Ruby engine is #{actual}, but your Gemfile specified #{expected}"
|
390
|
+
when :version
|
391
|
+
"Your Ruby version is #{actual}, but your Gemfile specified #{expected}"
|
392
|
+
when :engine_version
|
393
|
+
"Your #{Bundler.ruby_version.engine} version is #{actual}, but your Gemfile specified #{ruby_version.engine} #{expected}"
|
394
|
+
when :patchlevel
|
395
|
+
if !expected.is_a?(String)
|
396
|
+
"The Ruby patchlevel in your Gemfile must be a string"
|
397
|
+
else
|
398
|
+
"Your Ruby patchlevel is #{actual}, but your Gemfile specified #{expected}"
|
399
|
+
end
|
410
400
|
end
|
411
401
|
|
412
402
|
raise RubyVersionMismatch, msg
|
@@ -414,7 +404,7 @@ module Bundler
|
|
414
404
|
end
|
415
405
|
|
416
406
|
attr_reader :sources
|
417
|
-
private
|
407
|
+
private :sources
|
418
408
|
|
419
409
|
private
|
420
410
|
|
@@ -423,7 +413,7 @@ module Bundler
|
|
423
413
|
end
|
424
414
|
|
425
415
|
def pretty_dep(dep, source = false)
|
426
|
-
msg
|
416
|
+
msg = "#{dep.name}"
|
427
417
|
msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
|
428
418
|
msg << " from the `#{dep.source}` source" if source && dep.source
|
429
419
|
msg
|
@@ -446,8 +436,8 @@ module Bundler
|
|
446
436
|
end
|
447
437
|
|
448
438
|
def dependencies_for_source_changed?(source)
|
449
|
-
deps_for_source = @dependencies.select {
|
450
|
-
locked_deps_for_source = @locked_deps.select {
|
439
|
+
deps_for_source = @dependencies.select {|s| s.source == source }
|
440
|
+
locked_deps_for_source = @locked_deps.select {|s| s.source == source }
|
451
441
|
|
452
442
|
deps_for_source != locked_deps_for_source
|
453
443
|
end
|
@@ -458,17 +448,17 @@ module Bundler
|
|
458
448
|
def converge_locals
|
459
449
|
locals = []
|
460
450
|
|
461
|
-
Bundler.settings.local_overrides.map do |k,v|
|
462
|
-
spec = @dependencies.find {
|
451
|
+
Bundler.settings.local_overrides.map do |k, v|
|
452
|
+
spec = @dependencies.find {|s| s.name == k }
|
463
453
|
source = spec && spec.source
|
464
454
|
if source && source.respond_to?(:local_override!)
|
465
455
|
source.unlock! if @unlock[:gems].include?(spec.name)
|
466
|
-
locals << [
|
456
|
+
locals << [source, source.local_override!(v)]
|
467
457
|
end
|
468
458
|
end
|
469
459
|
|
470
460
|
locals.any? do |source, changed|
|
471
|
-
changed || specs_changed?(source) {
|
461
|
+
changed || specs_changed?(source) {|o| source.class == o.class && source.uri == o.uri }
|
472
462
|
end
|
473
463
|
end
|
474
464
|
|
@@ -484,7 +474,7 @@ module Bundler
|
|
484
474
|
changes = false
|
485
475
|
|
486
476
|
# Get the Rubygems sources from the Gemfile.lock
|
487
|
-
locked_gem_sources = @locked_sources.select {
|
477
|
+
locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
|
488
478
|
# Get the Rubygems remotes from the Gemfile
|
489
479
|
actual_remotes = sources.rubygems_remotes
|
490
480
|
|
@@ -492,14 +482,14 @@ module Bundler
|
|
492
482
|
if !locked_gem_sources.empty? && !actual_remotes.empty?
|
493
483
|
locked_gem_sources.each do |locked_gem|
|
494
484
|
# Merge the remotes from the Gemfile into the Gemfile.lock
|
495
|
-
changes
|
485
|
+
changes |= locked_gem.replace_remotes(actual_remotes)
|
496
486
|
end
|
497
487
|
end
|
498
488
|
|
499
489
|
# Replace the sources from the Gemfile with the sources from the Gemfile.lock,
|
500
490
|
# if they exist in the Gemfile.lock and are `==`. If you can't find an equivalent
|
501
491
|
# source in the Gemfile.lock, use the one from the Gemfile.
|
502
|
-
changes
|
492
|
+
changes |= sources.replace_sources!(@locked_sources)
|
503
493
|
|
504
494
|
sources.all_sources.each do |source|
|
505
495
|
# If the source is unlockable and the current command allows an unlock of
|
@@ -518,9 +508,7 @@ module Bundler
|
|
518
508
|
|
519
509
|
def converge_dependencies
|
520
510
|
(@dependencies + @locked_deps).each do |dep|
|
521
|
-
if dep.source
|
522
|
-
dep.source = sources.get(dep.source)
|
523
|
-
end
|
511
|
+
dep.source = sources.get(dep.source) if dep.source
|
524
512
|
end
|
525
513
|
Set.new(@dependencies) != Set.new(@locked_deps)
|
526
514
|
end
|
@@ -535,7 +523,10 @@ module Bundler
|
|
535
523
|
# and Gemfile.lock. If the Gemfile modified a dependency, but
|
536
524
|
# the gem in the Gemfile.lock still satisfies it, this is fine
|
537
525
|
# too.
|
538
|
-
locked_deps_hash = @locked_deps.inject({})
|
526
|
+
locked_deps_hash = @locked_deps.inject({}) do |hsh, dep|
|
527
|
+
hsh[dep] = dep
|
528
|
+
hsh
|
529
|
+
end
|
539
530
|
@dependencies.each do |dep|
|
540
531
|
locked_dep = locked_deps_hash[dep]
|
541
532
|
|
@@ -547,19 +538,24 @@ module Bundler
|
|
547
538
|
end
|
548
539
|
|
549
540
|
dep.source.unlock! if dep.source.respond_to?(:unlock!)
|
550
|
-
dep.source.specs.each {
|
541
|
+
dep.source.specs.each {|s| @unlock[:gems] << s.name }
|
551
542
|
end
|
552
543
|
end
|
553
544
|
|
554
545
|
converged = []
|
555
546
|
@locked_specs.each do |s|
|
556
547
|
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
557
|
-
dep = @dependencies.find {
|
548
|
+
dep = @dependencies.find {|d| s.satisfies?(d) }
|
558
549
|
s.source = (dep && dep.source) || sources.get(s.source)
|
559
550
|
|
560
551
|
# Don't add a spec to the list if its source is expired. For example,
|
561
552
|
# if you change a Git gem to Rubygems.
|
553
|
+
next if s.source.nil? || @unlock[:sources].include?(s.source.name)
|
554
|
+
|
555
|
+
# XXX This is a backwards-compatibility fix to preserve the ability to
|
556
|
+
# unlock a single gem by passing its name via `--source`. See issue #3759
|
562
557
|
next if s.source.nil? || @unlock[:sources].include?(s.name)
|
558
|
+
|
563
559
|
# If the spec is from a path source and it doesn't exist anymore
|
564
560
|
# then we just unlock it.
|
565
561
|
|
@@ -571,7 +567,7 @@ module Bundler
|
|
571
567
|
# commonly happens if the version changed in the gemspec
|
572
568
|
next unless other
|
573
569
|
|
574
|
-
deps2 = other.dependencies.select {
|
570
|
+
deps2 = other.dependencies.select {|d| d.type != :development }
|
575
571
|
# If the dependencies of the path source have changed, unlock it
|
576
572
|
next unless s.dependencies.sort == deps2.sort
|
577
573
|
end
|
@@ -587,8 +583,8 @@ module Bundler
|
|
587
583
|
sources.all_sources.each do |source|
|
588
584
|
next unless source.respond_to?(:unlock!)
|
589
585
|
|
590
|
-
unless resolve.any? {
|
591
|
-
source.unlock! if !diff.empty? && diff.any? {
|
586
|
+
unless resolve.any? {|s| s.source == source }
|
587
|
+
source.unlock! if !diff.empty? && diff.any? {|s| s.source == source }
|
592
588
|
end
|
593
589
|
end
|
594
590
|
|
@@ -603,7 +599,7 @@ module Bundler
|
|
603
599
|
end
|
604
600
|
|
605
601
|
def satisfies_locked_spec?(dep)
|
606
|
-
@locked_specs.any? {
|
602
|
+
@locked_specs.any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
|
607
603
|
end
|
608
604
|
|
609
605
|
def expanded_dependencies
|
@@ -624,8 +620,8 @@ module Bundler
|
|
624
620
|
|
625
621
|
def requested_dependencies
|
626
622
|
groups = requested_groups
|
627
|
-
groups.map!
|
628
|
-
dependencies.reject {
|
623
|
+
groups.map!(&:to_sym)
|
624
|
+
dependencies.reject {|d| !d.should_include? || (d.groups & groups).empty? }
|
629
625
|
end
|
630
626
|
|
631
627
|
def source_requirements
|
@@ -646,7 +642,7 @@ module Bundler
|
|
646
642
|
def pinned_spec_names(specs)
|
647
643
|
names = []
|
648
644
|
specs.each do |s|
|
649
|
-
# TODO when two sources without blocks is an error, we can change
|
645
|
+
# TODO: when two sources without blocks is an error, we can change
|
650
646
|
# this check to !s.source.is_a?(Source::LocalRubygems). For now,
|
651
647
|
# we need to ask every Rubygems for every gem name.
|
652
648
|
if s.source.is_a?(Source::Git) || s.source.is_a?(Source::Path)
|
@@ -658,7 +654,7 @@ module Bundler
|
|
658
654
|
end
|
659
655
|
|
660
656
|
def requested_groups
|
661
|
-
|
657
|
+
groups - Bundler.settings.without - @optional_groups + Bundler.settings.with
|
662
658
|
end
|
663
659
|
|
664
660
|
def lockfiles_equal?(current, proposed, preserve_bundled_with)
|
@@ -669,6 +665,5 @@ module Bundler
|
|
669
665
|
current == proposed
|
670
666
|
end
|
671
667
|
end
|
672
|
-
|
673
668
|
end
|
674
669
|
end
|
data/lib/bundler/dep_proxy.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
module Bundler
|
2
2
|
class DepProxy
|
3
|
-
|
4
3
|
attr_reader :__platform, :dep
|
5
4
|
|
6
5
|
def initialize(dep, platform)
|
7
|
-
@dep
|
6
|
+
@dep = dep
|
7
|
+
@__platform = platform
|
8
8
|
end
|
9
9
|
|
10
10
|
def hash
|
11
11
|
@hash ||= dep.hash
|
12
12
|
end
|
13
13
|
|
14
|
-
def ==(
|
15
|
-
dep ==
|
14
|
+
def ==(other)
|
15
|
+
dep == other.dep && __platform == other.__platform
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
alias_method :eql?, :==
|
19
19
|
|
20
20
|
def type
|
21
21
|
@dep.type
|
@@ -30,14 +30,16 @@ module Bundler
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def to_s
|
33
|
-
|
33
|
+
s = name.dup
|
34
|
+
s << " (#{requirement})" unless requirement == Gem::Requirement.default
|
35
|
+
s << " #{__platform}" unless __platform == Gem::Platform::RUBY
|
36
|
+
s
|
34
37
|
end
|
35
38
|
|
36
39
|
private
|
37
40
|
|
38
|
-
def method_missing(*args)
|
39
|
-
@dep.send(*args)
|
41
|
+
def method_missing(*args, &blk)
|
42
|
+
@dep.send(*args, &blk)
|
40
43
|
end
|
41
|
-
|
42
44
|
end
|
43
45
|
end
|