bundler 2.2.5 → 2.2.10
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 -0
- data/lib/bundler.rb +1 -1
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli.rb +1 -0
- data/lib/bundler/cli/cache.rb +1 -0
- data/lib/bundler/cli/gem.rb +12 -0
- data/lib/bundler/definition.rb +66 -56
- data/lib/bundler/dep_proxy.rb +15 -8
- data/lib/bundler/dsl.rb +38 -25
- data/lib/bundler/feature_flag.rb +0 -2
- data/lib/bundler/fetcher.rb +0 -1
- data/lib/bundler/gem_helper.rb +8 -6
- data/lib/bundler/gem_version_promoter.rb +2 -2
- data/lib/bundler/index.rb +6 -5
- data/lib/bundler/inline.rb +1 -0
- data/lib/bundler/installer.rb +0 -17
- data/lib/bundler/installer/standalone.rb +15 -0
- data/lib/bundler/lazy_specification.rb +9 -18
- data/lib/bundler/lockfile_parser.rb +12 -8
- data/lib/bundler/man/bundle-add.1 +1 -1
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +1 -1
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +6 -12
- data/lib/bundler/man/bundle-config.1.ronn +11 -18
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +1 -1
- data/lib/bundler/man/bundle-gem.1 +1 -1
- 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 +1 -1
- data/lib/bundler/man/bundle-install.1 +1 -1
- 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 +1 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +1 -1
- 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-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +1 -1
- data/lib/bundler/plugin.rb +1 -0
- data/lib/bundler/plugin/installer.rb +8 -9
- data/lib/bundler/resolver.rb +110 -80
- data/lib/bundler/resolver/spec_group.rb +56 -44
- data/lib/bundler/rubygems_ext.rb +16 -0
- data/lib/bundler/settings.rb +1 -2
- data/lib/bundler/shared_helpers.rb +2 -2
- data/lib/bundler/source/git.rb +1 -1
- data/lib/bundler/source/rubygems.rb +10 -2
- data/lib/bundler/source_list.rb +34 -25
- data/lib/bundler/spec_set.rb +5 -4
- data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -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 +4 -3
@@ -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
|
data/lib/bundler/man/bundle.1
CHANGED
data/lib/bundler/man/gemfile.5
CHANGED
data/lib/bundler/plugin.rb
CHANGED
@@ -16,15 +16,13 @@ module Bundler
|
|
16
16
|
|
17
17
|
version = options[:version] || [">= 0"]
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
install_rubygems(names, version, sources)
|
27
|
-
end
|
19
|
+
if options[:git]
|
20
|
+
install_git(names, version, options)
|
21
|
+
elsif options[:local_git]
|
22
|
+
install_local_git(names, version, options)
|
23
|
+
else
|
24
|
+
sources = options[:source] || Bundler.rubygems.sources
|
25
|
+
install_rubygems(names, version, sources)
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
@@ -84,6 +82,7 @@ module Bundler
|
|
84
82
|
deps = names.map {|name| Dependency.new name, version }
|
85
83
|
|
86
84
|
definition = Definition.new(nil, deps, source_list, true)
|
85
|
+
definition.allow_multisource!
|
87
86
|
install_definition(definition)
|
88
87
|
end
|
89
88
|
|
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.
|
@@ -15,16 +17,14 @@ module Bundler
|
|
15
17
|
# ==== Returns
|
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
|
-
def self.resolve(requirements,
|
19
|
-
platforms = Set.new(platforms) if platforms
|
20
|
+
def self.resolve(requirements, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
|
20
21
|
base = SpecSet.new(base) unless base.is_a?(SpecSet)
|
21
|
-
resolver = new(
|
22
|
+
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
22
23
|
result = resolver.start(requirements)
|
23
24
|
SpecSet.new(result)
|
24
25
|
end
|
25
26
|
|
26
|
-
def initialize(
|
27
|
-
@index = index
|
27
|
+
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
28
28
|
@source_requirements = source_requirements
|
29
29
|
@base = base
|
30
30
|
@resolver = Molinillo::Resolver.new(self, self)
|
@@ -32,14 +32,17 @@ module Bundler
|
|
32
32
|
@base_dg = Molinillo::DependencyGraph.new
|
33
33
|
@base.each do |ls|
|
34
34
|
dep = Dependency.new(ls.name, ls.version)
|
35
|
-
@base_dg.add_vertex(ls.name, DepProxy.
|
35
|
+
@base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
|
36
36
|
end
|
37
37
|
additional_base_requirements.each {|d| @base_dg.add_vertex(d.name, d) }
|
38
|
-
@platforms = platforms
|
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]
|
39
40
|
@gem_version_promoter = gem_version_promoter
|
40
|
-
@allow_bundler_dependency_conflicts = Bundler.feature_flag.allow_bundler_dependency_conflicts?
|
41
41
|
@use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
|
42
|
-
@
|
42
|
+
@no_aggregate_global_source = @source_requirements[:global].nil?
|
43
|
+
|
44
|
+
@variant_specific_names = []
|
45
|
+
@generic_names = ["Ruby\0", "RubyGems\0"]
|
43
46
|
end
|
44
47
|
|
45
48
|
def start(requirements)
|
@@ -75,7 +78,7 @@ module Bundler
|
|
75
78
|
return unless debug?
|
76
79
|
debug_info = yield
|
77
80
|
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
78
|
-
puts debug_info.split("\n").map {|s| "BUNDLER: "
|
81
|
+
puts debug_info.split("\n").map {|s| depth == 0 ? "BUNDLER: #{s}" : "BUNDLER(#{depth}): #{s}" }
|
79
82
|
end
|
80
83
|
|
81
84
|
def debug?
|
@@ -103,16 +106,25 @@ module Bundler
|
|
103
106
|
include Molinillo::SpecificationProvider
|
104
107
|
|
105
108
|
def dependencies_for(specification)
|
106
|
-
specification.dependencies_for_activated_platforms
|
109
|
+
all_dependencies = specification.dependencies_for_activated_platforms
|
110
|
+
|
111
|
+
if @variant_specific_names.include?(specification.name)
|
112
|
+
@variant_specific_names |= all_dependencies.map(&:name) - @generic_names
|
113
|
+
else
|
114
|
+
generic_names, variant_specific_names = specification.partitioned_dependency_names_for_activated_platforms
|
115
|
+
@variant_specific_names |= variant_specific_names - @generic_names
|
116
|
+
@generic_names |= generic_names
|
117
|
+
end
|
118
|
+
|
119
|
+
all_dependencies
|
107
120
|
end
|
108
121
|
|
109
122
|
def search_for(dependency_proxy)
|
110
123
|
platform = dependency_proxy.__platform
|
111
124
|
dependency = dependency_proxy.dep
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
results = index.search(dependency, @base[name])
|
125
|
+
name = dependency.name
|
126
|
+
search_result = @search_for[dependency_proxy] ||= begin
|
127
|
+
results = results_for(dependency, @base[name])
|
116
128
|
|
117
129
|
if vertex = @base_dg.vertex_named(name)
|
118
130
|
locked_requirement = vertex.payload.requirement
|
@@ -137,60 +149,70 @@ module Bundler
|
|
137
149
|
end
|
138
150
|
nested.reduce([]) do |groups, (version, specs)|
|
139
151
|
next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
|
140
|
-
|
141
|
-
|
142
|
-
|
152
|
+
|
153
|
+
specs_by_platform = Hash.new do |current_specs, current_platform|
|
154
|
+
current_specs[current_platform] = select_best_platform_match(specs, current_platform)
|
155
|
+
end
|
156
|
+
|
157
|
+
spec_group_ruby = SpecGroup.create_for(specs_by_platform, [Gem::Platform::RUBY], Gem::Platform::RUBY)
|
158
|
+
groups << spec_group_ruby if spec_group_ruby
|
159
|
+
|
160
|
+
next groups if @resolving_only_for_ruby
|
161
|
+
|
162
|
+
spec_group = SpecGroup.create_for(specs_by_platform, @platforms, platform)
|
163
|
+
groups << spec_group if spec_group
|
164
|
+
|
165
|
+
groups
|
143
166
|
end
|
144
167
|
else
|
145
168
|
[]
|
146
169
|
end
|
147
170
|
# GVP handles major itself, but it's still a bit risky to trust it with it
|
148
171
|
# until we get it settled with new behavior. For 2.x it can take over all cases.
|
149
|
-
|
172
|
+
if !@use_gvp
|
150
173
|
spec_groups
|
151
174
|
else
|
152
175
|
@gem_version_promoter.sort_versions(dependency, spec_groups)
|
153
176
|
end
|
154
|
-
|
155
|
-
search.each do |sg|
|
156
|
-
next unless sg.for?(platform)
|
157
|
-
sg_all_platforms = sg.copy_for(self.class.sort_platforms(@platforms).reverse)
|
158
|
-
next unless sg_all_platforms
|
159
|
-
|
160
|
-
selected_sgs << sg_all_platforms
|
161
|
-
|
162
|
-
next if sg_all_platforms.activated_platforms == [Gem::Platform::RUBY]
|
163
|
-
# Add a spec group for "non platform specific spec" as the fallback
|
164
|
-
# spec group.
|
165
|
-
sg_ruby = sg.copy_for([Gem::Platform::RUBY])
|
166
|
-
next unless sg_ruby
|
177
|
+
end
|
167
178
|
|
168
|
-
|
169
|
-
|
179
|
+
unless search_result.empty?
|
180
|
+
specific_dependency = @variant_specific_names.include?(name)
|
181
|
+
return search_result unless specific_dependency
|
170
182
|
|
171
|
-
|
183
|
+
search_result.each do |sg|
|
184
|
+
if @generic_names.include?(name)
|
185
|
+
@variant_specific_names -= [name]
|
186
|
+
sg.activate_all_platforms!
|
187
|
+
else
|
188
|
+
sg.activate_platform!(platform)
|
189
|
+
end
|
172
190
|
end
|
173
|
-
selected_sgs
|
174
191
|
end
|
192
|
+
|
193
|
+
search_result
|
175
194
|
end
|
176
195
|
|
177
|
-
def index_for(dependency)
|
196
|
+
def index_for(dependency, base)
|
178
197
|
source = @source_requirements[dependency.name]
|
179
198
|
if source
|
180
199
|
source.specs
|
181
|
-
elsif @
|
182
|
-
Index.
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
end
|
200
|
+
elsif @no_aggregate_global_source
|
201
|
+
dependency.all_sources.find(-> { Index.new }) do |s|
|
202
|
+
idx = s.specs
|
203
|
+
results = idx.search(dependency, base)
|
204
|
+
next if results.empty? || results == base
|
205
|
+
return idx
|
188
206
|
end
|
189
207
|
else
|
190
|
-
@
|
208
|
+
@source_requirements[:global]
|
191
209
|
end
|
192
210
|
end
|
193
211
|
|
212
|
+
def results_for(dependency, base)
|
213
|
+
index_for(dependency, base).search(dependency, base)
|
214
|
+
end
|
215
|
+
|
194
216
|
def name_for(dependency)
|
195
217
|
dependency.name
|
196
218
|
end
|
@@ -211,13 +233,19 @@ module Bundler
|
|
211
233
|
requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
|
212
234
|
end
|
213
235
|
|
236
|
+
def dependencies_equal?(dependencies, other_dependencies)
|
237
|
+
dependencies.map(&:dep) == other_dependencies.map(&:dep)
|
238
|
+
end
|
239
|
+
|
214
240
|
def relevant_sources_for_vertex(vertex)
|
215
241
|
if vertex.root?
|
216
|
-
[@source_requirements[vertex.name]]
|
217
|
-
elsif @
|
242
|
+
[@source_requirements[vertex.name]].compact
|
243
|
+
elsif @no_aggregate_global_source
|
218
244
|
vertex.recursive_predecessors.map do |v|
|
219
245
|
@source_requirements[v.name]
|
220
|
-
end << @source_requirements[:default]
|
246
|
+
end.compact << @source_requirements[:default]
|
247
|
+
else
|
248
|
+
[]
|
221
249
|
end
|
222
250
|
end
|
223
251
|
|
@@ -238,13 +266,6 @@ module Bundler
|
|
238
266
|
end
|
239
267
|
end
|
240
268
|
|
241
|
-
# Sort platforms from most general to most specific
|
242
|
-
def self.sort_platforms(platforms)
|
243
|
-
platforms.sort_by do |platform|
|
244
|
-
platform_sort_key(platform)
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
269
|
def self.platform_sort_key(platform)
|
249
270
|
# Prefer specific platform to not specific platform
|
250
271
|
return ["99-LAST", "", "", ""] if Gem::Platform::RUBY == platform
|
@@ -265,7 +286,7 @@ module Bundler
|
|
265
286
|
if (base = @base[dependency.name]) && !base.empty?
|
266
287
|
dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1
|
267
288
|
else
|
268
|
-
all = index_for(dependency).search(dependency.name).size
|
289
|
+
all = index_for(dependency, base).search(dependency.name).size
|
269
290
|
|
270
291
|
if all <= 1
|
271
292
|
all - 1_000_000
|
@@ -308,7 +329,7 @@ module Bundler
|
|
308
329
|
"The source does not contain any versions of '#{name}'"
|
309
330
|
end
|
310
331
|
else
|
311
|
-
message = "Could not find gem '#{requirement}' in any of the gem sources " \
|
332
|
+
message = "Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in any of the gem sources " \
|
312
333
|
"listed in your Gemfile#{cache_message}."
|
313
334
|
end
|
314
335
|
raise GemNotFound, message
|
@@ -329,10 +350,16 @@ module Bundler
|
|
329
350
|
def version_conflict_message(e)
|
330
351
|
# only show essential conflicts, if possible
|
331
352
|
conflicts = e.conflicts.dup
|
332
|
-
|
333
|
-
|
334
|
-
|
353
|
+
|
354
|
+
if conflicts["bundler"]
|
355
|
+
conflicts.replace("bundler" => conflicts["bundler"])
|
356
|
+
else
|
357
|
+
conflicts.delete_if do |_name, conflict|
|
358
|
+
deps = conflict.requirement_trees.map(&:last).flatten(1)
|
359
|
+
!Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
|
360
|
+
end
|
335
361
|
end
|
362
|
+
|
336
363
|
e = Molinillo::VersionConflict.new(conflicts, e.specification_provider) unless conflicts.empty?
|
337
364
|
|
338
365
|
solver_name = "Bundler"
|
@@ -360,15 +387,25 @@ module Bundler
|
|
360
387
|
:additional_message_for_conflict => lambda do |o, name, conflict|
|
361
388
|
if name == "bundler"
|
362
389
|
o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
|
363
|
-
other_bundler_required = !conflict.requirement.requirement.satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
364
|
-
end
|
365
390
|
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
391
|
+
conflict_dependency = conflict.requirement
|
392
|
+
conflict_requirement = conflict_dependency.requirement
|
393
|
+
other_bundler_required = !conflict_requirement.satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
394
|
+
|
395
|
+
if other_bundler_required
|
396
|
+
o << "\n\n"
|
397
|
+
|
398
|
+
candidate_specs = @source_requirements[:default_bundler].specs.search(conflict_dependency)
|
399
|
+
if candidate_specs.any?
|
400
|
+
target_version = candidate_specs.last.version
|
401
|
+
new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
|
402
|
+
o << "Your bundle requires a different version of Bundler than the one you're running.\n"
|
403
|
+
o << "Install the necessary version with `gem install bundler:#{target_version}` and rerun bundler using `#{new_command}`\n"
|
404
|
+
else
|
405
|
+
o << "Your bundle requires a different version of Bundler than the one you're running, and that version could not be found.\n"
|
406
|
+
end
|
407
|
+
end
|
408
|
+
elsif conflict.locked_requirement
|
372
409
|
o << "\n"
|
373
410
|
o << %(Running `bundle update` will rebuild your snapshot from scratch, using only\n)
|
374
411
|
o << %(the gems in your Gemfile, which may resolve the conflict.\n)
|
@@ -377,14 +414,8 @@ module Bundler
|
|
377
414
|
|
378
415
|
relevant_sources = if conflict.requirement.source
|
379
416
|
[conflict.requirement.source]
|
380
|
-
elsif conflict.requirement.all_sources
|
381
|
-
conflict.requirement.all_sources
|
382
|
-
elsif @lockfile_uses_separate_rubygems_sources
|
383
|
-
# every conflict should have an explicit group of sources when we
|
384
|
-
# enforce strict pinning
|
385
|
-
raise "no source set for #{conflict}"
|
386
417
|
else
|
387
|
-
|
418
|
+
conflict.requirement.all_sources
|
388
419
|
end.compact.map(&:to_s).uniq.sort
|
389
420
|
|
390
421
|
metadata_requirement = name.end_with?("\0")
|
@@ -421,7 +452,8 @@ module Bundler
|
|
421
452
|
def validate_resolved_specs!(resolved_specs)
|
422
453
|
resolved_specs.each do |v|
|
423
454
|
name = v.name
|
424
|
-
|
455
|
+
sources = relevant_sources_for_vertex(v)
|
456
|
+
next unless sources.any?
|
425
457
|
sources.compact!
|
426
458
|
if default_index = sources.index(@source_requirements[:default])
|
427
459
|
sources.delete_at(default_index)
|
@@ -430,14 +462,12 @@ module Bundler
|
|
430
462
|
sources.uniq!
|
431
463
|
next if sources.size <= 1
|
432
464
|
|
433
|
-
multisource_disabled = Bundler.feature_flag.disable_multisource?
|
434
|
-
|
435
465
|
msg = ["The gem '#{name}' was found in multiple relevant sources."]
|
436
466
|
msg.concat sources.map {|s| " * #{s}" }.sort
|
437
|
-
msg << "You #{
|
467
|
+
msg << "You #{@no_aggregate_global_source ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
|
438
468
|
msg = msg.join("\n")
|
439
469
|
|
440
|
-
raise SecurityError, msg if
|
470
|
+
raise SecurityError, msg if @no_aggregate_global_source
|
441
471
|
Bundler.ui.warn "Warning: #{msg}"
|
442
472
|
end
|
443
473
|
end
|