bundler 2.7.1 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/lib/bundler/build_metadata.rb +2 -2
  4. data/lib/bundler/checksum.rb +6 -0
  5. data/lib/bundler/cli/cache.rb +0 -1
  6. data/lib/bundler/cli/common.rb +1 -1
  7. data/lib/bundler/cli/install.rb +0 -2
  8. data/lib/bundler/cli/lock.rb +5 -5
  9. data/lib/bundler/cli/show.rb +2 -6
  10. data/lib/bundler/cli.rb +29 -19
  11. data/lib/bundler/definition.rb +77 -60
  12. data/lib/bundler/dsl.rb +1 -1
  13. data/lib/bundler/feature_flag.rb +1 -1
  14. data/lib/bundler/man/bundle-add.1 +1 -1
  15. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  16. data/lib/bundler/man/bundle-cache.1 +1 -1
  17. data/lib/bundler/man/bundle-check.1 +1 -1
  18. data/lib/bundler/man/bundle-clean.1 +1 -1
  19. data/lib/bundler/man/bundle-config.1 +31 -14
  20. data/lib/bundler/man/bundle-config.1.ronn +49 -20
  21. data/lib/bundler/man/bundle-console.1 +1 -1
  22. data/lib/bundler/man/bundle-doctor.1 +4 -4
  23. data/lib/bundler/man/bundle-doctor.1.ronn +4 -4
  24. data/lib/bundler/man/bundle-env.1 +1 -1
  25. data/lib/bundler/man/bundle-exec.1 +1 -1
  26. data/lib/bundler/man/bundle-fund.1 +1 -1
  27. data/lib/bundler/man/bundle-gem.1 +1 -1
  28. data/lib/bundler/man/bundle-help.1 +1 -1
  29. data/lib/bundler/man/bundle-info.1 +1 -1
  30. data/lib/bundler/man/bundle-init.1 +1 -1
  31. data/lib/bundler/man/bundle-inject.1 +1 -1
  32. data/lib/bundler/man/bundle-install.1 +1 -1
  33. data/lib/bundler/man/bundle-issue.1 +1 -1
  34. data/lib/bundler/man/bundle-licenses.1 +1 -1
  35. data/lib/bundler/man/bundle-list.1 +1 -1
  36. data/lib/bundler/man/bundle-lock.1 +1 -1
  37. data/lib/bundler/man/bundle-open.1 +1 -1
  38. data/lib/bundler/man/bundle-outdated.1 +1 -1
  39. data/lib/bundler/man/bundle-platform.1 +1 -1
  40. data/lib/bundler/man/bundle-plugin.1 +40 -15
  41. data/lib/bundler/man/bundle-plugin.1.ronn +44 -15
  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-version.1 +1 -1
  47. data/lib/bundler/man/bundle-viz.1 +1 -1
  48. data/lib/bundler/man/bundle.1 +1 -1
  49. data/lib/bundler/man/gemfile.5 +1 -1
  50. data/lib/bundler/resolver/package.rb +1 -0
  51. data/lib/bundler/settings.rb +1 -1
  52. data/lib/bundler/source/gemspec.rb +4 -0
  53. data/lib/bundler/source/path.rb +2 -0
  54. data/lib/bundler/templates/newgem/newgem.gemspec.tt +3 -3
  55. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +42 -6
  56. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +1 -1
  57. data/lib/bundler/vendor/thor/lib/thor/runner.rb +1 -1
  58. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +3 -7
  59. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  60. data/lib/bundler/version.rb +1 -1
  61. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7646bb07e1de3699f3cde655ea56767abc4b8f0b31b54bbe97db921b3190f6a6
4
- data.tar.gz: b86ad0963600740f1f966d82880f8f1b648c9cb2d5097da720201a4da6424bfa
3
+ metadata.gz: f1982c5c69b6f594a4722d67fe1dbdf4e172d4d5bb2f668dcf2d761b5b586073
4
+ data.tar.gz: 4ba353e26a9532c811867f2d5fd670ada1399800e9eef227777273cd18f7cfe4
5
5
  SHA512:
6
- metadata.gz: 106db161a170ecca9cb3fe526e796c4663e0f55c79e6a24a5e1ae1762af9af899408040edf30f143e640e67aeefdcf2a028e7ff7a20441478c4599a423b6f351
7
- data.tar.gz: 689de87d686762ff8539cdb800b00ad79816f4b48c1b447ac7ec87b1db9a76516f4df4ed9dd2a69d4588d9ab72b375b08df01dfaf1f2622dd3838f0aad81c5a2
6
+ metadata.gz: a3e5ca074599e8ef171e40134035e3f676ea99bcb9dda2aa1b4fea8d36cc31fac0b57e2751799ece3232b7cdf8df0c8dd85ccf4c95b1306552fd80915847e8c8
7
+ data.tar.gz: 2700a932263a8da12c748917da79cd8e058085a7b6db00bbbec6c60cffb671bb939d5ebc47f842083b9f0bbd5c139dd40d7ada3fb13b7a91abca2f97320b7b11
data/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.7.2 (2025-09-09)
4
+
5
+ ### Enhancements:
6
+
7
+ - Improve error message when the same source is specified through `gemspec` and `path` [#8460](https://github.com/rubygems/rubygems/pull/8460)
8
+ - Raise an error in frozen mode if some registry gems have empty checksums [#8888](https://github.com/rubygems/rubygems/pull/8888)
9
+ - Bump vendored thor to 1.4.0 [#8883](https://github.com/rubygems/rubygems/pull/8883)
10
+ - Delay default path and global cache changes to Bundler 5 [#8867](https://github.com/rubygems/rubygems/pull/8867)
11
+ - Fix spacing in bundle gem newgem.gemspec.tt [#8865](https://github.com/rubygems/rubygems/pull/8865)
12
+
13
+ ### Bug fixes:
14
+
15
+ - Fix `bundle cache --frozen` and `bundle cache --no-prune` not printing a deprecation message [#8926](https://github.com/rubygems/rubygems/pull/8926)
16
+ - Fix local installation incorrectly forced if there's a `vendor/cache` directory and frozen mode is set [#8925](https://github.com/rubygems/rubygems/pull/8925)
17
+ - Fix `bundle lock --update <gem>` with `--lockfile` flag updating all gems [#8922](https://github.com/rubygems/rubygems/pull/8922)
18
+ - Fix `bundle show --verbose` and recommend it as an alternative to `bundle show --outdated` [#8915](https://github.com/rubygems/rubygems/pull/8915)
19
+ - Fix `bundle cache --no-all` not printing a deprecation warning [#8912](https://github.com/rubygems/rubygems/pull/8912)
20
+ - Fix `bundle update foo` unable to update foo in an edge case [#8897](https://github.com/rubygems/rubygems/pull/8897)
21
+ - Fix Bundler printing more flags than actually passed in verbose mode [#8914](https://github.com/rubygems/rubygems/pull/8914)
22
+ - Fix bundler failing to install sorbet-static in truffleruby when there's no lockfile [#8872](https://github.com/rubygems/rubygems/pull/8872)
23
+
24
+ ### Documentation:
25
+
26
+ - Improve documentation of `bundle doctor`, `bundle plugin`, and `bundle config` [#8919](https://github.com/rubygems/rubygems/pull/8919)
27
+ - Make sure all CLI flags and subcommands are documented [#8861](https://github.com/rubygems/rubygems/pull/8861)
28
+
3
29
  ## 2.7.1 (2025-07-21)
4
30
 
5
31
  ### 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 = "2025-07-21".freeze
8
- @git_commit_sha = "bd22001d8c7".freeze
7
+ @built_at = "2025-09-09".freeze
8
+ @git_commit_sha = "b463ced1459".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -205,6 +205,12 @@ module Bundler
205
205
  @store[spec.lock_name].nil?
206
206
  end
207
207
 
208
+ def empty?(spec)
209
+ return false unless spec.source.is_a?(Bundler::Source::Rubygems)
210
+
211
+ @store[spec.lock_name].empty?
212
+ end
213
+
208
214
  def register(spec, checksum)
209
215
  register_checksum(spec.lock_name, checksum)
210
216
  end
@@ -16,7 +16,6 @@ module Bundler
16
16
  setup_cache_all
17
17
  install
18
18
 
19
- # TODO: move cache contents here now that all bundles are locked
20
19
  custom_path = Bundler.settings[:path] if options[:path]
21
20
 
22
21
  Bundler.settings.temporary(cache_all_platforms: options["all-platforms"]) do
@@ -130,7 +130,7 @@ module Bundler
130
130
  def self.clean_after_install?
131
131
  clean = Bundler.settings[:clean]
132
132
  return clean unless clean.nil?
133
- clean ||= Bundler.feature_flag.bundler_4_mode? && Bundler.settings[:path].nil?
133
+ clean ||= Bundler.feature_flag.bundler_5_mode? && Bundler.settings[:path].nil?
134
134
  clean &&= !Bundler.use_system_gems?
135
135
  clean
136
136
  end
@@ -42,8 +42,6 @@ module Bundler
42
42
  "before deploying."
43
43
  end
44
44
 
45
- options[:local] = true if Bundler.app_cache.exist?
46
-
47
45
  Bundler.settings.set_command_option :deployment, true if options[:deployment]
48
46
  Bundler.settings.set_command_option :frozen, true if options[:frozen]
49
47
  end
@@ -35,11 +35,8 @@ module Bundler
35
35
  update = { bundler: bundler }
36
36
  end
37
37
 
38
- file = options[:lockfile]
39
- file = file ? Pathname.new(file).expand_path : Bundler.default_lockfile
40
-
41
38
  Bundler.settings.temporary(frozen: false) do
42
- definition = Bundler.definition(update, file)
39
+ definition = Bundler.definition(update, Bundler.default_lockfile)
43
40
  definition.add_checksums if options["add-checksums"]
44
41
 
45
42
  Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update]
@@ -71,8 +68,11 @@ module Bundler
71
68
  if print
72
69
  puts definition.to_lock
73
70
  else
71
+ file = options[:lockfile]
72
+ file = file ? Pathname.new(file).expand_path : Bundler.default_lockfile
73
+
74
74
  puts "Writing lockfile to #{file}"
75
- definition.lock
75
+ definition.write_lock(file, false)
76
76
  end
77
77
  end
78
78
 
@@ -57,12 +57,8 @@ module Bundler
57
57
 
58
58
  def fetch_latest_specs
59
59
  definition = Bundler.definition(true)
60
- if options[:outdated]
61
- Bundler.ui.info "Fetching remote specs for outdated check...\n\n"
62
- Bundler.ui.silence { definition.remotely! }
63
- else
64
- definition.with_cache!
65
- end
60
+ Bundler.ui.info "Fetching remote specs for outdated check...\n\n"
61
+ Bundler.ui.silence { definition.remotely! }
66
62
  Bundler.reset!
67
63
  definition.specs
68
64
  end
data/lib/bundler/cli.rb CHANGED
@@ -287,8 +287,8 @@ module Bundler
287
287
  method_option "outdated", type: :boolean, banner: "Show verbose output including whether gems are outdated."
288
288
  def show(gem_name = nil)
289
289
  if ARGV.include?("--outdated")
290
- message = "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement"
291
- removed_message = "the `--outdated` flag to `bundle show` was undocumented and has been removed without replacement"
290
+ message = "the `--outdated` flag to `bundle show` will be removed in favor of `bundle show --verbose`"
291
+ removed_message = "the `--outdated` flag to `bundle show` has been removed in favor of `bundle show --verbose`"
292
292
  SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
293
293
  end
294
294
  require_relative "cli/show"
@@ -412,6 +412,11 @@ module Bundler
412
412
  D
413
413
  def cache
414
414
  print_remembered_flag_deprecation("--all", "cache_all", "true") if ARGV.include?("--all")
415
+ print_remembered_flag_deprecation("--no-all", "cache_all", "false") if ARGV.include?("--no-all")
416
+
417
+ %w[frozen no-prune].each do |option|
418
+ remembered_flag_deprecation(option)
419
+ end
415
420
 
416
421
  if flag_passed?("--path")
417
422
  message =
@@ -518,11 +523,11 @@ module Bundler
518
523
  Viz requires the ruby-graphviz gem (and its dependencies).
519
524
  The associated gems must also be installed via 'bundle install'.
520
525
  D
521
- method_option :file, type: :string, default: "gem_graph", aliases: "-f", desc: "The name to use for the generated file. see format option"
522
- method_option :format, type: :string, default: "png", aliases: "-F", desc: "This is output format option. Supported format is png, jpg, svg, dot ..."
523
- method_option :requirements, type: :boolean, default: false, aliases: "-R", desc: "Set to show the version of each required dependency."
524
- method_option :version, type: :boolean, default: false, aliases: "-v", desc: "Set to show each gem version."
525
- method_option :without, type: :array, default: [], aliases: "-W", banner: "GROUP[ GROUP...]", desc: "Exclude gems that are part of the specified named group."
526
+ method_option :file, type: :string, default: "gem_graph", aliases: "-f", banner: "The name to use for the generated file. see format option"
527
+ method_option :format, type: :string, default: "png", aliases: "-F", banner: "This is output format option. Supported format is png, jpg, svg, dot ..."
528
+ method_option :requirements, type: :boolean, default: false, aliases: "-R", banner: "Set to show the version of each required dependency."
529
+ method_option :version, type: :boolean, default: false, aliases: "-v", banner: "Set to show each gem version."
530
+ method_option :without, type: :array, default: [], aliases: "-W", banner: "Exclude gems that are part of the specified named group."
526
531
  def viz
527
532
  SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
528
533
  require_relative "cli/viz"
@@ -531,19 +536,19 @@ module Bundler
531
536
  end
532
537
 
533
538
  desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
534
- method_option :exe, type: :boolean, default: false, aliases: ["--bin", "-b"], desc: "Generate a binary executable for your library."
535
- method_option :coc, type: :boolean, desc: "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
536
- method_option :edit, type: :string, aliases: "-e", required: false, banner: "EDITOR", lazy_default: [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }, desc: "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
537
- method_option :ext, type: :string, desc: "Generate the boilerplate for C extension code.", enum: EXTENSIONS
538
- method_option :git, type: :boolean, default: true, desc: "Initialize a git repo inside your library."
539
- method_option :mit, type: :boolean, desc: "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
540
- method_option :rubocop, type: :boolean, desc: "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`."
541
- method_option :changelog, type: :boolean, desc: "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
539
+ method_option :exe, type: :boolean, default: false, aliases: ["--bin", "-b"], banner: "Generate a binary executable for your library."
540
+ method_option :coc, type: :boolean, banner: "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
541
+ method_option :edit, type: :string, aliases: "-e", required: false, lazy_default: [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }, banner: "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
542
+ method_option :ext, type: :string, banner: "Generate the boilerplate for C extension code.", enum: EXTENSIONS
543
+ method_option :git, type: :boolean, default: true, banner: "Initialize a git repo inside your library."
544
+ method_option :mit, type: :boolean, banner: "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
545
+ method_option :rubocop, type: :boolean, banner: "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`."
546
+ method_option :changelog, type: :boolean, banner: "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
542
547
  method_option :test, type: :string, lazy_default: Bundler.settings["gem.test"] || "", aliases: "-t", banner: "Use the specified test framework for your library", enum: %w[rspec minitest test-unit], desc: "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
543
- method_option :ci, type: :string, lazy_default: Bundler.settings["gem.ci"] || "", enum: %w[github gitlab circle], desc: "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`"
544
- method_option :linter, type: :string, lazy_default: Bundler.settings["gem.linter"] || "", enum: %w[rubocop standard], desc: "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
548
+ method_option :ci, type: :string, lazy_default: Bundler.settings["gem.ci"] || "", enum: %w[github gitlab circle], banner: "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`"
549
+ method_option :linter, type: :string, lazy_default: Bundler.settings["gem.linter"] || "", enum: %w[rubocop standard], banner: "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
545
550
  method_option :github_username, type: :string, default: Bundler.settings["gem.github_username"], banner: "Set your username on GitHub", desc: "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
546
- method_option :bundle, type: :boolean, default: Bundler.settings["gem.bundle"], desc: "Automatically run `bundle install` after creation. Set a default with `bundle config set --global gem.bundle true`"
551
+ method_option :bundle, type: :boolean, default: Bundler.settings["gem.bundle"], banner: "Automatically run `bundle install` after creation. Set a default with `bundle config set --global gem.bundle true`"
547
552
 
548
553
  def gem(name)
549
554
  require_relative "cli/gem"
@@ -713,7 +718,12 @@ module Bundler
713
718
  command_name = cmd.name
714
719
  return if PARSEABLE_COMMANDS.include?(command_name)
715
720
  command = ["bundle", command_name] + args
716
- command << Thor::Options.to_switches(options.sort_by(&:first)).strip
721
+ options_to_print = options.dup
722
+ options_to_print.delete_if do |k, v|
723
+ next unless o = cmd.options[k]
724
+ o.default == v
725
+ end
726
+ command << Thor::Options.to_switches(options_to_print.sort_by(&:first)).strip
717
727
  command.reject!(&:empty?)
718
728
  Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler.verbose_version}"
719
729
  end
@@ -189,12 +189,14 @@ module Bundler
189
189
  def setup_domain!(options = {})
190
190
  prefer_local! if options[:"prefer-local"]
191
191
 
192
+ sources.cached!
193
+
192
194
  if options[:add_checksums] || (!options[:local] && install_needed?)
193
- remotely!
195
+ sources.remote!
194
196
  true
195
197
  else
196
198
  Bundler.settings.set_command_option(:jobs, 1) unless install_needed? # to avoid the overhead of Bundler::Worker
197
- with_cache!
199
+ sources.local!
198
200
  false
199
201
  end
200
202
  end
@@ -373,6 +375,44 @@ module Bundler
373
375
  write_lock(target_lockfile, preserve_unknown_sections)
374
376
  end
375
377
 
378
+ def write_lock(file, preserve_unknown_sections)
379
+ return if Definition.no_lock || file.nil?
380
+
381
+ contents = to_lock
382
+
383
+ # Convert to \r\n if the existing lock has them
384
+ # i.e., Windows with `git config core.autocrlf=true`
385
+ contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
386
+
387
+ if @locked_bundler_version
388
+ locked_major = @locked_bundler_version.segments.first
389
+ current_major = bundler_version_to_lock.segments.first
390
+
391
+ updating_major = locked_major < current_major
392
+ end
393
+
394
+ preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
395
+
396
+ if File.exist?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
397
+ return if Bundler.frozen_bundle?
398
+ SharedHelpers.filesystem_access(file) { FileUtils.touch(file) }
399
+ return
400
+ end
401
+
402
+ if Bundler.frozen_bundle?
403
+ Bundler.ui.error "Cannot write a changed lockfile while frozen."
404
+ return
405
+ end
406
+
407
+ begin
408
+ SharedHelpers.filesystem_access(file) do |p|
409
+ File.open(p, "wb") {|f| f.puts(contents) }
410
+ end
411
+ rescue ReadOnlyFileSystemError
412
+ raise ProductionError, lockfile_changes_summary("file system is read-only")
413
+ end
414
+ end
415
+
376
416
  def locked_ruby_version
377
417
  return unless ruby_version
378
418
  if @unlocking_ruby || !@locked_ruby_version
@@ -492,8 +532,6 @@ module Bundler
492
532
  @unlocking
493
533
  end
494
534
 
495
- attr_writer :source_requirements
496
-
497
535
  def add_checksums
498
536
  @locked_checksums = true
499
537
 
@@ -533,7 +571,7 @@ module Bundler
533
571
 
534
572
  return unless added.any? || deleted.any? || changed.any? || resolve_needed?
535
573
 
536
- msg = String.new("#{change_reason.capitalize.strip}, but ")
574
+ msg = String.new("#{change_reason[0].upcase}#{change_reason[1..-1].strip}, but ")
537
575
  msg << "the lockfile " unless msg.start_with?("Your lockfile")
538
576
  msg << "can't be updated because #{update_refused_reason}"
539
577
  msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
@@ -559,6 +597,7 @@ module Bundler
559
597
  @missing_lockfile_dep ||
560
598
  @unlocking_bundler ||
561
599
  @locked_spec_with_missing_checksums ||
600
+ @locked_spec_with_empty_checksums ||
562
601
  @locked_spec_with_missing_deps ||
563
602
  @locked_spec_with_invalid_deps
564
603
  end
@@ -575,46 +614,8 @@ module Bundler
575
614
  lockfile && File.exist?(lockfile)
576
615
  end
577
616
 
578
- def write_lock(file, preserve_unknown_sections)
579
- return if Definition.no_lock || file.nil?
580
-
581
- contents = to_lock
582
-
583
- # Convert to \r\n if the existing lock has them
584
- # i.e., Windows with `git config core.autocrlf=true`
585
- contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
586
-
587
- if @locked_bundler_version
588
- locked_major = @locked_bundler_version.segments.first
589
- current_major = bundler_version_to_lock.segments.first
590
-
591
- updating_major = locked_major < current_major
592
- end
593
-
594
- preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
595
-
596
- if File.exist?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
597
- return if Bundler.frozen_bundle?
598
- SharedHelpers.filesystem_access(file) { FileUtils.touch(file) }
599
- return
600
- end
601
-
602
- if Bundler.frozen_bundle?
603
- Bundler.ui.error "Cannot write a changed lockfile while frozen."
604
- return
605
- end
606
-
607
- begin
608
- SharedHelpers.filesystem_access(file) do |p|
609
- File.open(p, "wb") {|f| f.puts(contents) }
610
- end
611
- rescue ReadOnlyFileSystemError
612
- raise ProductionError, lockfile_changes_summary("file system is read-only")
613
- end
614
- end
615
-
616
617
  def resolver
617
- @resolver ||= Resolver.new(resolution_base, gem_version_promoter, @most_specific_locked_platform)
618
+ @resolver ||= new_resolver(resolution_base)
618
619
  end
619
620
 
620
621
  def expanded_dependencies
@@ -632,8 +633,7 @@ module Bundler
632
633
  @resolution_base ||= begin
633
634
  last_resolve = converge_locked_specs
634
635
  remove_invalid_platforms!
635
- new_resolution_platforms = @current_platform_missing ? @new_platforms + [Bundler.local_platform] : @new_platforms
636
- base = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @unlocking_all || @gems_to_unlock, prerelease: gem_version_promoter.pre?, prefer_local: @prefer_local, new_platforms: new_resolution_platforms)
636
+ base = new_resolution_base(last_resolve: last_resolve, unlock: @unlocking_all || @gems_to_unlock)
637
637
  base = additional_base_requirements_to_prevent_downgrades(base)
638
638
  base = additional_base_requirements_to_force_updates(base)
639
639
  base
@@ -740,7 +740,6 @@ module Bundler
740
740
  def start_resolution
741
741
  local_platform_needed_for_resolvability = @most_specific_non_local_locked_platform && !@platforms.include?(Bundler.local_platform)
742
742
  @platforms << Bundler.local_platform if local_platform_needed_for_resolvability
743
- add_platform(Gem::Platform::RUBY) if RUBY_ENGINE == "truffleruby"
744
743
 
745
744
  result = SpecSet.new(resolver.start)
746
745
 
@@ -848,6 +847,7 @@ module Bundler
848
847
  [@missing_lockfile_dep, "your lockfile is missing \"#{@missing_lockfile_dep}\""],
849
848
  [@unlocking_bundler, "an update to the version of Bundler itself was requested"],
850
849
  [@locked_spec_with_missing_checksums, "your lockfile is missing a CHECKSUMS entry for \"#{@locked_spec_with_missing_checksums}\""],
850
+ [@locked_spec_with_empty_checksums, "your lockfile has an empty CHECKSUMS entry for \"#{@locked_spec_with_empty_checksums}\""],
851
851
  [@locked_spec_with_missing_deps, "your lockfile includes \"#{@locked_spec_with_missing_deps}\" but not some of its dependencies"],
852
852
  [@locked_spec_with_invalid_deps, "your lockfile does not satisfy dependencies of \"#{@locked_spec_with_invalid_deps}\""],
853
853
  ].select(&:first).map(&:last).join(", ")
@@ -907,13 +907,23 @@ module Bundler
907
907
  @locked_spec_with_invalid_deps = nil
908
908
  @locked_spec_with_missing_deps = nil
909
909
  @locked_spec_with_missing_checksums = nil
910
+ @locked_spec_with_empty_checksums = nil
910
911
 
911
912
  missing_deps = []
912
913
  missing_checksums = []
914
+ empty_checksums = []
913
915
  invalid = []
914
916
 
915
917
  @locked_specs.each do |s|
916
- missing_checksums << s if @locked_checksums && s.source.checksum_store.missing?(s)
918
+ if @locked_checksums
919
+ checksum_store = s.source.checksum_store
920
+
921
+ if checksum_store.missing?(s)
922
+ missing_checksums << s
923
+ elsif checksum_store.empty?(s)
924
+ empty_checksums << s
925
+ end
926
+ end
917
927
 
918
928
  validation = @locked_specs.validate_deps(s)
919
929
 
@@ -922,6 +932,7 @@ module Bundler
922
932
  end
923
933
 
924
934
  @locked_spec_with_missing_checksums = missing_checksums.first.name if missing_checksums.any?
935
+ @locked_spec_with_empty_checksums = empty_checksums.first.name if empty_checksums.any?
925
936
 
926
937
  if missing_deps.any?
927
938
  @locked_specs.delete(missing_deps)
@@ -1145,7 +1156,7 @@ module Bundler
1145
1156
 
1146
1157
  def additional_base_requirements_to_force_updates(resolution_base)
1147
1158
  return resolution_base if @explicit_unlocks.empty?
1148
- full_update = dup_for_full_unlock.resolve
1159
+ full_update = SpecSet.new(new_resolver_for_full_update.start)
1149
1160
  @explicit_unlocks.each do |name|
1150
1161
  version = full_update.version_for(name)
1151
1162
  resolution_base.base_requirements[name] = Gem::Requirement.new("= #{version}") if version
@@ -1153,17 +1164,6 @@ module Bundler
1153
1164
  resolution_base
1154
1165
  end
1155
1166
 
1156
- def dup_for_full_unlock
1157
- unlocked_definition = self.class.new(@lockfile, @dependencies, @sources, true, @ruby_version, @optional_groups, @gemfiles)
1158
- unlocked_definition.source_requirements = source_requirements
1159
- unlocked_definition.gem_version_promoter.tap do |gvp|
1160
- gvp.level = gem_version_promoter.level
1161
- gvp.strict = gem_version_promoter.strict
1162
- gvp.pre = gem_version_promoter.pre
1163
- end
1164
- unlocked_definition
1165
- end
1166
-
1167
1167
  def remove_invalid_platforms!
1168
1168
  return if Bundler.frozen_bundle?
1169
1169
 
@@ -1182,5 +1182,22 @@ module Bundler
1182
1182
  def source_map
1183
1183
  @source_map ||= SourceMap.new(sources, dependencies, @locked_specs)
1184
1184
  end
1185
+
1186
+ def new_resolver_for_full_update
1187
+ new_resolver(unlocked_resolution_base)
1188
+ end
1189
+
1190
+ def unlocked_resolution_base
1191
+ new_resolution_base(last_resolve: SpecSet.new([]), unlock: true)
1192
+ end
1193
+
1194
+ def new_resolution_base(last_resolve:, unlock:)
1195
+ new_resolution_platforms = @current_platform_missing ? @new_platforms + [Bundler.local_platform] : @new_platforms
1196
+ Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: unlock, prerelease: gem_version_promoter.pre?, prefer_local: @prefer_local, new_platforms: new_resolution_platforms)
1197
+ end
1198
+
1199
+ def new_resolver(base)
1200
+ Resolver.new(base, gem_version_promoter, @most_specific_locked_platform)
1201
+ end
1185
1202
  end
1186
1203
  end
data/lib/bundler/dsl.rb CHANGED
@@ -290,7 +290,7 @@ module Bundler
290
290
  @dependencies.delete(current)
291
291
  elsif dep.gemspec_dev_dep?
292
292
  return
293
- elsif current.source != dep.source
293
+ elsif current.source.to_s != dep.source.to_s
294
294
  raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
295
295
  "You specified that #{name} (#{dep.requirement}) should come from " \
296
296
  "#{current.source || "an unspecified source"} and #{dep.source}\n"
@@ -30,7 +30,7 @@ module Bundler
30
30
  settings_flag(:allow_offline_install) { bundler_4_mode? }
31
31
  settings_flag(:cache_all) { bundler_4_mode? }
32
32
  settings_flag(:forget_cli_options) { bundler_4_mode? }
33
- settings_flag(:global_gem_cache) { bundler_4_mode? }
33
+ settings_flag(:global_gem_cache) { bundler_5_mode? }
34
34
  settings_flag(:lockfile_checksums) { bundler_4_mode? }
35
35
  settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
36
36
  settings_flag(:update_requires_all_flag) { bundler_5_mode? }
@@ -1,6 +1,6 @@
1
1
  .\" generated with Ronn-NG/v0.10.1
2
2
  .\" http://github.com/apjanke/ronn-ng/tree/0.10.1
3
- .TH "BUNDLE\-ADD" "1" "July 2025" ""
3
+ .TH "BUNDLE\-ADD" "1" "August 2025" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with Ronn-NG/v0.10.1
2
2
  .\" http://github.com/apjanke/ronn-ng/tree/0.10.1
3
- .TH "BUNDLE\-BINSTUBS" "1" "July 2025" ""
3
+ .TH "BUNDLE\-BINSTUBS" "1" "August 2025" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with Ronn-NG/v0.10.1
2
2
  .\" http://github.com/apjanke/ronn-ng/tree/0.10.1
3
- .TH "BUNDLE\-CACHE" "1" "July 2025" ""
3
+ .TH "BUNDLE\-CACHE" "1" "August 2025" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with Ronn-NG/v0.10.1
2
2
  .\" http://github.com/apjanke/ronn-ng/tree/0.10.1
3
- .TH "BUNDLE\-CHECK" "1" "July 2025" ""
3
+ .TH "BUNDLE\-CHECK" "1" "August 2025" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with Ronn-NG/v0.10.1
2
2
  .\" http://github.com/apjanke/ronn-ng/tree/0.10.1
3
- .TH "BUNDLE\-CLEAN" "1" "July 2025" ""
3
+ .TH "BUNDLE\-CLEAN" "1" "August 2025" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
6
6
  .SH "SYNOPSIS"
@@ -1,16 +1,16 @@
1
1
  .\" generated with Ronn-NG/v0.10.1
2
2
  .\" http://github.com/apjanke/ronn-ng/tree/0.10.1
3
- .TH "BUNDLE\-CONFIG" "1" "July 2025" ""
3
+ .TH "BUNDLE\-CONFIG" "1" "August 2025" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-config\fR \- Set bundler configuration options
6
6
  .SH "SYNOPSIS"
7
- \fBbundle config\fR list
7
+ \fBbundle config\fR [list]
8
8
  .br
9
- \fBbundle config\fR [get] NAME
9
+ \fBbundle config\fR [get [\-\-local|\-\-global]] NAME
10
10
  .br
11
- \fBbundle config\fR [set] NAME VALUE
11
+ \fBbundle config\fR [set [\-\-local|\-\-global]] NAME VALUE
12
12
  .br
13
- \fBbundle config\fR unset NAME
13
+ \fBbundle config\fR unset [\-\-local|\-\-global] NAME
14
14
  .SH "DESCRIPTION"
15
15
  This command allows you to interact with Bundler's configuration system\.
16
16
  .P
@@ -25,23 +25,40 @@ Global config (\fB~/\.bundle/config\fR)
25
25
  Bundler default config
26
26
  .IP "" 0
27
27
  .P
28
+ Executing \fBbundle\fR with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set will cause it to ignore all configuration\.
29
+ .SH "SUB\-COMMANDS"
30
+ .SS "list (default command)"
28
31
  Executing \fBbundle config list\fR will print a list of all bundler configuration for the current bundle, and where that configuration was set\.
32
+ .SS "get"
33
+ Executing \fBbundle config get <name>\fR will print the value of that configuration setting, and all locations where it was set\.
29
34
  .P
30
- Executing \fBbundle config get <name>\fR will print the value of that configuration setting, and where it was set\.
31
- .P
32
- Executing \fBbundle config set <name> <value>\fR defaults to setting \fBlocal\fR configuration if executing from within a local application, otherwise it will set \fBglobal\fR configuration\. See \fB\-\-local\fR and \fB\-\-global\fR options below\.
35
+ \fBOPTIONS\fR
36
+ .TP
37
+ \fB\-\-local\fR
38
+ Get configuration from configuration file for the local application, namely, \fB<project_root>/\.bundle/config\fR, or \fB$BUNDLE_APP_CONFIG/config\fR if \fBBUNDLE_APP_CONFIG\fR is set\.
39
+ .TP
40
+ \fB\-\-global\fR
41
+ Get configuration from configuration file global to all bundles executed as the current user, namely, from \fB~/\.bundle/config\fR\.
42
+ .SS "set"
43
+ Executing \fBbundle config set <name> <value>\fR defaults to setting \fBlocal\fR configuration if executing from within a local application, otherwise it will set \fBglobal\fR configuration\.
33
44
  .P
45
+ \fBOPTIONS\fR
46
+ .TP
47
+ \fB\-\-local\fR
34
48
  Executing \fBbundle config set \-\-local <name> <value>\fR will set that configuration in the directory for the local application\. The configuration will be stored in \fB<project_root>/\.bundle/config\fR\. If \fBBUNDLE_APP_CONFIG\fR is set, the configuration will be stored in \fB$BUNDLE_APP_CONFIG/config\fR\.
35
- .P
49
+ .TP
50
+ \fB\-\-global\fR
36
51
  Executing \fBbundle config set \-\-global <name> <value>\fR will set that configuration to the value specified for all bundles executed as the current user\. The configuration will be stored in \fB~/\.bundle/config\fR\. If \fIname\fR already is set, \fIname\fR will be overridden and user will be warned\.
37
- .P
52
+ .SS "unset"
38
53
  Executing \fBbundle config unset <name>\fR will delete the configuration in both local and global sources\.
39
54
  .P
40
- Executing \fBbundle config unset \-\-global <name>\fR will delete the configuration only from the user configuration\.
41
- .P
55
+ \fBOPTIONS\fR
56
+ .TP
57
+ \fB\-\-local\fR
42
58
  Executing \fBbundle config unset \-\-local <name>\fR will delete the configuration only from the local application\.
43
- .P
44
- Executing bundle with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set will cause it to ignore all configuration\.
59
+ .TP
60
+ \fB\-\-global\fR
61
+ Executing \fBbundle config unset \-\-global <name>\fR will delete the configuration only from the user configuration\.
45
62
  .SH "CONFIGURATION KEYS"
46
63
  Configuration keys in bundler have two forms: the canonical form and the environment variable form\.
47
64
  .P