@@ -120,28 +120,31 @@ def cli_help
120120 self . class . send ( :class_options_help , shell )
121121 end
122122
123- desc "install_or_cli_help" , "Tries to run bundle install but prints a summary of bundler commands if there is no Gemfile " , hide : true
123+ desc "install_or_cli_help" , "Deprecated alias of install " , hide : true
124124 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
125130 invoke_other_command ( "install" )
126- rescue GemfileNotFound => error
127- Bundler . ui . error error . message , wrap : true
128- invoke_other_command ( "cli_help" )
129131 end
130132
131133 def self . default_command ( meth = nil )
132134 return super if meth
133135
134136 unless Bundler . settings [ :default_cli_command ]
135- Bundler . ui . info <<- MSG
137+ Bundler . ui . info <<~ MSG
136138 In a future version of Bundler, running `bundle` without argument will no longer run `bundle install`.
137139 Instead, the `cli_help` command will be displayed. Please use `bundle install` explicitly for scripts like CI/CD.
138140 You can use the future behavior now with `bundle config set default_cli_command cli_help --global`,
139- or you can continue to use the current behavior with `bundle config set default_cli_command install_or_cli_help --global`.
141+ or you can continue to use the current behavior with `bundle config set default_cli_command install --global`.
140142 This message will be removed after a default_cli_command value is set.
143+
141144 MSG
142145 end
143146
144- Bundler . settings [ :default_cli_command ] || "install_or_cli_help "
147+ Bundler . settings [ :default_cli_command ] || "install "
145148 end
146149
147150 class_option "no-color" , type : :boolean , desc : "Disable colorization in output"
@@ -287,6 +290,9 @@ def install
287290 Bundler . settings . temporary ( no_install : false ) do
288291 Install . new ( options ) . run
289292 end
293+ rescue GemfileNotFound => error
294+ invoke_other_command ( "cli_help" )
295+ raise error # re-raise to show the error and get a failing exit status
290296 end
291297
292298 map aliases_for ( "install" )
0 commit comments