2018-11-02 19:07:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Bundler
|
|
|
|
class Resolver
|
2019-06-01 05:49:40 -04:00
|
|
|
require_relative "vendored_molinillo"
|
|
|
|
require_relative "resolver/spec_group"
|
2018-11-02 19:07:56 -04:00
|
|
|
|
2021-02-01 10:17:16 -05:00
|
|
|
include GemHelpers
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
# Figures out the best possible configuration of gems that satisfies
|
|
|
|
# the list of passed dependencies and any child dependencies without
|
|
|
|
# causing any gem activation errors.
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# *dependencies<Gem::Dependency>:: The list of dependencies to resolve
|
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# <GemBundle>,nil:: If the list of dependencies can be resolved, a
|
|
|
|
# collection of gemspecs is returned. Otherwise, nil is returned.
|
2021-02-01 10:17:16 -05:00
|
|
|
def self.resolve(requirements, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
|
2018-11-02 19:07:56 -04:00
|
|
|
base = SpecSet.new(base) unless base.is_a?(SpecSet)
|
2022-05-24 06:18:38 -04:00
|
|
|
metadata_requirements, regular_requirements = requirements.partition {|dep| dep.name.end_with?("\0") }
|
|
|
|
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
|
2018-11-02 19:07:56 -04:00
|
|
|
result = resolver.start(requirements)
|
2022-05-24 06:18:38 -04:00
|
|
|
SpecSet.new(SpecSet.new(result).for(regular_requirements))
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
2022-05-24 06:18:38 -04:00
|
|
|
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
|
2018-11-02 19:07:56 -04:00
|
|
|
@source_requirements = source_requirements
|
2022-05-24 06:18:38 -04:00
|
|
|
@metadata_requirements = metadata_requirements
|
2018-11-02 19:07:56 -04:00
|
|
|
@base = base
|
|
|
|
@resolver = Molinillo::Resolver.new(self, self)
|
|
|
|
@search_for = {}
|
|
|
|
@base_dg = Molinillo::DependencyGraph.new
|
|
|
|
@base.each do |ls|
|
|
|
|
dep = Dependency.new(ls.name, ls.version)
|
2021-02-01 10:17:16 -05:00
|
|
|
@base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
additional_base_requirements.each {|d| @base_dg.add_vertex(d.name, d) }
|
2021-02-01 10:17:16 -05:00
|
|
|
@platforms = platforms.reject {|p| p != Gem::Platform::RUBY && (platforms - [p]).any? {|pl| generic(pl) == p } }
|
|
|
|
@resolving_only_for_ruby = platforms == [Gem::Platform::RUBY]
|
2018-11-02 19:07:56 -04:00
|
|
|
@gem_version_promoter = gem_version_promoter
|
|
|
|
@use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
|
|
|
|
end
|
|
|
|
|
|
|
|
def start(requirements)
|
|
|
|
@gem_version_promoter.prerelease_specified = @prerelease_specified = {}
|
|
|
|
requirements.each {|dep| @prerelease_specified[dep.name] ||= dep.prerelease? }
|
|
|
|
|
|
|
|
verify_gemfile_dependencies_are_found!(requirements)
|
|
|
|
dg = @resolver.resolve(requirements, @base_dg)
|
2019-04-14 02:01:35 -04:00
|
|
|
dg.
|
|
|
|
map(&:payload).
|
2018-11-02 19:07:56 -04:00
|
|
|
reject {|sg| sg.name.end_with?("\0") }.
|
2019-04-14 02:01:35 -04:00
|
|
|
map(&:to_specs).
|
|
|
|
flatten
|
2018-11-02 19:07:56 -04:00
|
|
|
rescue Molinillo::VersionConflict => e
|
|
|
|
message = version_conflict_message(e)
|
|
|
|
raise VersionConflict.new(e.conflicts.keys.uniq, message)
|
|
|
|
rescue Molinillo::CircularDependencyError => e
|
|
|
|
names = e.dependencies.sort_by(&:name).map {|d| "gem '#{d.name}'" }
|
|
|
|
raise CyclicDependencyError, "Your bundle requires gems that depend" \
|
|
|
|
" on each other, creating an infinite loop. Please remove" \
|
|
|
|
" #{names.count > 1 ? "either " : ""}#{names.join(" or ")}" \
|
|
|
|
" and try again."
|
|
|
|
end
|
|
|
|
|
|
|
|
include Molinillo::UI
|
|
|
|
|
|
|
|
# Conveys debug information to the user.
|
|
|
|
#
|
|
|
|
# @param [Integer] depth the current depth of the resolution process.
|
|
|
|
# @return [void]
|
|
|
|
def debug(depth = 0)
|
|
|
|
return unless debug?
|
|
|
|
debug_info = yield
|
|
|
|
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
2021-02-01 10:17:16 -05:00
|
|
|
puts debug_info.split("\n").map {|s| depth == 0 ? "BUNDLER: #{s}" : "BUNDLER(#{depth}): #{s}" }
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def debug?
|
|
|
|
return @debug_mode if defined?(@debug_mode)
|
2020-05-08 01:19:04 -04:00
|
|
|
@debug_mode =
|
|
|
|
ENV["BUNDLER_DEBUG_RESOLVER"] ||
|
|
|
|
ENV["BUNDLER_DEBUG_RESOLVER_TREE"] ||
|
|
|
|
ENV["DEBUG_RESOLVER"] ||
|
|
|
|
ENV["DEBUG_RESOLVER_TREE"] ||
|
|
|
|
false
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def before_resolution
|
|
|
|
Bundler.ui.info "Resolving dependencies...", debug?
|
|
|
|
end
|
|
|
|
|
|
|
|
def after_resolution
|
|
|
|
Bundler.ui.info ""
|
|
|
|
end
|
|
|
|
|
|
|
|
def indicate_progress
|
|
|
|
Bundler.ui.info ".", false unless debug?
|
|
|
|
end
|
|
|
|
|
|
|
|
include Molinillo::SpecificationProvider
|
|
|
|
|
|
|
|
def dependencies_for(specification)
|
2021-04-21 07:54:29 -04:00
|
|
|
specification.dependencies_for_activated_platforms
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
2020-12-14 18:32:54 -05:00
|
|
|
def search_for(dependency_proxy)
|
|
|
|
platform = dependency_proxy.__platform
|
|
|
|
dependency = dependency_proxy.dep
|
2021-02-01 10:17:16 -05:00
|
|
|
name = dependency.name
|
2021-04-21 07:54:29 -04:00
|
|
|
@search_for[dependency_proxy] ||= begin
|
2021-02-01 10:17:16 -05:00
|
|
|
results = results_for(dependency, @base[name])
|
2018-11-02 19:07:56 -04:00
|
|
|
|
2020-12-14 18:32:54 -05:00
|
|
|
if vertex = @base_dg.vertex_named(name)
|
2018-11-02 19:07:56 -04:00
|
|
|
locked_requirement = vertex.payload.requirement
|
|
|
|
end
|
|
|
|
|
2020-12-14 18:32:54 -05:00
|
|
|
if !@prerelease_specified[name] && (!@use_gvp || locked_requirement.nil?)
|
2018-11-02 19:07:56 -04:00
|
|
|
# Move prereleases to the beginning of the list, so they're considered
|
|
|
|
# last during resolution.
|
|
|
|
pre, results = results.partition {|spec| spec.version.prerelease? }
|
|
|
|
results = pre + results
|
|
|
|
end
|
|
|
|
|
|
|
|
spec_groups = if results.any?
|
|
|
|
nested = []
|
|
|
|
results.each do |spec|
|
|
|
|
version, specs = nested.last
|
|
|
|
if version == spec.version
|
|
|
|
specs << spec
|
|
|
|
else
|
|
|
|
nested << [spec.version, [spec]]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
nested.reduce([]) do |groups, (version, specs)|
|
|
|
|
next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
|
2021-12-14 08:29:04 -05:00
|
|
|
next groups unless specs.any? {|spec| spec.match_platform(platform) }
|
2021-02-01 10:17:16 -05:00
|
|
|
|
|
|
|
specs_by_platform = Hash.new do |current_specs, current_platform|
|
|
|
|
current_specs[current_platform] = select_best_platform_match(specs, current_platform)
|
|
|
|
end
|
|
|
|
|
|
|
|
spec_group_ruby = SpecGroup.create_for(specs_by_platform, [Gem::Platform::RUBY], Gem::Platform::RUBY)
|
|
|
|
groups << spec_group_ruby if spec_group_ruby
|
|
|
|
|
|
|
|
next groups if @resolving_only_for_ruby
|
|
|
|
|
|
|
|
spec_group = SpecGroup.create_for(specs_by_platform, @platforms, platform)
|
2021-12-14 08:29:04 -05:00
|
|
|
groups << spec_group
|
2021-02-01 10:17:16 -05:00
|
|
|
|
|
|
|
groups
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
else
|
|
|
|
[]
|
|
|
|
end
|
|
|
|
# GVP handles major itself, but it's still a bit risky to trust it with it
|
|
|
|
# until we get it settled with new behavior. For 2.x it can take over all cases.
|
2021-02-01 10:17:16 -05:00
|
|
|
if !@use_gvp
|
2018-11-02 19:07:56 -04:00
|
|
|
spec_groups
|
|
|
|
else
|
|
|
|
@gem_version_promoter.sort_versions(dependency, spec_groups)
|
|
|
|
end
|
2021-02-01 10:17:16 -05:00
|
|
|
end
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def index_for(dependency)
|
2021-05-28 06:47:49 -04:00
|
|
|
source_for(dependency.name).specs
|
|
|
|
end
|
|
|
|
|
|
|
|
def source_for(name)
|
|
|
|
@source_requirements[name] || @source_requirements[:default]
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
2021-02-01 10:17:16 -05:00
|
|
|
def results_for(dependency, base)
|
|
|
|
index_for(dependency).search(dependency, base)
|
|
|
|
end
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
def name_for(dependency)
|
|
|
|
dependency.name
|
|
|
|
end
|
|
|
|
|
|
|
|
def name_for_explicit_dependency_source
|
|
|
|
Bundler.default_gemfile.basename.to_s
|
2019-04-14 02:01:35 -04:00
|
|
|
rescue StandardError
|
2018-11-02 19:07:56 -04:00
|
|
|
"Gemfile"
|
|
|
|
end
|
|
|
|
|
|
|
|
def name_for_locking_dependency_source
|
|
|
|
Bundler.default_lockfile.basename.to_s
|
2019-04-14 02:01:35 -04:00
|
|
|
rescue StandardError
|
2018-11-02 19:07:56 -04:00
|
|
|
"Gemfile.lock"
|
|
|
|
end
|
|
|
|
|
|
|
|
def requirement_satisfied_by?(requirement, activated, spec)
|
2020-05-08 01:19:04 -04:00
|
|
|
requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
2021-02-01 10:17:16 -05:00
|
|
|
def dependencies_equal?(dependencies, other_dependencies)
|
|
|
|
dependencies.map(&:dep) == other_dependencies.map(&:dep)
|
|
|
|
end
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
def sort_dependencies(dependencies, activated, conflicts)
|
|
|
|
dependencies.sort_by do |dependency|
|
|
|
|
name = name_for(dependency)
|
|
|
|
vertex = activated.vertex_named(name)
|
|
|
|
[
|
|
|
|
@base_dg.vertex_named(name) ? 0 : 1,
|
|
|
|
vertex.payload ? 0 : 1,
|
|
|
|
vertex.root? ? 0 : 1,
|
|
|
|
amount_constrained(dependency),
|
|
|
|
conflicts[name] ? 0 : 1,
|
|
|
|
vertex.payload ? 0 : search_for(dependency).count,
|
|
|
|
self.class.platform_sort_key(dependency.__platform),
|
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.platform_sort_key(platform)
|
2020-05-08 01:19:04 -04:00
|
|
|
# Prefer specific platform to not specific platform
|
|
|
|
return ["99-LAST", "", "", ""] if Gem::Platform::RUBY == platform
|
|
|
|
["00", *platform.to_a.map {|part| part || "" }]
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
2020-10-15 00:20:25 -04:00
|
|
|
private
|
2018-11-02 19:07:56 -04:00
|
|
|
|
|
|
|
# returns an integer \in (-\infty, 0]
|
|
|
|
# a number closer to 0 means the dependency is less constraining
|
|
|
|
#
|
|
|
|
# dependencies w/ 0 or 1 possibilities (ignoring version requirements)
|
|
|
|
# are given very negative values, so they _always_ sort first,
|
|
|
|
# before dependencies that are unconstrained
|
|
|
|
def amount_constrained(dependency)
|
|
|
|
@amount_constrained ||= {}
|
2022-06-23 05:22:36 -04:00
|
|
|
@amount_constrained[dependency.name] ||= if (base = @base[dependency.name]) && !base.empty?
|
|
|
|
dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1
|
|
|
|
else
|
|
|
|
all = index_for(dependency).search(dependency.name).size
|
|
|
|
|
|
|
|
if all <= 1
|
|
|
|
all - 1_000_000
|
2018-11-02 19:07:56 -04:00
|
|
|
else
|
2022-06-23 05:22:36 -04:00
|
|
|
search = search_for(dependency)
|
|
|
|
search = @prerelease_specified[dependency.name] ? search.count : search.count {|s| !s.version.prerelease? }
|
|
|
|
search - all
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def verify_gemfile_dependencies_are_found!(requirements)
|
2022-01-31 11:45:12 -05:00
|
|
|
requirements.map! do |requirement|
|
2018-11-02 19:07:56 -04:00
|
|
|
name = requirement.name
|
2022-01-31 11:45:12 -05:00
|
|
|
next requirement if name == "bundler"
|
|
|
|
next requirement unless search_for(requirement).empty?
|
|
|
|
next unless requirement.current_platform?
|
2018-11-02 19:07:56 -04:00
|
|
|
|
|
|
|
if (base = @base[name]) && !base.empty?
|
|
|
|
version = base.first.version
|
|
|
|
message = "You have requested:\n" \
|
|
|
|
" #{name} #{requirement.requirement}\n\n" \
|
|
|
|
"The bundle currently has #{name} locked at #{version}.\n" \
|
|
|
|
"Try running `bundle update #{name}`\n\n" \
|
|
|
|
"If you are updating multiple gems in your Gemfile at once,\n" \
|
|
|
|
"try passing them all to `bundle update`"
|
2021-07-31 07:33:08 -04:00
|
|
|
else
|
2021-12-15 06:41:28 -05:00
|
|
|
message = gem_not_found_message(name, requirement, source_for(name))
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
raise GemNotFound, message
|
2022-01-31 11:45:12 -05:00
|
|
|
end.compact!
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
2021-12-15 06:41:28 -05:00
|
|
|
def gem_not_found_message(name, requirement, source, extra_message = "")
|
|
|
|
specs = source.specs.search(name)
|
|
|
|
matching_part = name
|
|
|
|
requirement_label = SharedHelpers.pretty_dependency(requirement)
|
|
|
|
cache_message = begin
|
|
|
|
" or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
|
|
|
|
rescue GemfileNotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
specs_matching_requirement = specs.select {| spec| requirement.matches_spec?(spec) }
|
|
|
|
|
|
|
|
if specs_matching_requirement.any?
|
|
|
|
specs = specs_matching_requirement
|
|
|
|
matching_part = requirement_label
|
|
|
|
requirement_label = "#{requirement_label} #{requirement.__platform}"
|
|
|
|
end
|
|
|
|
|
|
|
|
message = String.new("Could not find gem '#{requirement_label}'#{extra_message} in #{source}#{cache_message}.\n")
|
2021-12-15 07:28:50 -05:00
|
|
|
|
|
|
|
if specs.any?
|
|
|
|
message << "\nThe source contains the following gems matching '#{matching_part}':\n"
|
|
|
|
message << specs.map {|s| " * #{s.full_name}" }.join("\n")
|
|
|
|
end
|
|
|
|
|
2021-12-15 06:41:28 -05:00
|
|
|
message
|
|
|
|
end
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
def version_conflict_message(e)
|
2019-04-14 02:01:35 -04:00
|
|
|
# only show essential conflicts, if possible
|
|
|
|
conflicts = e.conflicts.dup
|
2021-02-01 10:17:16 -05:00
|
|
|
|
|
|
|
if conflicts["bundler"]
|
|
|
|
conflicts.replace("bundler" => conflicts["bundler"])
|
|
|
|
else
|
|
|
|
conflicts.delete_if do |_name, conflict|
|
|
|
|
deps = conflict.requirement_trees.map(&:last).flatten(1)
|
|
|
|
!Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
|
|
|
|
end
|
2019-04-14 02:01:35 -04:00
|
|
|
end
|
2021-02-01 10:17:16 -05:00
|
|
|
|
2019-04-14 02:01:35 -04:00
|
|
|
e = Molinillo::VersionConflict.new(conflicts, e.specification_provider) unless conflicts.empty?
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
e.message_with_trees(
|
2022-04-28 04:15:43 -04:00
|
|
|
:full_message_for_conflict => lambda do |name, conflict|
|
|
|
|
o = if name.end_with?("\0")
|
|
|
|
String.new("Bundler found conflicting requirements for the #{name} version:")
|
|
|
|
else
|
|
|
|
String.new("Bundler could not find compatible versions for gem \"#{name}\":")
|
|
|
|
end
|
|
|
|
o << %(\n)
|
|
|
|
if conflict.locked_requirement
|
|
|
|
o << %( In snapshot (#{name_for_locking_dependency_source}):\n)
|
|
|
|
o << %( #{SharedHelpers.pretty_dependency(conflict.locked_requirement)}\n)
|
|
|
|
o << %(\n)
|
|
|
|
end
|
|
|
|
o << %( In #{name_for_explicit_dependency_source}:\n)
|
|
|
|
trees = conflict.requirement_trees
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
# called first, because we want to reduce the amount of work required to find maximal empty sets
|
|
|
|
trees = trees.uniq {|t| t.flatten.map {|dep| [dep.name, dep.requirement] } }
|
|
|
|
|
|
|
|
# bail out if tree size is too big for Array#combination to make any sense
|
2022-04-28 04:15:43 -04:00
|
|
|
if trees.size <= 15
|
|
|
|
maximal = 1.upto(trees.size).map do |size|
|
|
|
|
trees.map(&:last).flatten(1).combination(size).to_a
|
|
|
|
end.flatten(1).select do |deps|
|
|
|
|
Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
|
|
|
|
end.min_by(&:size)
|
|
|
|
|
|
|
|
trees.reject! {|t| !maximal.include?(t.last) } if maximal
|
|
|
|
|
|
|
|
trees.sort_by! {|t| t.reverse.map(&:name) }
|
|
|
|
end
|
|
|
|
|
|
|
|
o << trees.map do |tree|
|
|
|
|
t = "".dup
|
|
|
|
depth = 2
|
|
|
|
|
|
|
|
base_tree = tree.first
|
|
|
|
base_tree_name = base_tree.name
|
|
|
|
|
|
|
|
if base_tree_name.end_with?("\0")
|
|
|
|
t = nil
|
|
|
|
else
|
|
|
|
tree.each do |req|
|
|
|
|
t << " " * depth << SharedHelpers.pretty_dependency(req)
|
|
|
|
unless tree.last == req
|
|
|
|
if spec = conflict.activated_by_name[req.name]
|
|
|
|
t << %( was resolved to #{spec.version}, which)
|
|
|
|
end
|
|
|
|
t << %( depends on)
|
|
|
|
end
|
|
|
|
t << %(\n)
|
|
|
|
depth += 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
t
|
|
|
|
end.compact.join("\n")
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
if name == "bundler"
|
|
|
|
o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
|
|
|
|
|
2021-02-01 10:17:16 -05:00
|
|
|
conflict_dependency = conflict.requirement
|
|
|
|
conflict_requirement = conflict_dependency.requirement
|
|
|
|
other_bundler_required = !conflict_requirement.satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
|
|
|
|
|
|
|
if other_bundler_required
|
|
|
|
o << "\n\n"
|
|
|
|
|
2021-05-28 06:47:49 -04:00
|
|
|
candidate_specs = source_for(:default_bundler).specs.search(conflict_dependency)
|
2021-02-01 10:17:16 -05:00
|
|
|
if candidate_specs.any?
|
|
|
|
target_version = candidate_specs.last.version
|
|
|
|
new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
|
|
|
|
o << "Your bundle requires a different version of Bundler than the one you're running.\n"
|
|
|
|
o << "Install the necessary version with `gem install bundler:#{target_version}` and rerun bundler using `#{new_command}`\n"
|
|
|
|
else
|
|
|
|
o << "Your bundle requires a different version of Bundler than the one you're running, and that version could not be found.\n"
|
|
|
|
end
|
|
|
|
end
|
2022-04-28 04:15:43 -04:00
|
|
|
elsif name.end_with?("\0")
|
2022-05-24 06:18:38 -04:00
|
|
|
o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(@metadata_requirements.find {|req| req.name == name })}\n\n)
|
2021-02-01 10:17:16 -05:00
|
|
|
elsif conflict.locked_requirement
|
2018-11-02 19:07:56 -04:00
|
|
|
o << "\n"
|
2022-05-29 10:47:22 -04:00
|
|
|
o << %(Deleting your #{name_for_locking_dependency_source} file and running `bundle install` will rebuild your snapshot from scratch, using only\n)
|
2018-11-02 19:07:56 -04:00
|
|
|
o << %(the gems in your Gemfile, which may resolve the conflict.\n)
|
2022-04-28 04:15:43 -04:00
|
|
|
elsif !conflict.existing
|
2018-11-02 19:07:56 -04:00
|
|
|
o << "\n"
|
|
|
|
|
2021-05-28 06:47:49 -04:00
|
|
|
relevant_source = conflict.requirement.source || source_for(name)
|
2018-11-02 19:07:56 -04:00
|
|
|
|
2021-12-15 06:41:28 -05:00
|
|
|
extra_message = if conflict.requirement_trees.first.size > 1
|
|
|
|
", which is required by gem '#{SharedHelpers.pretty_dependency(conflict.requirement_trees.first[-2])}',"
|
|
|
|
else
|
|
|
|
""
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
2022-01-18 23:28:23 -05:00
|
|
|
o << gem_not_found_message(name, conflict.requirement, relevant_source, extra_message)
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
2022-04-28 04:15:43 -04:00
|
|
|
|
|
|
|
o
|
2019-04-14 02:01:35 -04:00
|
|
|
end
|
2018-11-02 19:07:56 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|