Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 0 additions & 4 deletions lib/bundler/feature_flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/bundler/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 18 additions & 1 deletion spec/bundler/bundler/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}").
Expand All @@ -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
Expand Down