rubygems-update 3.3.26 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/CONTRIBUTING.md +24 -1
- data/Manifest.txt +30 -27
- data/POLICIES.md +10 -8
- data/README.md +2 -2
- data/bin/gem +1 -4
- data/bin/update_rubygems +1 -1
- data/bundler/CHANGELOG.md +59 -0
- data/bundler/README.md +2 -2
- data/bundler/bundler.gemspec +2 -2
- data/bundler/exe/bundle +1 -4
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/add.rb +1 -1
- data/bundler/lib/bundler/cli/check.rb +1 -1
- data/bundler/lib/bundler/cli/common.rb +1 -0
- data/bundler/lib/bundler/cli/console.rb +2 -2
- data/bundler/lib/bundler/cli/doctor.rb +4 -6
- data/bundler/lib/bundler/cli/gem.rb +62 -40
- data/bundler/lib/bundler/cli/install.rb +2 -3
- data/bundler/lib/bundler/cli/lock.rb +8 -5
- data/bundler/lib/bundler/cli/outdated.rb +1 -3
- data/bundler/lib/bundler/cli/viz.rb +1 -1
- data/bundler/lib/bundler/cli.rb +43 -2
- data/bundler/lib/bundler/compact_index_client/cache.rb +1 -1
- data/bundler/lib/bundler/compact_index_client/updater.rb +40 -39
- data/bundler/lib/bundler/constants.rb +1 -1
- data/bundler/lib/bundler/definition.rb +61 -31
- data/bundler/lib/bundler/dependency.rb +12 -11
- data/bundler/lib/bundler/digest.rb +1 -1
- data/bundler/lib/bundler/dsl.rb +1 -1
- data/bundler/lib/bundler/env.rb +1 -1
- data/bundler/lib/bundler/environment_preserver.rb +1 -0
- data/bundler/lib/bundler/errors.rb +1 -11
- data/bundler/lib/bundler/fetcher/compact_index.rb +9 -11
- data/bundler/lib/bundler/fetcher/dependency.rb +1 -1
- data/bundler/lib/bundler/fetcher/downloader.rb +2 -5
- data/bundler/lib/bundler/fetcher.rb +2 -6
- data/bundler/lib/bundler/force_platform.rb +18 -0
- data/bundler/lib/bundler/friendly_errors.rb +0 -3
- data/bundler/lib/bundler/gem_version_promoter.rb +52 -86
- data/bundler/lib/bundler/graph.rb +3 -3
- data/bundler/lib/bundler/index.rb +5 -13
- data/bundler/lib/bundler/injector.rb +1 -1
- data/bundler/lib/bundler/inline.rb +2 -2
- data/bundler/lib/bundler/installer/parallel_installer.rb +0 -31
- data/bundler/lib/bundler/installer.rb +6 -16
- data/bundler/lib/bundler/lazy_specification.rb +5 -1
- data/bundler/lib/bundler/lockfile_parser.rb +5 -5
- data/bundler/lib/bundler/man/bundle-add.1 +1 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +1 -1
- data/bundler/lib/bundler/man/bundle-console.1 +1 -1
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +27 -37
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +5 -5
- data/bundler/lib/bundler/man/bundle-help.1 +1 -1
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
- data/bundler/lib/bundler/man/bundle-install.1 +1 -30
- data/bundler/lib/bundler/man/bundle-install.1.ronn +0 -29
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +2 -2
- data/bundler/lib/bundler/man/bundle-platform.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-version.1 +1 -1
- data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
- data/bundler/lib/bundler/man/bundle.1 +1 -1
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/mirror.rb +5 -7
- data/bundler/lib/bundler/plugin/index.rb +4 -4
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +0 -4
- data/bundler/lib/bundler/resolver/base.rb +7 -11
- data/bundler/lib/bundler/resolver/candidate.rb +92 -0
- data/bundler/lib/bundler/resolver/incompatibility.rb +15 -0
- data/bundler/lib/bundler/resolver/package.rb +63 -0
- data/bundler/lib/bundler/resolver/root.rb +25 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +26 -36
- data/bundler/lib/bundler/resolver.rb +294 -277
- data/bundler/lib/bundler/rubygems_ext.rb +11 -6
- data/bundler/lib/bundler/rubygems_gem_installer.rb +4 -2
- data/bundler/lib/bundler/rubygems_integration.rb +1 -9
- data/bundler/lib/bundler/runtime.rb +1 -5
- data/bundler/lib/bundler/settings.rb +0 -6
- data/bundler/lib/bundler/shared_helpers.rb +1 -0
- data/bundler/lib/bundler/source/git/git_proxy.rb +193 -67
- data/bundler/lib/bundler/source/git.rb +15 -17
- data/bundler/lib/bundler/source/metadata.rb +0 -1
- data/bundler/lib/bundler/source/path/installer.rb +1 -22
- data/bundler/lib/bundler/source/path.rb +5 -5
- data/bundler/lib/bundler/source/rubygems.rb +13 -67
- data/bundler/lib/bundler/source_list.rb +8 -2
- data/bundler/lib/bundler/spec_set.rb +7 -9
- data/bundler/lib/bundler/templates/Executable +1 -1
- data/bundler/lib/bundler/templates/Executable.bundler +4 -9
- data/bundler/lib/bundler/templates/Executable.standalone +2 -0
- data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/README.md.tt +6 -4
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +2 -1
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +0 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +10 -0
- data/bundler/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -2
- data/bundler/lib/bundler/ui/shell.rb +35 -12
- data/bundler/lib/bundler/ui/silent.rb +21 -5
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +3 -3
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +0 -1
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +3 -1
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
- data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
- data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +151 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +53 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +124 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +409 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +240 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +64 -16
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +27 -7
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +40 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +2 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +13 -7
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +10 -5
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +1 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +2 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +3 -2
- data/bundler/lib/bundler/vendored_persistent.rb +1 -33
- data/bundler/lib/bundler/{vendored_tmpdir.rb → vendored_pub_grub.rb} +1 -1
- data/bundler/lib/bundler/version.rb +5 -1
- data/bundler/lib/bundler/worker.rb +5 -7
- data/bundler/lib/bundler.rb +20 -64
- data/lib/rubygems/command_manager.rb +2 -2
- data/lib/rubygems/commands/fetch_command.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +7 -3
- data/lib/rubygems/commands/rdoc_command.rb +3 -2
- data/lib/rubygems/commands/setup_command.rb +2 -2
- data/lib/rubygems/commands/unpack_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +1 -7
- data/lib/rubygems/config_file.rb +33 -0
- data/lib/rubygems/core_ext/kernel_warn.rb +1 -2
- data/lib/rubygems/defaults.rb +15 -1
- data/lib/rubygems/dependency.rb +4 -1
- data/lib/rubygems/dependency_installer.rb +24 -24
- data/lib/rubygems/exceptions.rb +1 -3
- data/lib/rubygems/ext/builder.rb +3 -3
- data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +9 -5
- data/lib/rubygems/ext/cargo_builder.rb +15 -20
- data/lib/rubygems/ext/ext_conf_builder.rb +2 -0
- data/lib/rubygems/indexer.rb +1 -1
- data/lib/rubygems/installer.rb +5 -5
- data/lib/rubygems/optparse/lib/optparse.rb +20 -15
- data/lib/rubygems/package/tar_header.rb +11 -11
- data/lib/rubygems/platform.rb +0 -2
- data/lib/rubygems/request_set/gem_dependency_api.rb +104 -104
- data/lib/rubygems/requirement.rb +7 -7
- data/lib/rubygems/resolver/installer_set.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +32 -26
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/rubygems/security/policies.rb +40 -40
- data/lib/rubygems/security/trust_dir.rb +1 -1
- data/lib/rubygems/security.rb +3 -16
- data/lib/rubygems/source.rb +2 -2
- data/lib/rubygems/specification.rb +37 -49
- data/lib/rubygems/specification_policy.rb +14 -0
- data/lib/rubygems/stub_specification.rb +2 -2
- data/lib/rubygems/text.rb +1 -1
- data/lib/rubygems/tsort/lib/tsort.rb +308 -310
- data/lib/rubygems/update_suggestion.rb +69 -0
- data/lib/rubygems/util.rb +1 -5
- data/lib/rubygems/validator.rb +1 -1
- data/lib/rubygems.rb +8 -3
- data/rubygems-update.gemspec +2 -2
- data/test/rubygems/helper.rb +7 -3
- data/test/rubygems/test_bundled_ca.rb +1 -1
- data/test/rubygems/test_exit.rb +6 -0
- data/test/rubygems/test_gem.rb +4 -9
- data/test/rubygems/test_gem_bundler_version_finder.rb +2 -1
- data/test/rubygems/test_gem_command_manager.rb +1 -1
- data/test/rubygems/test_gem_commands_install_command.rb +19 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +1 -8
- data/test/rubygems/test_gem_commands_update_command.rb +6 -6
- data/test/rubygems/test_gem_config_file.rb +1 -1
- data/test/rubygems/test_gem_dependency.rb +2 -0
- data/test/rubygems/test_gem_ext_builder.rb +3 -3
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +22 -32
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +22 -32
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +12 -0
- data/test/rubygems/test_gem_ext_cargo_builder.rb +22 -27
- data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +16 -16
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +0 -10
- data/test/rubygems/test_gem_indexer.rb +39 -20
- data/test/rubygems/test_gem_installer.rb +68 -2
- data/test/rubygems/test_gem_package_tar_header.rb +13 -13
- data/test/rubygems/test_gem_platform.rb +59 -60
- data/test/rubygems/test_gem_remote_fetcher.rb +4 -4
- data/test/rubygems/test_gem_request_set.rb +2 -2
- data/test/rubygems/test_gem_requirement.rb +1 -1
- data/test/rubygems/test_gem_resolver_api_set.rb +12 -12
- data/test/rubygems/test_gem_resolver_api_specification.rb +19 -19
- data/test/rubygems/test_gem_resolver_git_specification.rb +1 -1
- data/test/rubygems/test_gem_security_policy.rb +10 -10
- data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
- data/test/rubygems/test_gem_specification.rb +50 -37
- data/test/rubygems/test_gem_uninstaller.rb +1 -1
- data/test/rubygems/test_gem_update_suggestion.rb +208 -0
- data/test/rubygems/test_kernel.rb +10 -8
- data/test/rubygems/test_require.rb +70 -55
- metadata +34 -31
- data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -6
- data/bundler/lib/bundler/vendor/molinillo/LICENSE +0 -9
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -88
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -164
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -149
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -11
- data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
- data/bundler/lib/bundler/vendored_molinillo.rb +0 -4
- data/bundler/lib/bundler/version_ranges.rb +0 -122
@@ -1,380 +1,397 @@
|
|
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 "
|
10
|
+
require_relative "vendored_pub_grub"
|
6
11
|
require_relative "resolver/base"
|
7
|
-
require_relative "resolver/
|
12
|
+
require_relative "resolver/package"
|
13
|
+
require_relative "resolver/candidate"
|
14
|
+
require_relative "resolver/incompatibility"
|
15
|
+
require_relative "resolver/root"
|
8
16
|
|
9
17
|
include GemHelpers
|
10
18
|
|
11
|
-
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements
|
19
|
+
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements)
|
12
20
|
@source_requirements = source_requirements
|
13
21
|
@base = Resolver::Base.new(base, additional_base_requirements)
|
14
|
-
@resolver = Molinillo::Resolver.new(self, self)
|
15
|
-
@results_for = {}
|
16
|
-
@search_for = {}
|
17
|
-
@platforms = platforms
|
18
|
-
@resolving_only_for_ruby = platforms == [Gem::Platform::RUBY]
|
19
22
|
@gem_version_promoter = gem_version_promoter
|
20
23
|
end
|
21
24
|
|
22
|
-
def start(requirements, exclude_specs: [])
|
23
|
-
@metadata_requirements, regular_requirements = requirements.partition {|dep| dep.name.end_with?("\0") }
|
24
|
-
|
25
|
+
def start(requirements, packages, exclude_specs: [])
|
25
26
|
exclude_specs.each do |spec|
|
26
27
|
remove_from_candidates(spec)
|
27
28
|
end
|
28
29
|
|
29
|
-
requirements
|
30
|
-
|
31
|
-
verify_gemfile_dependencies_are_found!(requirements)
|
32
|
-
result = @resolver.resolve(requirements).
|
33
|
-
map(&:payload).
|
34
|
-
reject {|sg| sg.name.end_with?("\0") }.
|
35
|
-
map(&:to_specs).
|
36
|
-
flatten
|
30
|
+
@requirements = requirements
|
31
|
+
@packages = packages
|
37
32
|
|
38
|
-
|
39
|
-
rescue Molinillo::VersionConflict => e
|
40
|
-
conflicts = e.conflicts
|
41
|
-
|
42
|
-
deps_to_unlock = conflicts.values.inject([]) do |deps, conflict|
|
43
|
-
deps |= conflict.requirement_trees.flatten.map {|req| base_requirements[req.name] }.compact
|
44
|
-
end
|
33
|
+
root, logger = setup_solver
|
45
34
|
|
46
|
-
|
47
|
-
@base.unlock_deps(deps_to_unlock)
|
48
|
-
reset_spec_cache
|
49
|
-
retry
|
50
|
-
end
|
35
|
+
Bundler.ui.info "Resolving dependencies...", true
|
51
36
|
|
52
|
-
|
53
|
-
raise VersionConflict.new(conflicts.keys.uniq, message)
|
54
|
-
rescue Molinillo::CircularDependencyError => e
|
55
|
-
names = e.dependencies.sort_by(&:name).map {|d| "gem '#{d.name}'" }
|
56
|
-
raise CyclicDependencyError, "Your bundle requires gems that depend" \
|
57
|
-
" on each other, creating an infinite loop. Please remove" \
|
58
|
-
" #{names.count > 1 ? "either " : ""}#{names.join(" or ")}" \
|
59
|
-
" and try again."
|
37
|
+
solve_versions(:root => root, :logger => logger)
|
60
38
|
end
|
61
39
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
#
|
66
|
-
# @param [Integer] depth the current depth of the resolution process.
|
67
|
-
# @return [void]
|
68
|
-
def debug(depth = 0)
|
69
|
-
return unless debug?
|
70
|
-
debug_info = yield
|
71
|
-
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
72
|
-
puts debug_info.split("\n").map {|s| depth == 0 ? "BUNDLER: #{s}" : "BUNDLER(#{depth}): #{s}" }
|
73
|
-
end
|
40
|
+
def setup_solver
|
41
|
+
root = Resolver::Root.new(name_for_explicit_dependency_source)
|
42
|
+
root_version = Resolver::Candidate.new(0)
|
74
43
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
ENV["BUNDLER_DEBUG_RESOLVER"] ||
|
79
|
-
ENV["BUNDLER_DEBUG_RESOLVER_TREE"] ||
|
80
|
-
ENV["DEBUG_RESOLVER"] ||
|
81
|
-
ENV["DEBUG_RESOLVER_TREE"] ||
|
82
|
-
false
|
83
|
-
end
|
44
|
+
@all_specs = Hash.new do |specs, name|
|
45
|
+
specs[name] = source_for(name).specs.search(name).sort_by {|s| [s.version, s.platform.to_s] }
|
46
|
+
end
|
84
47
|
|
85
|
-
|
86
|
-
|
87
|
-
|
48
|
+
@sorted_versions = Hash.new do |candidates, package|
|
49
|
+
candidates[package] = if package.root?
|
50
|
+
[root_version]
|
51
|
+
else
|
52
|
+
all_versions_for(package).sort
|
53
|
+
end
|
54
|
+
end
|
88
55
|
|
89
|
-
|
90
|
-
Bundler.ui.info ""
|
91
|
-
end
|
56
|
+
root_dependencies = prepare_dependencies(@requirements, @packages)
|
92
57
|
|
93
|
-
|
94
|
-
|
95
|
-
|
58
|
+
@cached_dependencies = Hash.new do |dependencies, package|
|
59
|
+
dependencies[package] = if package.root?
|
60
|
+
{ root_version => root_dependencies }
|
61
|
+
else
|
62
|
+
Hash.new do |versions, version|
|
63
|
+
versions[version] = to_dependency_hash(version.dependencies, @packages)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
96
67
|
|
97
|
-
|
68
|
+
logger = Bundler::UI::Shell.new
|
69
|
+
logger.level = debug? ? "debug" : "warn"
|
98
70
|
|
99
|
-
|
100
|
-
specification.dependencies_for_activated_platforms
|
71
|
+
[root, logger]
|
101
72
|
end
|
102
73
|
|
103
|
-
def
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
@gem_version_promoter.sort_versions(dependency, results).group_by(&:version).reduce([]) do |groups, (_, specs)|
|
113
|
-
relevant_platforms = dep_platforms.select {|platform| specs.any? {|spec| spec.match_platform(platform) } }
|
114
|
-
next groups unless relevant_platforms.any?
|
115
|
-
|
116
|
-
ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY)
|
117
|
-
if ruby_specs.any?
|
118
|
-
spec_group_ruby = SpecGroup.new(ruby_specs, [Gem::Platform::RUBY])
|
119
|
-
spec_group_ruby.force_ruby_platform = dependency.force_ruby_platform
|
120
|
-
groups << spec_group_ruby
|
121
|
-
end
|
74
|
+
def solve_versions(root:, logger:)
|
75
|
+
solver = PubGrub::VersionSolver.new(:source => self, :root => root, :logger => logger)
|
76
|
+
result = solver.solve
|
77
|
+
result.map {|package, version| version.to_specs(package) }.flatten.uniq
|
78
|
+
rescue PubGrub::SolveFailure => e
|
79
|
+
incompatibility = e.incompatibility
|
80
|
+
|
81
|
+
names_to_unlock = []
|
82
|
+
extended_explanation = nil
|
122
83
|
|
123
|
-
|
84
|
+
while incompatibility.conflict?
|
85
|
+
cause = incompatibility.cause
|
86
|
+
incompatibility = cause.incompatibility
|
124
87
|
|
125
|
-
|
126
|
-
|
88
|
+
incompatibility.terms.each do |term|
|
89
|
+
name = term.package.name
|
90
|
+
names_to_unlock << name if base_requirements[name]
|
127
91
|
|
128
|
-
|
129
|
-
|
92
|
+
no_versions_incompat = [cause.incompatibility, cause.satisfier].find {|incompat| incompat.cause.is_a?(PubGrub::Incompatibility::NoVersions) }
|
93
|
+
next unless no_versions_incompat
|
130
94
|
|
131
|
-
|
95
|
+
extended_explanation = no_versions_incompat.extended_explanation
|
132
96
|
end
|
133
97
|
end
|
134
|
-
end
|
135
98
|
|
136
|
-
|
137
|
-
source_for(dependency.name).specs
|
138
|
-
end
|
99
|
+
names_to_unlock.uniq!
|
139
100
|
|
140
|
-
|
141
|
-
|
142
|
-
end
|
101
|
+
if names_to_unlock.any?
|
102
|
+
Bundler.ui.debug "Found conflicts with locked dependencies. Retrying with #{names_to_unlock.join(", ")} unlocked...", true
|
143
103
|
|
144
|
-
|
145
|
-
@results_for[dependency] ||= index_for(dependency).search(dependency)
|
146
|
-
end
|
104
|
+
@base.unlock_names(names_to_unlock)
|
147
105
|
|
148
|
-
|
149
|
-
dependency.name
|
150
|
-
end
|
106
|
+
root, logger = setup_solver
|
151
107
|
|
152
|
-
|
153
|
-
|
154
|
-
rescue StandardError
|
155
|
-
"Gemfile"
|
156
|
-
end
|
108
|
+
retry
|
109
|
+
end
|
157
110
|
|
158
|
-
|
159
|
-
requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
|
160
|
-
end
|
111
|
+
explanation = e.message
|
161
112
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
vertex = activated.vertex_named(name)
|
166
|
-
[
|
167
|
-
@base[name].any? ? 0 : 1,
|
168
|
-
vertex.payload ? 0 : 1,
|
169
|
-
vertex.root? ? 0 : 1,
|
170
|
-
amount_constrained(dependency),
|
171
|
-
conflicts[name] ? 0 : 1,
|
172
|
-
vertex.payload ? 0 : search_for(dependency).count,
|
173
|
-
]
|
113
|
+
if extended_explanation
|
114
|
+
explanation << "\n\n"
|
115
|
+
explanation << extended_explanation
|
174
116
|
end
|
117
|
+
|
118
|
+
raise SolveFailure.new(explanation)
|
175
119
|
end
|
176
120
|
|
177
|
-
|
121
|
+
def parse_dependency(package, dependency)
|
122
|
+
range = if repository_for(package).is_a?(Source::Gemspec)
|
123
|
+
PubGrub::VersionRange.any
|
124
|
+
else
|
125
|
+
requirement_to_range(dependency)
|
126
|
+
end
|
178
127
|
|
179
|
-
|
180
|
-
@base.base_requirements
|
128
|
+
PubGrub::VersionConstraint.new(package, :range => range)
|
181
129
|
end
|
182
130
|
|
183
|
-
def
|
184
|
-
@
|
131
|
+
def versions_for(package, range=VersionRange.any)
|
132
|
+
versions = range.select_versions(@sorted_versions[package])
|
133
|
+
|
134
|
+
sort_versions(package, versions)
|
185
135
|
end
|
186
136
|
|
187
|
-
def
|
188
|
-
|
137
|
+
def no_versions_incompatibility_for(package, unsatisfied_term)
|
138
|
+
cause = PubGrub::Incompatibility::NoVersions.new(unsatisfied_term)
|
139
|
+
name = package.name
|
140
|
+
constraint = unsatisfied_term.constraint
|
141
|
+
constraint_string = constraint.constraint_string
|
142
|
+
requirements = constraint_string.split(" OR ").map {|req| Gem::Requirement.new(req.split(",")) }
|
143
|
+
|
144
|
+
if name == "bundler"
|
145
|
+
custom_explanation = "the current Bundler version (#{Bundler::VERSION}) does not satisfy #{constraint}"
|
146
|
+
extended_explanation = bundler_not_found_message(requirements)
|
147
|
+
else
|
148
|
+
specs_matching_other_platforms = filter_matching_specs(@all_specs[name], requirements)
|
189
149
|
|
190
|
-
|
191
|
-
|
150
|
+
platforms_explanation = specs_matching_other_platforms.any? ? " for any resolution platforms (#{package.platforms.join(", ")})" : ""
|
151
|
+
custom_explanation = "#{constraint} could not be found in #{repository_for(package)}#{platforms_explanation}"
|
192
152
|
|
193
|
-
|
153
|
+
label = "#{name} (#{constraint_string})"
|
154
|
+
extended_explanation = other_specs_matching_message(specs_matching_other_platforms, label) if specs_matching_other_platforms.any?
|
194
155
|
end
|
195
156
|
|
196
|
-
|
157
|
+
Incompatibility.new([unsatisfied_term], :cause => cause, :custom_explanation => custom_explanation, :extended_explanation => extended_explanation)
|
197
158
|
end
|
198
159
|
|
199
|
-
def
|
200
|
-
|
201
|
-
|
160
|
+
def debug?
|
161
|
+
ENV["BUNDLER_DEBUG_RESOLVER"] ||
|
162
|
+
ENV["BUNDLER_DEBUG_RESOLVER_TREE"] ||
|
163
|
+
ENV["DEBUG_RESOLVER"] ||
|
164
|
+
ENV["DEBUG_RESOLVER_TREE"] ||
|
165
|
+
false
|
202
166
|
end
|
203
167
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
@amount_constrained[dependency.name] ||= if (base = @base[dependency.name]) && !base.empty?
|
213
|
-
dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1
|
214
|
-
else
|
215
|
-
all = index_for(dependency).search(dependency.name).size
|
168
|
+
def incompatibilities_for(package, version)
|
169
|
+
package_deps = @cached_dependencies[package]
|
170
|
+
sorted_versions = @sorted_versions[package]
|
171
|
+
package_deps[version].map do |dep_package, dep_constraint|
|
172
|
+
if package == dep_package
|
173
|
+
cause = PubGrub::Incompatibility::CircularDependency.new(dep_package, dep_constraint.constraint_string)
|
174
|
+
return [PubGrub::Incompatibility.new([PubGrub::Term.new(dep_constraint, true)], :cause => cause)]
|
175
|
+
end
|
216
176
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
177
|
+
low = high = sorted_versions.index(version)
|
178
|
+
|
179
|
+
# find version low such that all >= low share the same dep
|
180
|
+
while low > 0 && package_deps[sorted_versions[low - 1]][dep_package] == dep_constraint
|
181
|
+
low -= 1
|
182
|
+
end
|
183
|
+
low =
|
184
|
+
if low == 0
|
185
|
+
nil
|
186
|
+
else
|
187
|
+
sorted_versions[low]
|
188
|
+
end
|
189
|
+
|
190
|
+
# find version high such that all < high share the same dep
|
191
|
+
while high < sorted_versions.length && package_deps[sorted_versions[high]][dep_package] == dep_constraint
|
192
|
+
high += 1
|
193
|
+
end
|
194
|
+
high =
|
195
|
+
if high == sorted_versions.length
|
196
|
+
nil
|
197
|
+
else
|
198
|
+
sorted_versions[high]
|
199
|
+
end
|
200
|
+
|
201
|
+
range = PubGrub::VersionRange.new(:min => low, :max => high, :include_min => true)
|
202
|
+
|
203
|
+
self_constraint = PubGrub::VersionConstraint.new(package, :range => range)
|
204
|
+
|
205
|
+
dep_term = PubGrub::Term.new(dep_constraint, false)
|
206
|
+
self_term = PubGrub::Term.new(self_constraint, true)
|
207
|
+
|
208
|
+
custom_explanation = if dep_package.meta? && package.root?
|
209
|
+
"current #{dep_package} version is #{dep_constraint.constraint_string}"
|
223
210
|
end
|
211
|
+
|
212
|
+
PubGrub::Incompatibility.new([self_term, dep_term], :cause => :dependency, :custom_explanation => custom_explanation)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
def all_versions_for(package)
|
217
|
+
name = package.name
|
218
|
+
results = (@base[name] + @all_specs[name]).uniq(&:full_name)
|
219
|
+
locked_requirement = base_requirements[name]
|
220
|
+
results = filter_matching_specs(results, locked_requirement) if locked_requirement
|
221
|
+
|
222
|
+
versions = results.group_by(&:version).reduce([]) do |groups, (version, specs)|
|
223
|
+
platform_specs = package.platforms.flat_map {|platform| select_best_platform_match(specs, platform) }
|
224
|
+
next groups if platform_specs.empty?
|
225
|
+
|
226
|
+
ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY)
|
227
|
+
groups << Resolver::Candidate.new(version, :specs => ruby_specs) if ruby_specs.any?
|
228
|
+
|
229
|
+
next groups if platform_specs == ruby_specs
|
230
|
+
|
231
|
+
groups << Resolver::Candidate.new(version, :specs => platform_specs)
|
232
|
+
|
233
|
+
groups
|
224
234
|
end
|
235
|
+
|
236
|
+
sort_versions(package, versions)
|
225
237
|
end
|
226
238
|
|
227
|
-
def
|
228
|
-
|
229
|
-
|
230
|
-
next requirement if name == "bundler"
|
231
|
-
next if requirement.gem_platforms(@platforms).empty?
|
232
|
-
next requirement unless search_for(requirement).empty?
|
233
|
-
next unless requirement.current_platform?
|
239
|
+
def source_for(name)
|
240
|
+
@source_requirements[name] || @source_requirements[:default]
|
241
|
+
end
|
234
242
|
|
235
|
-
|
236
|
-
|
243
|
+
def name_for_explicit_dependency_source
|
244
|
+
Bundler.default_gemfile.basename.to_s
|
245
|
+
rescue StandardError
|
246
|
+
"Gemfile"
|
237
247
|
end
|
238
248
|
|
239
|
-
def
|
240
|
-
|
249
|
+
def raise_not_found!(package)
|
250
|
+
name = package.name
|
251
|
+
source = source_for(name)
|
252
|
+
specs = @all_specs[name]
|
241
253
|
matching_part = name
|
242
|
-
requirement_label = SharedHelpers.pretty_dependency(
|
254
|
+
requirement_label = SharedHelpers.pretty_dependency(package.dependency)
|
243
255
|
cache_message = begin
|
244
256
|
" or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
|
245
257
|
rescue GemfileNotFound
|
246
258
|
nil
|
247
259
|
end
|
248
|
-
specs_matching_requirement = specs.
|
260
|
+
specs_matching_requirement = filter_matching_specs(specs, package.dependency.requirement)
|
249
261
|
|
250
262
|
if specs_matching_requirement.any?
|
251
263
|
specs = specs_matching_requirement
|
252
264
|
matching_part = requirement_label
|
253
|
-
platforms =
|
265
|
+
platforms = package.platforms
|
254
266
|
platform_label = platforms.size == 1 ? "platform '#{platforms.first}" : "platforms '#{platforms.join("', '")}"
|
255
267
|
requirement_label = "#{requirement_label}' with #{platform_label}"
|
256
268
|
end
|
257
269
|
|
258
|
-
message = String.new("Could not find gem '#{requirement_label}'
|
270
|
+
message = String.new("Could not find gem '#{requirement_label}' in #{source}#{cache_message}.\n")
|
259
271
|
|
260
272
|
if specs.any?
|
261
|
-
message << "\
|
262
|
-
message << specs.map {|s| " * #{s.full_name}" }.join("\n")
|
273
|
+
message << "\n#{other_specs_matching_message(specs, matching_part)}"
|
263
274
|
end
|
264
275
|
|
265
|
-
message
|
276
|
+
raise GemNotFound, message
|
277
|
+
end
|
278
|
+
|
279
|
+
private
|
280
|
+
|
281
|
+
def filter_matching_specs(specs, requirements)
|
282
|
+
Array(requirements).flat_map do |requirement|
|
283
|
+
specs.select {| spec| requirement_satisfied_by?(requirement, spec) }
|
284
|
+
end
|
266
285
|
end
|
267
286
|
|
268
|
-
def
|
269
|
-
|
270
|
-
|
287
|
+
def requirement_satisfied_by?(requirement, spec)
|
288
|
+
requirement.satisfied_by?(spec.version) || spec.source.is_a?(Source::Gemspec)
|
289
|
+
end
|
271
290
|
|
272
|
-
|
273
|
-
|
291
|
+
def sort_versions(package, versions)
|
292
|
+
if versions.size > 1
|
293
|
+
@gem_version_promoter.sort_versions(package, versions).reverse
|
274
294
|
else
|
275
|
-
|
276
|
-
deps = conflict.requirement_trees.map(&:last).flatten(1)
|
277
|
-
!Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
|
278
|
-
end
|
295
|
+
versions
|
279
296
|
end
|
297
|
+
end
|
280
298
|
|
281
|
-
|
299
|
+
def repository_for(package)
|
300
|
+
source_for(package.name)
|
301
|
+
end
|
282
302
|
|
283
|
-
|
284
|
-
|
285
|
-
|
303
|
+
def base_requirements
|
304
|
+
@base.base_requirements
|
305
|
+
end
|
286
306
|
|
287
|
-
|
288
|
-
|
307
|
+
def remove_from_candidates(spec)
|
308
|
+
@base.delete(spec)
|
309
|
+
end
|
289
310
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
311
|
+
def prepare_dependencies(requirements, packages)
|
312
|
+
to_dependency_hash(requirements, packages).map do |dep_package, dep_constraint|
|
313
|
+
name = dep_package.name
|
314
|
+
|
315
|
+
# If a dependency is scoped to a platform different from the current
|
316
|
+
# one, we ignore it. However, it may reappear during resolution as a
|
317
|
+
# transitive dependency of another package, so we need to reset the
|
318
|
+
# package so the proper versions are considered if reintroduced later.
|
319
|
+
if dep_package.platforms.empty?
|
320
|
+
@packages.delete(name)
|
321
|
+
next
|
322
|
+
end
|
297
323
|
|
298
|
-
|
324
|
+
next [dep_package, dep_constraint] if name == "bundler"
|
325
|
+
next [dep_package, dep_constraint] unless versions_for(dep_package, dep_constraint.range).empty?
|
326
|
+
next unless dep_package.current_platform?
|
299
327
|
|
300
|
-
|
301
|
-
|
328
|
+
raise_not_found!(dep_package)
|
329
|
+
end.compact.to_h
|
330
|
+
end
|
302
331
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
end
|
309
|
-
o << %(\n)
|
310
|
-
o << %( In #{name_for_explicit_dependency_source}:\n)
|
311
|
-
o << trees.map do |tree|
|
312
|
-
t = "".dup
|
313
|
-
depth = 2
|
314
|
-
|
315
|
-
base_tree = tree.first
|
316
|
-
base_tree_name = base_tree.name
|
317
|
-
|
318
|
-
if base_tree_name.end_with?("\0")
|
319
|
-
t = nil
|
320
|
-
else
|
321
|
-
tree.each do |req|
|
322
|
-
t << " " * depth << SharedHelpers.pretty_dependency(req)
|
323
|
-
unless tree.last == req
|
324
|
-
if spec = conflict.activated_by_name[req.name]
|
325
|
-
t << %( was resolved to #{spec.version}, which)
|
326
|
-
end
|
327
|
-
t << %( depends on)
|
328
|
-
end
|
329
|
-
t << %(\n)
|
330
|
-
depth += 1
|
331
|
-
end
|
332
|
-
end
|
333
|
-
t
|
334
|
-
end.compact.join("\n")
|
335
|
-
else
|
336
|
-
o = String.new
|
337
|
-
end
|
332
|
+
def other_specs_matching_message(specs, requirement)
|
333
|
+
message = String.new("The source contains the following gems matching '#{requirement}':\n")
|
334
|
+
message << specs.map {|s| " * #{s.full_name}" }.join("\n")
|
335
|
+
message
|
336
|
+
end
|
338
337
|
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
338
|
+
def requirement_to_range(requirement)
|
339
|
+
ranges = requirement.requirements.map do |(op, version)|
|
340
|
+
ver = Resolver::Candidate.new(version)
|
341
|
+
|
342
|
+
case op
|
343
|
+
when "~>"
|
344
|
+
name = "~> #{ver}"
|
345
|
+
bump = Resolver::Candidate.new(version.bump.to_s + ".A")
|
346
|
+
PubGrub::VersionRange.new(:name => name, :min => ver, :max => bump, :include_min => true)
|
347
|
+
when ">"
|
348
|
+
PubGrub::VersionRange.new(:min => ver)
|
349
|
+
when ">="
|
350
|
+
PubGrub::VersionRange.new(:min => ver, :include_min => true)
|
351
|
+
when "<"
|
352
|
+
PubGrub::VersionRange.new(:max => ver)
|
353
|
+
when "<="
|
354
|
+
PubGrub::VersionRange.new(:max => ver, :include_max => true)
|
355
|
+
when "="
|
356
|
+
PubGrub::VersionRange.new(:min => ver, :max => ver, :include_min => true, :include_max => true)
|
357
|
+
when "!="
|
358
|
+
PubGrub::VersionRange.new(:min => ver, :max => ver, :include_min => true, :include_max => true).invert
|
359
|
+
else
|
360
|
+
raise "bad version specifier: #{op}"
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
ranges.inject(&:intersect)
|
365
|
+
end
|
366
|
+
|
367
|
+
def to_dependency_hash(dependencies, packages)
|
368
|
+
dependencies.inject({}) do |deps, dep|
|
369
|
+
package = packages[dep.name]
|
370
|
+
|
371
|
+
current_req = deps[package]
|
372
|
+
new_req = parse_dependency(package, dep.requirement)
|
374
373
|
|
375
|
-
|
374
|
+
deps[package] = if current_req
|
375
|
+
current_req.intersect(new_req)
|
376
|
+
else
|
377
|
+
new_req
|
376
378
|
end
|
377
|
-
|
379
|
+
|
380
|
+
deps
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
def bundler_not_found_message(conflict_dependencies)
|
385
|
+
candidate_specs = filter_matching_specs(source_for(:default_bundler).specs.search("bundler"), conflict_dependencies)
|
386
|
+
|
387
|
+
if candidate_specs.any?
|
388
|
+
target_version = candidate_specs.last.version
|
389
|
+
new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
|
390
|
+
"Your bundle requires a different version of Bundler than the one you're running.\n" \
|
391
|
+
"Install the necessary version with `gem install bundler:#{target_version}` and rerun bundler using `#{new_command}`\n"
|
392
|
+
else
|
393
|
+
"Your bundle requires a different version of Bundler than the one you're running, and that version could not be found.\n"
|
394
|
+
end
|
378
395
|
end
|
379
396
|
end
|
380
397
|
end
|