bundler 2.2.3 → 2.2.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +73 -2
- data/bundler.gemspec +1 -1
- data/lib/bundler.rb +0 -1
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli.rb +3 -5
- data/lib/bundler/cli/cache.rb +1 -0
- data/lib/bundler/cli/gem.rb +14 -0
- data/lib/bundler/compact_index_client/updater.rb +0 -8
- data/lib/bundler/definition.rb +17 -27
- data/lib/bundler/dep_proxy.rb +15 -8
- data/lib/bundler/feature_flag.rb +0 -1
- data/lib/bundler/fetcher.rb +0 -1
- data/lib/bundler/gem_helper.rb +9 -7
- data/lib/bundler/gem_version_promoter.rb +2 -2
- data/lib/bundler/index.rb +6 -5
- data/lib/bundler/installer.rb +0 -17
- data/lib/bundler/installer/standalone.rb +15 -0
- data/lib/bundler/lazy_specification.rb +9 -18
- data/{man → lib/bundler/man}/bundle-add.1 +1 -1
- data/{man → lib/bundler/man}/bundle-binstubs.1 +1 -1
- data/{man → lib/bundler/man}/bundle-cache.1 +1 -1
- data/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
- data/{man → lib/bundler/man}/bundle-config.1 +4 -4
- data/lib/bundler/man/bundle-config.1.ronn +3 -3
- data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/{man → lib/bundler/man}/bundle-exec.1 +1 -1
- data/{man → lib/bundler/man}/bundle-gem.1 +1 -1
- data/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/{man → lib/bundler/man}/bundle-init.1 +1 -1
- data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
- data/{man → lib/bundler/man}/bundle-install.1 +1 -1
- data/{man → lib/bundler/man}/bundle-list.1 +1 -1
- data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/{man → lib/bundler/man}/bundle-open.1 +1 -1
- data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
- data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
- data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/{man → lib/bundler/man}/bundle-update.1 +1 -1
- data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
- data/{man → lib/bundler/man}/bundle.1 +1 -1
- data/{man → lib/bundler/man}/gemfile.5 +1 -1
- data/{man → lib/bundler/man}/index.txt +0 -0
- data/lib/bundler/resolver.rb +82 -43
- data/lib/bundler/resolver/spec_group.rb +56 -44
- data/lib/bundler/rubygems_ext.rb +16 -0
- data/lib/bundler/settings.rb +1 -1
- data/lib/bundler/shared_helpers.rb +2 -2
- data/lib/bundler/source/git.rb +19 -17
- data/lib/bundler/source/git/git_proxy.rb +54 -49
- data/lib/bundler/source/path/installer.rb +2 -0
- data/lib/bundler/source/rubygems.rb +10 -2
- data/lib/bundler/source_list.rb +2 -4
- data/lib/bundler/spec_set.rb +5 -4
- data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/lib/bundler/templates/newgem/rubocop.yml.tt +3 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +11 -7
- data/lib/bundler/vendor/thor/lib/thor.rb +5 -6
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +4 -2
- data/lib/bundler/vendor/thor/lib/thor/error.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +9 -8
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +5 -2
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/version.rb +1 -1
- metadata +30 -29
data/lib/bundler/installer.rb
CHANGED
@@ -82,7 +82,6 @@ module Bundler
|
|
82
82
|
|
83
83
|
if resolve_if_needed(options)
|
84
84
|
ensure_specs_are_compatible!
|
85
|
-
warn_on_incompatible_bundler_deps
|
86
85
|
load_plugins
|
87
86
|
options.delete(:jobs)
|
88
87
|
else
|
@@ -265,22 +264,6 @@ module Bundler
|
|
265
264
|
end
|
266
265
|
end
|
267
266
|
|
268
|
-
def warn_on_incompatible_bundler_deps
|
269
|
-
bundler_version = Gem::Version.create(Bundler::VERSION)
|
270
|
-
@definition.specs.each do |spec|
|
271
|
-
spec.dependencies.each do |dep|
|
272
|
-
next if dep.type == :development
|
273
|
-
next unless dep.name == "bundler".freeze
|
274
|
-
next if dep.requirement.satisfied_by?(bundler_version)
|
275
|
-
|
276
|
-
Bundler.ui.warn "#{spec.name} (#{spec.version}) has dependency" \
|
277
|
-
" #{SharedHelpers.pretty_dependency(dep)}" \
|
278
|
-
", which is unsatisfied by the current bundler version #{VERSION}" \
|
279
|
-
", so the dependency is being ignored"
|
280
|
-
end
|
281
|
-
end
|
282
|
-
end
|
283
|
-
|
284
267
|
def install_in_parallel(size, standalone, force = false)
|
285
268
|
spec_installations = ParallelInstaller.call(self, @definition.specs, size, standalone, force)
|
286
269
|
spec_installations.each do |installation|
|
@@ -15,6 +15,7 @@ module Bundler
|
|
15
15
|
file.puts "ruby_engine = RUBY_ENGINE"
|
16
16
|
file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
|
17
17
|
file.puts "path = File.expand_path('..', __FILE__)"
|
18
|
+
file.puts reverse_rubygems_kernel_mixin
|
18
19
|
paths.each do |path|
|
19
20
|
file.puts %($:.unshift File.expand_path("\#{path}/#{path}"))
|
20
21
|
end
|
@@ -48,5 +49,19 @@ module Bundler
|
|
48
49
|
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
|
49
50
|
raise Gem::InvalidSpecificationException.new(error_message)
|
50
51
|
end
|
52
|
+
|
53
|
+
def reverse_rubygems_kernel_mixin
|
54
|
+
<<~END
|
55
|
+
kernel = (class << ::Kernel; self; end)
|
56
|
+
[kernel, ::Kernel].each do |k|
|
57
|
+
if k.private_method_defined?(:gem_original_require)
|
58
|
+
private_require = k.private_method_defined?(:require)
|
59
|
+
k.send(:remove_method, :require)
|
60
|
+
k.send(:define_method, :require, k.instance_method(:gem_original_require))
|
61
|
+
k.send(:private, :require) if private_require
|
62
|
+
end
|
63
|
+
end
|
64
|
+
END
|
65
|
+
end
|
51
66
|
end
|
52
67
|
end
|
@@ -4,22 +4,6 @@ require_relative "match_platform"
|
|
4
4
|
|
5
5
|
module Bundler
|
6
6
|
class LazySpecification
|
7
|
-
Identifier = Struct.new(:name, :version, :platform)
|
8
|
-
class Identifier
|
9
|
-
include Comparable
|
10
|
-
def <=>(other)
|
11
|
-
return unless other.is_a?(Identifier)
|
12
|
-
[name, version, platform_string] <=> [other.name, other.version, other.platform_string]
|
13
|
-
end
|
14
|
-
|
15
|
-
protected
|
16
|
-
|
17
|
-
def platform_string
|
18
|
-
platform_string = platform.to_s
|
19
|
-
platform_string == Index::RUBY ? Index::NULL : platform_string
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
7
|
include MatchPlatform
|
24
8
|
|
25
9
|
attr_reader :name, :version, :dependencies, :platform
|
@@ -108,7 +92,7 @@ module Bundler
|
|
108
92
|
end
|
109
93
|
|
110
94
|
def identifier
|
111
|
-
@__identifier ||=
|
95
|
+
@__identifier ||= [name, version, platform_string]
|
112
96
|
end
|
113
97
|
|
114
98
|
def git_version
|
@@ -116,6 +100,13 @@ module Bundler
|
|
116
100
|
" #{source.revision[0..6]}"
|
117
101
|
end
|
118
102
|
|
103
|
+
protected
|
104
|
+
|
105
|
+
def platform_string
|
106
|
+
platform_string = platform.to_s
|
107
|
+
platform_string == Index::RUBY ? Index::NULL : platform_string
|
108
|
+
end
|
109
|
+
|
119
110
|
private
|
120
111
|
|
121
112
|
def to_ary
|
@@ -140,7 +131,7 @@ module Bundler
|
|
140
131
|
# explicitly add a more specific platform.
|
141
132
|
#
|
142
133
|
def ruby_platform_materializes_to_ruby_platform?
|
143
|
-
!Bundler.most_specific_locked_platform?(Gem::Platform::RUBY)
|
134
|
+
!Bundler.most_specific_locked_platform?(Gem::Platform::RUBY) || Bundler.settings[:force_ruby_platform]
|
144
135
|
end
|
145
136
|
end
|
146
137
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-BINSTUBS" "1" "
|
4
|
+
.TH "BUNDLE\-BINSTUBS" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-CACHE" "1" "
|
4
|
+
.TH "BUNDLE\-CACHE" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-CHECK" "1" "
|
4
|
+
.TH "BUNDLE\-CHECK" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-CLEAN" "1" "
|
4
|
+
.TH "BUNDLE\-CLEAN" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-CONFIG" "1" "
|
4
|
+
.TH "BUNDLE\-CONFIG" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-config\fR \- Set bundler configuration options
|
@@ -136,9 +136,6 @@ Any periods in the configuration keys must be replaced with two underscores when
|
|
136
136
|
The following is a list of all configuration keys and their purpose\. You can learn more about their operation in bundle install(1) \fIbundle\-install\.1\.html\fR\.
|
137
137
|
.
|
138
138
|
.IP "\(bu" 4
|
139
|
-
\fBallow_bundler_dependency_conflicts\fR (\fBBUNDLE_ALLOW_BUNDLER_DEPENDENCY_CONFLICTS\fR): Allow resolving to specifications that have dependencies on \fBbundler\fR that are incompatible with the running Bundler version\.
|
140
|
-
.
|
141
|
-
.IP "\(bu" 4
|
142
139
|
\fBallow_deployment_source_credential_changes\fR (\fBBUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES\fR): When in deployment mode, allow changing the credentials to a gem\'s source\. Ex: \fBhttps://some\.host\.com/gems/path/\fR \-> \fBhttps://user_name:password@some\.host\.com/gems/path\fR
|
143
140
|
.
|
144
141
|
.IP "\(bu" 4
|
@@ -184,6 +181,9 @@ The following is a list of all configuration keys and their purpose\. You can le
|
|
184
181
|
\fBdisable_local_branch_check\fR (\fBBUNDLE_DISABLE_LOCAL_BRANCH_CHECK\fR): Allow Bundler to use a local git override without a branch specified in the Gemfile\.
|
185
182
|
.
|
186
183
|
.IP "\(bu" 4
|
184
|
+
\fBdisable_local_revision_check\fR (\fBBUNDLE_DISABLE_LOCAL_REVISION_CHECK\fR): Allow Bundler to use a local git override without checking if the revision present in the lockfile is present in the repository\.
|
185
|
+
.
|
186
|
+
.IP "\(bu" 4
|
187
187
|
\fBdisable_multisource\fR (\fBBUNDLE_DISABLE_MULTISOURCE\fR): When set, Gemfiles containing multiple sources will produce errors instead of warnings\. Use \fBbundle config unset disable_multisource\fR to unset\.
|
188
188
|
.
|
189
189
|
.IP "\(bu" 4
|
@@ -133,9 +133,6 @@ the environment variable `BUNDLE_LOCAL__RACK`.
|
|
133
133
|
The following is a list of all configuration keys and their purpose. You can
|
134
134
|
learn more about their operation in [bundle install(1)](bundle-install.1.html).
|
135
135
|
|
136
|
-
* `allow_bundler_dependency_conflicts` (`BUNDLE_ALLOW_BUNDLER_DEPENDENCY_CONFLICTS`):
|
137
|
-
Allow resolving to specifications that have dependencies on `bundler` that
|
138
|
-
are incompatible with the running Bundler version.
|
139
136
|
* `allow_deployment_source_credential_changes` (`BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES`):
|
140
137
|
When in deployment mode, allow changing the credentials to a gem's source.
|
141
138
|
Ex: `https://some.host.com/gems/path/` -> `https://user_name:password@some.host.com/gems/path`
|
@@ -178,6 +175,9 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
|
|
178
175
|
* `disable_local_branch_check` (`BUNDLE_DISABLE_LOCAL_BRANCH_CHECK`):
|
179
176
|
Allow Bundler to use a local git override without a branch specified in the
|
180
177
|
Gemfile.
|
178
|
+
* `disable_local_revision_check` (`BUNDLE_DISABLE_LOCAL_REVISION_CHECK`):
|
179
|
+
Allow Bundler to use a local git override without checking if the revision
|
180
|
+
present in the lockfile is present in the repository.
|
181
181
|
* `disable_multisource` (`BUNDLE_DISABLE_MULTISOURCE`):
|
182
182
|
When set, Gemfiles containing multiple sources will produce errors
|
183
183
|
instead of warnings.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-INFO" "1" "
|
4
|
+
.TH "BUNDLE\-INFO" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-info\fR \- Show information for the given gem in your bundle
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-INIT" "1" "
|
4
|
+
.TH "BUNDLE\-INIT" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-INJECT" "1" "
|
4
|
+
.TH "BUNDLE\-INJECT" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-INSTALL" "1" "
|
4
|
+
.TH "BUNDLE\-INSTALL" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-OPEN" "1" "
|
4
|
+
.TH "BUNDLE\-OPEN" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-OUTDATED" "1" "
|
4
|
+
.TH "BUNDLE\-OUTDATED" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-outdated\fR \- List installed gems with newer versions available
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-PLATFORM" "1" "
|
4
|
+
.TH "BUNDLE\-PLATFORM" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-platform\fR \- Displays platform compatibility information
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-PRISTINE" "1" "
|
4
|
+
.TH "BUNDLE\-PRISTINE" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-SHOW" "1" "
|
4
|
+
.TH "BUNDLE\-SHOW" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-UPDATE" "1" "
|
4
|
+
.TH "BUNDLE\-UPDATE" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-update\fR \- Update your gems to the latest available versions
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-VIZ" "1" "
|
4
|
+
.TH "BUNDLE\-VIZ" "1" "January 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
|
File without changes
|
data/lib/bundler/resolver.rb
CHANGED
@@ -5,6 +5,8 @@ module Bundler
|
|
5
5
|
require_relative "vendored_molinillo"
|
6
6
|
require_relative "resolver/spec_group"
|
7
7
|
|
8
|
+
include GemHelpers
|
9
|
+
|
8
10
|
# Figures out the best possible configuration of gems that satisfies
|
9
11
|
# the list of passed dependencies and any child dependencies without
|
10
12
|
# causing any gem activation errors.
|
@@ -16,7 +18,6 @@ module Bundler
|
|
16
18
|
# <GemBundle>,nil:: If the list of dependencies can be resolved, a
|
17
19
|
# collection of gemspecs is returned. Otherwise, nil is returned.
|
18
20
|
def self.resolve(requirements, index, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
|
19
|
-
platforms = Set.new(platforms) if platforms
|
20
21
|
base = SpecSet.new(base) unless base.is_a?(SpecSet)
|
21
22
|
resolver = new(index, source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
22
23
|
result = resolver.start(requirements)
|
@@ -32,14 +33,17 @@ module Bundler
|
|
32
33
|
@base_dg = Molinillo::DependencyGraph.new
|
33
34
|
@base.each do |ls|
|
34
35
|
dep = Dependency.new(ls.name, ls.version)
|
35
|
-
@base_dg.add_vertex(ls.name, DepProxy.
|
36
|
+
@base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
|
36
37
|
end
|
37
38
|
additional_base_requirements.each {|d| @base_dg.add_vertex(d.name, d) }
|
38
39
|
@platforms = platforms
|
40
|
+
@resolving_only_for_ruby = platforms == [Gem::Platform::RUBY]
|
39
41
|
@gem_version_promoter = gem_version_promoter
|
40
|
-
@allow_bundler_dependency_conflicts = Bundler.feature_flag.allow_bundler_dependency_conflicts?
|
41
42
|
@use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
|
42
43
|
@lockfile_uses_separate_rubygems_sources = Bundler.feature_flag.disable_multisource?
|
44
|
+
|
45
|
+
@variant_specific_names = []
|
46
|
+
@generic_names = []
|
43
47
|
end
|
44
48
|
|
45
49
|
def start(requirements)
|
@@ -75,7 +79,7 @@ module Bundler
|
|
75
79
|
return unless debug?
|
76
80
|
debug_info = yield
|
77
81
|
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
78
|
-
puts debug_info.split("\n").map {|s| "BUNDLER: "
|
82
|
+
puts debug_info.split("\n").map {|s| depth == 0 ? "BUNDLER: #{s}" : "BUNDLER(#{depth}): #{s}" }
|
79
83
|
end
|
80
84
|
|
81
85
|
def debug?
|
@@ -103,14 +107,24 @@ module Bundler
|
|
103
107
|
include Molinillo::SpecificationProvider
|
104
108
|
|
105
109
|
def dependencies_for(specification)
|
106
|
-
specification.dependencies_for_activated_platforms
|
110
|
+
all_dependencies = specification.dependencies_for_activated_platforms
|
111
|
+
|
112
|
+
if @variant_specific_names.include?(specification.name)
|
113
|
+
@variant_specific_names |= all_dependencies.map(&:name) - @generic_names
|
114
|
+
else
|
115
|
+
generic_names, variant_specific_names = specification.partitioned_dependency_names_for_activated_platforms
|
116
|
+
@variant_specific_names |= variant_specific_names - @generic_names
|
117
|
+
@generic_names |= generic_names
|
118
|
+
end
|
119
|
+
|
120
|
+
all_dependencies
|
107
121
|
end
|
108
122
|
|
109
123
|
def search_for(dependency_proxy)
|
110
124
|
platform = dependency_proxy.__platform
|
111
125
|
dependency = dependency_proxy.dep
|
112
|
-
|
113
|
-
|
126
|
+
name = dependency.name
|
127
|
+
search_result = @search_for[dependency_proxy] ||= begin
|
114
128
|
index = index_for(dependency)
|
115
129
|
results = index.search(dependency, @base[name])
|
116
130
|
|
@@ -137,36 +151,48 @@ module Bundler
|
|
137
151
|
end
|
138
152
|
nested.reduce([]) do |groups, (version, specs)|
|
139
153
|
next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
|
140
|
-
|
141
|
-
|
142
|
-
|
154
|
+
|
155
|
+
specs_by_platform = Hash.new do |current_specs, current_platform|
|
156
|
+
current_specs[current_platform] = select_best_platform_match(specs, current_platform)
|
157
|
+
end
|
158
|
+
|
159
|
+
spec_group_ruby = SpecGroup.create_for(specs_by_platform, [Gem::Platform::RUBY], Gem::Platform::RUBY)
|
160
|
+
groups << spec_group_ruby if spec_group_ruby
|
161
|
+
|
162
|
+
next groups if @resolving_only_for_ruby
|
163
|
+
|
164
|
+
spec_group = SpecGroup.create_for(specs_by_platform, @platforms, platform)
|
165
|
+
groups << spec_group if spec_group
|
166
|
+
|
167
|
+
groups
|
143
168
|
end
|
144
169
|
else
|
145
170
|
[]
|
146
171
|
end
|
147
172
|
# GVP handles major itself, but it's still a bit risky to trust it with it
|
148
173
|
# until we get it settled with new behavior. For 2.x it can take over all cases.
|
149
|
-
|
174
|
+
if !@use_gvp
|
150
175
|
spec_groups
|
151
176
|
else
|
152
177
|
@gem_version_promoter.sort_versions(dependency, spec_groups)
|
153
178
|
end
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
179
|
+
end
|
180
|
+
|
181
|
+
unless search_result.empty?
|
182
|
+
specific_dependency = @variant_specific_names.include?(name)
|
183
|
+
return search_result unless specific_dependency
|
184
|
+
|
185
|
+
search_result.each do |sg|
|
186
|
+
if @generic_names.include?(name)
|
187
|
+
@variant_specific_names -= [name]
|
188
|
+
sg.activate_all_platforms!
|
189
|
+
else
|
190
|
+
sg.activate_platform!(platform)
|
191
|
+
end
|
167
192
|
end
|
168
|
-
selected_sgs
|
169
193
|
end
|
194
|
+
|
195
|
+
search_result
|
170
196
|
end
|
171
197
|
|
172
198
|
def index_for(dependency)
|
@@ -206,6 +232,10 @@ module Bundler
|
|
206
232
|
requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
|
207
233
|
end
|
208
234
|
|
235
|
+
def dependencies_equal?(dependencies, other_dependencies)
|
236
|
+
dependencies.map(&:dep) == other_dependencies.map(&:dep)
|
237
|
+
end
|
238
|
+
|
209
239
|
def relevant_sources_for_vertex(vertex)
|
210
240
|
if vertex.root?
|
211
241
|
[@source_requirements[vertex.name]]
|
@@ -233,13 +263,6 @@ module Bundler
|
|
233
263
|
end
|
234
264
|
end
|
235
265
|
|
236
|
-
# Sort platforms from most general to most specific
|
237
|
-
def self.sort_platforms(platforms)
|
238
|
-
platforms.sort_by do |platform|
|
239
|
-
platform_sort_key(platform)
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
266
|
def self.platform_sort_key(platform)
|
244
267
|
# Prefer specific platform to not specific platform
|
245
268
|
return ["99-LAST", "", "", ""] if Gem::Platform::RUBY == platform
|
@@ -324,10 +347,16 @@ module Bundler
|
|
324
347
|
def version_conflict_message(e)
|
325
348
|
# only show essential conflicts, if possible
|
326
349
|
conflicts = e.conflicts.dup
|
327
|
-
|
328
|
-
|
329
|
-
|
350
|
+
|
351
|
+
if conflicts["bundler"]
|
352
|
+
conflicts.replace("bundler" => conflicts["bundler"])
|
353
|
+
else
|
354
|
+
conflicts.delete_if do |_name, conflict|
|
355
|
+
deps = conflict.requirement_trees.map(&:last).flatten(1)
|
356
|
+
!Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
|
357
|
+
end
|
330
358
|
end
|
359
|
+
|
331
360
|
e = Molinillo::VersionConflict.new(conflicts, e.specification_provider) unless conflicts.empty?
|
332
361
|
|
333
362
|
solver_name = "Bundler"
|
@@ -355,15 +384,25 @@ module Bundler
|
|
355
384
|
:additional_message_for_conflict => lambda do |o, name, conflict|
|
356
385
|
if name == "bundler"
|
357
386
|
o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
|
358
|
-
other_bundler_required = !conflict.requirement.requirement.satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
359
|
-
end
|
360
387
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
388
|
+
conflict_dependency = conflict.requirement
|
389
|
+
conflict_requirement = conflict_dependency.requirement
|
390
|
+
other_bundler_required = !conflict_requirement.satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
391
|
+
|
392
|
+
if other_bundler_required
|
393
|
+
o << "\n\n"
|
394
|
+
|
395
|
+
candidate_specs = @source_requirements[:default_bundler].specs.search(conflict_dependency)
|
396
|
+
if candidate_specs.any?
|
397
|
+
target_version = candidate_specs.last.version
|
398
|
+
new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
|
399
|
+
o << "Your bundle requires a different version of Bundler than the one you're running.\n"
|
400
|
+
o << "Install the necessary version with `gem install bundler:#{target_version}` and rerun bundler using `#{new_command}`\n"
|
401
|
+
else
|
402
|
+
o << "Your bundle requires a different version of Bundler than the one you're running, and that version could not be found.\n"
|
403
|
+
end
|
404
|
+
end
|
405
|
+
elsif conflict.locked_requirement
|
367
406
|
o << "\n"
|
368
407
|
o << %(Running `bundle update` will rebuild your snapshot from scratch, using only\n)
|
369
408
|
o << %(the gems in your Gemfile, which may resolve the conflict.\n)
|