summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2025-11-28 19:23:50 +0900
committergit <svn-admin@ruby-lang.org>2025-11-28 23:50:00 +0000
commita9d2a46d64ead4dae8491c2f93b9e86416006fd4 (patch)
tree106e8f7887e622d269e3d6ad7ffa899c185370ca
parent69293f52550032cbda8d92188407b8700f4c3bb1 (diff)
[ruby/rubygems] Add informational message when default_cli_command is unset.
https://github.com/ruby/rubygems/commit/9e44b5ebc4
-rw-r--r--lib/bundler/cli.rb10
-rw-r--r--spec/bundler/bundler/cli_spec.rb8
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index d3c948c7ce..f5977863dd 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -131,6 +131,16 @@ module Bundler
def self.default_command(meth = nil)
return super if meth
+ unless Bundler.settings[:default_cli_command]
+ Bundler.ui.info <<-MSG
+ In the feature version of Bundler, running `bundle` without argument will no longer run `bundle install`.
+ Instead, the `cli_help` command will be displayed. Please use `bundle install` explicitly for scripts like CI/CD.
+ If you wish to use feature behavior now with `bundle config set default_cli_command cli_help --global`
+ or you can continue to use the old behavior with `bundle config set default_cli_command install_or_cli_help --global`.
+ This message will be removed after a default_cli_command value is set.
+ MSG
+ end
+
Bundler.settings[:default_cli_command] || "install_or_cli_help"
end
diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb
index 33a23a75de..ac6b77ad74 100644
--- a/spec/bundler/bundler/cli_spec.rb
+++ b/spec/bundler/bundler/cli_spec.rb
@@ -90,6 +90,7 @@ RSpec.describe "bundle executable" do
it "tries to installs by default but print help on missing Gemfile" do
bundle "", raise_on_error: false
expect(err).to include("Could not locate Gemfile")
+ expect(out).to include("In the feature version of Bundler")
expect(out).to include("Bundler version #{Bundler::VERSION}").
and include("\n\nBundler commands:\n\n").
@@ -97,6 +98,13 @@ RSpec.describe "bundle executable" do
and include("\n\n Utilities:\n").
and include("\n\nOptions:\n")
end
+
+ it "runs bundle install when default_cli_command set to install" do
+ bundle "config set default_cli_command install_or_cli_help"
+ bundle "", raise_on_error: false
+ expect(out).to_not include("In the feature version of Bundler")
+ expect(err).to include("Could not locate Gemfile")
+ end
end
context "when ENV['BUNDLE_GEMFILE'] is set to an empty string" do