Skip to content

Commit e415480

Browse files
Edouard-chinhsbt
authored andcommitted
Warn users that bundle now display the help:
- In 31d67ec 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.
1 parent ffa3eb9 commit e415480

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

bundler/lib/bundler/cli.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,22 @@ def cli_help
107107
shell.say
108108
self.class.send(:class_options_help, shell)
109109
end
110-
default_task(Bundler.settings[: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
111126

112127
class_option "no-color", type: :boolean, desc: "Disable colorization in output"
113128
class_option "retry", type: :numeric, aliases: "-r", banner: "NUM",

bundler/lib/bundler/settings.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ class Settings
8383
"BUNDLE_VERSION" => "lockfile",
8484
"BUNDLE_LOCKFILE_CHECKSUMS" => true,
8585
"BUNDLE_CACHE_ALL" => true,
86-
"BUNDLE_DEFAULT_CLI_COMMAND" => "cli_help",
8786
"BUNDLE_PLUGINS" => true,
8887
"BUNDLE_GLOBAL_GEM_CACHE" => false,
8988
"BUNDLE_UPDATE_REQUIRES_ALL_FLAG" => false,

bundler/spec/bundler/cli_spec.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,10 @@ def out_with_macos_man_workaround
8787
end
8888

8989
context "with no arguments" do
90-
it "prints a concise help message by default" do
91-
bundle ""
92-
expect(err).to be_empty
93-
expect(out).to include("Bundler version #{Bundler::VERSION}").
94-
and include("\n\nBundler commands:\n\n").
95-
and include("\n\n Primary commands:\n").
96-
and include("\n\n Utilities:\n").
97-
and include("\n\nOptions:\n")
90+
it "installs and log a warning by default" do
91+
bundle "", raise_on_error: false
92+
expect(err).to include("running `bundle` without argument will no longer run `bundle install`.")
93+
expect(err).to include("Could not locate Gemfile")
9894
end
9995

10096
it "prints a concise help message when default_cli_command set to cli_help" do

0 commit comments

Comments
 (0)