diff options
| author | Edouard CHIN <chin.edouard@gmail.com> | 2025-11-17 21:33:58 +0100 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-11-19 01:37:57 +0000 |
| commit | 3b9539176bc37b3e95864b04b0eef1263f434eef (patch) | |
| tree | 11ba792bfa8c9a1a8750c435b1e1107a029b8694 | |
| parent | 83b0cfe1b5d5cab1328aeeac0c1c6eb2484b66de (diff) | |
[ruby/rubygems] Warn users that `bundle` now display the help:
- In https://github.com/ruby/rubygems/commit/31d67ecc056fb5a9193bc66a6e69e21576a87702
we enforced the new behaviour where running `bundle` no longer
installs gems but displays the help.
Users now have a way to configure their preferred default command using
the `BUNDLE_DEFAULT_CLI_COMMAND` flag.
With the preview of Ruby 4.0 now being released, some people will
start to see this new change.
The problem is that the previous behaviour had existed for like an
eternity and we didn't warn users about this change in advance.
I'd like to provide a deprecation/warning cycle because this is
confusing users already and this breaks various CI setup that now
needs to be changed immediately.
https://github.com/ruby/rubygems/commit/e415480ac5
| -rw-r--r-- | lib/bundler/cli.rb | 17 | ||||
| -rw-r--r-- | lib/bundler/settings.rb | 1 | ||||
| -rw-r--r-- | spec/bundler/bundler/cli_spec.rb | 12 |
3 files changed, 20 insertions, 10 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 86b86b359f..79f93a7784 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -107,7 +107,22 @@ module Bundler shell.say self.class.send(:class_options_help, shell) end - default_task(Bundler.settings[:default_cli_command]) + + def self.default_command(meth = nil) + return super if meth + + default_cli_command = Bundler.settings[:default_cli_command] + return default_cli_command if default_cli_command + + Bundler.ui.warn(<<~MSG) + In the next version of Bundler, running `bundle` without argument will no longer run `bundle install`. + Instead, the `help` command will be displayed. + + If you'd like to keep the previous behaviour please run `bundle config set default_cli_command install --global`. + MSG + + "install" + end class_option "no-color", type: :boolean, desc: "Disable colorization in output" class_option "retry", type: :numeric, aliases: "-r", banner: "NUM", diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 81f1857eec..fb1b875b26 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -83,7 +83,6 @@ module Bundler "BUNDLE_VERSION" => "lockfile", "BUNDLE_LOCKFILE_CHECKSUMS" => true, "BUNDLE_CACHE_ALL" => true, - "BUNDLE_DEFAULT_CLI_COMMAND" => "cli_help", "BUNDLE_PLUGINS" => true, "BUNDLE_GLOBAL_GEM_CACHE" => false, "BUNDLE_UPDATE_REQUIRES_ALL_FLAG" => false, diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb index b3a97e72ce..ee3c0d0fd5 100644 --- a/spec/bundler/bundler/cli_spec.rb +++ b/spec/bundler/bundler/cli_spec.rb @@ -87,14 +87,10 @@ RSpec.describe "bundle executable" do end context "with no arguments" do - it "prints a concise help message by default" do - bundle "" - expect(err).to be_empty - expect(out).to include("Bundler version #{Bundler::VERSION}"). - and include("\n\nBundler commands:\n\n"). - and include("\n\n Primary commands:\n"). - and include("\n\n Utilities:\n"). - and include("\n\nOptions:\n") + it "installs and log a warning by default" do + bundle "", raise_on_error: false + expect(err).to include("running `bundle` without argument will no longer run `bundle install`.") + expect(err).to include("Could not locate Gemfile") end it "prints a concise help message when default_cli_command set to cli_help" do |
