bundler 2.3.11 → 2.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/lib/bundler/build_metadata.rb +2 -2
  4. data/lib/bundler/cli/common.rb +1 -1
  5. data/lib/bundler/current_ruby.rb +1 -0
  6. data/lib/bundler/definition.rb +18 -31
  7. data/lib/bundler/dependency.rb +18 -0
  8. data/lib/bundler/dsl.rb +1 -1
  9. data/lib/bundler/endpoint_specification.rb +4 -1
  10. data/lib/bundler/gem_helpers.rb +1 -1
  11. data/lib/bundler/installer/gem_installer.rb +14 -1
  12. data/lib/bundler/installer.rb +1 -1
  13. data/lib/bundler/lazy_specification.rb +1 -1
  14. data/lib/bundler/man/bundle-add.1 +7 -3
  15. data/lib/bundler/man/bundle-add.1.ronn +5 -2
  16. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  17. data/lib/bundler/man/bundle-cache.1 +1 -1
  18. data/lib/bundler/man/bundle-check.1 +1 -1
  19. data/lib/bundler/man/bundle-clean.1 +1 -1
  20. data/lib/bundler/man/bundle-config.1 +1 -1
  21. data/lib/bundler/man/bundle-doctor.1 +1 -1
  22. data/lib/bundler/man/bundle-exec.1 +1 -1
  23. data/lib/bundler/man/bundle-gem.1 +1 -1
  24. data/lib/bundler/man/bundle-info.1 +1 -1
  25. data/lib/bundler/man/bundle-init.1 +1 -1
  26. data/lib/bundler/man/bundle-inject.1 +1 -1
  27. data/lib/bundler/man/bundle-install.1 +1 -1
  28. data/lib/bundler/man/bundle-list.1 +1 -1
  29. data/lib/bundler/man/bundle-lock.1 +1 -1
  30. data/lib/bundler/man/bundle-open.1 +1 -1
  31. data/lib/bundler/man/bundle-outdated.1 +1 -1
  32. data/lib/bundler/man/bundle-platform.1 +1 -1
  33. data/lib/bundler/man/bundle-pristine.1 +1 -1
  34. data/lib/bundler/man/bundle-remove.1 +1 -1
  35. data/lib/bundler/man/bundle-show.1 +1 -1
  36. data/lib/bundler/man/bundle-update.1 +1 -1
  37. data/lib/bundler/man/bundle-viz.1 +1 -1
  38. data/lib/bundler/man/bundle.1 +1 -1
  39. data/lib/bundler/man/gemfile.5 +1 -1
  40. data/lib/bundler/plugin/installer/git.rb +0 -4
  41. data/lib/bundler/plugin/installer/rubygems.rb +0 -4
  42. data/lib/bundler/resolver/spec_group.rb +2 -2
  43. data/lib/bundler/resolver.rb +61 -28
  44. data/lib/bundler/ruby_version.rb +0 -13
  45. data/lib/bundler/rubygems_ext.rb +18 -1
  46. data/lib/bundler/shared_helpers.rb +5 -5
  47. data/lib/bundler/source/git.rb +2 -2
  48. data/lib/bundler/source/metadata.rb +1 -1
  49. data/lib/bundler/source/path.rb +1 -1
  50. data/lib/bundler/source/rubygems.rb +13 -10
  51. data/lib/bundler/source.rb +3 -4
  52. data/lib/bundler/spec_set.rb +5 -3
  53. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +1 -1
  54. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +32 -26
  55. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  56. data/lib/bundler/vendor/tsort/lib/tsort.rb +318 -319
  57. data/lib/bundler/version.rb +1 -1
  58. data/lib/bundler.rb +1 -1
  59. metadata +3 -3
@@ -4,10 +4,6 @@ module Bundler
4
4
  module Plugin
5
5
  class Installer
6
6
  class Rubygems < Bundler::Source::Rubygems
7
- def version_message(spec)
8
- "#{spec.name} #{spec.version}"
9
- end
10
-
11
7
  private
12
8
 
13
9
  def requires_sudo?
@@ -97,10 +97,10 @@ module Bundler
97
97
  spec = @specs[platform].first
98
98
  return [] if spec.is_a?(LazySpecification)
99
99
  dependencies = []
100
- if !spec.required_ruby_version.nil? && !spec.required_ruby_version.none?
100
+ unless spec.required_ruby_version.none?
101
101
  dependencies << DepProxy.get_proxy(Gem::Dependency.new("Ruby\0", spec.required_ruby_version), platform)
102
102
  end
103
- if !spec.required_rubygems_version.nil? && !spec.required_rubygems_version.none?
103
+ unless spec.required_rubygems_version.none?
104
104
  dependencies << DepProxy.get_proxy(Gem::Dependency.new("RubyGems\0", spec.required_rubygems_version), platform)
105
105
  end
106
106
  dependencies
@@ -21,7 +21,7 @@ module Bundler
21
21
  base = SpecSet.new(base) unless base.is_a?(SpecSet)
22
22
  resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
23
23
  result = resolver.start(requirements)
24
- SpecSet.new(SpecSet.new(result).for(requirements.reject{|dep| dep.name.end_with?("\0") }))
24
+ SpecSet.new(SpecSet.new(result).for(requirements.reject {|dep| dep.name.end_with?("\0") }))
25
25
  end
26
26
 
27
27
  def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
@@ -312,29 +312,66 @@ module Bundler
312
312
 
313
313
  e = Molinillo::VersionConflict.new(conflicts, e.specification_provider) unless conflicts.empty?
314
314
 
315
- solver_name = "Bundler"
316
- possibility_type = "gem"
317
315
  e.message_with_trees(
318
- :solver_name => solver_name,
319
- :possibility_type => possibility_type,
320
- :reduce_trees => lambda do |trees|
316
+ :full_message_for_conflict => lambda do |name, conflict|
317
+ o = if name.end_with?("\0")
318
+ String.new("Bundler found conflicting requirements for the #{name} version:")
319
+ else
320
+ String.new("Bundler could not find compatible versions for gem \"#{name}\":")
321
+ end
322
+ o << %(\n)
323
+ if conflict.locked_requirement
324
+ o << %( In snapshot (#{name_for_locking_dependency_source}):\n)
325
+ o << %( #{SharedHelpers.pretty_dependency(conflict.locked_requirement)}\n)
326
+ o << %(\n)
327
+ end
328
+ o << %( In #{name_for_explicit_dependency_source}:\n)
329
+ trees = conflict.requirement_trees
330
+
321
331
  # called first, because we want to reduce the amount of work required to find maximal empty sets
322
332
  trees = trees.uniq {|t| t.flatten.map {|dep| [dep.name, dep.requirement] } }
323
333
 
324
334
  # bail out if tree size is too big for Array#combination to make any sense
325
- return trees if trees.size > 15
326
- maximal = 1.upto(trees.size).map do |size|
327
- trees.map(&:last).flatten(1).combination(size).to_a
328
- end.flatten(1).select do |deps|
329
- Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
330
- end.min_by(&:size)
331
-
332
- trees.reject! {|t| !maximal.include?(t.last) } if maximal
333
-
334
- trees.sort_by {|t| t.reverse.map(&:name) }
335
- end,
336
- :printable_requirement => lambda {|req| SharedHelpers.pretty_dependency(req) },
337
- :additional_message_for_conflict => lambda do |o, name, conflict|
335
+ if trees.size <= 15
336
+ maximal = 1.upto(trees.size).map do |size|
337
+ trees.map(&:last).flatten(1).combination(size).to_a
338
+ end.flatten(1).select do |deps|
339
+ Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
340
+ end.min_by(&:size)
341
+
342
+ trees.reject! {|t| !maximal.include?(t.last) } if maximal
343
+
344
+ trees.sort_by! {|t| t.reverse.map(&:name) }
345
+ end
346
+
347
+ metadata_requirements = {}
348
+
349
+ o << trees.map do |tree|
350
+ t = "".dup
351
+ depth = 2
352
+
353
+ base_tree = tree.first
354
+ base_tree_name = base_tree.name
355
+
356
+ if base_tree_name.end_with?("\0")
357
+ metadata_requirements[base_tree_name] = base_tree
358
+ t = nil
359
+ else
360
+ tree.each do |req|
361
+ t << " " * depth << SharedHelpers.pretty_dependency(req)
362
+ unless tree.last == req
363
+ if spec = conflict.activated_by_name[req.name]
364
+ t << %( was resolved to #{spec.version}, which)
365
+ end
366
+ t << %( depends on)
367
+ end
368
+ t << %(\n)
369
+ depth += 1
370
+ end
371
+ end
372
+ t
373
+ end.compact.join("\n")
374
+
338
375
  if name == "bundler"
339
376
  o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
340
377
 
@@ -355,11 +392,13 @@ module Bundler
355
392
  o << "Your bundle requires a different version of Bundler than the one you're running, and that version could not be found.\n"
356
393
  end
357
394
  end
395
+ elsif name.end_with?("\0")
396
+ o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(metadata_requirements[name])}\n\n)
358
397
  elsif conflict.locked_requirement
359
398
  o << "\n"
360
399
  o << %(Running `bundle update` will rebuild your snapshot from scratch, using only\n)
361
400
  o << %(the gems in your Gemfile, which may resolve the conflict.\n)
362
- elsif !conflict.existing && !name.end_with?("\0")
401
+ elsif !conflict.existing
363
402
  o << "\n"
364
403
 
365
404
  relevant_source = conflict.requirement.source || source_for(name)
@@ -372,14 +411,8 @@ module Bundler
372
411
 
373
412
  o << gem_not_found_message(name, conflict.requirement, relevant_source, extra_message)
374
413
  end
375
- end,
376
- :version_for_spec => lambda {|spec| spec.version },
377
- :incompatible_version_message_for_conflict => lambda do |name, _conflict|
378
- if name.end_with?("\0")
379
- %(#{solver_name} found conflicting requirements for the #{name} version:)
380
- else
381
- %(#{solver_name} could not find compatible versions for #{possibility_type} "#{name}":)
382
- end
414
+
415
+ o
383
416
  end
384
417
  )
385
418
  end
@@ -110,19 +110,6 @@ module Bundler
110
110
  @ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
111
111
  end
112
112
 
113
- def to_gem_version_with_patchlevel
114
- @gem_version_with_patch ||= begin
115
- Gem::Version.create("#{@gem_version}.#{@patchlevel}")
116
- rescue ArgumentError
117
- @gem_version
118
- end
119
- end
120
-
121
- def exact?
122
- return @exact if defined?(@exact)
123
- @exact = versions.all? {|v| Gem::Requirement.create(v).exact? }
124
- end
125
-
126
113
  private
127
114
 
128
115
  def matches?(requirements, version)
@@ -34,7 +34,7 @@ module Gem
34
34
 
35
35
  def full_gem_path
36
36
  if source.respond_to?(:root)
37
- Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
37
+ Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
38
38
  else
39
39
  rg_full_gem_path
40
40
  end
@@ -67,6 +67,23 @@ module Gem
67
67
  full_gem_path
68
68
  end
69
69
 
70
+ unless const_defined?(:LATEST_RUBY_WITHOUT_PATCH_VERSIONS)
71
+ LATEST_RUBY_WITHOUT_PATCH_VERSIONS = Gem::Version.new("2.1")
72
+
73
+ alias_method :rg_required_ruby_version=, :required_ruby_version=
74
+ def required_ruby_version=(req)
75
+ self.rg_required_ruby_version = req
76
+
77
+ @required_ruby_version.requirements.map! do |op, v|
78
+ if v >= LATEST_RUBY_WITHOUT_PATCH_VERSIONS && v.release.segments.size == 4
79
+ [op == "~>" ? "=" : op, Gem::Version.new(v.segments.tap {|s| s.delete_at(3) }.join("."))]
80
+ else
81
+ [op, v]
82
+ end
83
+ end
84
+ end
85
+ end
86
+
70
87
  def groups
71
88
  @groups ||= []
72
89
  end
@@ -13,13 +13,13 @@ module Bundler
13
13
  def root
14
14
  gemfile = find_gemfile
15
15
  raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
16
- Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
16
+ Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
17
17
  end
18
18
 
19
19
  def default_gemfile
20
20
  gemfile = find_gemfile
21
21
  raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
22
- Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
22
+ Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
23
23
  end
24
24
 
25
25
  def default_lockfile
@@ -28,7 +28,7 @@ module Bundler
28
28
  case gemfile.basename.to_s
29
29
  when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
30
30
  else Pathname.new("#{gemfile}.lock")
31
- end.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
31
+ end.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
32
32
  end
33
33
 
34
34
  def default_bundle_dir
@@ -100,7 +100,7 @@ module Bundler
100
100
  #
101
101
  # @see {Bundler::PermissionError}
102
102
  def filesystem_access(path, action = :write, &block)
103
- yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" })
103
+ yield(path.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" })
104
104
  rescue Errno::EACCES
105
105
  raise PermissionError.new(path, action)
106
106
  rescue Errno::EAGAIN
@@ -236,7 +236,7 @@ module Bundler
236
236
 
237
237
  def search_up(*names)
238
238
  previous = nil
239
- current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
239
+ current = File.expand_path(SharedHelpers.pwd).tap {|x| x.untaint if RUBY_VERSION < "2.7" }
240
240
 
241
241
  until !File.directory?(current) || current == previous
242
242
  if ENV["BUNDLER_SPEC_RUN"]
@@ -181,7 +181,7 @@ module Bundler
181
181
  def install(spec, options = {})
182
182
  force = options[:force]
183
183
 
184
- print_using_message "Using #{version_message(spec)} from #{self}"
184
+ print_using_message "Using #{version_message(spec, options[:previous_spec])} from #{self}"
185
185
 
186
186
  if (requires_checkout? && !@copied) || force
187
187
  Bundler.ui.debug " * Checking out revision: #{ref}"
@@ -336,7 +336,7 @@ module Bundler
336
336
 
337
337
  def load_gemspec(file)
338
338
  stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
339
- stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
339
+ stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
340
340
  StubSpecification.from_stub(stub)
341
341
  end
342
342
 
@@ -5,7 +5,7 @@ module Bundler
5
5
  class Metadata < Source
6
6
  def specs
7
7
  @specs ||= Index.build do |idx|
8
- idx << Gem::Specification.new("Ruby\0", RubyVersion.system.to_gem_version_with_patchlevel)
8
+ idx << Gem::Specification.new("Ruby\0", RubyVersion.system.gem_version)
9
9
  idx << Gem::Specification.new("RubyGems\0", Gem::VERSION) do |s|
10
10
  s.required_rubygems_version = Gem::Requirement.default
11
11
  end
@@ -82,7 +82,7 @@ module Bundler
82
82
  end
83
83
 
84
84
  def install(spec, options = {})
85
- using_message = "Using #{version_message(spec)} from #{self}"
85
+ using_message = "Using #{version_message(spec, options[:previous_spec])} from #{self}"
86
86
  using_message += " and installing its executables" unless spec.executables.empty?
87
87
  print_using_message using_message
88
88
  generate_bin(spec, :disable_extensions => true)
@@ -135,9 +135,9 @@ module Bundler
135
135
  end
136
136
  end
137
137
 
138
- def install(spec, opts = {})
139
- force = opts[:force]
140
- ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]
138
+ def install(spec, options = {})
139
+ force = options[:force]
140
+ ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached]
141
141
 
142
142
  if ensure_builtin_gems_cached && spec.default_gem?
143
143
  if !cached_path(spec)
@@ -162,7 +162,7 @@ module Bundler
162
162
  uris.uniq!
163
163
  Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
164
164
 
165
- path = fetch_gem(spec)
165
+ path = fetch_gem(spec, options[:previous_spec])
166
166
  begin
167
167
  s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
168
168
  spec.__swap__(s)
@@ -173,7 +173,7 @@ module Bundler
173
173
  end
174
174
 
175
175
  unless Bundler.settings[:no_install]
176
- message = "Installing #{version_message(spec)}"
176
+ message = "Installing #{version_message(spec, options[:previous_spec])}"
177
177
  message += " with native extensions" if spec.extensions.any?
178
178
  Bundler.ui.confirm message
179
179
 
@@ -198,7 +198,7 @@ module Bundler
198
198
  :ignore_dependencies => true,
199
199
  :wrappers => true,
200
200
  :env_shebang => true,
201
- :build_args => opts[:build_args],
201
+ :build_args => options[:build_args],
202
202
  :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
203
203
  :bundler_extension_cache_path => extension_cache_path(spec)
204
204
  ).install
@@ -458,7 +458,7 @@ module Bundler
458
458
  end
459
459
  end
460
460
 
461
- def fetch_gem(spec)
461
+ def fetch_gem(spec, previous_spec = nil)
462
462
  return false unless spec.remote
463
463
 
464
464
  spec.fetch_platform
@@ -476,7 +476,7 @@ module Bundler
476
476
  SharedHelpers.filesystem_access(download_cache_path) do |p|
477
477
  FileUtils.mkdir_p(p)
478
478
  end
479
- download_gem(spec, download_cache_path)
479
+ download_gem(spec, download_cache_path, previous_spec)
480
480
 
481
481
  if requires_sudo?
482
482
  SharedHelpers.filesystem_access(cache_path) do |p|
@@ -521,9 +521,12 @@ module Bundler
521
521
  # @param [String] download_cache_path
522
522
  # the local directory the .gem will end up in.
523
523
  #
524
- def download_gem(spec, download_cache_path)
524
+ # @param [Specification] previous_spec
525
+ # the spec previously locked
526
+ #
527
+ def download_gem(spec, download_cache_path, previous_spec = nil)
525
528
  uri = spec.remote.uri
526
- Bundler.ui.confirm("Fetching #{version_message(spec)}")
529
+ Bundler.ui.confirm("Fetching #{version_message(spec, previous_spec)}")
527
530
  Bundler.rubygems.download_gem(spec, uri, download_cache_path)
528
531
  end
529
532
 
@@ -15,13 +15,12 @@ module Bundler
15
15
  specs.unmet_dependency_names
16
16
  end
17
17
 
18
- def version_message(spec)
18
+ def version_message(spec, locked_spec = nil)
19
19
  message = "#{spec.name} #{spec.version}"
20
20
  message += " (#{spec.platform})" if spec.platform != Gem::Platform::RUBY && !spec.platform.nil?
21
21
 
22
- if Bundler.locked_gems
23
- locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name }
24
- locked_spec_version = locked_spec.version if locked_spec
22
+ if locked_spec
23
+ locked_spec_version = locked_spec.version
25
24
  if locked_spec_version && spec.version != locked_spec_version
26
25
  message += Bundler.ui.add_color(" (was #{locked_spec_version})", version_color(spec.version, locked_spec_version))
27
26
  end
@@ -18,13 +18,13 @@ module Bundler
18
18
 
19
19
  loop do
20
20
  break unless dep = deps.shift
21
- next if handled.any?{|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
21
+ next if handled.any? {|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
22
22
 
23
23
  handled << dep
24
24
 
25
25
  specs_for_dep = spec_for_dependency(dep, match_current_platform)
26
26
  if specs_for_dep.any?
27
- match_current_platform ? specs += specs_for_dep : specs |= specs_for_dep
27
+ specs.concat(specs_for_dep)
28
28
 
29
29
  specs_for_dep.first.dependencies.each do |d|
30
30
  next if d.type == :development
@@ -40,6 +40,8 @@ module Bundler
40
40
  specs << spec
41
41
  end
42
42
 
43
+ specs.uniq! unless match_current_platform
44
+
43
45
  check ? true : specs
44
46
  end
45
47
 
@@ -172,7 +174,7 @@ module Bundler
172
174
  def spec_for_dependency(dep, match_current_platform)
173
175
  specs_for_platforms = lookup[dep.name]
174
176
  if match_current_platform
175
- GemHelpers.select_best_platform_match(specs_for_platforms.select{|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
177
+ GemHelpers.select_best_platform_match(specs_for_platforms.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
176
178
  else
177
179
  GemHelpers.select_best_platform_match(specs_for_platforms, dep.__platform)
178
180
  end
@@ -32,7 +32,7 @@ module Bundler::Molinillo
32
32
  # all belong to the same graph.
33
33
  # @return [Array<Vertex>] The sorted vertices.
34
34
  def self.tsort(vertices)
35
- TSort.tsort(
35
+ Bundler::TSort.tsort(
36
36
  lambda { |b| vertices.each(&b) },
37
37
  lambda { |v, &b| (v.successors & vertices).each(&b) }
38
38
  )
@@ -107,36 +107,42 @@ module Bundler::Molinillo
107
107
  end
108
108
  end
109
109
 
110
- conflicts.sort.reduce(''.dup) do |o, (name, conflict)|
111
- o << "\n" << incompatible_version_message_for_conflict.call(name, conflict) << "\n"
112
- if conflict.locked_requirement
113
- o << %( In snapshot (#{name_for_locking_dependency_source}):\n)
114
- o << %( #{printable_requirement.call(conflict.locked_requirement)}\n)
115
- o << %(\n)
116
- end
117
- o << %( In #{name_for_explicit_dependency_source}:\n)
118
- trees = reduce_trees.call(conflict.requirement_trees)
119
-
120
- o << trees.map do |tree|
121
- t = ''.dup
122
- depth = 2
123
- tree.each do |req|
124
- t << ' ' * depth << printable_requirement.call(req)
125
- unless tree.last == req
126
- if spec = conflict.activated_by_name[name_for(req)]
127
- t << %( was resolved to #{version_for_spec.call(spec)}, which)
110
+ full_message_for_conflict = opts.delete(:full_message_for_conflict) do
111
+ proc do |name, conflict|
112
+ o = "\n".dup << incompatible_version_message_for_conflict.call(name, conflict) << "\n"
113
+ if conflict.locked_requirement
114
+ o << %( In snapshot (#{name_for_locking_dependency_source}):\n)
115
+ o << %( #{printable_requirement.call(conflict.locked_requirement)}\n)
116
+ o << %(\n)
117
+ end
118
+ o << %( In #{name_for_explicit_dependency_source}:\n)
119
+ trees = reduce_trees.call(conflict.requirement_trees)
120
+
121
+ o << trees.map do |tree|
122
+ t = ''.dup
123
+ depth = 2
124
+ tree.each do |req|
125
+ t << ' ' * depth << printable_requirement.call(req)
126
+ unless tree.last == req
127
+ if spec = conflict.activated_by_name[name_for(req)]
128
+ t << %( was resolved to #{version_for_spec.call(spec)}, which)
129
+ end
130
+ t << %( depends on)
128
131
  end
129
- t << %( depends on)
132
+ t << %(\n)
133
+ depth += 1
130
134
  end
131
- t << %(\n)
132
- depth += 1
133
- end
134
- t
135
- end.join("\n")
135
+ t
136
+ end.join("\n")
136
137
 
137
- additional_message_for_conflict.call(o, name, conflict)
138
+ additional_message_for_conflict.call(o, name, conflict)
138
139
 
139
- o
140
+ o
141
+ end
142
+ end
143
+
144
+ conflicts.sort.reduce(''.dup) do |o, (name, conflict)|
145
+ o << full_message_for_conflict.call(name, conflict)
140
146
  end.strip
141
147
  end
142
148
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Bundler::Molinillo
4
4
  # The version of Bundler::Molinillo.
5
- VERSION = '0.7.0'.freeze
5
+ VERSION = '0.8.0'.freeze
6
6
  end