bundler 2.7.2 → 4.0.7

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 (153) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1107 -917
  3. data/README.md +4 -4
  4. data/bundler.gemspec +3 -3
  5. data/lib/bundler/build_metadata.rb +2 -2
  6. data/lib/bundler/capistrano.rb +1 -19
  7. data/lib/bundler/cli/add.rb +10 -0
  8. data/lib/bundler/cli/cache.rb +1 -11
  9. data/lib/bundler/cli/common.rb +20 -3
  10. data/lib/bundler/cli/config.rb +1 -2
  11. data/lib/bundler/cli/console.rb +5 -0
  12. data/lib/bundler/cli/exec.rb +29 -4
  13. data/lib/bundler/cli/gem.rb +27 -33
  14. data/lib/bundler/cli/install.rb +10 -83
  15. data/lib/bundler/cli/issue.rb +2 -2
  16. data/lib/bundler/cli/list.rb +33 -2
  17. data/lib/bundler/cli/plugin.rb +5 -1
  18. data/lib/bundler/cli/pristine.rb +4 -0
  19. data/lib/bundler/cli/show.rb +1 -1
  20. data/lib/bundler/cli/update.rb +3 -3
  21. data/lib/bundler/cli.rb +126 -87
  22. data/lib/bundler/compact_index_client.rb +0 -1
  23. data/lib/bundler/current_ruby.rb +3 -15
  24. data/lib/bundler/definition.rb +103 -39
  25. data/lib/bundler/deployment.rb +1 -64
  26. data/lib/bundler/digest.rb +1 -1
  27. data/lib/bundler/dsl.rb +26 -36
  28. data/lib/bundler/environment_preserver.rb +1 -0
  29. data/lib/bundler/errors.rb +1 -5
  30. data/lib/bundler/feature_flag.rb +0 -33
  31. data/lib/bundler/fetcher/compact_index.rb +1 -1
  32. data/lib/bundler/fetcher/downloader.rb +0 -1
  33. data/lib/bundler/fetcher/gem_remote_fetcher.rb +6 -0
  34. data/lib/bundler/friendly_errors.rb +2 -2
  35. data/lib/bundler/index.rb +0 -7
  36. data/lib/bundler/inline.rb +9 -1
  37. data/lib/bundler/installer/gem_installer.rb +0 -11
  38. data/lib/bundler/installer.rb +0 -6
  39. data/lib/bundler/lazy_specification.rb +41 -16
  40. data/lib/bundler/lockfile_generator.rb +1 -1
  41. data/lib/bundler/lockfile_parser.rb +2 -12
  42. data/lib/bundler/man/bundle-add.1 +1 -1
  43. data/lib/bundler/man/bundle-binstubs.1 +3 -6
  44. data/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
  45. data/lib/bundler/man/bundle-cache.1 +2 -14
  46. data/lib/bundler/man/bundle-cache.1.ronn +1 -14
  47. data/lib/bundler/man/bundle-check.1 +2 -5
  48. data/lib/bundler/man/bundle-check.1.ronn +0 -5
  49. data/lib/bundler/man/bundle-clean.1 +1 -1
  50. data/lib/bundler/man/bundle-config.1 +26 -34
  51. data/lib/bundler/man/bundle-config.1.ronn +39 -56
  52. data/lib/bundler/man/bundle-console.1 +1 -1
  53. data/lib/bundler/man/bundle-doctor.1 +1 -1
  54. data/lib/bundler/man/bundle-env.1 +1 -1
  55. data/lib/bundler/man/bundle-exec.1 +2 -5
  56. data/lib/bundler/man/bundle-exec.1.ronn +1 -5
  57. data/lib/bundler/man/bundle-fund.1 +1 -1
  58. data/lib/bundler/man/bundle-gem.1 +3 -6
  59. data/lib/bundler/man/bundle-gem.1.ronn +2 -5
  60. data/lib/bundler/man/bundle-help.1 +1 -1
  61. data/lib/bundler/man/bundle-info.1 +1 -1
  62. data/lib/bundler/man/bundle-init.1 +1 -1
  63. data/lib/bundler/man/bundle-install.1 +14 -57
  64. data/lib/bundler/man/bundle-install.1.ronn +25 -105
  65. data/lib/bundler/man/bundle-issue.1 +1 -1
  66. data/lib/bundler/man/bundle-licenses.1 +1 -1
  67. data/lib/bundler/man/bundle-list.1 +6 -1
  68. data/lib/bundler/man/bundle-list.1.ronn +5 -0
  69. data/lib/bundler/man/bundle-lock.1 +1 -1
  70. data/lib/bundler/man/bundle-open.1 +1 -1
  71. data/lib/bundler/man/bundle-outdated.1 +1 -1
  72. data/lib/bundler/man/bundle-platform.1 +1 -1
  73. data/lib/bundler/man/bundle-plugin.1 +2 -9
  74. data/lib/bundler/man/bundle-plugin.1.ronn +0 -8
  75. data/lib/bundler/man/bundle-pristine.1 +1 -1
  76. data/lib/bundler/man/bundle-remove.1 +2 -8
  77. data/lib/bundler/man/bundle-remove.1.ronn +1 -8
  78. data/lib/bundler/man/bundle-show.1 +2 -5
  79. data/lib/bundler/man/bundle-show.1.ronn +0 -4
  80. data/lib/bundler/man/bundle-update.1 +1 -1
  81. data/lib/bundler/man/bundle-version.1 +1 -1
  82. data/lib/bundler/man/bundle.1 +1 -10
  83. data/lib/bundler/man/bundle.1.ronn +0 -9
  84. data/lib/bundler/man/gemfile.5 +32 -1
  85. data/lib/bundler/man/gemfile.5.ronn +28 -0
  86. data/lib/bundler/man/index.txt +0 -2
  87. data/lib/bundler/materialization.rb +1 -1
  88. data/lib/bundler/plugin/installer.rb +0 -10
  89. data/lib/bundler/plugin/source_list.rb +1 -1
  90. data/lib/bundler/plugin.rb +6 -3
  91. data/lib/bundler/resolver.rb +1 -1
  92. data/lib/bundler/ruby_dsl.rb +17 -12
  93. data/lib/bundler/ruby_version.rb +1 -3
  94. data/lib/bundler/rubygems_ext.rb +1 -1
  95. data/lib/bundler/rubygems_gem_installer.rb +5 -4
  96. data/lib/bundler/rubygems_integration.rb +2 -6
  97. data/lib/bundler/runtime.rb +13 -2
  98. data/lib/bundler/self_manager.rb +1 -1
  99. data/lib/bundler/settings.rb +8 -26
  100. data/lib/bundler/shared_helpers.rb +12 -20
  101. data/lib/bundler/source/git/git_proxy.rb +4 -12
  102. data/lib/bundler/source/git.rb +2 -3
  103. data/lib/bundler/source/path.rb +3 -7
  104. data/lib/bundler/source/rubygems.rb +11 -17
  105. data/lib/bundler/source/rubygems_aggregate.rb +4 -1
  106. data/lib/bundler/source.rb +1 -1
  107. data/lib/bundler/source_list.rb +4 -45
  108. data/lib/bundler/source_map.rb +8 -7
  109. data/lib/bundler/spec_set.rb +6 -15
  110. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
  111. data/lib/bundler/templates/newgem/Cargo.toml.tt +6 -0
  112. data/lib/bundler/templates/newgem/Rakefile.tt +5 -0
  113. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  114. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +8 -1
  115. data/lib/bundler/templates/newgem/ext/newgem/build.rs.tt +5 -0
  116. data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
  117. data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
  118. data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
  119. data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
  120. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +13 -2
  121. data/lib/bundler/templates/newgem/github/workflows/build-gems.yml.tt +65 -0
  122. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +6 -0
  123. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  124. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -1
  125. data/lib/bundler/templates/newgem/newgem.gemspec.tt +3 -7
  126. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +8 -0
  127. data/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +6 -0
  128. data/lib/bundler/ui/shell.rb +10 -6
  129. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
  130. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  131. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
  132. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
  133. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +5 -2
  134. data/lib/bundler/vendor/thor/lib/thor/runner.rb +1 -1
  135. data/lib/bundler/vendor/thor/lib/thor.rb +1 -1
  136. data/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
  137. data/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
  138. data/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
  139. data/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
  140. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  141. data/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
  142. data/lib/bundler/version.rb +1 -1
  143. data/lib/bundler/vlad.rb +1 -14
  144. data/lib/bundler.rb +7 -29
  145. metadata +11 -13
  146. data/lib/bundler/cli/inject.rb +0 -60
  147. data/lib/bundler/cli/viz.rb +0 -31
  148. data/lib/bundler/graph.rb +0 -152
  149. data/lib/bundler/man/bundle-inject.1 +0 -31
  150. data/lib/bundler/man/bundle-inject.1.ronn +0 -32
  151. data/lib/bundler/man/bundle-viz.1 +0 -30
  152. data/lib/bundler/man/bundle-viz.1.ronn +0 -36
  153. data/lib/bundler/similarity_detector.rb +0 -63
@@ -1,21 +1,15 @@
1
1
  .\" generated with Ronn-NG/v0.10.1
2
2
  .\" http://github.com/apjanke/ronn-ng/tree/0.10.1
3
- .TH "BUNDLE\-REMOVE" "1" "August 2025" ""
3
+ .TH "BUNDLE\-REMOVE" "1" "February 2026" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-remove\fR \- Removes gems from the Gemfile
6
6
  .SH "SYNOPSIS"
7
- \fBbundle remove [GEM [GEM \|\.\|\.\|\.]] [\-\-install]\fR
7
+ `bundle remove [GEM [GEM \|\.\|\.\|\.]]
8
8
  .SH "DESCRIPTION"
9
9
  Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid\. If a gem cannot be removed, a warning is printed\. If a gem is already absent from the Gemfile, and error is raised\.
10
- .SH "OPTIONS"
11
- .TP
12
- \fB\-\-install\fR
13
- Runs \fBbundle install\fR after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s)\.
14
10
  .P
15
11
  Example:
16
12
  .P
17
13
  bundle remove rails
18
14
  .P
19
15
  bundle remove rails rack
20
- .P
21
- bundle remove rails rack \-\-install
@@ -3,21 +3,14 @@ bundle-remove(1) -- Removes gems from the Gemfile
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `bundle remove [GEM [GEM ...]] [--install]`
6
+ `bundle remove [GEM [GEM ...]]
7
7
 
8
8
  ## DESCRIPTION
9
9
 
10
10
  Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If a gem cannot be removed, a warning is printed. If a gem is already absent from the Gemfile, and error is raised.
11
11
 
12
- ## OPTIONS
13
-
14
- * `--install`:
15
- Runs `bundle install` after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s).
16
-
17
12
  Example:
18
13
 
19
14
  bundle remove rails
20
15
 
21
16
  bundle remove rails rack
22
-
23
- bundle remove rails rack --install
@@ -1,10 +1,10 @@
1
1
  .\" generated with Ronn-NG/v0.10.1
2
2
  .\" http://github.com/apjanke/ronn-ng/tree/0.10.1
3
- .TH "BUNDLE\-SHOW" "1" "August 2025" ""
3
+ .TH "BUNDLE\-SHOW" "1" "February 2026" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
6
6
  .SH "SYNOPSIS"
7
- \fBbundle show\fR [GEM] [\-\-paths] [\-\-outdated]
7
+ \fBbundle show\fR [GEM] [\-\-paths]
8
8
  .SH "DESCRIPTION"
9
9
  Without the [GEM] option, \fBshow\fR will print a list of the names and versions of all gems that are required by your [\fBGemfile(5)\fR][Gemfile(5)], sorted by name\.
10
10
  .P
@@ -13,7 +13,4 @@ Calling show with [GEM] will list the exact location of that gem on your machine
13
13
  .TP
14
14
  \fB\-\-paths\fR
15
15
  List the paths of all gems that are required by your [\fBGemfile(5)\fR][Gemfile(5)], sorted by gem name\.
16
- .TP
17
- \fB\-\-outdated\fR
18
- Show verbose output including whether gems are outdated\.
19
16
 
@@ -5,7 +5,6 @@ bundle-show(1) -- Shows all the gems in your bundle, or the path to a gem
5
5
 
6
6
  `bundle show` [GEM]
7
7
  [--paths]
8
- [--outdated]
9
8
 
10
9
  ## DESCRIPTION
11
10
 
@@ -20,6 +19,3 @@ machine.
20
19
  * `--paths`:
21
20
  List the paths of all gems that are required by your [`Gemfile(5)`][Gemfile(5)],
22
21
  sorted by gem name.
23
-
24
- * `--outdated`:
25
- Show verbose output including whether gems are outdated.
@@ -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\-UPDATE" "1" "August 2025" ""
3
+ .TH "BUNDLE\-UPDATE" "1" "February 2026" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-update\fR \- Update your gems to the latest available versions
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\-VERSION" "1" "August 2025" ""
3
+ .TH "BUNDLE\-VERSION" "1" "February 2026" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-version\fR \- Prints Bundler version information
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" "1" "August 2025" ""
3
+ .TH "BUNDLE" "1" "February 2026" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\fR \- Ruby Dependency Management
6
6
  .SH "SYNOPSIS"
@@ -66,9 +66,6 @@ Open an installed gem in the editor
66
66
  \fBbundle lock(1)\fR \fIbundle\-lock\.1\.html\fR
67
67
  Generate a lockfile for your dependencies
68
68
  .TP
69
- \fBbundle viz(1)\fR \fIbundle\-viz\.1\.html\fR (deprecated)
70
- Generate a visual representation of your dependencies
71
- .TP
72
69
  \fBbundle init(1)\fR \fIbundle\-init\.1\.html\fR
73
70
  Generate a simple \fBGemfile\fR, placed in the current directory
74
71
  .TP
@@ -94,9 +91,3 @@ Manage Bundler plugins
94
91
  Prints Bundler version information
95
92
  .SH "PLUGINS"
96
93
  When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES, Bundler will try to find an executable on your path named \fBbundler\-<command>\fR and execute it, passing down any extra arguments to it\.
97
- .SH "OBSOLETE"
98
- These commands are obsolete and should no longer be used:
99
- .IP "\(bu" 4
100
- \fBbundle inject(1)\fR
101
- .IP "" 0
102
-
@@ -76,9 +76,6 @@ We divide `bundle` subcommands into primary commands and utilities:
76
76
  * [`bundle lock(1)`](bundle-lock.1.html):
77
77
  Generate a lockfile for your dependencies
78
78
 
79
- * [`bundle viz(1)`](bundle-viz.1.html) (deprecated):
80
- Generate a visual representation of your dependencies
81
-
82
79
  * [`bundle init(1)`](bundle-init.1.html):
83
80
  Generate a simple `Gemfile`, placed in the current directory
84
81
 
@@ -108,9 +105,3 @@ We divide `bundle` subcommands into primary commands and utilities:
108
105
  When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES,
109
106
  Bundler will try to find an executable on your path named `bundler-<command>`
110
107
  and execute it, passing down any extra arguments to it.
111
-
112
- ## OBSOLETE
113
-
114
- These commands are obsolete and should no longer be used:
115
-
116
- * `bundle inject(1)`
@@ -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 "GEMFILE" "5" "August 2025" ""
3
+ .TH "GEMFILE" "5" "February 2026" ""
4
4
  .SH "NAME"
5
5
  \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
6
6
  .SH "SYNOPSIS"
@@ -469,4 +469,35 @@ For implicit gems (dependencies of explicit gems), any source, git, or path repo
469
469
  .IP "3." 4
470
470
  If neither of the above conditions are met, the global source will be used\. If multiple global sources are specified, they will be prioritized from last to first, but this is deprecated since Bundler 1\.13, so Bundler prints a warning and will abort with an error in the future\.
471
471
  .IP "" 0
472
+ .SH "LOCKFILE"
473
+ By default, Bundler will create a lockfile by adding \fB\.lock\fR to the end of the Gemfile name\. To change this, use the \fBlockfile\fR method:
474
+ .IP "" 4
475
+ .nf
476
+ lockfile "/path/to/lockfile\.lock"
477
+ .fi
478
+ .IP "" 0
479
+ .P
480
+ This is useful when you want to use different lockfiles per ruby version or platform\.
481
+ .P
482
+ To avoid writing a lock file, use \fBfalse\fR as the argument:
483
+ .IP "" 4
484
+ .nf
485
+ lockfile false
486
+ .fi
487
+ .IP "" 0
488
+ .P
489
+ This is useful for library development and other situations where the code is expected to work with a range of dependency versions\.
490
+ .SS "LOCKFILE PRECEDENCE"
491
+ When determining path to the lockfile or whether to create a lockfile, the following precedence is used:
492
+ .IP "1." 4
493
+ The \fBbundle install\fR \fB\-\-no\-lock\fR option (which disables lockfile creation)\.
494
+ .IP "2." 4
495
+ The \fBbundle install\fR \fB\-\-lockfile\fR option\.
496
+ .IP "3." 4
497
+ The \fBBUNDLE_LOCKFILE\fR environment variable\.
498
+ .IP "4." 4
499
+ The \fBlockfile\fR method in the Gemfile\.
500
+ .IP "5." 4
501
+ The default behavior of adding \fB\.lock\fR to the end of the Gemfile name\.
502
+ .IP "" 0
472
503
 
@@ -556,3 +556,31 @@ bundler uses the following priority order:
556
556
  If multiple global sources are specified, they will be prioritized from
557
557
  last to first, but this is deprecated since Bundler 1.13, so Bundler prints
558
558
  a warning and will abort with an error in the future.
559
+
560
+ ## LOCKFILE
561
+
562
+ By default, Bundler will create a lockfile by adding `.lock` to the end of the
563
+ Gemfile name. To change this, use the `lockfile` method:
564
+
565
+ lockfile "/path/to/lockfile.lock"
566
+
567
+ This is useful when you want to use different lockfiles per ruby version or
568
+ platform.
569
+
570
+ To avoid writing a lock file, use `false` as the argument:
571
+
572
+ lockfile false
573
+
574
+ This is useful for library development and other situations where the code is
575
+ expected to work with a range of dependency versions.
576
+
577
+ ### LOCKFILE PRECEDENCE
578
+
579
+ When determining path to the lockfile or whether to create a lockfile, the
580
+ following precedence is used:
581
+
582
+ 1. The `bundle install` `--no-lock` option (which disables lockfile creation).
583
+ 1. The `bundle install` `--lockfile` option.
584
+ 1. The `BUNDLE_LOCKFILE` environment variable.
585
+ 1. The `lockfile` method in the Gemfile.
586
+ 1. The default behavior of adding `.lock` to the end of the Gemfile name.
@@ -15,7 +15,6 @@ bundle-gem(1) bundle-gem.1
15
15
  bundle-help(1) bundle-help.1
16
16
  bundle-info(1) bundle-info.1
17
17
  bundle-init(1) bundle-init.1
18
- bundle-inject(1) bundle-inject.1
19
18
  bundle-install(1) bundle-install.1
20
19
  bundle-issue(1) bundle-issue.1
21
20
  bundle-licenses(1) bundle-licenses.1
@@ -30,4 +29,3 @@ bundle-remove(1) bundle-remove.1
30
29
  bundle-show(1) bundle-show.1
31
30
  bundle-update(1) bundle-update.1
32
31
  bundle-version(1) bundle-version.1
33
- bundle-viz(1) bundle-viz.1
@@ -29,7 +29,7 @@ module Bundler
29
29
  end
30
30
 
31
31
  def dependencies
32
- specs.first.runtime_dependencies.map {|d| [d, platform] }
32
+ (materialized_spec || specs.first).runtime_dependencies.map {|d| [d, platform] }
33
33
  end
34
34
 
35
35
  def materialized_spec
@@ -43,16 +43,6 @@ module Bundler
43
43
  private
44
44
 
45
45
  def check_sources_consistency!(options)
46
- if options.key?(:git) && options.key?(:local_git)
47
- raise InvalidOption, "Remote and local plugin git sources can't be both specified"
48
- end
49
-
50
- # back-compat; local_git is an alias for git
51
- if options.key?(:local_git)
52
- Bundler::SharedHelpers.major_deprecation(2, "--local_git is deprecated, use --git")
53
- options[:git] = options.delete(:local_git)
54
- end
55
-
56
46
  if (options.keys & [:source, :git, :path]).length > 1
57
47
  raise InvalidOption, "Only one of --source, --git, or --path may be specified"
58
48
  end
@@ -23,7 +23,7 @@ module Bundler
23
23
 
24
24
  private
25
25
 
26
- def rubygems_aggregate_class
26
+ def source_class
27
27
  Plugin::Installer::Rubygems
28
28
  end
29
29
  end
@@ -220,7 +220,7 @@ module Bundler
220
220
  #
221
221
  # @param [String] event
222
222
  def hook(event, *args, &arg_blk)
223
- return unless Bundler.feature_flag.plugins?
223
+ return unless Bundler.settings[:plugins]
224
224
  unless Events.defined_event?(event)
225
225
  raise ArgumentError, "Event '#{event}' not defined in Bundler::Plugin::Events"
226
226
  end
@@ -253,10 +253,13 @@ module Bundler
253
253
  # @param [Array<String>] names of inferred source plugins that can be ignored
254
254
  def save_plugins(plugins, specs, optional_plugins = [])
255
255
  plugins.each do |name|
256
- next if index.installed?(name)
257
-
258
256
  spec = specs[name]
259
257
 
258
+ # It's possible that the `plugin` found in the Gemfile don't appear in the specs. For instance when
259
+ # calling `BUNDLE_WITHOUT=default bundle install`, the plugins will not get installed.
260
+ next if spec.nil?
261
+ next if index.installed?(name)
262
+
260
263
  save_plugin(name, spec, optional_plugins.include?(name))
261
264
  end
262
265
  end
@@ -165,7 +165,7 @@ module Bundler
165
165
  PubGrub::VersionConstraint.new(package, range: range)
166
166
  end
167
167
 
168
- def versions_for(package, range=VersionRange.any)
168
+ def versions_for(package, range = VersionRange.any)
169
169
  range.select_versions(@sorted_versions[package])
170
170
  end
171
171
 
@@ -42,21 +42,26 @@ module Bundler
42
42
  # Loads the file relative to the dirname of the Gemfile itself.
43
43
  def normalize_ruby_file(filename)
44
44
  file_content = Bundler.read_file(gemfile.dirname.join(filename))
45
- # match "ruby-3.2.2", ruby = "3.2.2" or "ruby 3.2.2" capturing version string up to the first space or comment
46
- if /^ # Start of line
47
- ruby # Literal "ruby"
48
- [\s-]* # Optional whitespace or hyphens (for "ruby-3.2.2" format)
49
- (?:=\s*)? # Optional equals sign with whitespace (for ruby = "3.2.2" format)
50
- "? # Optional opening quote
51
- ( # Start capturing group
52
- [^\s#"]+ # One or more chars that aren't spaces, #, or quotes
53
- ) # End capturing group
54
- "? # Optional closing quote
55
- /x.match(file_content)
56
- $1
45
+ # match "ruby-3.2.2", ruby = "3.2.2", ruby = '3.2.2' or "ruby 3.2.2" capturing version string up to the first space or comment
46
+ version_match = /^ # Start of line
47
+ ruby # Literal "ruby"
48
+ [\s-]* # Optional whitespace or hyphens (for "ruby-3.2.2" format)
49
+ (?:=\s*)? # Optional equals sign with whitespace (for ruby = "3.2.2" format)
50
+ (?:
51
+ "([^"]+)" # Double quoted version
52
+ |
53
+ '([^']+)' # Single quoted version
54
+ |
55
+ ([^\s#"']+) # Unquoted version
56
+ )
57
+ /x.match(file_content)
58
+ if version_match
59
+ version_match[1] || version_match[2] || version_match[3]
57
60
  else
58
61
  file_content.strip
59
62
  end
63
+ rescue Errno::ENOENT
64
+ raise GemfileError, "Could not find version file #{filename}"
60
65
  end
61
66
  end
62
67
  end
@@ -43,7 +43,6 @@ module Bundler
43
43
 
44
44
  def to_s(versions = self.versions)
45
45
  output = String.new("ruby #{versions_string(versions)}")
46
- output << "p#{patchlevel}" if patchlevel && patchlevel != "-1"
47
46
  output << " (#{engine} #{versions_string(engine_versions)})" unless engine == "ruby"
48
47
 
49
48
  output
@@ -72,8 +71,7 @@ module Bundler
72
71
  def ==(other)
73
72
  versions == other.versions &&
74
73
  engine == other.engine &&
75
- engine_versions == other.engine_versions &&
76
- patchlevel == other.patchlevel
74
+ engine_versions == other.engine_versions
77
75
  end
78
76
 
79
77
  def host
@@ -417,7 +417,7 @@ module Gem
417
417
  unless Gem::NameTuple.new("a", Gem::Version.new("1"), Gem::Platform.new("x86_64-linux")).platform.is_a?(String)
418
418
  alias_method :initialize_with_platform, :initialize
419
419
 
420
- def initialize(name, version, platform=Gem::Platform::RUBY)
420
+ def initialize(name, version, platform = Gem::Platform::RUBY)
421
421
  if Gem::Platform === platform
422
422
  initialize_with_platform(name, version, platform.to_s)
423
423
  else
@@ -69,10 +69,7 @@ module Bundler
69
69
  end
70
70
 
71
71
  def generate_plugins
72
- return unless Gem::Installer.instance_methods(false).include?(:generate_plugins)
73
-
74
- latest = Gem::Specification.stubs_for(spec.name).first
75
- return if latest && latest.version > spec.version
72
+ return unless Gem::Installer.method_defined?(:generate_plugins, false)
76
73
 
77
74
  ensure_writable_dir @plugins_dir
78
75
 
@@ -103,6 +100,10 @@ module Bundler
103
100
  end
104
101
  end
105
102
 
103
+ def build_jobs
104
+ Bundler.settings[:jobs] || super
105
+ end
106
+
106
107
  def build_extensions
107
108
  extension_cache_path = options[:bundler_extension_cache_path]
108
109
  extension_dir = spec.extension_dir
@@ -416,11 +416,7 @@ module Bundler
416
416
  end
417
417
 
418
418
  def all_specs
419
- SharedHelpers.major_deprecation 2, "Bundler.rubygems.all_specs has been removed in favor of Bundler.rubygems.installed_specs"
420
-
421
- Gem::Specification.stubs.map do |stub|
422
- StubSpecification.from_stub(stub)
423
- end
419
+ SharedHelpers.feature_removed! "Bundler.rubygems.all_specs has been removed in favor of Bundler.rubygems.installed_specs"
424
420
  end
425
421
 
426
422
  def installed_specs
@@ -436,7 +432,7 @@ module Bundler
436
432
  end
437
433
 
438
434
  def find_bundler(version)
439
- find_name("bundler").find {|s| s.version.to_s == version }
435
+ find_name("bundler").find {|s| s.version.to_s == version.to_s }
440
436
  end
441
437
 
442
438
  def find_name(name)
@@ -174,7 +174,14 @@ module Bundler
174
174
  spec_cache_paths = []
175
175
  spec_gemspec_paths = []
176
176
  spec_extension_paths = []
177
- Bundler.rubygems.add_default_gems_to(specs).values.each do |spec|
177
+ specs_to_keep = Bundler.rubygems.add_default_gems_to(specs).values
178
+
179
+ current_bundler = Bundler.rubygems.find_bundler(Bundler.gem_version)
180
+ if current_bundler
181
+ specs_to_keep << current_bundler
182
+ end
183
+
184
+ specs_to_keep.each do |spec|
178
185
  spec_gem_paths << spec.full_gem_path
179
186
  # need to check here in case gems are nested like for the rails git repo
180
187
  md = %r{(.+bundler/gems/.+-[a-f0-9]{7,12})}.match(spec.full_gem_path)
@@ -240,7 +247,11 @@ module Bundler
240
247
 
241
248
  cached.each do |path|
242
249
  Bundler.ui.info " * #{File.basename(path)}"
243
- File.delete(path)
250
+
251
+ begin
252
+ File.delete(path)
253
+ rescue Errno::ENOENT
254
+ end
244
255
  end
245
256
  end
246
257
  end
@@ -97,7 +97,7 @@ module Bundler
97
97
  end
98
98
 
99
99
  def autoswitching_applies?
100
- ENV["BUNDLER_VERSION"].nil? &&
100
+ (ENV["BUNDLER_VERSION"].nil? || ENV["BUNDLER_VERSION"].empty?) &&
101
101
  ruby_can_restart_with_same_arguments? &&
102
102
  lockfile_version
103
103
  end
@@ -7,7 +7,6 @@ module Bundler
7
7
  autoload :Validator, File.expand_path("settings/validator", __dir__)
8
8
 
9
9
  BOOL_KEYS = %w[
10
- allow_offline_install
11
10
  auto_install
12
11
  cache_all
13
12
  cache_all_platforms
@@ -20,7 +19,6 @@ module Bundler
20
19
  disable_shared_gems
21
20
  disable_version_check
22
21
  force_ruby_platform
23
- forget_cli_options
24
22
  frozen
25
23
  gem.changelog
26
24
  gem.coc
@@ -43,20 +41,6 @@ module Bundler
43
41
  verbose
44
42
  ].freeze
45
43
 
46
- REMEMBERED_KEYS = %w[
47
- bin
48
- cache_all
49
- clean
50
- deployment
51
- frozen
52
- no_prune
53
- path
54
- shebang
55
- path.system
56
- without
57
- with
58
- ].freeze
59
-
60
44
  NUMBER_KEYS = %w[
61
45
  jobs
62
46
  redirect
@@ -81,6 +65,7 @@ module Bundler
81
65
  gem.rubocop
82
66
  gem.test
83
67
  gemfile
68
+ lockfile
84
69
  path
85
70
  shebang
86
71
  simulate_version
@@ -97,6 +82,11 @@ module Bundler
97
82
  "BUNDLE_RETRY" => 3,
98
83
  "BUNDLE_TIMEOUT" => 10,
99
84
  "BUNDLE_VERSION" => "lockfile",
85
+ "BUNDLE_LOCKFILE_CHECKSUMS" => true,
86
+ "BUNDLE_CACHE_ALL" => true,
87
+ "BUNDLE_PLUGINS" => true,
88
+ "BUNDLE_GLOBAL_GEM_CACHE" => false,
89
+ "BUNDLE_UPDATE_REQUIRES_ALL_FLAG" => false,
100
90
  }.freeze
101
91
 
102
92
  def initialize(root = nil)
@@ -128,12 +118,8 @@ module Bundler
128
118
  end
129
119
 
130
120
  def set_command_option(key, value)
131
- if !is_remembered(key) || Bundler.feature_flag.forget_cli_options?
132
- temporary(key => value)
133
- value
134
- else
135
- set_local(key, value)
136
- end
121
+ temporary(key => value)
122
+ value
137
123
  end
138
124
 
139
125
  def set_command_option_if_given(key, value)
@@ -387,10 +373,6 @@ module Bundler
387
373
  ARRAY_KEYS.include?(self.class.key_to_s(key))
388
374
  end
389
375
 
390
- def is_remembered(key)
391
- REMEMBERED_KEYS.include?(self.class.key_to_s(key))
392
- end
393
-
394
376
  def is_credential(key)
395
377
  key == "gem.push_key"
396
378
  end
@@ -4,8 +4,6 @@ require_relative "version"
4
4
  require_relative "rubygems_integration"
5
5
  require_relative "current_ruby"
6
6
 
7
- autoload :Pathname, "pathname"
8
-
9
7
  module Bundler
10
8
  autoload :WINDOWS, File.expand_path("constants", __dir__)
11
9
  autoload :FREEBSD, File.expand_path("constants", __dir__)
@@ -25,6 +23,9 @@ module Bundler
25
23
  end
26
24
 
27
25
  def default_lockfile
26
+ given = ENV["BUNDLE_LOCKFILE"]
27
+ return Pathname.new(given) if given && !given.empty?
28
+
28
29
  gemfile = default_gemfile
29
30
 
30
31
  case gemfile.basename.to_s
@@ -57,7 +58,7 @@ module Bundler
57
58
 
58
59
  def pwd
59
60
  Bundler.rubygems.ext_lock.synchronize do
60
- Pathname.pwd
61
+ Dir.pwd
61
62
  end
62
63
  end
63
64
 
@@ -125,27 +126,17 @@ module Bundler
125
126
  raise GenericSystemCallError.new(e, "There was an error #{[:create, :write].include?(action) ? "creating" : "accessing"} `#{path}`.")
126
127
  end
127
128
 
128
- def major_deprecation(major_version, message, removed_message: nil, print_caller_location: false)
129
- if print_caller_location
130
- caller_location = caller_locations(2, 2).first
131
- suffix = " (called at #{caller_location.path}:#{caller_location.lineno})"
132
- message += suffix
133
- removed_message += suffix if removed_message
134
- end
135
-
136
- require_relative "../bundler"
137
-
138
- feature_flag = Bundler.feature_flag
129
+ def feature_deprecated!(message)
130
+ return unless prints_major_deprecations?
139
131
 
140
- if feature_flag.removed_major?(major_version)
141
- require_relative "errors"
142
- raise DeprecatedError, "[REMOVED] #{removed_message || message}"
143
- end
144
-
145
- return unless feature_flag.deprecated_major?(major_version) && prints_major_deprecations?
146
132
  Bundler.ui.warn("[DEPRECATED] #{message}")
147
133
  end
148
134
 
135
+ def feature_removed!(message)
136
+ require_relative "errors"
137
+ raise RemovedError, "[REMOVED] #{message}"
138
+ end
139
+
149
140
  def print_major_deprecations!
150
141
  multiple_gemfiles = search_up(".") do |dir|
151
142
  gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
@@ -309,6 +300,7 @@ module Bundler
309
300
  def set_bundle_variables
310
301
  Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", bundle_bin_path
311
302
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile.to_s
303
+ Bundler::SharedHelpers.set_env "BUNDLE_LOCKFILE", default_lockfile.to_s
312
304
  Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
313
305
  Bundler::SharedHelpers.set_env "BUNDLER_SETUP", File.expand_path("setup", __dir__)
314
306
  end