bundler 2.2.14 → 2.2.19

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.

Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +81 -5
  3. data/bundler.gemspec +2 -3
  4. data/lib/bundler.rb +1 -0
  5. data/lib/bundler/build_metadata.rb +2 -2
  6. data/lib/bundler/cli.rb +16 -35
  7. data/lib/bundler/cli/common.rb +15 -2
  8. data/lib/bundler/cli/gem.rb +9 -1
  9. data/lib/bundler/cli/outdated.rb +8 -11
  10. data/lib/bundler/compact_index_client/updater.rb +9 -5
  11. data/lib/bundler/current_ruby.rb +1 -0
  12. data/lib/bundler/definition.rb +21 -84
  13. data/lib/bundler/feature_flag.rb +0 -2
  14. data/lib/bundler/fetcher.rb +2 -1
  15. data/lib/bundler/fetcher/downloader.rb +8 -4
  16. data/lib/bundler/friendly_errors.rb +1 -1
  17. data/lib/bundler/gem_helper.rb +16 -0
  18. data/lib/bundler/index.rb +1 -2
  19. data/lib/bundler/injector.rb +2 -2
  20. data/lib/bundler/inline.rb +1 -1
  21. data/lib/bundler/installer/parallel_installer.rb +30 -7
  22. data/lib/bundler/lazy_specification.rb +6 -1
  23. data/lib/bundler/man/bundle-add.1 +1 -1
  24. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  25. data/lib/bundler/man/bundle-cache.1 +1 -1
  26. data/lib/bundler/man/bundle-check.1 +1 -1
  27. data/lib/bundler/man/bundle-clean.1 +1 -1
  28. data/lib/bundler/man/bundle-config.1 +21 -10
  29. data/lib/bundler/man/bundle-config.1.ronn +21 -11
  30. data/lib/bundler/man/bundle-doctor.1 +1 -1
  31. data/lib/bundler/man/bundle-exec.1 +1 -1
  32. data/lib/bundler/man/bundle-gem.1 +1 -1
  33. data/lib/bundler/man/bundle-info.1 +1 -1
  34. data/lib/bundler/man/bundle-init.1 +1 -1
  35. data/lib/bundler/man/bundle-inject.1 +1 -1
  36. data/lib/bundler/man/bundle-install.1 +1 -1
  37. data/lib/bundler/man/bundle-list.1 +1 -1
  38. data/lib/bundler/man/bundle-lock.1 +1 -1
  39. data/lib/bundler/man/bundle-open.1 +1 -1
  40. data/lib/bundler/man/bundle-outdated.1 +1 -1
  41. data/lib/bundler/man/bundle-platform.1 +1 -1
  42. data/lib/bundler/man/bundle-pristine.1 +1 -1
  43. data/lib/bundler/man/bundle-remove.1 +1 -1
  44. data/lib/bundler/man/bundle-show.1 +1 -1
  45. data/lib/bundler/man/bundle-update.1 +1 -1
  46. data/lib/bundler/man/bundle-viz.1 +1 -1
  47. data/lib/bundler/man/bundle.1 +1 -1
  48. data/lib/bundler/man/gemfile.5 +1 -1
  49. data/lib/bundler/plugin.rb +2 -2
  50. data/lib/bundler/plugin/api/source.rb +14 -0
  51. data/lib/bundler/resolver.rb +13 -96
  52. data/lib/bundler/resolver/spec_group.rb +0 -24
  53. data/lib/bundler/retry.rb +1 -1
  54. data/lib/bundler/rubygems_ext.rb +2 -2
  55. data/lib/bundler/settings.rb +74 -12
  56. data/lib/bundler/source.rb +9 -0
  57. data/lib/bundler/source/path.rb +3 -1
  58. data/lib/bundler/source/path/installer.rb +1 -1
  59. data/lib/bundler/source/rubygems.rb +17 -10
  60. data/lib/bundler/source/rubygems_aggregate.rb +64 -0
  61. data/lib/bundler/source_list.rb +29 -10
  62. data/lib/bundler/source_map.rb +58 -0
  63. data/lib/bundler/spec_set.rb +18 -7
  64. data/lib/bundler/templates/Gemfile +1 -1
  65. data/lib/bundler/templates/gems.rb +1 -1
  66. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -4
  67. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  68. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -1
  69. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +1 -1
  70. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +1 -1
  71. data/lib/bundler/version.rb +1 -1
  72. metadata +9 -4
@@ -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" "January 2021" "" ""
4
+ .TH "BUNDLE\-INFO" "1" "May 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" "January 2021" "" ""
4
+ .TH "BUNDLE\-INIT" "1" "May 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" "January 2021" "" ""
4
+ .TH "BUNDLE\-INJECT" "1" "May 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" "January 2021" "" ""
4
+ .TH "BUNDLE\-INSTALL" "1" "May 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\-LIST" "1" "January 2021" "" ""
4
+ .TH "BUNDLE\-LIST" "1" "May 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-list\fR \- List all the gems in the 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\-LOCK" "1" "January 2021" "" ""
4
+ .TH "BUNDLE\-LOCK" "1" "May 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
@@ -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" "January 2021" "" ""
4
+ .TH "BUNDLE\-OPEN" "1" "May 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" "January 2021" "" ""
4
+ .TH "BUNDLE\-OUTDATED" "1" "May 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" "January 2021" "" ""
4
+ .TH "BUNDLE\-PLATFORM" "1" "May 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" "January 2021" "" ""
4
+ .TH "BUNDLE\-PRISTINE" "1" "May 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\-REMOVE" "1" "January 2021" "" ""
4
+ .TH "BUNDLE\-REMOVE" "1" "May 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-remove\fR \- Removes gems from the 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\-SHOW" "1" "January 2021" "" ""
4
+ .TH "BUNDLE\-SHOW" "1" "May 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" "January 2021" "" ""
4
+ .TH "BUNDLE\-UPDATE" "1" "May 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" "January 2021" "" ""
4
+ .TH "BUNDLE\-VIZ" "1" "May 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-viz\fR \- Generates a visual dependency graph for 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" "1" "January 2021" "" ""
4
+ .TH "BUNDLE" "1" "May 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\fR \- Ruby Dependency Management
@@ -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 "GEMFILE" "5" "January 2021" "" ""
4
+ .TH "GEMFILE" "5" "May 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
@@ -164,7 +164,7 @@ module Bundler
164
164
  end
165
165
 
166
166
  # To be called from Cli class to pass the command and argument to
167
- # approriate plugin class
167
+ # appropriate plugin class
168
168
  def exec_command(command, args)
169
169
  raise UndefinedCommandError, "Command `#{command}` not found" unless command? command
170
170
 
@@ -183,7 +183,7 @@ module Bundler
183
183
  !index.source_plugin(name.to_s).nil?
184
184
  end
185
185
 
186
- # @return [Class] that handles the source. The calss includes API::Source
186
+ # @return [Class] that handles the source. The class includes API::Source
187
187
  def source(name)
188
188
  raise UnknownSourceError, "Source #{name} not found" unless source? name
189
189
 
@@ -244,6 +244,20 @@ module Bundler
244
244
  specs.unmet_dependency_names
245
245
  end
246
246
 
247
+ # Used by definition.
248
+ #
249
+ # Note: Do not override if you don't know what you are doing.
250
+ def spec_names
251
+ specs.spec_names
252
+ end
253
+
254
+ # Used by definition.
255
+ #
256
+ # Note: Do not override if you don't know what you are doing.
257
+ def add_dependency_names(names)
258
+ @dependencies |= Array(names)
259
+ end
260
+
247
261
  # Note: Do not override if you don't know what you are doing.
248
262
  def can_lock?(spec)
249
263
  spec.source == self
@@ -21,17 +21,11 @@ module Bundler
21
21
  base = SpecSet.new(base) unless base.is_a?(SpecSet)
22
22
  resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
23
23
  result = resolver.start(requirements)
24
- SpecSet.new(result)
24
+ SpecSet.new(result).for(requirements.reject{|dep| dep.name.end_with?("\0") })
25
25
  end
26
26
 
27
27
  def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
28
28
  @source_requirements = source_requirements
29
-
30
- @index_requirements = source_requirements.each_with_object({}) do |source_requirement, index_requirements|
31
- name, source = source_requirement
32
- index_requirements[name] = name == :global ? source : source.specs
33
- end
34
-
35
29
  @base = base
36
30
  @resolver = Molinillo::Resolver.new(self, self)
37
31
  @search_for = {}
@@ -45,10 +39,6 @@ module Bundler
45
39
  @resolving_only_for_ruby = platforms == [Gem::Platform::RUBY]
46
40
  @gem_version_promoter = gem_version_promoter
47
41
  @use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
48
- @no_aggregate_global_source = @source_requirements[:global].nil?
49
-
50
- @variant_specific_names = []
51
- @generic_names = ["Ruby\0", "RubyGems\0"]
52
42
  end
53
43
 
54
44
  def start(requirements)
@@ -58,7 +48,6 @@ module Bundler
58
48
  verify_gemfile_dependencies_are_found!(requirements)
59
49
  dg = @resolver.resolve(requirements, @base_dg)
60
50
  dg.
61
- tap {|resolved| validate_resolved_specs!(resolved) }.
62
51
  map(&:payload).
63
52
  reject {|sg| sg.name.end_with?("\0") }.
64
53
  map(&:to_specs).
@@ -112,24 +101,14 @@ module Bundler
112
101
  include Molinillo::SpecificationProvider
113
102
 
114
103
  def dependencies_for(specification)
115
- all_dependencies = specification.dependencies_for_activated_platforms
116
-
117
- if @variant_specific_names.include?(specification.name)
118
- @variant_specific_names |= all_dependencies.map(&:name) - @generic_names
119
- else
120
- generic_names, variant_specific_names = specification.partitioned_dependency_names_for_activated_platforms
121
- @variant_specific_names |= variant_specific_names - @generic_names
122
- @generic_names |= generic_names
123
- end
124
-
125
- all_dependencies
104
+ specification.dependencies_for_activated_platforms
126
105
  end
127
106
 
128
107
  def search_for(dependency_proxy)
129
108
  platform = dependency_proxy.__platform
130
109
  dependency = dependency_proxy.dep
131
110
  name = dependency.name
132
- search_result = @search_for[dependency_proxy] ||= begin
111
+ @search_for[dependency_proxy] ||= begin
133
112
  results = results_for(dependency, @base[name])
134
113
 
135
114
  if vertex = @base_dg.vertex_named(name)
@@ -181,35 +160,14 @@ module Bundler
181
160
  @gem_version_promoter.sort_versions(dependency, spec_groups)
182
161
  end
183
162
  end
184
-
185
- unless search_result.empty?
186
- specific_dependency = @variant_specific_names.include?(name)
187
- return search_result unless specific_dependency
188
-
189
- search_result.each do |sg|
190
- if @generic_names.include?(name)
191
- @variant_specific_names -= [name]
192
- sg.activate_all_platforms!
193
- else
194
- sg.activate_platform!(platform)
195
- end
196
- end
197
- end
198
-
199
- search_result
200
163
  end
201
164
 
202
165
  def index_for(dependency)
203
- source = @index_requirements[dependency.name]
204
- if source
205
- source
206
- elsif @no_aggregate_global_source
207
- Index.build do |idx|
208
- dependency.all_sources.each {|s| idx.add_source(s.specs) }
209
- end
210
- else
211
- @index_requirements[:global]
212
- end
166
+ source_for(dependency.name).specs
167
+ end
168
+
169
+ def source_for(name)
170
+ @source_requirements[name] || @source_requirements[:default]
213
171
  end
214
172
 
215
173
  def results_for(dependency, base)
@@ -240,23 +198,10 @@ module Bundler
240
198
  dependencies.map(&:dep) == other_dependencies.map(&:dep)
241
199
  end
242
200
 
243
- def relevant_sources_for_vertex(vertex)
244
- if vertex.root?
245
- [@source_requirements[vertex.name]]
246
- elsif @no_aggregate_global_source
247
- vertex.recursive_predecessors.map do |v|
248
- @source_requirements[v.name]
249
- end.compact << @source_requirements[:default]
250
- else
251
- []
252
- end
253
- end
254
-
255
201
  def sort_dependencies(dependencies, activated, conflicts)
256
202
  dependencies.sort_by do |dependency|
257
203
  name = name_for(dependency)
258
204
  vertex = activated.vertex_named(name)
259
- dependency.all_sources = relevant_sources_for_vertex(vertex)
260
205
  [
261
206
  @base_dg.vertex_named(name) ? 0 : 1,
262
207
  vertex.payload ? 0 : 1,
@@ -398,7 +343,7 @@ module Bundler
398
343
  if other_bundler_required
399
344
  o << "\n\n"
400
345
 
401
- candidate_specs = @index_requirements[:default_bundler].search(conflict_dependency)
346
+ candidate_specs = source_for(:default_bundler).specs.search(conflict_dependency)
402
347
  if candidate_specs.any?
403
348
  target_version = candidate_specs.last.version
404
349
  new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
@@ -415,11 +360,7 @@ module Bundler
415
360
  elsif !conflict.existing
416
361
  o << "\n"
417
362
 
418
- relevant_sources = if conflict.requirement.source
419
- [conflict.requirement.source]
420
- else
421
- conflict.requirement.all_sources
422
- end.compact.map(&:to_s).uniq.sort
363
+ relevant_source = conflict.requirement.source || source_for(name)
423
364
 
424
365
  metadata_requirement = name.end_with?("\0")
425
366
 
@@ -432,12 +373,10 @@ module Bundler
432
373
  end
433
374
  o << " "
434
375
 
435
- o << if relevant_sources.empty?
436
- "in any of the sources.\n"
437
- elsif metadata_requirement
438
- "is not available in #{relevant_sources.join(" or ")}"
376
+ o << if metadata_requirement
377
+ "is not available in #{relevant_source}"
439
378
  else
440
- "in any of the relevant sources:\n #{relevant_sources * "\n "}\n"
379
+ "in #{relevant_source}.\n"
441
380
  end
442
381
  end
443
382
  end,
@@ -451,27 +390,5 @@ module Bundler
451
390
  end
452
391
  )
453
392
  end
454
-
455
- def validate_resolved_specs!(resolved_specs)
456
- resolved_specs.each do |v|
457
- name = v.name
458
- sources = relevant_sources_for_vertex(v)
459
- next unless sources.any?
460
- if default_index = sources.index(@source_requirements[:default])
461
- sources.delete_at(default_index)
462
- end
463
- sources.reject! {|s| s.specs.search(name).empty? }
464
- sources.uniq!
465
- next if sources.size <= 1
466
-
467
- msg = ["The gem '#{name}' was found in multiple relevant sources."]
468
- msg.concat sources.map {|s| " * #{s}" }.sort
469
- 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."
470
- msg = msg.join("\n")
471
-
472
- raise SecurityError, msg if @no_aggregate_global_source
473
- Bundler.ui.warn "Warning: #{msg}"
474
- end
475
- end
476
393
  end
477
394
  end
@@ -21,14 +21,10 @@ module Bundler
21
21
  @version = exemplary_spec.version
22
22
  @source = exemplary_spec.source
23
23
 
24
- @all_platforms = relevant_platforms
25
24
  @activated_platforms = relevant_platforms
26
25
  @dependencies = Hash.new do |dependencies, platforms|
27
26
  dependencies[platforms] = dependencies_for(platforms)
28
27
  end
29
- @partitioned_dependency_names = Hash.new do |partitioned_dependency_names, platforms|
30
- partitioned_dependency_names[platforms] = partitioned_dependency_names_for(platforms)
31
- end
32
28
  @specs = specs
33
29
  end
34
30
 
@@ -45,14 +41,6 @@ module Bundler
45
41
  end.flatten.compact.uniq
46
42
  end
47
43
 
48
- def activate_platform!(platform)
49
- self.activated_platforms = [platform]
50
- end
51
-
52
- def activate_all_platforms!
53
- self.activated_platforms = @all_platforms
54
- end
55
-
56
44
  def to_s
57
45
  activated_platforms_string = sorted_activated_platforms.join(", ")
58
46
  "#{name} (#{version}) (#{activated_platforms_string})"
@@ -62,10 +50,6 @@ module Bundler
62
50
  @dependencies[activated_platforms]
63
51
  end
64
52
 
65
- def partitioned_dependency_names_for_activated_platforms
66
- @partitioned_dependency_names[activated_platforms]
67
- end
68
-
69
53
  def ==(other)
70
54
  return unless other.is_a?(SpecGroup)
71
55
  name == other.name &&
@@ -100,14 +84,6 @@ module Bundler
100
84
  end.flatten
101
85
  end
102
86
 
103
- def partitioned_dependency_names_for(platforms)
104
- return @dependencies[platforms].map(&:name), [] if platforms.size == 1
105
-
106
- @dependencies[platforms].partition do |dep_proxy|
107
- @dependencies[platforms].count {|dp| dp.dep == dep_proxy.dep } == platforms.size
108
- end.map {|deps| deps.map(&:name) }
109
- end
110
-
111
87
  def __dependencies(platform)
112
88
  dependencies = []
113
89
  @specs[platform].first.dependencies.each do |dep|