diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 6ee6bc76aec8ff..62225a352d71fa 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -107,7 +107,7 @@ def cli_help shell.say self.class.send(:class_options_help, shell) end - default_task(Bundler.feature_flag.default_cli_command) + default_task(Bundler.settings[:default_cli_command]) 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/cli/update.rb b/lib/bundler/cli/update.rb index cf0ceac0bd19c5..4b4ba3c64712be 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -23,7 +23,7 @@ def run full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !update_bundler if full_update && !options[:all] - if Bundler.feature_flag.update_requires_all_flag? + if Bundler.settings[:update_requires_all_flag] raise InvalidOption, "To update everything, pass the `--all` flag." end SharedHelpers.major_deprecation 4, "Pass --all to `bundle update` to update everything" diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index c3b8d790fbbce9..8ec62fc1c9e638 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -27,10 +27,6 @@ def self.settings_method(name, key, &default) (1..10).each {|v| define_method("bundler_#{v}_mode?") { @major_version >= v } } - settings_flag(:update_requires_all_flag) { bundler_5_mode? } - - settings_option(:default_cli_command) { bundler_4_mode? ? :cli_help : :install } - def removed_major?(target_major_version) @major_version > target_major_version end diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 64f0c9900eb285..81f1857eec7648 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -83,8 +83,10 @@ class Settings "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, }.freeze def initialize(root = nil) diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb index 07f589bd5de359..b3a97e72ceb2d8 100644 --- a/spec/bundler/bundler/cli_spec.rb +++ b/spec/bundler/bundler/cli_spec.rb @@ -87,7 +87,7 @@ def out_with_macos_man_workaround end context "with no arguments" do - it "prints a concise help message", bundler: "4" do + it "prints a concise help message by default" do bundle "" expect(err).to be_empty expect(out).to include("Bundler version #{Bundler::VERSION}"). @@ -96,6 +96,23 @@ def out_with_macos_man_workaround and include("\n\n Utilities:\n"). and include("\n\nOptions:\n") end + + it "prints a concise help message when default_cli_command set to cli_help" do + bundle "config set default_cli_command cli_help" + 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") + end + + it "runs bundle install when default_cli_command set to install" do + bundle "config set default_cli_command install" + bundle "", raise_on_error: false + expect(err).to include("Could not locate Gemfile") + end end context "when ENV['BUNDLE_GEMFILE'] is set to an empty string" do