bundler 2.7.1 → 4.0.0.beta1

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 (144) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1001 -902
  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/checksum.rb +6 -0
  8. data/lib/bundler/cli/cache.rb +1 -12
  9. data/lib/bundler/cli/common.rb +21 -4
  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 +19 -33
  14. data/lib/bundler/cli/install.rb +7 -84
  15. data/lib/bundler/cli/issue.rb +2 -2
  16. data/lib/bundler/cli/list.rb +33 -2
  17. data/lib/bundler/cli/lock.rb +5 -5
  18. data/lib/bundler/cli/plugin.rb +5 -1
  19. data/lib/bundler/cli/show.rb +3 -7
  20. data/lib/bundler/cli/update.rb +3 -3
  21. data/lib/bundler/cli.rb +97 -95
  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 +122 -95
  25. data/lib/bundler/deployment.rb +1 -64
  26. data/lib/bundler/digest.rb +1 -1
  27. data/lib/bundler/dsl.rb +14 -36
  28. data/lib/bundler/endpoint_specification.rb +0 -22
  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/friendly_errors.rb +2 -2
  33. data/lib/bundler/index.rb +0 -7
  34. data/lib/bundler/inline.rb +1 -1
  35. data/lib/bundler/installer/gem_installer.rb +0 -11
  36. data/lib/bundler/installer.rb +0 -6
  37. data/lib/bundler/lockfile_generator.rb +1 -1
  38. data/lib/bundler/lockfile_parser.rb +2 -12
  39. data/lib/bundler/man/bundle-add.1 +1 -1
  40. data/lib/bundler/man/bundle-binstubs.1 +3 -6
  41. data/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
  42. data/lib/bundler/man/bundle-cache.1 +2 -14
  43. data/lib/bundler/man/bundle-cache.1.ronn +1 -14
  44. data/lib/bundler/man/bundle-check.1 +2 -5
  45. data/lib/bundler/man/bundle-check.1.ronn +0 -5
  46. data/lib/bundler/man/bundle-clean.1 +1 -1
  47. data/lib/bundler/man/bundle-config.1 +36 -46
  48. data/lib/bundler/man/bundle-config.1.ronn +69 -75
  49. data/lib/bundler/man/bundle-console.1 +1 -1
  50. data/lib/bundler/man/bundle-doctor.1 +4 -4
  51. data/lib/bundler/man/bundle-doctor.1.ronn +4 -4
  52. data/lib/bundler/man/bundle-env.1 +1 -1
  53. data/lib/bundler/man/bundle-exec.1 +2 -5
  54. data/lib/bundler/man/bundle-exec.1.ronn +1 -5
  55. data/lib/bundler/man/bundle-fund.1 +1 -1
  56. data/lib/bundler/man/bundle-gem.1 +3 -6
  57. data/lib/bundler/man/bundle-gem.1.ronn +2 -5
  58. data/lib/bundler/man/bundle-help.1 +1 -1
  59. data/lib/bundler/man/bundle-info.1 +1 -1
  60. data/lib/bundler/man/bundle-init.1 +1 -1
  61. data/lib/bundler/man/bundle-install.1 +8 -59
  62. data/lib/bundler/man/bundle-install.1.ronn +12 -107
  63. data/lib/bundler/man/bundle-issue.1 +1 -1
  64. data/lib/bundler/man/bundle-licenses.1 +1 -1
  65. data/lib/bundler/man/bundle-list.1 +6 -1
  66. data/lib/bundler/man/bundle-list.1.ronn +5 -0
  67. data/lib/bundler/man/bundle-lock.1 +1 -1
  68. data/lib/bundler/man/bundle-open.1 +1 -1
  69. data/lib/bundler/man/bundle-outdated.1 +1 -1
  70. data/lib/bundler/man/bundle-platform.1 +1 -1
  71. data/lib/bundler/man/bundle-plugin.1 +33 -15
  72. data/lib/bundler/man/bundle-plugin.1.ronn +36 -15
  73. data/lib/bundler/man/bundle-pristine.1 +1 -1
  74. data/lib/bundler/man/bundle-remove.1 +2 -8
  75. data/lib/bundler/man/bundle-remove.1.ronn +1 -8
  76. data/lib/bundler/man/bundle-show.1 +2 -5
  77. data/lib/bundler/man/bundle-show.1.ronn +0 -4
  78. data/lib/bundler/man/bundle-update.1 +1 -1
  79. data/lib/bundler/man/bundle-version.1 +1 -1
  80. data/lib/bundler/man/bundle.1 +1 -10
  81. data/lib/bundler/man/bundle.1.ronn +0 -9
  82. data/lib/bundler/man/gemfile.5 +1 -1
  83. data/lib/bundler/man/index.txt +0 -2
  84. data/lib/bundler/materialization.rb +1 -1
  85. data/lib/bundler/plugin/installer.rb +0 -10
  86. data/lib/bundler/plugin/source_list.rb +1 -1
  87. data/lib/bundler/plugin.rb +1 -1
  88. data/lib/bundler/resolver/package.rb +1 -0
  89. data/lib/bundler/resolver.rb +1 -1
  90. data/lib/bundler/ruby_dsl.rb +2 -0
  91. data/lib/bundler/ruby_version.rb +1 -3
  92. data/lib/bundler/rubygems_ext.rb +1 -1
  93. data/lib/bundler/rubygems_gem_installer.rb +1 -1
  94. data/lib/bundler/rubygems_integration.rb +1 -5
  95. data/lib/bundler/self_manager.rb +1 -1
  96. data/lib/bundler/settings.rb +8 -27
  97. data/lib/bundler/shared_helpers.rb +8 -20
  98. data/lib/bundler/source/gemspec.rb +4 -0
  99. data/lib/bundler/source/git/git_proxy.rb +3 -11
  100. data/lib/bundler/source/git.rb +2 -3
  101. data/lib/bundler/source/path.rb +5 -7
  102. data/lib/bundler/source/rubygems.rb +11 -17
  103. data/lib/bundler/source.rb +1 -1
  104. data/lib/bundler/source_list.rb +4 -45
  105. data/lib/bundler/source_map.rb +2 -5
  106. data/lib/bundler/spec_set.rb +6 -15
  107. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
  108. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  109. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  110. data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
  111. data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
  112. data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
  113. data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
  114. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +6 -0
  115. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  116. data/lib/bundler/templates/newgem/newgem.gemspec.tt +7 -4
  117. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
  118. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  119. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
  120. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
  121. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +5 -2
  122. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +42 -6
  123. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +1 -1
  124. data/lib/bundler/vendor/thor/lib/thor/runner.rb +2 -2
  125. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +3 -7
  126. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  127. data/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
  128. data/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
  129. data/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
  130. data/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
  131. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  132. data/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
  133. data/lib/bundler/version.rb +1 -1
  134. data/lib/bundler/vlad.rb +1 -14
  135. data/lib/bundler.rb +6 -28
  136. metadata +9 -13
  137. data/lib/bundler/cli/inject.rb +0 -60
  138. data/lib/bundler/cli/viz.rb +0 -31
  139. data/lib/bundler/graph.rb +0 -152
  140. data/lib/bundler/man/bundle-inject.1 +0 -31
  141. data/lib/bundler/man/bundle-inject.1.ronn +0 -32
  142. data/lib/bundler/man/bundle-viz.1 +0 -30
  143. data/lib/bundler/man/bundle-viz.1.ronn +0 -36
  144. data/lib/bundler/similarity_detector.rb +0 -63
@@ -15,7 +15,7 @@ module Bundler
15
15
 
16
16
  Bundler.self_manager.update_bundler_and_restart_with_it_if_needed(update_bundler) if update_bundler
17
17
 
18
- Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
18
+ Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.settings[:plugins]
19
19
 
20
20
  sources = Array(options[:source])
21
21
  groups = Array(options[:group]).map(&:to_sym)
@@ -23,10 +23,10 @@ module Bundler
23
23
  full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !update_bundler
24
24
 
25
25
  if full_update && !options[:all]
26
- if Bundler.feature_flag.update_requires_all_flag?
26
+ if Bundler.settings[:update_requires_all_flag]
27
27
  raise InvalidOption, "To update everything, pass the `--all` flag."
28
28
  end
29
- SharedHelpers.major_deprecation 4, "Pass --all to `bundle update` to update everything"
29
+ SharedHelpers.feature_deprecated! "Pass --all to `bundle update` to update everything"
30
30
  elsif !full_update && options[:all]
31
31
  raise InvalidOption, "Cannot specify --all along with specific options."
32
32
  end
data/lib/bundler/cli.rb CHANGED
@@ -11,7 +11,7 @@ module Bundler
11
11
 
12
12
  AUTO_INSTALL_CMDS = %w[show binstubs outdated exec open console licenses clean].freeze
13
13
  PARSEABLE_COMMANDS = %w[check config help exec platform show version].freeze
14
- EXTENSIONS = ["c", "rust"].freeze
14
+ EXTENSIONS = ["c", "rust", "go"].freeze
15
15
 
16
16
  COMMAND_ALIASES = {
17
17
  "check" => "c",
@@ -24,7 +24,7 @@ module Bundler
24
24
  }.freeze
25
25
 
26
26
  def self.start(*)
27
- check_deprecated_ext_option(ARGV) if ARGV.include?("--ext")
27
+ check_invalid_ext_option(ARGV) if ARGV.include?("--ext")
28
28
 
29
29
  super
30
30
  ensure
@@ -107,7 +107,22 @@ module Bundler
107
107
  shell.say
108
108
  self.class.send(:class_options_help, shell)
109
109
  end
110
- default_task(Bundler.feature_flag.default_cli_command)
110
+
111
+ def self.default_command(meth = nil)
112
+ return super if meth
113
+
114
+ default_cli_command = Bundler.settings[:default_cli_command]
115
+ return default_cli_command if default_cli_command
116
+
117
+ Bundler.ui.warn(<<~MSG)
118
+ In the next version of Bundler, running `bundle` without argument will no longer run `bundle install`.
119
+ Instead, the `help` command will be displayed.
120
+
121
+ If you'd like to keep the previous behaviour please run `bundle config set default_cli_command install --global`.
122
+ MSG
123
+
124
+ "install"
125
+ end
111
126
 
112
127
  class_option "no-color", type: :boolean, desc: "Disable colorization in output"
113
128
  class_option "retry", type: :numeric, aliases: "-r", banner: "NUM",
@@ -143,7 +158,7 @@ module Bundler
143
158
  end
144
159
 
145
160
  def self.handle_no_command_error(command, has_namespace = $thor_runner)
146
- if Bundler.feature_flag.plugins? && Bundler::Plugin.command?(command)
161
+ if Bundler.settings[:plugins] && Bundler::Plugin.command?(command)
147
162
  return Bundler::Plugin.exec_command(command, ARGV[1..-1])
148
163
  end
149
164
 
@@ -173,7 +188,7 @@ module Bundler
173
188
  D
174
189
  method_option "dry-run", type: :boolean, default: false, banner: "Lock the Gemfile"
175
190
  method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
176
- method_option "path", type: :string, banner: "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
191
+ method_option "path", type: :string, banner: "Specify a different path than the system default, namely, $BUNDLE_PATH or $GEM_HOME (removed)"
177
192
  def check
178
193
  remembered_flag_deprecation("path")
179
194
 
@@ -187,12 +202,11 @@ module Bundler
187
202
  long_desc <<-D
188
203
  Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If the gem is not found, Bundler prints a error message and if gem could not be removed due to any reason Bundler will display a warning.
189
204
  D
190
- method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile"
205
+ method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile (removed)"
191
206
  def remove(*gems)
192
207
  if ARGV.include?("--install")
193
- message = "The `--install` flag has been deprecated. `bundle install` is triggered by default."
194
208
  removed_message = "The `--install` flag has been removed. `bundle install` is triggered by default."
195
- SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
209
+ raise InvalidOption, removed_message
196
210
  end
197
211
 
198
212
  require_relative "cli/remove"
@@ -210,10 +224,10 @@ module Bundler
210
224
 
211
225
  If the bundle has already been installed, bundler will tell you so and then exit.
212
226
  D
213
- method_option "binstubs", type: :string, lazy_default: "bin", banner: "Generate bin stubs for bundled gems to ./bin"
214
- method_option "clean", type: :boolean, banner: "Run bundle clean automatically after install"
215
- method_option "deployment", type: :boolean, banner: "Install using defaults tuned for deployment environments"
216
- method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this install"
227
+ method_option "binstubs", type: :string, lazy_default: "bin", banner: "Generate bin stubs for bundled gems to ./bin (removed)"
228
+ method_option "clean", type: :boolean, banner: "Run bundle clean automatically after install (removed)"
229
+ method_option "deployment", type: :boolean, banner: "Install using defaults tuned for deployment environments (removed)"
230
+ method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this install (removed)"
217
231
  method_option "full-index", type: :boolean, banner: "Fall back to using the single-file index of all gems"
218
232
  method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
219
233
  method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel"
@@ -221,16 +235,16 @@ module Bundler
221
235
  method_option "prefer-local", type: :boolean, banner: "Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely"
222
236
  method_option "no-cache", type: :boolean, banner: "Don't update the existing gem cache."
223
237
  method_option "force", type: :boolean, aliases: "--redownload", banner: "Force reinstalling every gem, even if already installed"
224
- method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache."
225
- method_option "path", type: :string, banner: "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
238
+ method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache (removed)."
239
+ method_option "path", type: :string, banner: "Specify a different path than the system default, namely, $BUNDLE_PATH or $GEM_HOME (removed)."
226
240
  method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
227
- method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')"
241
+ method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default, usually 'ruby' (removed)"
228
242
  method_option "standalone", type: :array, lazy_default: [], banner: "Make a bundle that can work without the Bundler runtime"
229
- method_option "system", type: :boolean, banner: "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
243
+ method_option "system", type: :boolean, banner: "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application (removed)"
230
244
  method_option "trust-policy", alias: "P", type: :string, banner: "Gem trust policy (like gem install -P). Must be one of #{Bundler.rubygems.security_policy_keys.join("|")}"
231
245
  method_option "target-rbconfig", type: :string, banner: "Path to rbconfig.rb for the deployment target platform"
232
- method_option "without", type: :array, banner: "Exclude gems that are part of the specified named group."
233
- method_option "with", type: :array, banner: "Include gems that are part of the specified named group."
246
+ method_option "without", type: :array, banner: "Exclude gems that are part of the specified named group (removed)."
247
+ method_option "with", type: :array, banner: "Include gems that are part of the specified named group (removed)."
234
248
  def install
235
249
  %w[clean deployment frozen no-prune path shebang without with].each do |option|
236
250
  remembered_flag_deprecation(option)
@@ -240,6 +254,11 @@ module Bundler
240
254
 
241
255
  remembered_flag_deprecation("deployment", negative: true)
242
256
 
257
+ if ARGV.include?("--binstubs")
258
+ removed_message = "The --binstubs option has been removed in favor of `bundle binstubs --all`"
259
+ raise InvalidOption, removed_message
260
+ end
261
+
243
262
  require_relative "cli/install"
244
263
  Bundler.settings.temporary(no_install: false) do
245
264
  Install.new(options.dup).run
@@ -284,12 +303,11 @@ module Bundler
284
303
  Calling show with [GEM] will list the exact location of that gem on your machine.
285
304
  D
286
305
  method_option "paths", type: :boolean, banner: "List the paths of all gems that are required by your Gemfile."
287
- method_option "outdated", type: :boolean, banner: "Show verbose output including whether gems are outdated."
306
+ method_option "outdated", type: :boolean, banner: "Show verbose output including whether gems are outdated (removed)."
288
307
  def show(gem_name = nil)
289
308
  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"
292
- SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
309
+ removed_message = "the `--outdated` flag to `bundle show` has been removed in favor of `bundle show --verbose`"
310
+ raise InvalidOption, removed_message
293
311
  end
294
312
  require_relative "cli/show"
295
313
  Show.new(options, gem_name).run
@@ -299,6 +317,7 @@ module Bundler
299
317
  method_option "name-only", type: :boolean, banner: "print only the gem names"
300
318
  method_option "only-group", type: :array, default: [], banner: "print gems from a given set of groups"
301
319
  method_option "without-group", type: :array, default: [], banner: "print all gems except from a given set of groups"
320
+ method_option "format", type: :string, banner: "format output ('json' is the only supported format)"
302
321
  method_option "paths", type: :boolean, banner: "print the path to each gem in the bundle"
303
322
  def list
304
323
  require_relative "cli/list"
@@ -322,7 +341,7 @@ module Bundler
322
341
  will create binstubs for all given gems.
323
342
  D
324
343
  method_option "force", type: :boolean, default: false, banner: "Overwrite existing binstubs if they exist"
325
- method_option "path", type: :string, lazy_default: "bin", banner: "Binstub destination directory (default bin)"
344
+ method_option "path", type: :string, lazy_default: "bin", banner: "Binstub destination directory, `bin` by default (removed)"
326
345
  method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')"
327
346
  method_option "standalone", type: :boolean, banner: "Make binstubs that can work without the Bundler runtime"
328
347
  method_option "all", type: :boolean, banner: "Install binstubs for all gems"
@@ -395,15 +414,15 @@ module Bundler
395
414
  end
396
415
 
397
416
  desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
398
- method_option "all", type: :boolean, default: Bundler.feature_flag.cache_all?, banner: "Include all sources (including path and git)."
417
+ method_option "all", type: :boolean, default: Bundler.settings[:cache_all], banner: "Include all sources (including path and git) (removed)."
399
418
  method_option "all-platforms", type: :boolean, banner: "Include gems for all platforms present in the lockfile, not only the current one"
400
419
  method_option "cache-path", type: :string, banner: "Specify a different cache path than the default (vendor/cache)."
401
420
  method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
402
421
  method_option "no-install", type: :boolean, banner: "Don't install the gems, only update the cache."
403
- method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache."
404
- method_option "path", type: :string, banner: "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
422
+ method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache (removed)."
423
+ method_option "path", type: :string, banner: "Specify a different path than the system default, namely, $BUNDLE_PATH or $GEM_HOME (removed)."
405
424
  method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
406
- method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install"
425
+ method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install (removed)"
407
426
  long_desc <<-D
408
427
  The cache command will copy the .gem files for every gem in the bundle into the
409
428
  directory ./vendor/cache. If you then check that directory into your source
@@ -412,18 +431,19 @@ module Bundler
412
431
  D
413
432
  def cache
414
433
  print_remembered_flag_deprecation("--all", "cache_all", "true") if ARGV.include?("--all")
434
+ print_remembered_flag_deprecation("--no-all", "cache_all", "false") if ARGV.include?("--no-all")
435
+
436
+ %w[frozen no-prune].each do |option|
437
+ remembered_flag_deprecation(option)
438
+ end
415
439
 
416
440
  if flag_passed?("--path")
417
- message =
418
- "The `--path` flag is deprecated because its semantics are unclear. " \
419
- "Use `bundle config cache_path` to configure the path of your cache of gems, " \
420
- "and `bundle config path` to configure the path where your gems are installed, " \
421
- "and stop using this flag"
422
441
  removed_message =
423
442
  "The `--path` flag has been removed because its semantics were unclear. " \
424
443
  "Use `bundle config cache_path` to configure the path of your cache of gems, " \
425
- "and `bundle config path` to configure the path where your gems are installed."
426
- SharedHelpers.major_deprecation 2, message, removed_message: removed_message
444
+ "and `bundle config path` to configure the path where your gems are installed, " \
445
+ "and stop using this flag"
446
+ raise InvalidOption, removed_message
427
447
  end
428
448
 
429
449
  require_relative "cli/cache"
@@ -433,7 +453,7 @@ module Bundler
433
453
  map aliases_for("cache")
434
454
 
435
455
  desc "exec [OPTIONS]", "Run the command in context of the bundle"
436
- method_option :keep_file_descriptors, type: :boolean, default: true, banner: "Passes all file descriptors to the new processes. Default is true, and setting it to false is deprecated"
456
+ method_option :keep_file_descriptors, type: :boolean, default: true, banner: "Passes all file descriptors to the new processes. Default is true, and setting it to false is not permitted (removed)."
437
457
  method_option :gemfile, type: :string, required: false, banner: "Use the specified gemfile instead of Gemfile"
438
458
  long_desc <<-D
439
459
  Exec runs a command, providing it access to the gems in the bundle. While using
@@ -442,9 +462,8 @@ module Bundler
442
462
  D
443
463
  def exec(*args)
444
464
  if ARGV.include?("--no-keep-file-descriptors")
445
- message = "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to"
446
465
  removed_message = "The `--no-keep-file-descriptors` has been removed. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to"
447
- SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
466
+ raise InvalidOption, removed_message
448
467
  end
449
468
 
450
469
  require_relative "cli/exec"
@@ -488,7 +507,7 @@ module Bundler
488
507
  build_info = " (#{BuildMetadata.timestamp} commit #{BuildMetadata.git_commit_sha})"
489
508
  end
490
509
 
491
- if !cli_help && Bundler.feature_flag.bundler_4_mode?
510
+ if !cli_help
492
511
  Bundler.ui.info "#{Bundler.verbose_version}#{build_info}"
493
512
  else
494
513
  Bundler.ui.info "Bundler version #{Bundler.verbose_version}#{build_info}"
@@ -511,42 +530,32 @@ module Bundler
511
530
  end
512
531
  end
513
532
 
514
- unless Bundler.feature_flag.bundler_4_mode?
515
- desc "viz [OPTIONS]", "Generates a visual dependency graph", hide: true
516
- long_desc <<-D
517
- Viz generates a PNG file of the current Gemfile as a dependency graph.
518
- Viz requires the ruby-graphviz gem (and its dependencies).
519
- The associated gems must also be installed via 'bundle install'.
520
- 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
- def viz
527
- 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
- require_relative "cli/viz"
529
- Viz.new(options.dup).run
530
- end
533
+ desc "viz [OPTIONS]", "Generates a visual dependency graph", hide: true
534
+ def viz
535
+ SharedHelpers.feature_removed! "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
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` (removed)."
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"
555
+
556
+ raise InvalidOption, "--rubocop has been removed, use --linter=rubocop" if ARGV.include?("--rubocop")
557
+ raise InvalidOption, "--no-rubocop has been removed, use --no-linter" if ARGV.include?("--no-rubocop")
558
+
550
559
  cmd_args = args + [self]
551
560
  cmd_args.unshift(options)
552
561
 
@@ -557,7 +566,7 @@ module Bundler
557
566
  File.expand_path("templates", __dir__)
558
567
  end
559
568
 
560
- desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", hide: true
569
+ desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory"
561
570
  method_option "dry-run", type: :boolean, default: false, banner: "Only print out changes, do not clean gems"
562
571
  method_option "force", type: :boolean, default: false, banner: "Forces cleaning up unused gems even if Bundler is configured to use globally installed gems. As a consequence, removes all system gems except for the ones in the current application."
563
572
  def clean
@@ -573,12 +582,8 @@ module Bundler
573
582
  end
574
583
 
575
584
  desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", hide: true
576
- method_option "source", type: :string, banner: "Install gem from the given source"
577
- method_option "group", type: :string, banner: "Install gem into a bundler group"
578
- def inject(name, version)
579
- SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
580
- require_relative "cli/inject"
581
- Inject.new(options.dup, name, version).run
585
+ def inject(*)
586
+ SharedHelpers.feature_removed! "The `inject` command has been replaced by the `add` command"
582
587
  end
583
588
 
584
589
  desc "lock", "Creates a lockfile without installing"
@@ -632,7 +637,7 @@ module Bundler
632
637
  end
633
638
  end
634
639
 
635
- if Bundler.feature_flag.plugins?
640
+ if Bundler.settings[:plugins]
636
641
  require_relative "cli/plugin"
637
642
  desc "plugin", "Manage the bundler plugins"
638
643
  subcommand "plugin", Plugin
@@ -666,18 +671,15 @@ module Bundler
666
671
  end
667
672
  end
668
673
 
669
- def self.check_deprecated_ext_option(arguments)
670
- # when deprecated version of `--ext` is called
671
- # print out deprecation warning and pretend `--ext=c` was provided
672
- if deprecated_ext_value?(arguments)
673
- message = "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been deprecated. Please select a language, e.g. `--ext=rust` to generate a Rust extension. This gem will now be generated as if `--ext=c` was used."
674
+ def self.check_invalid_ext_option(arguments)
675
+ # when invalid version of `--ext` is called
676
+ if invalid_ext_value?(arguments)
674
677
  removed_message = "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been removed. Please select a language, e.g. `--ext=rust` to generate a Rust extension."
675
- SharedHelpers.major_deprecation 2, message, removed_message: removed_message
676
- arguments[arguments.index("--ext")] = "--ext=c"
678
+ raise InvalidOption, removed_message
677
679
  end
678
680
  end
679
681
 
680
- def self.deprecated_ext_value?(arguments)
682
+ def self.invalid_ext_value?(arguments)
681
683
  index = arguments.index("--ext")
682
684
  next_argument = arguments[index + 1]
683
685
 
@@ -685,15 +687,15 @@ module Bundler
685
687
  # for example `bundle gem hello --ext c`
686
688
  return false if EXTENSIONS.include?(next_argument)
687
689
 
688
- # deprecated call when --ext is called with no value in last position
690
+ # invalid call when --ext is called with no value in last position
689
691
  # for example `bundle gem hello_gem --ext`
690
692
  return true if next_argument.nil?
691
693
 
692
- # deprecated call when --ext is followed by other parameter
694
+ # invalid call when --ext is followed by other parameter
693
695
  # for example `bundle gem --ext --no-ci hello_gem`
694
696
  return true if next_argument.start_with?("-")
695
697
 
696
- # deprecated call when --ext is followed by gem name
698
+ # invalid call when --ext is followed by gem name
697
699
  # for example `bundle gem --ext hello_gem`
698
700
  return true if next_argument
699
701
 
@@ -713,7 +715,12 @@ module Bundler
713
715
  command_name = cmd.name
714
716
  return if PARSEABLE_COMMANDS.include?(command_name)
715
717
  command = ["bundle", command_name] + args
716
- command << Thor::Options.to_switches(options.sort_by(&:first)).strip
718
+ options_to_print = options.dup
719
+ options_to_print.delete_if do |k, v|
720
+ next unless o = cmd.options[k]
721
+ o.default == v
722
+ end
723
+ command << Thor::Options.to_switches(options_to_print.sort_by(&:first)).strip
717
724
  command.reject!(&:empty?)
718
725
  Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler.verbose_version}"
719
726
  end
@@ -756,17 +763,12 @@ module Bundler
756
763
  end
757
764
 
758
765
  def print_remembered_flag_deprecation(flag_name, option_name, option_value)
759
- message =
760
- "The `#{flag_name}` flag is deprecated because it relies on being " \
761
- "remembered across bundler invocations, which bundler will no longer " \
762
- "do in future versions. Instead please use `bundle config set #{option_name} " \
763
- "#{option_value}`, and stop using this flag"
764
766
  removed_message =
765
767
  "The `#{flag_name}` flag has been removed because it relied on being " \
766
- "remembered across bundler invocations, which bundler will no longer " \
767
- "do. Instead please use `bundle config set #{option_name} " \
768
- "#{option_value}`, and stop using this flag"
769
- Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
768
+ "remembered across bundler invocations, which bundler no longer does. " \
769
+ "Instead please use `bundle config set #{option_name} #{option_value}`, " \
770
+ "and stop using this flag"
771
+ raise InvalidOption, removed_message
770
772
  end
771
773
 
772
774
  def flag_passed?(name)
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "pathname"
4
3
  require "set"
5
4
 
6
5
  module Bundler
@@ -11,7 +11,7 @@ module Bundler
11
11
  end
12
12
 
13
13
  class CurrentRuby
14
- ALL_RUBY_VERSIONS = (18..27).to_a.concat((30..35).to_a).freeze
14
+ ALL_RUBY_VERSIONS = [*18..27, *30..34, 40].freeze
15
15
  KNOWN_MINOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.reverse.join(".") }.freeze
16
16
  KNOWN_MAJOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.last.to_s }.uniq.freeze
17
17
  PLATFORM_MAP = {
@@ -50,19 +50,10 @@ module Bundler
50
50
  end
51
51
 
52
52
  def maglev?
53
- message =
54
- "`CurrentRuby#maglev?` is deprecated with no replacement. Please use the " \
55
- "built-in Ruby `RUBY_ENGINE` constant to check the Ruby implementation you are running on."
56
53
  removed_message =
57
54
  "`CurrentRuby#maglev?` was removed with no replacement. Please use the " \
58
55
  "built-in Ruby `RUBY_ENGINE` constant to check the Ruby implementation you are running on."
59
- internally_exempted = caller_locations(1, 1).first.path == __FILE__
60
-
61
- unless internally_exempted
62
- SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
63
- end
64
-
65
- RUBY_ENGINE == "maglev"
56
+ SharedHelpers.feature_removed!(removed_message)
66
57
  end
67
58
 
68
59
  def truffleruby?
@@ -90,14 +81,11 @@ module Bundler
90
81
  end
91
82
 
92
83
  define_method(:"maglev_#{trimmed_version}?") do
93
- message =
94
- "`CurrentRuby##{__method__}` is deprecated with no replacement. Please use the " \
95
- "built-in Ruby `RUBY_ENGINE` and `RUBY_VERSION` constants to perform a similar check."
96
84
  removed_message =
97
85
  "`CurrentRuby##{__method__}` was removed with no replacement. Please use the " \
98
86
  "built-in Ruby `RUBY_ENGINE` and `RUBY_VERSION` constants to perform a similar check."
99
87
 
100
- SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
88
+ SharedHelpers.feature_removed!(removed_message)
101
89
 
102
90
  send(:"maglev?") && send(:"on_#{trimmed_version}?")
103
91
  end