bundler 2.4.14 → 2.4.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9946bc6a889915e914f12ec576748b58edfa7a41732d242dcd0ea72736bf0c54
4
- data.tar.gz: ac280b3666ae5967bee95dc98ee754d20efb52f390d0653b85cec9a38d3cae3f
3
+ metadata.gz: d86d908aad51054ecd34b5431e5b831aa1290d51b1a0b84bbfa72993479f8bbe
4
+ data.tar.gz: ba67e60139c27838dc8a945f026d7551721b7a83c519631d595ab01a6ad42bf4
5
5
  SHA512:
6
- metadata.gz: a8433864b6208eb1ce25b83d7dfac39b2745f906e2590d99b10d71de48dfb28cf028e7b6a7731289f534bfe2cbade1cc79cb1502096278f14ed67d70e21edcb2
7
- data.tar.gz: ec6c495bd7a6fdef3c7bb2ce703494c3aeebb3eb902fed8022c0ba22d72df746b38da610bfa0ea7598e1022963a44f13dbc16e3142a178762b235128063371f0
6
+ metadata.gz: 0111c1f28e1069aece178f51b86a7786c335f2942c2df13efdc2c52066ae6ba1ad52eb249092f3e5bcb3729063249f5c2043e2e2d43263d6a029e6dac09c4c7c
7
+ data.tar.gz: 91e31ddab4115b5ae57385cb26e7b2eb66590bc1850ca008f3dd9fade35d7e28d147aac2dcb7a15904e4a2b60d430b5af4b7124d0f8de3a45304b1cd47ab6301
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 2.4.15 (June 29, 2023)
2
+
3
+ ## Enhancements:
4
+
5
+ - Improve edge case error message [#6733](https://github.com/rubygems/rubygems/pull/6733)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Fix `bundle lock --update --bundler` [#6213](https://github.com/rubygems/rubygems/pull/6213)
10
+
1
11
  # 2.4.14 (June 12, 2023)
2
12
 
3
13
  ## Enhancements:
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2023-06-12".freeze
8
- @git_commit_sha = "69f47cf53a".freeze
7
+ @built_at = "2023-06-29".freeze
8
+ @git_commit_sha = "702f922bf2".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -76,8 +76,11 @@ module Bundler
76
76
 
77
77
  @lockfile = lockfile
78
78
  @lockfile_contents = String.new
79
+
79
80
  @locked_bundler_version = nil
80
- @locked_ruby_version = nil
81
+ @resolved_bundler_version = nil
82
+
83
+ @locked_ruby_version = nil
81
84
  @new_platform = nil
82
85
  @removed_platform = nil
83
86
 
@@ -146,7 +149,7 @@ module Bundler
146
149
  @dependency_changes = converge_dependencies
147
150
  @local_changes = converge_locals
148
151
 
149
- @incomplete_lockfile = check_missing_lockfile_specs
152
+ @missing_lockfile_dep = check_missing_lockfile_dep
150
153
  end
151
154
 
152
155
  def gem_version_promoter
@@ -234,6 +237,14 @@ module Bundler
234
237
  end
235
238
 
236
239
  def current_dependencies
240
+ filter_relevant(dependencies)
241
+ end
242
+
243
+ def current_locked_dependencies
244
+ filter_relevant(locked_dependencies)
245
+ end
246
+
247
+ def filter_relevant(dependencies)
237
248
  dependencies.select do |d|
238
249
  d.should_include? && !d.gem_platforms([generic_local_platform]).empty?
239
250
  end
@@ -273,7 +284,7 @@ module Bundler
273
284
  @resolve ||= if Bundler.frozen_bundle?
274
285
  Bundler.ui.debug "Frozen, using resolution from the lockfile"
275
286
  @locked_specs
276
- elsif !unlocking? && nothing_changed?
287
+ elsif no_resolve_needed?
277
288
  if deleted_deps.any?
278
289
  Bundler.ui.debug "Some dependencies were deleted, using a subset of the resolution from the lockfile"
279
290
  SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps))
@@ -310,7 +321,7 @@ module Bundler
310
321
 
311
322
  if @locked_bundler_version
312
323
  locked_major = @locked_bundler_version.segments.first
313
- current_major = Bundler.gem_version.segments.first
324
+ current_major = bundler_version_to_lock.segments.first
314
325
 
315
326
  updating_major = locked_major < current_major
316
327
  end
@@ -350,25 +361,16 @@ module Bundler
350
361
  end
351
362
  end
352
363
 
364
+ def bundler_version_to_lock
365
+ @resolved_bundler_version || Bundler.gem_version
366
+ end
367
+
353
368
  def to_lock
354
369
  require_relative "lockfile_generator"
355
370
  LockfileGenerator.generate(self)
356
371
  end
357
372
 
358
373
  def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
359
- msg = String.new
360
- msg << "You are trying to install in deployment mode after changing\n" \
361
- "your Gemfile. Run `bundle install` elsewhere and add the\n" \
362
- "updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control."
363
-
364
- unless explicit_flag
365
- suggested_command = unless Bundler.settings.locations("frozen").keys.include?(:env)
366
- "bundle config set frozen false"
367
- end
368
- msg << "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \
369
- "freeze \nby running `#{suggested_command}`." if suggested_command
370
- end
371
-
372
374
  added = []
373
375
  deleted = []
374
376
  changed = []
@@ -382,13 +384,8 @@ module Bundler
382
384
  deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
383
385
 
384
386
  both_sources = Hash.new {|h, k| h[k] = [] }
385
- @dependencies.each {|d| both_sources[d.name][0] = d }
386
-
387
- locked_dependencies.each do |d|
388
- next if !Bundler.feature_flag.bundler_3_mode? && @locked_specs[d.name].empty?
389
-
390
- both_sources[d.name][1] = d
391
- end
387
+ current_dependencies.each {|d| both_sources[d.name][0] = d }
388
+ current_locked_dependencies.each {|d| both_sources[d.name][1] = d }
392
389
 
393
390
  both_sources.each do |name, (dep, lock_dep)|
394
391
  next if dep.nil? || lock_dep.nil?
@@ -403,11 +400,20 @@ module Bundler
403
400
  end
404
401
 
405
402
  reason = change_reason
406
- msg << "\n\n#{reason.split(", ").map(&:capitalize).join("\n")}" unless reason.strip.empty?
403
+ msg = String.new
404
+ msg << "#{reason.capitalize.strip}, but the lockfile can't be updated because frozen mode is set"
407
405
  msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
408
406
  msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
409
407
  msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
410
- msg << "\n"
408
+ msg << "\n\nRun `bundle install` elsewhere and add the updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control.\n"
409
+
410
+ unless explicit_flag
411
+ suggested_command = unless Bundler.settings.locations("frozen").keys.include?(:env)
412
+ "bundle config set frozen false"
413
+ end
414
+ msg << "If this is a development machine, remove the #{Bundler.default_gemfile.relative_path_from(SharedHelpers.pwd)} " \
415
+ "freeze by running `#{suggested_command}`." if suggested_command
416
+ end
411
417
 
412
418
  raise ProductionError, msg if added.any? || deleted.any? || changed.any? || !nothing_changed?
413
419
  end
@@ -472,7 +478,11 @@ module Bundler
472
478
  private :sources
473
479
 
474
480
  def nothing_changed?
475
- !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@incomplete_lockfile
481
+ !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@missing_lockfile_dep && !@unlocking_bundler
482
+ end
483
+
484
+ def no_resolve_needed?
485
+ !unlocking? && nothing_changed?
476
486
  end
477
487
 
478
488
  def unlocking?
@@ -486,7 +496,14 @@ module Bundler
486
496
  end
487
497
 
488
498
  def expanded_dependencies
489
- dependencies + metadata_dependencies
499
+ dependencies_with_bundler + metadata_dependencies
500
+ end
501
+
502
+ def dependencies_with_bundler
503
+ return dependencies unless @unlocking_bundler
504
+ return dependencies if dependencies.map(&:name).include?("bundler")
505
+
506
+ [Dependency.new("bundler", @unlocking_bundler)] + dependencies
490
507
  end
491
508
 
492
509
  def resolution_packages
@@ -552,6 +569,8 @@ module Bundler
552
569
  def start_resolution
553
570
  result = resolver.start
554
571
 
572
+ @resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
573
+
555
574
  SpecSet.new(SpecSet.new(result).for(dependencies, false, @platforms))
556
575
  end
557
576
 
@@ -609,7 +628,8 @@ module Bundler
609
628
  [@new_platform, "you added a new platform to your gemfile"],
610
629
  [@path_changes, "the gemspecs for path gems changed"],
611
630
  [@local_changes, "the gemspecs for git local gems changed"],
612
- [@incomplete_lockfile, "your lock file is missing some gems"],
631
+ [@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""],
632
+ [@unlocking_bundler, "an update to the version of Bundler itself was requested"],
613
633
  ].select(&:first).map(&:last).join(", ")
614
634
  end
615
635
 
@@ -664,7 +684,7 @@ module Bundler
664
684
  !sources_with_changes.each {|source| @unlock[:sources] << source.name }.empty?
665
685
  end
666
686
 
667
- def check_missing_lockfile_specs
687
+ def check_missing_lockfile_dep
668
688
  all_locked_specs = @locked_specs.map(&:name) << "bundler"
669
689
 
670
690
  missing = @locked_specs.select do |s|
@@ -674,10 +694,14 @@ module Bundler
674
694
  if missing.any?
675
695
  @locked_specs.delete(missing)
676
696
 
677
- true
678
- else
679
- false
697
+ return missing.first.name
680
698
  end
699
+
700
+ return if @dependency_changes
701
+
702
+ current_dependencies.find do |d|
703
+ @locked_specs[d.name].empty?
704
+ end&.name
681
705
  end
682
706
 
683
707
  def converge_paths
@@ -861,8 +885,16 @@ module Bundler
861
885
  metadata_dependencies.each do |dep|
862
886
  source_requirements[dep.name] = sources.metadata_source
863
887
  end
864
- source_requirements[:default_bundler] = source_requirements["bundler"] || sources.default_source
865
- source_requirements["bundler"] = sources.metadata_source # needs to come last to override
888
+
889
+ default_bundler_source = source_requirements["bundler"] || sources.default_source
890
+
891
+ if @unlocking_bundler
892
+ default_bundler_source.add_dependency_names("bundler")
893
+ else
894
+ source_requirements[:default_bundler] = default_bundler_source
895
+ source_requirements["bundler"] = sources.metadata_source # needs to come last to override
896
+ end
897
+
866
898
  verify_changed_sources!
867
899
  source_requirements
868
900
  end
@@ -71,7 +71,7 @@ module Bundler
71
71
  end
72
72
 
73
73
  def add_bundled_with
74
- add_section("BUNDLED WITH", Bundler::VERSION)
74
+ add_section("BUNDLED WITH", definition.bundler_version_to_lock.to_s)
75
75
  end
76
76
 
77
77
  def add_section(name, value)
@@ -160,7 +160,7 @@ module Bundler
160
160
  constraint_string = constraint.constraint_string
161
161
  requirements = constraint_string.split(" OR ").map {|req| Gem::Requirement.new(req.split(",")) }
162
162
 
163
- if name == "bundler"
163
+ if name == "bundler" && bundler_pinned_to_current_version?
164
164
  custom_explanation = "the current Bundler version (#{Bundler::VERSION}) does not satisfy #{constraint}"
165
165
  extended_explanation = bundler_not_found_message(requirements)
166
166
  else
@@ -230,6 +230,12 @@ module Bundler
230
230
  def all_versions_for(package)
231
231
  name = package.name
232
232
  results = (@base[name] + filter_prereleases(@all_specs[name], package)).uniq {|spec| [spec.version.hash, spec.platform] }
233
+
234
+ if name == "bundler" && !bundler_pinned_to_current_version?
235
+ bundler_spec = Gem.loaded_specs["bundler"]
236
+ results << bundler_spec if bundler_spec
237
+ end
238
+
233
239
  locked_requirement = base_requirements[name]
234
240
  results = filter_matching_specs(results, locked_requirement) if locked_requirement
235
241
 
@@ -254,6 +260,14 @@ module Bundler
254
260
  @source_requirements[name] || @source_requirements[:default]
255
261
  end
256
262
 
263
+ def default_bundler_source
264
+ @source_requirements[:default_bundler]
265
+ end
266
+
267
+ def bundler_pinned_to_current_version?
268
+ !default_bundler_source.nil?
269
+ end
270
+
257
271
  def name_for_explicit_dependency_source
258
272
  Bundler.default_gemfile.basename.to_s
259
273
  rescue StandardError
@@ -398,7 +412,7 @@ module Bundler
398
412
  end
399
413
 
400
414
  def bundler_not_found_message(conflict_dependencies)
401
- candidate_specs = filter_matching_specs(source_for(:default_bundler).specs.search("bundler"), conflict_dependencies)
415
+ candidate_specs = filter_matching_specs(default_bundler_source.specs.search("bundler"), conflict_dependencies)
402
416
 
403
417
  if candidate_specs.any?
404
418
  target_version = candidate_specs.last.version
@@ -94,7 +94,7 @@ module Bundler
94
94
  definition_method :requires
95
95
 
96
96
  def lock(opts = {})
97
- return if @definition.nothing_changed? && !@definition.unlocking?
97
+ return if @definition.no_resolve_needed?
98
98
  @definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
99
99
  end
100
100
 
@@ -381,7 +381,6 @@ module Bundler
381
381
  idx = @allow_local ? installed_specs.dup : Index.new
382
382
 
383
383
  Dir["#{cache_path}/*.gem"].each do |gemfile|
384
- next if /^bundler\-[\d\.]+?\.gem/.match?(gemfile)
385
384
  s ||= Bundler.rubygems.spec_from_gem(gemfile)
386
385
  s.source = self
387
386
  idx << s
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.4.14".freeze
4
+ VERSION = "2.4.15".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.14
4
+ version: 2.4.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -22,7 +22,7 @@ authors:
22
22
  autorequire:
23
23
  bindir: exe
24
24
  cert_chain: []
25
- date: 2023-06-12 00:00:00.000000000 Z
25
+ date: 2023-06-29 00:00:00.000000000 Z
26
26
  dependencies: []
27
27
  description: Bundler manages an application's dependencies through its entire life,
28
28
  across many machines, systematically and repeatably
@@ -381,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
381
381
  - !ruby/object:Gem::Version
382
382
  version: 3.0.1
383
383
  requirements: []
384
- rubygems_version: 3.4.14
384
+ rubygems_version: 3.4.15
385
385
  signing_key:
386
386
  specification_version: 4
387
387
  summary: The best way to manage your application's dependencies