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/resolver.rb
CHANGED
@@ -1,420 +1,416 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Bundler
|
4
|
+
#
|
5
|
+
# This class implements the interface needed by PubGrub for resolution. It is
|
6
|
+
# equivalent to the `PubGrub::BasicPackageSource` class provided by PubGrub by
|
7
|
+
# default and used by the most simple PubGrub consumers.
|
8
|
+
#
|
4
9
|
class Resolver
|
5
|
-
require_relative "
|
6
|
-
require_relative "resolver/
|
10
|
+
require_relative "vendored_pub_grub"
|
11
|
+
require_relative "resolver/base"
|
12
|
+
require_relative "resolver/candidate"
|
13
|
+
require_relative "resolver/incompatibility"
|
14
|
+
require_relative "resolver/root"
|
7
15
|
|
8
16
|
include GemHelpers
|
9
17
|
|
10
|
-
|
11
|
-
|
12
|
-
# causing any gem activation errors.
|
13
|
-
#
|
14
|
-
# ==== Parameters
|
15
|
-
# *dependencies<Gem::Dependency>:: The list of dependencies to resolve
|
16
|
-
#
|
17
|
-
# ==== Returns
|
18
|
-
# <GemBundle>,nil:: If the list of dependencies can be resolved, a
|
19
|
-
# collection of gemspecs is returned. Otherwise, nil is returned.
|
20
|
-
def self.resolve(requirements, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
|
21
|
-
base = SpecSet.new(base) unless base.is_a?(SpecSet)
|
22
|
-
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
23
|
-
result = resolver.start(requirements)
|
24
|
-
SpecSet.new(SpecSet.new(result).for(requirements.reject{|dep| dep.name.end_with?("\0") }))
|
25
|
-
end
|
26
|
-
|
27
|
-
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
28
|
-
@source_requirements = source_requirements
|
18
|
+
def initialize(base, gem_version_promoter)
|
19
|
+
@source_requirements = base.source_requirements
|
29
20
|
@base = base
|
30
|
-
@resolver = Molinillo::Resolver.new(self, self)
|
31
|
-
@search_for = {}
|
32
|
-
@base_dg = Molinillo::DependencyGraph.new
|
33
|
-
@base.each do |ls|
|
34
|
-
dep = Dependency.new(ls.name, ls.version)
|
35
|
-
@base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
|
36
|
-
end
|
37
|
-
additional_base_requirements.each {|d| @base_dg.add_vertex(d.name, d) }
|
38
|
-
@platforms = platforms.reject {|p| p != Gem::Platform::RUBY && (platforms - [p]).any? {|pl| generic(pl) == p } }
|
39
|
-
@resolving_only_for_ruby = platforms == [Gem::Platform::RUBY]
|
40
21
|
@gem_version_promoter = gem_version_promoter
|
41
|
-
@use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
|
42
22
|
end
|
43
23
|
|
44
|
-
def start
|
45
|
-
@
|
46
|
-
|
47
|
-
|
48
|
-
verify_gemfile_dependencies_are_found!(requirements)
|
49
|
-
dg = @resolver.resolve(requirements, @base_dg)
|
50
|
-
dg.
|
51
|
-
map(&:payload).
|
52
|
-
reject {|sg| sg.name.end_with?("\0") }.
|
53
|
-
map(&:to_specs).
|
54
|
-
flatten
|
55
|
-
rescue Molinillo::VersionConflict => e
|
56
|
-
message = version_conflict_message(e)
|
57
|
-
raise VersionConflict.new(e.conflicts.keys.uniq, message)
|
58
|
-
rescue Molinillo::CircularDependencyError => e
|
59
|
-
names = e.dependencies.sort_by(&:name).map {|d| "gem '#{d.name}'" }
|
60
|
-
raise CyclicDependencyError, "Your bundle requires gems that depend" \
|
61
|
-
" on each other, creating an infinite loop. Please remove" \
|
62
|
-
" #{names.count > 1 ? "either " : ""}#{names.join(" or ")}" \
|
63
|
-
" and try again."
|
64
|
-
end
|
24
|
+
def start
|
25
|
+
@requirements = @base.requirements
|
26
|
+
@packages = @base.packages
|
65
27
|
|
66
|
-
|
67
|
-
|
68
|
-
# Conveys debug information to the user.
|
69
|
-
#
|
70
|
-
# @param [Integer] depth the current depth of the resolution process.
|
71
|
-
# @return [void]
|
72
|
-
def debug(depth = 0)
|
73
|
-
return unless debug?
|
74
|
-
debug_info = yield
|
75
|
-
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
76
|
-
puts debug_info.split("\n").map {|s| depth == 0 ? "BUNDLER: #{s}" : "BUNDLER(#{depth}): #{s}" }
|
77
|
-
end
|
28
|
+
root, logger = setup_solver
|
78
29
|
|
79
|
-
|
80
|
-
return @debug_mode if defined?(@debug_mode)
|
81
|
-
@debug_mode =
|
82
|
-
ENV["BUNDLER_DEBUG_RESOLVER"] ||
|
83
|
-
ENV["BUNDLER_DEBUG_RESOLVER_TREE"] ||
|
84
|
-
ENV["DEBUG_RESOLVER"] ||
|
85
|
-
ENV["DEBUG_RESOLVER_TREE"] ||
|
86
|
-
false
|
87
|
-
end
|
30
|
+
Bundler.ui.info "Resolving dependencies...", true
|
88
31
|
|
89
|
-
|
90
|
-
Bundler.ui.info "Resolving dependencies...", debug?
|
32
|
+
solve_versions(:root => root, :logger => logger)
|
91
33
|
end
|
92
34
|
|
93
|
-
def
|
94
|
-
|
95
|
-
|
35
|
+
def setup_solver
|
36
|
+
root = Resolver::Root.new(name_for_explicit_dependency_source)
|
37
|
+
root_version = Resolver::Candidate.new(0)
|
96
38
|
|
97
|
-
|
98
|
-
|
99
|
-
|
39
|
+
@all_specs = Hash.new do |specs, name|
|
40
|
+
specs[name] = source_for(name).specs.search(name).sort_by {|s| [s.version, s.platform.to_s] }
|
41
|
+
end
|
42
|
+
|
43
|
+
@sorted_versions = Hash.new do |candidates, package|
|
44
|
+
candidates[package] = if package.root?
|
45
|
+
[root_version]
|
46
|
+
else
|
47
|
+
all_versions_for(package).sort
|
48
|
+
end
|
49
|
+
end
|
100
50
|
|
101
|
-
|
51
|
+
root_dependencies = prepare_dependencies(@requirements, @packages)
|
102
52
|
|
103
|
-
|
104
|
-
|
53
|
+
@cached_dependencies = Hash.new do |dependencies, package|
|
54
|
+
dependencies[package] = if package.root?
|
55
|
+
{ root_version => root_dependencies }
|
56
|
+
else
|
57
|
+
Hash.new do |versions, version|
|
58
|
+
versions[version] = to_dependency_hash(version.dependencies, @packages)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
logger = Bundler::UI::Shell.new
|
64
|
+
logger.level = debug? ? "debug" : "warn"
|
65
|
+
|
66
|
+
[root, logger]
|
105
67
|
end
|
106
68
|
|
107
|
-
def
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
69
|
+
def solve_versions(root:, logger:)
|
70
|
+
solver = PubGrub::VersionSolver.new(:source => self, :root => root, :logger => logger)
|
71
|
+
result = solver.solve
|
72
|
+
result.map {|package, version| version.to_specs(package) }.flatten.uniq
|
73
|
+
rescue PubGrub::SolveFailure => e
|
74
|
+
incompatibility = e.incompatibility
|
75
|
+
|
76
|
+
names_to_unlock, names_to_allow_prereleases_for, extended_explanation = find_names_to_relax(incompatibility)
|
77
|
+
|
78
|
+
names_to_relax = names_to_unlock + names_to_allow_prereleases_for
|
113
79
|
|
114
|
-
|
115
|
-
|
80
|
+
if names_to_relax.any?
|
81
|
+
if names_to_unlock.any?
|
82
|
+
Bundler.ui.debug "Found conflicts with locked dependencies. Will retry with #{names_to_unlock.join(", ")} unlocked...", true
|
83
|
+
|
84
|
+
@base.unlock_names(names_to_unlock)
|
116
85
|
end
|
117
86
|
|
118
|
-
if
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
results = pre + results
|
87
|
+
if names_to_allow_prereleases_for.any?
|
88
|
+
Bundler.ui.debug "Found conflicts with dependencies with prereleases. Will retrying considering prereleases for #{names_to_allow_prereleases_for.join(", ")}...", true
|
89
|
+
|
90
|
+
@base.include_prereleases(names_to_allow_prereleases_for)
|
123
91
|
end
|
124
92
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
nested << [spec.version, [spec]]
|
133
|
-
end
|
134
|
-
end
|
135
|
-
nested.reduce([]) do |groups, (version, specs)|
|
136
|
-
next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
|
137
|
-
next groups unless specs.any? {|spec| spec.match_platform(platform) }
|
93
|
+
root, logger = setup_solver
|
94
|
+
|
95
|
+
Bundler.ui.debug "Retrying resolution...", true
|
96
|
+
retry
|
97
|
+
end
|
98
|
+
|
99
|
+
explanation = e.message
|
138
100
|
|
139
|
-
|
140
|
-
|
141
|
-
|
101
|
+
if extended_explanation
|
102
|
+
explanation << "\n\n"
|
103
|
+
explanation << extended_explanation
|
104
|
+
end
|
142
105
|
|
143
|
-
|
144
|
-
|
106
|
+
raise SolveFailure.new(explanation)
|
107
|
+
end
|
145
108
|
|
146
|
-
|
109
|
+
def find_names_to_relax(incompatibility)
|
110
|
+
names_to_unlock = []
|
111
|
+
names_to_allow_prereleases_for = []
|
112
|
+
extended_explanation = nil
|
147
113
|
|
148
|
-
|
149
|
-
|
114
|
+
while incompatibility.conflict?
|
115
|
+
cause = incompatibility.cause
|
116
|
+
incompatibility = cause.incompatibility
|
150
117
|
|
151
|
-
|
118
|
+
incompatibility.terms.each do |term|
|
119
|
+
package = term.package
|
120
|
+
name = package.name
|
121
|
+
|
122
|
+
if base_requirements[name]
|
123
|
+
names_to_unlock << name
|
124
|
+
elsif package.ignores_prereleases?
|
125
|
+
names_to_allow_prereleases_for << name
|
152
126
|
end
|
153
|
-
|
154
|
-
[]
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
if !@use_gvp
|
159
|
-
spec_groups
|
160
|
-
else
|
161
|
-
@gem_version_promoter.sort_versions(dependency, spec_groups)
|
127
|
+
|
128
|
+
no_versions_incompat = [cause.incompatibility, cause.satisfier].find {|incompat| incompat.cause.is_a?(PubGrub::Incompatibility::NoVersions) }
|
129
|
+
next unless no_versions_incompat
|
130
|
+
|
131
|
+
extended_explanation = no_versions_incompat.extended_explanation
|
162
132
|
end
|
163
133
|
end
|
164
|
-
end
|
165
134
|
|
166
|
-
|
167
|
-
source_for(dependency.name).specs
|
135
|
+
[names_to_unlock.uniq, names_to_allow_prereleases_for.uniq, extended_explanation]
|
168
136
|
end
|
169
137
|
|
170
|
-
def
|
171
|
-
|
172
|
-
|
138
|
+
def parse_dependency(package, dependency)
|
139
|
+
range = if repository_for(package).is_a?(Source::Gemspec)
|
140
|
+
PubGrub::VersionRange.any
|
141
|
+
else
|
142
|
+
requirement_to_range(dependency)
|
143
|
+
end
|
173
144
|
|
174
|
-
|
175
|
-
index_for(dependency).search(dependency, base)
|
145
|
+
PubGrub::VersionConstraint.new(package, :range => range)
|
176
146
|
end
|
177
147
|
|
178
|
-
def
|
179
|
-
|
180
|
-
end
|
148
|
+
def versions_for(package, range=VersionRange.any)
|
149
|
+
versions = range.select_versions(@sorted_versions[package])
|
181
150
|
|
182
|
-
|
183
|
-
Bundler.default_gemfile.basename.to_s
|
184
|
-
rescue StandardError
|
185
|
-
"Gemfile"
|
151
|
+
sort_versions(package, versions)
|
186
152
|
end
|
187
153
|
|
188
|
-
def
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
154
|
+
def no_versions_incompatibility_for(package, unsatisfied_term)
|
155
|
+
cause = PubGrub::Incompatibility::NoVersions.new(unsatisfied_term)
|
156
|
+
name = package.name
|
157
|
+
constraint = unsatisfied_term.constraint
|
158
|
+
constraint_string = constraint.constraint_string
|
159
|
+
requirements = constraint_string.split(" OR ").map {|req| Gem::Requirement.new(req.split(",")) }
|
193
160
|
|
194
|
-
|
195
|
-
|
196
|
-
|
161
|
+
if name == "bundler"
|
162
|
+
custom_explanation = "the current Bundler version (#{Bundler::VERSION}) does not satisfy #{constraint}"
|
163
|
+
extended_explanation = bundler_not_found_message(requirements)
|
164
|
+
else
|
165
|
+
specs_matching_other_platforms = filter_matching_specs(@all_specs[name], requirements)
|
197
166
|
|
198
|
-
|
199
|
-
|
200
|
-
end
|
167
|
+
platforms_explanation = specs_matching_other_platforms.any? ? " for any resolution platforms (#{package.platforms.join(", ")})" : ""
|
168
|
+
custom_explanation = "#{constraint} could not be found in #{repository_for(package)}#{platforms_explanation}"
|
201
169
|
|
202
|
-
|
203
|
-
|
204
|
-
name = name_for(dependency)
|
205
|
-
vertex = activated.vertex_named(name)
|
206
|
-
[
|
207
|
-
@base_dg.vertex_named(name) ? 0 : 1,
|
208
|
-
vertex.payload ? 0 : 1,
|
209
|
-
vertex.root? ? 0 : 1,
|
210
|
-
amount_constrained(dependency),
|
211
|
-
conflicts[name] ? 0 : 1,
|
212
|
-
vertex.payload ? 0 : search_for(dependency).count,
|
213
|
-
self.class.platform_sort_key(dependency.__platform),
|
214
|
-
]
|
170
|
+
label = "#{name} (#{constraint_string})"
|
171
|
+
extended_explanation = other_specs_matching_message(specs_matching_other_platforms, label) if specs_matching_other_platforms.any?
|
215
172
|
end
|
173
|
+
|
174
|
+
Incompatibility.new([unsatisfied_term], :cause => cause, :custom_explanation => custom_explanation, :extended_explanation => extended_explanation)
|
216
175
|
end
|
217
176
|
|
218
|
-
def
|
219
|
-
|
220
|
-
|
221
|
-
|
177
|
+
def debug?
|
178
|
+
ENV["BUNDLER_DEBUG_RESOLVER"] ||
|
179
|
+
ENV["BUNDLER_DEBUG_RESOLVER_TREE"] ||
|
180
|
+
ENV["DEBUG_RESOLVER"] ||
|
181
|
+
ENV["DEBUG_RESOLVER_TREE"] ||
|
182
|
+
false
|
222
183
|
end
|
223
184
|
|
224
|
-
|
185
|
+
def incompatibilities_for(package, version)
|
186
|
+
package_deps = @cached_dependencies[package]
|
187
|
+
sorted_versions = @sorted_versions[package]
|
188
|
+
package_deps[version].map do |dep_package, dep_constraint|
|
189
|
+
if package == dep_package
|
190
|
+
cause = PubGrub::Incompatibility::CircularDependency.new(dep_package, dep_constraint.constraint_string)
|
191
|
+
return [PubGrub::Incompatibility.new([PubGrub::Term.new(dep_constraint, true)], :cause => cause)]
|
192
|
+
end
|
225
193
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
all = index_for(dependency).search(dependency.name).size
|
194
|
+
low = high = sorted_versions.index(version)
|
195
|
+
|
196
|
+
# find version low such that all >= low share the same dep
|
197
|
+
while low > 0 && package_deps[sorted_versions[low - 1]][dep_package] == dep_constraint
|
198
|
+
low -= 1
|
199
|
+
end
|
200
|
+
low =
|
201
|
+
if low == 0
|
202
|
+
nil
|
203
|
+
else
|
204
|
+
sorted_versions[low]
|
205
|
+
end
|
239
206
|
|
240
|
-
|
241
|
-
|
207
|
+
# find version high such that all < high share the same dep
|
208
|
+
while high < sorted_versions.length && package_deps[sorted_versions[high]][dep_package] == dep_constraint
|
209
|
+
high += 1
|
210
|
+
end
|
211
|
+
high =
|
212
|
+
if high == sorted_versions.length
|
213
|
+
nil
|
242
214
|
else
|
243
|
-
|
244
|
-
search = @prerelease_specified[dependency.name] ? search.count : search.count {|s| !s.version.prerelease? }
|
245
|
-
search - all
|
215
|
+
sorted_versions[high]
|
246
216
|
end
|
217
|
+
|
218
|
+
range = PubGrub::VersionRange.new(:min => low, :max => high, :include_min => true)
|
219
|
+
|
220
|
+
self_constraint = PubGrub::VersionConstraint.new(package, :range => range)
|
221
|
+
|
222
|
+
dep_term = PubGrub::Term.new(dep_constraint, false)
|
223
|
+
self_term = PubGrub::Term.new(self_constraint, true)
|
224
|
+
|
225
|
+
custom_explanation = if dep_package.meta? && package.root?
|
226
|
+
"current #{dep_package} version is #{dep_constraint.constraint_string}"
|
247
227
|
end
|
228
|
+
|
229
|
+
PubGrub::Incompatibility.new([self_term, dep_term], :cause => :dependency, :custom_explanation => custom_explanation)
|
248
230
|
end
|
249
231
|
end
|
250
232
|
|
251
|
-
def
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
233
|
+
def all_versions_for(package)
|
234
|
+
name = package.name
|
235
|
+
results = (@base[name] + filter_prereleases(@all_specs[name], package)).uniq {|spec| [spec.version.hash, spec.platform] }
|
236
|
+
locked_requirement = base_requirements[name]
|
237
|
+
results = filter_matching_specs(results, locked_requirement) if locked_requirement
|
238
|
+
|
239
|
+
versions = results.group_by(&:version).reduce([]) do |groups, (version, specs)|
|
240
|
+
platform_specs = package.platforms.flat_map {|platform| select_best_platform_match(specs, platform) }
|
241
|
+
next groups if platform_specs.empty?
|
242
|
+
|
243
|
+
ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY)
|
244
|
+
groups << Resolver::Candidate.new(version, :specs => ruby_specs) if ruby_specs.any?
|
245
|
+
|
246
|
+
next groups if platform_specs == ruby_specs
|
247
|
+
|
248
|
+
groups << Resolver::Candidate.new(version, :specs => platform_specs)
|
249
|
+
|
250
|
+
groups
|
251
|
+
end
|
252
|
+
|
253
|
+
sort_versions(package, versions)
|
271
254
|
end
|
272
255
|
|
273
|
-
def
|
274
|
-
|
256
|
+
def source_for(name)
|
257
|
+
@source_requirements[name] || @source_requirements[:default]
|
258
|
+
end
|
259
|
+
|
260
|
+
def name_for_explicit_dependency_source
|
261
|
+
Bundler.default_gemfile.basename.to_s
|
262
|
+
rescue StandardError
|
263
|
+
"Gemfile"
|
264
|
+
end
|
265
|
+
|
266
|
+
def raise_not_found!(package)
|
267
|
+
name = package.name
|
268
|
+
source = source_for(name)
|
269
|
+
specs = @all_specs[name]
|
275
270
|
matching_part = name
|
276
|
-
requirement_label = SharedHelpers.pretty_dependency(
|
271
|
+
requirement_label = SharedHelpers.pretty_dependency(package.dependency)
|
277
272
|
cache_message = begin
|
278
273
|
" or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
|
279
274
|
rescue GemfileNotFound
|
280
275
|
nil
|
281
276
|
end
|
282
|
-
specs_matching_requirement = specs.
|
277
|
+
specs_matching_requirement = filter_matching_specs(specs, package.dependency.requirement)
|
283
278
|
|
284
279
|
if specs_matching_requirement.any?
|
285
280
|
specs = specs_matching_requirement
|
286
281
|
matching_part = requirement_label
|
287
|
-
|
282
|
+
platforms = package.platforms
|
283
|
+
platform_label = platforms.size == 1 ? "platform '#{platforms.first}" : "platforms '#{platforms.join("', '")}"
|
284
|
+
requirement_label = "#{requirement_label}' with #{platform_label}"
|
288
285
|
end
|
289
286
|
|
290
|
-
message = String.new("Could not find gem '#{requirement_label}'
|
287
|
+
message = String.new("Could not find gem '#{requirement_label}' in #{source}#{cache_message}.\n")
|
291
288
|
|
292
289
|
if specs.any?
|
293
|
-
message << "\
|
294
|
-
message << specs.map {|s| " * #{s.full_name}" }.join("\n")
|
290
|
+
message << "\n#{other_specs_matching_message(specs, matching_part)}"
|
295
291
|
end
|
296
292
|
|
297
|
-
message
|
293
|
+
raise GemNotFound, message
|
294
|
+
end
|
295
|
+
|
296
|
+
private
|
297
|
+
|
298
|
+
def filter_matching_specs(specs, requirements)
|
299
|
+
Array(requirements).flat_map do |requirement|
|
300
|
+
specs.select {| spec| requirement_satisfied_by?(requirement, spec) }
|
301
|
+
end
|
298
302
|
end
|
299
303
|
|
300
|
-
def
|
301
|
-
|
302
|
-
conflicts = e.conflicts.dup
|
304
|
+
def filter_prereleases(specs, package)
|
305
|
+
return specs unless package.ignores_prereleases?
|
303
306
|
|
304
|
-
|
305
|
-
|
307
|
+
specs.reject {|s| s.version.prerelease? }
|
308
|
+
end
|
309
|
+
|
310
|
+
def requirement_satisfied_by?(requirement, spec)
|
311
|
+
requirement.satisfied_by?(spec.version) || spec.source.is_a?(Source::Gemspec)
|
312
|
+
end
|
313
|
+
|
314
|
+
def sort_versions(package, versions)
|
315
|
+
if versions.size > 1
|
316
|
+
@gem_version_promoter.sort_versions(package, versions).reverse
|
306
317
|
else
|
307
|
-
|
308
|
-
deps = conflict.requirement_trees.map(&:last).flatten(1)
|
309
|
-
!Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
|
310
|
-
end
|
318
|
+
versions
|
311
319
|
end
|
320
|
+
end
|
312
321
|
|
313
|
-
|
322
|
+
def repository_for(package)
|
323
|
+
source_for(package.name)
|
324
|
+
end
|
314
325
|
|
315
|
-
|
316
|
-
|
317
|
-
|
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
|
326
|
+
def base_requirements
|
327
|
+
@base.base_requirements
|
328
|
+
end
|
330
329
|
|
331
|
-
|
332
|
-
|
330
|
+
def prepare_dependencies(requirements, packages)
|
331
|
+
to_dependency_hash(requirements, packages).map do |dep_package, dep_constraint|
|
332
|
+
name = dep_package.name
|
333
333
|
|
334
|
-
|
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)
|
334
|
+
next [dep_package, dep_constraint] if name == "bundler"
|
341
335
|
|
342
|
-
|
336
|
+
versions = versions_for(dep_package, dep_constraint.range)
|
337
|
+
if versions.empty? && dep_package.ignores_prereleases?
|
338
|
+
@sorted_versions.delete(dep_package)
|
339
|
+
dep_package.consider_prereleases!
|
340
|
+
versions = versions_for(dep_package, dep_constraint.range)
|
341
|
+
end
|
342
|
+
next [dep_package, dep_constraint] unless versions.empty?
|
343
343
|
|
344
|
-
|
345
|
-
end
|
344
|
+
next unless dep_package.current_platform?
|
346
345
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
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
|
-
|
375
|
-
if name == "bundler"
|
376
|
-
o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
|
377
|
-
|
378
|
-
conflict_dependency = conflict.requirement
|
379
|
-
conflict_requirement = conflict_dependency.requirement
|
380
|
-
other_bundler_required = !conflict_requirement.satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
381
|
-
|
382
|
-
if other_bundler_required
|
383
|
-
o << "\n\n"
|
384
|
-
|
385
|
-
candidate_specs = source_for(:default_bundler).specs.search(conflict_dependency)
|
386
|
-
if candidate_specs.any?
|
387
|
-
target_version = candidate_specs.last.version
|
388
|
-
new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
|
389
|
-
o << "Your bundle requires a different version of Bundler than the one you're running.\n"
|
390
|
-
o << "Install the necessary version with `gem install bundler:#{target_version}` and rerun bundler using `#{new_command}`\n"
|
391
|
-
else
|
392
|
-
o << "Your bundle requires a different version of Bundler than the one you're running, and that version could not be found.\n"
|
393
|
-
end
|
394
|
-
end
|
395
|
-
elsif name.end_with?("\0")
|
396
|
-
o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(metadata_requirements[name])}\n\n)
|
397
|
-
elsif conflict.locked_requirement
|
398
|
-
o << "\n"
|
399
|
-
o << %(Running `bundle update` will rebuild your snapshot from scratch, using only\n)
|
400
|
-
o << %(the gems in your Gemfile, which may resolve the conflict.\n)
|
401
|
-
elsif !conflict.existing
|
402
|
-
o << "\n"
|
403
|
-
|
404
|
-
relevant_source = conflict.requirement.source || source_for(name)
|
405
|
-
|
406
|
-
extra_message = if conflict.requirement_trees.first.size > 1
|
407
|
-
", which is required by gem '#{SharedHelpers.pretty_dependency(conflict.requirement_trees.first[-2])}',"
|
408
|
-
else
|
409
|
-
""
|
410
|
-
end
|
411
|
-
|
412
|
-
o << gem_not_found_message(name, conflict.requirement, relevant_source, extra_message)
|
413
|
-
end
|
346
|
+
raise_not_found!(dep_package)
|
347
|
+
end.compact.to_h
|
348
|
+
end
|
349
|
+
|
350
|
+
def other_specs_matching_message(specs, requirement)
|
351
|
+
message = String.new("The source contains the following gems matching '#{requirement}':\n")
|
352
|
+
message << specs.map {|s| " * #{s.full_name}" }.join("\n")
|
353
|
+
message
|
354
|
+
end
|
414
355
|
|
415
|
-
|
356
|
+
def requirement_to_range(requirement)
|
357
|
+
ranges = requirement.requirements.map do |(op, version)|
|
358
|
+
ver = Resolver::Candidate.new(version).generic!
|
359
|
+
platform_ver = Resolver::Candidate.new(version).platform_specific!
|
360
|
+
|
361
|
+
case op
|
362
|
+
when "~>"
|
363
|
+
name = "~> #{ver}"
|
364
|
+
bump = Resolver::Candidate.new(version.bump.to_s + ".A")
|
365
|
+
PubGrub::VersionRange.new(:name => name, :min => ver, :max => bump, :include_min => true)
|
366
|
+
when ">"
|
367
|
+
PubGrub::VersionRange.new(:min => platform_ver)
|
368
|
+
when ">="
|
369
|
+
PubGrub::VersionRange.new(:min => ver, :include_min => true)
|
370
|
+
when "<"
|
371
|
+
PubGrub::VersionRange.new(:max => ver)
|
372
|
+
when "<="
|
373
|
+
PubGrub::VersionRange.new(:max => platform_ver, :include_max => true)
|
374
|
+
when "="
|
375
|
+
PubGrub::VersionRange.new(:min => ver, :max => platform_ver, :include_min => true, :include_max => true)
|
376
|
+
when "!="
|
377
|
+
PubGrub::VersionRange.new(:min => ver, :max => platform_ver, :include_min => true, :include_max => true).invert
|
378
|
+
else
|
379
|
+
raise "bad version specifier: #{op}"
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
ranges.inject(&:intersect)
|
384
|
+
end
|
385
|
+
|
386
|
+
def to_dependency_hash(dependencies, packages)
|
387
|
+
dependencies.inject({}) do |deps, dep|
|
388
|
+
package = packages[dep.name]
|
389
|
+
|
390
|
+
current_req = deps[package]
|
391
|
+
new_req = parse_dependency(package, dep.requirement)
|
392
|
+
|
393
|
+
deps[package] = if current_req
|
394
|
+
current_req.intersect(new_req)
|
395
|
+
else
|
396
|
+
new_req
|
416
397
|
end
|
417
|
-
|
398
|
+
|
399
|
+
deps
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
def bundler_not_found_message(conflict_dependencies)
|
404
|
+
candidate_specs = filter_matching_specs(source_for(:default_bundler).specs.search("bundler"), conflict_dependencies)
|
405
|
+
|
406
|
+
if candidate_specs.any?
|
407
|
+
target_version = candidate_specs.last.version
|
408
|
+
new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
|
409
|
+
"Your bundle requires a different version of Bundler than the one you're running.\n" \
|
410
|
+
"Install the necessary version with `gem install bundler:#{target_version}` and rerun bundler using `#{new_command}`\n"
|
411
|
+
else
|
412
|
+
"Your bundle requires a different version of Bundler than the one you're running, and that version could not be found.\n"
|
413
|
+
end
|
418
414
|
end
|
419
415
|
end
|
420
416
|
end
|