bundler 2.6.9 → 4.0.10

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 (190) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2212 -1879
  3. data/README.md +11 -11
  4. data/bundler.gemspec +5 -5
  5. data/lib/bundler/build_metadata.rb +10 -11
  6. data/lib/bundler/capistrano.rb +1 -19
  7. data/lib/bundler/checksum.rb +6 -0
  8. data/lib/bundler/cli/add.rb +10 -0
  9. data/lib/bundler/cli/cache.rb +1 -12
  10. data/lib/bundler/cli/common.rb +21 -4
  11. data/lib/bundler/cli/config.rb +1 -2
  12. data/lib/bundler/cli/console.rb +5 -0
  13. data/lib/bundler/cli/exec.rb +29 -4
  14. data/lib/bundler/cli/gem.rb +89 -63
  15. data/lib/bundler/cli/install.rb +15 -90
  16. data/lib/bundler/cli/issue.rb +2 -2
  17. data/lib/bundler/cli/list.rb +33 -2
  18. data/lib/bundler/cli/lock.rb +5 -5
  19. data/lib/bundler/cli/outdated.rb +1 -1
  20. data/lib/bundler/cli/plugin.rb +5 -1
  21. data/lib/bundler/cli/pristine.rb +5 -1
  22. data/lib/bundler/cli/show.rb +3 -7
  23. data/lib/bundler/cli/update.rb +5 -5
  24. data/lib/bundler/cli.rb +162 -127
  25. data/lib/bundler/compact_index_client.rb +1 -6
  26. data/lib/bundler/current_ruby.rb +17 -5
  27. data/lib/bundler/definition.rb +199 -117
  28. data/lib/bundler/dependency.rb +1 -1
  29. data/lib/bundler/deployment.rb +1 -64
  30. data/lib/bundler/digest.rb +1 -1
  31. data/lib/bundler/dsl.rb +48 -48
  32. data/lib/bundler/environment_preserver.rb +1 -0
  33. data/lib/bundler/errors.rb +1 -5
  34. data/lib/bundler/feature_flag.rb +5 -35
  35. data/lib/bundler/fetcher/compact_index.rb +1 -1
  36. data/lib/bundler/fetcher/dependency.rb +9 -2
  37. data/lib/bundler/fetcher/downloader.rb +33 -8
  38. data/lib/bundler/fetcher/gem_remote_fetcher.rb +6 -0
  39. data/lib/bundler/fetcher.rb +49 -19
  40. data/lib/bundler/friendly_errors.rb +4 -3
  41. data/lib/bundler/index.rb +7 -9
  42. data/lib/bundler/injector.rb +1 -2
  43. data/lib/bundler/inline.rb +9 -1
  44. data/lib/bundler/installer/gem_installer.rb +14 -11
  45. data/lib/bundler/installer/parallel_installer.rb +63 -17
  46. data/lib/bundler/installer.rb +6 -19
  47. data/lib/bundler/lazy_specification.rb +47 -20
  48. data/lib/bundler/lockfile_generator.rb +1 -1
  49. data/lib/bundler/lockfile_parser.rb +11 -5
  50. data/lib/bundler/man/bundle-add.1 +1 -1
  51. data/lib/bundler/man/bundle-binstubs.1 +3 -6
  52. data/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
  53. data/lib/bundler/man/bundle-cache.1 +2 -14
  54. data/lib/bundler/man/bundle-cache.1.ronn +1 -14
  55. data/lib/bundler/man/bundle-check.1 +2 -5
  56. data/lib/bundler/man/bundle-check.1.ronn +0 -5
  57. data/lib/bundler/man/bundle-clean.1 +1 -1
  58. data/lib/bundler/man/bundle-config.1 +206 -148
  59. data/lib/bundler/man/bundle-config.1.ronn +135 -118
  60. data/lib/bundler/man/bundle-console.1 +1 -1
  61. data/lib/bundler/man/bundle-doctor.1 +43 -4
  62. data/lib/bundler/man/bundle-doctor.1.ronn +48 -4
  63. data/lib/bundler/man/bundle-env.1 +1 -1
  64. data/lib/bundler/man/bundle-exec.1 +2 -5
  65. data/lib/bundler/man/bundle-exec.1.ronn +1 -5
  66. data/lib/bundler/man/bundle-fund.1 +1 -1
  67. data/lib/bundler/man/bundle-gem.1 +64 -44
  68. data/lib/bundler/man/bundle-gem.1.ronn +10 -9
  69. data/lib/bundler/man/bundle-help.1 +1 -1
  70. data/lib/bundler/man/bundle-info.1 +1 -1
  71. data/lib/bundler/man/bundle-init.1 +1 -1
  72. data/lib/bundler/man/bundle-install.1 +16 -59
  73. data/lib/bundler/man/bundle-install.1.ronn +27 -108
  74. data/lib/bundler/man/bundle-issue.1 +1 -1
  75. data/lib/bundler/man/bundle-licenses.1 +1 -1
  76. data/lib/bundler/man/bundle-list.1 +6 -1
  77. data/lib/bundler/man/bundle-list.1.ronn +5 -0
  78. data/lib/bundler/man/bundle-lock.1 +1 -1
  79. data/lib/bundler/man/bundle-open.1 +1 -1
  80. data/lib/bundler/man/bundle-outdated.1 +1 -1
  81. data/lib/bundler/man/bundle-platform.1 +1 -1
  82. data/lib/bundler/man/bundle-plugin.1 +33 -15
  83. data/lib/bundler/man/bundle-plugin.1.ronn +36 -15
  84. data/lib/bundler/man/bundle-pristine.1 +1 -1
  85. data/lib/bundler/man/bundle-remove.1 +2 -8
  86. data/lib/bundler/man/bundle-remove.1.ronn +1 -8
  87. data/lib/bundler/man/bundle-show.1 +2 -5
  88. data/lib/bundler/man/bundle-show.1.ronn +0 -4
  89. data/lib/bundler/man/bundle-update.1 +5 -5
  90. data/lib/bundler/man/bundle-update.1.ronn +4 -4
  91. data/lib/bundler/man/bundle-version.1 +1 -1
  92. data/lib/bundler/man/bundle.1 +1 -10
  93. data/lib/bundler/man/bundle.1.ronn +0 -9
  94. data/lib/bundler/man/gemfile.5 +32 -1
  95. data/lib/bundler/man/gemfile.5.ronn +28 -0
  96. data/lib/bundler/man/index.txt +0 -2
  97. data/lib/bundler/match_platform.rb +31 -12
  98. data/lib/bundler/materialization.rb +3 -3
  99. data/lib/bundler/plugin/api/source.rb +8 -0
  100. data/lib/bundler/plugin/index.rb +6 -0
  101. data/lib/bundler/plugin/installer.rb +2 -11
  102. data/lib/bundler/plugin/source_list.rb +1 -1
  103. data/lib/bundler/plugin.rb +7 -4
  104. data/lib/bundler/resolver/package.rb +2 -1
  105. data/lib/bundler/resolver/strategy.rb +6 -3
  106. data/lib/bundler/resolver.rb +20 -4
  107. data/lib/bundler/retry.rb +30 -4
  108. data/lib/bundler/ruby_dsl.rb +17 -12
  109. data/lib/bundler/ruby_version.rb +1 -3
  110. data/lib/bundler/rubygems_ext.rb +117 -121
  111. data/lib/bundler/rubygems_gem_installer.rb +5 -4
  112. data/lib/bundler/rubygems_integration.rb +13 -12
  113. data/lib/bundler/runtime.rb +14 -3
  114. data/lib/bundler/self_manager.rb +34 -43
  115. data/lib/bundler/settings/validator.rb +5 -21
  116. data/lib/bundler/settings.rb +17 -32
  117. data/lib/bundler/shared_helpers.rb +12 -18
  118. data/lib/bundler/source/gemspec.rb +4 -0
  119. data/lib/bundler/source/git/git_proxy.rb +55 -29
  120. data/lib/bundler/source/git.rb +2 -3
  121. data/lib/bundler/source/path.rb +12 -7
  122. data/lib/bundler/source/rubygems.rb +59 -43
  123. data/lib/bundler/source/rubygems_aggregate.rb +4 -1
  124. data/lib/bundler/source.rb +3 -1
  125. data/lib/bundler/source_list.rb +5 -50
  126. data/lib/bundler/source_map.rb +8 -7
  127. data/lib/bundler/spec_set.rb +9 -14
  128. data/lib/bundler/stub_specification.rb +1 -0
  129. data/lib/bundler/templates/Executable +0 -11
  130. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
  131. data/lib/bundler/templates/newgem/Cargo.toml.tt +6 -0
  132. data/lib/bundler/templates/newgem/Rakefile.tt +5 -0
  133. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  134. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +8 -1
  135. data/lib/bundler/templates/newgem/ext/newgem/build.rs.tt +5 -0
  136. data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
  137. data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
  138. data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
  139. data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
  140. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +13 -2
  141. data/lib/bundler/templates/newgem/github/workflows/build-gems.yml.tt +69 -0
  142. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +12 -1
  143. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  144. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -1
  145. data/lib/bundler/templates/newgem/newgem.gemspec.tt +10 -10
  146. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +8 -0
  147. data/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +6 -0
  148. data/lib/bundler/ui/shell.rb +12 -8
  149. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
  150. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  151. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
  152. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
  153. data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  154. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
  155. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +84 -42
  156. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +42 -6
  157. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +1 -1
  158. data/lib/bundler/vendor/thor/lib/thor/runner.rb +2 -2
  159. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +3 -7
  160. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  161. data/lib/bundler/vendor/thor/lib/thor.rb +1 -1
  162. data/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
  163. data/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
  164. data/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
  165. data/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
  166. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  167. data/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
  168. data/lib/bundler/version.rb +10 -2
  169. data/lib/bundler/vlad.rb +1 -14
  170. data/lib/bundler/worker.rb +12 -4
  171. data/lib/bundler.rb +20 -40
  172. metadata +13 -25
  173. data/lib/bundler/cli/inject.rb +0 -60
  174. data/lib/bundler/cli/viz.rb +0 -31
  175. data/lib/bundler/gem_helpers.rb +0 -144
  176. data/lib/bundler/graph.rb +0 -152
  177. data/lib/bundler/man/bundle-inject.1 +0 -31
  178. data/lib/bundler/man/bundle-inject.1.ronn +0 -32
  179. data/lib/bundler/man/bundle-viz.1 +0 -30
  180. data/lib/bundler/man/bundle-viz.1.ronn +0 -36
  181. data/lib/bundler/similarity_detector.rb +0 -63
  182. data/lib/bundler/templates/Executable.bundler +0 -109
  183. data/lib/bundler/vendor/connection_pool/.document +0 -1
  184. data/lib/bundler/vendor/fileutils/.document +0 -1
  185. data/lib/bundler/vendor/net-http-persistent/.document +0 -1
  186. data/lib/bundler/vendor/pub_grub/.document +0 -1
  187. data/lib/bundler/vendor/securerandom/.document +0 -1
  188. data/lib/bundler/vendor/thor/.document +0 -1
  189. data/lib/bundler/vendor/tsort/.document +0 -1
  190. data/lib/bundler/vendor/uri/.document +0 -1
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
@@ -59,17 +59,29 @@ module Bundler
59
59
  def initialize(*args)
60
60
  super
61
61
 
62
+ current_cmd = args.last[:current_command].name
63
+
62
64
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
63
65
  if custom_gemfile && !custom_gemfile.empty?
64
66
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
65
- Bundler.reset_settings_and_root!
67
+ reset_settings = true
68
+ end
69
+
70
+ # lock --lockfile works differently than install --lockfile
71
+ unless current_cmd == "lock"
72
+ custom_lockfile = options[:lockfile] || ENV["BUNDLE_LOCKFILE"] || Bundler.settings[:lockfile]
73
+ if custom_lockfile && !custom_lockfile.empty?
74
+ Bundler::SharedHelpers.set_env "BUNDLE_LOCKFILE", File.expand_path(custom_lockfile)
75
+ reset_settings = true
76
+ end
66
77
  end
67
78
 
79
+ Bundler.reset_settings_and_root! if reset_settings
80
+
68
81
  Bundler.auto_switch
69
82
 
70
83
  Bundler.settings.set_command_option_if_given :retry, options[:retry]
71
84
 
72
- current_cmd = args.last[:current_command].name
73
85
  Bundler.auto_install if AUTO_INSTALL_CMDS.include?(current_cmd)
74
86
  rescue UnknownArgumentError => e
75
87
  raise InvalidOption, e.message
@@ -77,7 +89,7 @@ module Bundler
77
89
  self.options ||= {}
78
90
  unprinted_warnings = Bundler.ui.unprinted_warnings
79
91
  Bundler.ui = UI::Shell.new(options)
80
- Bundler.ui.level = "debug" if options["verbose"]
92
+ Bundler.ui.level = "debug" if options[:verbose] || Bundler.settings[:verbose]
81
93
  unprinted_warnings.each {|w| Bundler.ui.warn(w) }
82
94
  end
83
95
 
@@ -92,7 +104,7 @@ module Bundler
92
104
  primary_commands = ["install", "update", "cache", "exec", "config", "help"]
93
105
 
94
106
  list = self.class.printable_commands(true)
95
- by_name = list.group_by {|name, _message| name.match(/^bundle (\w+)/)[1] }
107
+ by_name = list.group_by {|name, _message| name.match(/^bundler? (\w+)/)[1] }
96
108
  utilities = by_name.keys.sort - primary_commands
97
109
  primary_commands.map! {|name| (by_name[name] || raise("no primary command #{name}")).first }
98
110
  utilities.map! {|name| by_name[name].first }
@@ -107,7 +119,33 @@ module Bundler
107
119
  shell.say
108
120
  self.class.send(:class_options_help, shell)
109
121
  end
110
- default_task(Bundler.feature_flag.default_cli_command)
122
+
123
+ desc "install_or_cli_help", "Deprecated alias of install", hide: true
124
+ def install_or_cli_help
125
+ Bundler.ui.warn <<~MSG
126
+ `bundle install_or_cli_help` is a deprecated alias of `bundle install`.
127
+ It might be called due to the 'default_cli_command' being set to 'install_or_cli_help',
128
+ if so fix that by running `bundle config set default_cli_command install --global`.
129
+ MSG
130
+ invoke_other_command("install")
131
+ end
132
+
133
+ def self.default_command(meth = nil)
134
+ return super if meth
135
+
136
+ unless Bundler.settings[:default_cli_command]
137
+ Bundler.ui.info <<~MSG
138
+ In a future version of Bundler, running `bundle` without argument will no longer run `bundle install`.
139
+ Instead, the `cli_help` command will be displayed. Please use `bundle install` explicitly for scripts like CI/CD.
140
+ You can use the future behavior now with `bundle config set default_cli_command cli_help --global`,
141
+ or you can continue to use the current behavior with `bundle config set default_cli_command install --global`.
142
+ This message will be removed after a default_cli_command value is set.
143
+
144
+ MSG
145
+ end
146
+
147
+ Bundler.settings[:default_cli_command] || "install"
148
+ end
111
149
 
112
150
  class_option "no-color", type: :boolean, desc: "Disable colorization in output"
113
151
  class_option "retry", type: :numeric, aliases: "-r", banner: "NUM",
@@ -117,6 +155,10 @@ module Bundler
117
155
  def help(cli = nil)
118
156
  cli = self.class.all_aliases[cli] if self.class.all_aliases[cli]
119
157
 
158
+ if Bundler.settings[:plugins] && Bundler::Plugin.command?(cli) && !self.class.all_commands.key?(cli)
159
+ return Bundler::Plugin.exec_command(cli, ["--help"])
160
+ end
161
+
120
162
  case cli
121
163
  when "gemfile" then command = "gemfile"
122
164
  when nil then command = "bundle"
@@ -130,7 +172,7 @@ module Bundler
130
172
 
131
173
  if man_pages.include?(command)
132
174
  man_page = man_pages[command]
133
- if Bundler.which("man") && !man_path.match?(%r{^file:/.+!/META-INF/jruby.home/.+})
175
+ if Bundler.which("man") && !man_path.match?(%r{^(?:file:/.+!|uri:classloader:)/META-INF/jruby.home/.+})
134
176
  Kernel.exec("man", man_page)
135
177
  else
136
178
  puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
@@ -143,7 +185,7 @@ module Bundler
143
185
  end
144
186
 
145
187
  def self.handle_no_command_error(command, has_namespace = $thor_runner)
146
- if Bundler.feature_flag.plugins? && Bundler::Plugin.command?(command)
188
+ if Bundler.settings[:plugins] && Bundler::Plugin.command?(command)
147
189
  return Bundler::Plugin.exec_command(command, ARGV[1..-1])
148
190
  end
149
191
 
@@ -173,7 +215,7 @@ module Bundler
173
215
  D
174
216
  method_option "dry-run", type: :boolean, default: false, banner: "Lock the Gemfile"
175
217
  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?}"
218
+ method_option "path", type: :string, banner: "Specify a different path than the system default, namely, $BUNDLE_PATH or $GEM_HOME (removed)"
177
219
  def check
178
220
  remembered_flag_deprecation("path")
179
221
 
@@ -187,12 +229,11 @@ module Bundler
187
229
  long_desc <<-D
188
230
  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
231
  D
190
- method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile"
232
+ method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile (removed)"
191
233
  def remove(*gems)
192
234
  if ARGV.include?("--install")
193
- message = "The `--install` flag has been deprecated. `bundle install` is triggered by default."
194
235
  removed_message = "The `--install` flag has been removed. `bundle install` is triggered by default."
195
- SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
236
+ raise InvalidOption, removed_message
196
237
  end
197
238
 
198
239
  require_relative "cli/remove"
@@ -210,42 +251,52 @@ module Bundler
210
251
 
211
252
  If the bundle has already been installed, bundler will tell you so and then exit.
212
253
  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"
254
+ method_option "binstubs", type: :string, lazy_default: "bin", banner: "Generate bin stubs for bundled gems to ./bin (removed)"
255
+ method_option "clean", type: :boolean, banner: "Run bundle clean automatically after install (removed)"
256
+ method_option "deployment", type: :boolean, banner: "Install using defaults tuned for deployment environments (removed)"
257
+ method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this install (removed)"
217
258
  method_option "full-index", type: :boolean, banner: "Fall back to using the single-file index of all gems"
218
259
  method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
219
260
  method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel"
220
261
  method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
262
+ method_option "lockfile", type: :string, banner: "Use the specified lockfile instead of the default."
221
263
  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
264
  method_option "no-cache", type: :boolean, banner: "Don't update the existing gem cache."
223
- method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
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?}"
265
+ method_option "no-lock", type: :boolean, banner: "Don't create a lockfile."
266
+ method_option "force", type: :boolean, aliases: "--redownload", banner: "Force reinstalling every gem, even if already installed"
267
+ method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache (removed)."
268
+ method_option "path", type: :string, banner: "Specify a different path than the system default, namely, $BUNDLE_PATH or $GEM_HOME (removed)."
226
269
  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')"
270
+ method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default, usually 'ruby' (removed)"
228
271
  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"
272
+ 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
273
  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
274
  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."
275
+ method_option "without", type: :array, banner: "Exclude gems that are part of the specified named group (removed)."
276
+ method_option "with", type: :array, banner: "Include gems that are part of the specified named group (removed)."
234
277
  def install
235
- SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
236
-
237
278
  %w[clean deployment frozen no-prune path shebang without with].each do |option|
238
279
  remembered_flag_deprecation(option)
239
280
  end
240
281
 
241
282
  print_remembered_flag_deprecation("--system", "path.system", "true") if ARGV.include?("--system")
242
283
 
243
- remembered_negative_flag_deprecation("no-deployment")
284
+ remembered_flag_deprecation("deployment", negative: true)
285
+
286
+ if ARGV.include?("--binstubs")
287
+ removed_message = "The --binstubs option has been removed in favor of `bundle binstubs --all`"
288
+ raise InvalidOption, removed_message
289
+ end
244
290
 
245
291
  require_relative "cli/install"
292
+ options = self.options.dup
293
+ options["lockfile"] ||= ENV["BUNDLE_LOCKFILE"]
246
294
  Bundler.settings.temporary(no_install: false) do
247
- Install.new(options.dup).run
295
+ Install.new(options).run
248
296
  end
297
+ rescue GemfileNotFound => error
298
+ invoke_other_command("cli_help")
299
+ raise error # re-raise to show the error and get a failing exit status
249
300
  end
250
301
 
251
302
  map aliases_for("install")
@@ -263,7 +314,7 @@ module Bundler
263
314
  method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
264
315
  method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
265
316
  method_option "source", type: :array, banner: "Update a specific source (and all gems associated with it)"
266
- method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
317
+ method_option "force", type: :boolean, aliases: "--redownload", banner: "Force reinstalling every gem, even if already installed"
267
318
  method_option "ruby", type: :boolean, banner: "Update ruby specified in Gemfile.lock"
268
319
  method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
269
320
  method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
@@ -274,7 +325,6 @@ module Bundler
274
325
  method_option "conservative", type: :boolean, banner: "Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
275
326
  method_option "all", type: :boolean, banner: "Update everything."
276
327
  def update(*gems)
277
- SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
278
328
  require_relative "cli/update"
279
329
  Bundler.settings.temporary(no_install: false) do
280
330
  Update.new(options, gems).run
@@ -287,12 +337,11 @@ module Bundler
287
337
  Calling show with [GEM] will list the exact location of that gem on your machine.
288
338
  D
289
339
  method_option "paths", type: :boolean, banner: "List the paths of all gems that are required by your Gemfile."
290
- method_option "outdated", type: :boolean, banner: "Show verbose output including whether gems are outdated."
340
+ method_option "outdated", type: :boolean, banner: "Show verbose output including whether gems are outdated (removed)."
291
341
  def show(gem_name = nil)
292
342
  if ARGV.include?("--outdated")
293
- message = "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement"
294
- removed_message = "the `--outdated` flag to `bundle show` was undocumented and has been removed without replacement"
295
- SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
343
+ removed_message = "the `--outdated` flag to `bundle show` has been removed in favor of `bundle show --verbose`"
344
+ raise InvalidOption, removed_message
296
345
  end
297
346
  require_relative "cli/show"
298
347
  Show.new(options, gem_name).run
@@ -302,6 +351,7 @@ module Bundler
302
351
  method_option "name-only", type: :boolean, banner: "print only the gem names"
303
352
  method_option "only-group", type: :array, default: [], banner: "print gems from a given set of groups"
304
353
  method_option "without-group", type: :array, default: [], banner: "print all gems except from a given set of groups"
354
+ method_option "format", type: :string, banner: "format output ('json' is the only supported format)"
305
355
  method_option "paths", type: :boolean, banner: "print the path to each gem in the bundle"
306
356
  def list
307
357
  require_relative "cli/list"
@@ -325,12 +375,14 @@ module Bundler
325
375
  will create binstubs for all given gems.
326
376
  D
327
377
  method_option "force", type: :boolean, default: false, banner: "Overwrite existing binstubs if they exist"
328
- method_option "path", type: :string, lazy_default: "bin", banner: "Binstub destination directory (default bin)"
378
+ method_option "path", type: :string, lazy_default: "bin", banner: "Binstub destination directory, `bin` by default (removed)"
329
379
  method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')"
330
380
  method_option "standalone", type: :boolean, banner: "Make binstubs that can work without the Bundler runtime"
331
381
  method_option "all", type: :boolean, banner: "Install binstubs for all gems"
332
382
  method_option "all-platforms", type: :boolean, default: false, banner: "Install binstubs for all platforms"
333
383
  def binstubs(*gems)
384
+ remembered_flag_deprecation("path", option_name: "bin")
385
+
334
386
  require_relative "cli/binstubs"
335
387
  Binstubs.new(options, gems).run
336
388
  end
@@ -396,15 +448,15 @@ module Bundler
396
448
  end
397
449
 
398
450
  desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
399
- method_option "all", type: :boolean, default: Bundler.feature_flag.cache_all?, banner: "Include all sources (including path and git)."
451
+ method_option "all", type: :boolean, default: Bundler.settings[:cache_all], banner: "Include all sources (including path and git) (removed)."
400
452
  method_option "all-platforms", type: :boolean, banner: "Include gems for all platforms present in the lockfile, not only the current one"
401
453
  method_option "cache-path", type: :string, banner: "Specify a different cache path than the default (vendor/cache)."
402
454
  method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
403
455
  method_option "no-install", type: :boolean, banner: "Don't install the gems, only update the cache."
404
- method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache."
405
- 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?}"
456
+ method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache (removed)."
457
+ method_option "path", type: :string, banner: "Specify a different path than the system default, namely, $BUNDLE_PATH or $GEM_HOME (removed)."
406
458
  method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
407
- method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install"
459
+ method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install (removed)"
408
460
  long_desc <<-D
409
461
  The cache command will copy the .gem files for every gem in the bundle into the
410
462
  directory ./vendor/cache. If you then check that directory into your source
@@ -413,18 +465,19 @@ module Bundler
413
465
  D
414
466
  def cache
415
467
  print_remembered_flag_deprecation("--all", "cache_all", "true") if ARGV.include?("--all")
468
+ print_remembered_flag_deprecation("--no-all", "cache_all", "false") if ARGV.include?("--no-all")
416
469
 
417
- if ARGV.include?("--path")
418
- message =
419
- "The `--path` flag is deprecated because its semantics are unclear. " \
420
- "Use `bundle config cache_path` to configure the path of your cache of gems, " \
421
- "and `bundle config path` to configure the path where your gems are installed, " \
422
- "and stop using this flag"
470
+ %w[frozen no-prune].each do |option|
471
+ remembered_flag_deprecation(option)
472
+ end
473
+
474
+ if flag_passed?("--path")
423
475
  removed_message =
424
476
  "The `--path` flag has been removed because its semantics were unclear. " \
425
477
  "Use `bundle config cache_path` to configure the path of your cache of gems, " \
426
- "and `bundle config path` to configure the path where your gems are installed."
427
- SharedHelpers.major_deprecation 2, message, removed_message: removed_message
478
+ "and `bundle config path` to configure the path where your gems are installed, " \
479
+ "and stop using this flag"
480
+ raise InvalidOption, removed_message
428
481
  end
429
482
 
430
483
  require_relative "cli/cache"
@@ -434,7 +487,7 @@ module Bundler
434
487
  map aliases_for("cache")
435
488
 
436
489
  desc "exec [OPTIONS]", "Run the command in context of the bundle"
437
- 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"
490
+ 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)."
438
491
  method_option :gemfile, type: :string, required: false, banner: "Use the specified gemfile instead of Gemfile"
439
492
  long_desc <<-D
440
493
  Exec runs a command, providing it access to the gems in the bundle. While using
@@ -443,9 +496,8 @@ module Bundler
443
496
  D
444
497
  def exec(*args)
445
498
  if ARGV.include?("--no-keep-file-descriptors")
446
- 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"
447
499
  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"
448
- SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
500
+ raise InvalidOption, removed_message
449
501
  end
450
502
 
451
503
  require_relative "cli/exec"
@@ -486,13 +538,13 @@ module Bundler
486
538
  def version
487
539
  cli_help = current_command.name == "cli_help"
488
540
  if cli_help || ARGV.include?("version")
489
- build_info = " (#{BuildMetadata.built_at} commit #{BuildMetadata.git_commit_sha})"
541
+ build_info = " (#{BuildMetadata.timestamp} commit #{BuildMetadata.git_commit_sha})"
490
542
  end
491
543
 
492
- if !cli_help && Bundler.feature_flag.print_only_version_number?
493
- Bundler.ui.info "#{Bundler::VERSION}#{build_info}"
544
+ if !cli_help
545
+ Bundler.ui.info "#{Bundler.verbose_version}#{build_info}"
494
546
  else
495
- Bundler.ui.info "Bundler version #{Bundler::VERSION}#{build_info}"
547
+ Bundler.ui.info "Bundler version #{Bundler.verbose_version}#{build_info}"
496
548
  end
497
549
  end
498
550
 
@@ -512,41 +564,32 @@ module Bundler
512
564
  end
513
565
  end
514
566
 
515
- unless Bundler.feature_flag.bundler_3_mode?
516
- desc "viz [OPTIONS]", "Generates a visual dependency graph", hide: true
517
- long_desc <<-D
518
- Viz generates a PNG file of the current Gemfile as a dependency graph.
519
- Viz requires the ruby-graphviz gem (and its dependencies).
520
- The associated gems must also be installed via 'bundle install'.
521
- D
522
- method_option :file, type: :string, default: "gem_graph", aliases: "-f", desc: "The name to use for the generated file. see format option"
523
- method_option :format, type: :string, default: "png", aliases: "-F", desc: "This is output format option. Supported format is png, jpg, svg, dot ..."
524
- method_option :requirements, type: :boolean, default: false, aliases: "-R", desc: "Set to show the version of each required dependency."
525
- method_option :version, type: :boolean, default: false, aliases: "-v", desc: "Set to show each gem version."
526
- method_option :without, type: :array, default: [], aliases: "-W", banner: "GROUP[ GROUP...]", desc: "Exclude gems that are part of the specified named group."
527
- def viz
528
- SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
529
- require_relative "cli/viz"
530
- Viz.new(options.dup).run
531
- end
567
+ desc "viz [OPTIONS]", "Generates a visual dependency graph", hide: true
568
+ def viz
569
+ SharedHelpers.feature_removed! "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
532
570
  end
533
571
 
534
572
  desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
535
- method_option :exe, type: :boolean, default: false, aliases: ["--bin", "-b"], desc: "Generate a binary executable for your library."
536
- method_option :coc, type: :boolean, desc: "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
537
- 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)"
538
- method_option :ext, type: :string, desc: "Generate the boilerplate for C extension code.", enum: EXTENSIONS
539
- method_option :git, type: :boolean, default: true, desc: "Initialize a git repo inside your library."
540
- method_option :mit, type: :boolean, desc: "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
541
- 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`."
542
- method_option :changelog, type: :boolean, desc: "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
573
+ method_option :exe, type: :boolean, default: false, aliases: ["--bin", "-b"], banner: "Generate a binary executable for your library."
574
+ method_option :coc, type: :boolean, banner: "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
575
+ 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)"
576
+ method_option :ext, type: :string, banner: "Generate the boilerplate for C extension code.", enum: EXTENSIONS
577
+ method_option :git, type: :boolean, default: true, banner: "Initialize a git repo inside your library."
578
+ method_option :mit, type: :boolean, banner: "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
579
+ 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)."
580
+ method_option :changelog, type: :boolean, banner: "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
543
581
  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)`."
544
- 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)`"
545
- 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)`"
582
+ 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)`"
583
+ 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)`"
546
584
  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>`."
585
+ 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
586
 
548
587
  def gem(name)
549
588
  require_relative "cli/gem"
589
+
590
+ raise InvalidOption, "--rubocop has been removed, use --linter=rubocop" if ARGV.include?("--rubocop")
591
+ raise InvalidOption, "--no-rubocop has been removed, use --no-linter" if ARGV.include?("--no-rubocop")
592
+
550
593
  cmd_args = args + [self]
551
594
  cmd_args.unshift(options)
552
595
 
@@ -557,7 +600,7 @@ module Bundler
557
600
  File.expand_path("templates", __dir__)
558
601
  end
559
602
 
560
- desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", hide: true
603
+ desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory"
561
604
  method_option "dry-run", type: :boolean, default: false, banner: "Only print out changes, do not clean gems"
562
605
  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
606
  def clean
@@ -573,12 +616,8 @@ module Bundler
573
616
  end
574
617
 
575
618
  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
619
+ def inject(*)
620
+ SharedHelpers.feature_removed! "The `inject` command has been replaced by the `add` command"
582
621
  end
583
622
 
584
623
  desc "lock", "Creates a lockfile without installing"
@@ -632,7 +671,7 @@ module Bundler
632
671
  end
633
672
  end
634
673
 
635
- if Bundler.feature_flag.plugins?
674
+ if Bundler.settings[:plugins]
636
675
  require_relative "cli/plugin"
637
676
  desc "plugin", "Manage the bundler plugins"
638
677
  subcommand "plugin", Plugin
@@ -666,18 +705,15 @@ module Bundler
666
705
  end
667
706
  end
668
707
 
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."
708
+ def self.check_invalid_ext_option(arguments)
709
+ # when invalid version of `--ext` is called
710
+ if invalid_ext_value?(arguments)
674
711
  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"
712
+ raise InvalidOption, removed_message
677
713
  end
678
714
  end
679
715
 
680
- def self.deprecated_ext_value?(arguments)
716
+ def self.invalid_ext_value?(arguments)
681
717
  index = arguments.index("--ext")
682
718
  next_argument = arguments[index + 1]
683
719
 
@@ -685,15 +721,15 @@ module Bundler
685
721
  # for example `bundle gem hello --ext c`
686
722
  return false if EXTENSIONS.include?(next_argument)
687
723
 
688
- # deprecated call when --ext is called with no value in last position
724
+ # invalid call when --ext is called with no value in last position
689
725
  # for example `bundle gem hello_gem --ext`
690
726
  return true if next_argument.nil?
691
727
 
692
- # deprecated call when --ext is followed by other parameter
728
+ # invalid call when --ext is followed by other parameter
693
729
  # for example `bundle gem --ext --no-ci hello_gem`
694
730
  return true if next_argument.start_with?("-")
695
731
 
696
- # deprecated call when --ext is followed by gem name
732
+ # invalid call when --ext is followed by gem name
697
733
  # for example `bundle gem --ext hello_gem`
698
734
  return true if next_argument
699
735
 
@@ -707,6 +743,19 @@ module Bundler
707
743
  config[:current_command]
708
744
  end
709
745
 
746
+ def invoke_other_command(name)
747
+ _, _, config = @_initializer
748
+ original_command = config[:current_command]
749
+ command = self.class.all_commands[name]
750
+ config[:current_command] = command
751
+ send(name)
752
+ ensure
753
+ config[:current_command] = original_command
754
+ end
755
+
756
+ def current_command=(command)
757
+ end
758
+
710
759
  def print_command
711
760
  return unless Bundler.ui.debug?
712
761
  cmd = current_command
@@ -720,7 +769,7 @@ module Bundler
720
769
  end
721
770
  command << Thor::Options.to_switches(options_to_print.sort_by(&:first)).strip
722
771
  command.reject!(&:empty?)
723
- Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler::VERSION}"
772
+ Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler.verbose_version}"
724
773
  end
725
774
 
726
775
  def warn_on_outdated_bundler
@@ -747,44 +796,30 @@ module Bundler
747
796
  nil
748
797
  end
749
798
 
750
- def remembered_negative_flag_deprecation(name)
751
- positive_name = name.gsub(/\Ano-/, "")
752
- option = current_command.options[positive_name]
753
- flag_name = "--no-" + option.switch_name.gsub(/\A--/, "")
754
-
755
- flag_deprecation(positive_name, flag_name, option)
756
- end
757
-
758
- def remembered_flag_deprecation(name)
799
+ def remembered_flag_deprecation(name, negative: false, option_name: nil)
759
800
  option = current_command.options[name]
760
801
  flag_name = option.switch_name
761
-
762
- flag_deprecation(name, flag_name, option)
763
- end
764
-
765
- def flag_deprecation(name, flag_name, option)
766
- name_index = ARGV.find {|arg| flag_name == arg.split("=")[0] }
767
- return unless name_index
802
+ flag_name = "--no-" + flag_name.gsub(/\A--/, "") if negative
803
+ return unless flag_passed?(flag_name)
768
804
 
769
805
  value = options[name]
770
806
  value = value.join(" ").to_s if option.type == :array
771
807
  value = "'#{value}'" unless option.type == :boolean
772
808
 
773
- print_remembered_flag_deprecation(flag_name, name.tr("-", "_"), value)
809
+ print_remembered_flag_deprecation(flag_name, option_name || name.tr("-", "_"), value)
774
810
  end
775
811
 
776
812
  def print_remembered_flag_deprecation(flag_name, option_name, option_value)
777
- message =
778
- "The `#{flag_name}` flag is deprecated because it relies on being " \
779
- "remembered across bundler invocations, which bundler will no longer " \
780
- "do in future versions. Instead please use `bundle config set #{option_name} " \
781
- "#{option_value}`, and stop using this flag"
782
813
  removed_message =
783
814
  "The `#{flag_name}` flag has been removed because it relied on being " \
784
- "remembered across bundler invocations, which bundler will no longer " \
785
- "do. Instead please use `bundle config set #{option_name} " \
786
- "#{option_value}`, and stop using this flag"
787
- Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
815
+ "remembered across bundler invocations, which bundler no longer does. " \
816
+ "Instead please use `bundle config set #{option_name} #{option_value}`, " \
817
+ "and stop using this flag"
818
+ raise InvalidOption, removed_message
819
+ end
820
+
821
+ def flag_passed?(name)
822
+ ARGV.any? {|arg| name == arg.split("=")[0] }
788
823
  end
789
824
  end
790
825
  end
@@ -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
@@ -28,11 +27,7 @@ module Bundler
28
27
  # It may be called concurrently without global interpreter lock in some Rubies.
29
28
  # As a result, some methods may look more complex than necessary to save memory or time.
30
29
  class CompactIndexClient
31
- # NOTE: MD5 is here not because we expect a server to respond with it, but
32
- # because we use it to generate the etag on first request during the upgrade
33
- # to the compact index client that uses opaque etags saved to files.
34
- # Remove once 2.5.0 has been out for a while.
35
- SUPPORTED_DIGESTS = { "sha-256" => :SHA256, "md5" => :MD5 }.freeze
30
+ SUPPORTED_DIGESTS = { "sha-256" => :SHA256 }.freeze
36
31
  DEBUG_MUTEX = Thread::Mutex.new
37
32
 
38
33
  # info returns an Array of INFO Arrays. Each INFO Array has the following indices: