diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-08-29 09:28:40 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-08-29 11:17:18 -0500 |
commit | 22d55688603ff85ee2a0603b25b37a977abedbbe (patch) | |
tree | cf8a335474a1c3fd5a14b58ac460939c33a4bb5a | |
parent | 9d169fba74922b6e19713dd3f362dafd7df7f606 (diff) | |
download | bundler-seg-pretty-bundle-help.tar.gz |
Add a spec for no-args bundle on 2.0seg-pretty-bundle-help
-rw-r--r-- | lib/bundler/cli.rb | 6 | ||||
-rw-r--r-- | spec/bundler/cli_spec.rb | 12 |
2 files changed, 16 insertions, 2 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index d1bdc09f2f..d5aa49e526 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -72,12 +72,14 @@ module Bundler version Bundler.ui.info "\n" - primary_commands = %w[install update package exec config help] + primary_commands = ["install", "update", + Bundler.feature_flag.cache_command_is_package? ? "cache" : "package", + "exec", "config", "help"] list = self.class.printable_commands(true) by_name = list.group_by {|name, _message| name.match(/^bundle (\w+)/)[1] } utilities = by_name.keys.sort - primary_commands - primary_commands.map! {|name| by_name[name].first } + primary_commands.map! {|name| (by_name[name] || raise("no primary command #{name}")).first } utilities.map! {|name| by_name[name].first } shell.say "Bundler commands:\n\n" diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb index 4302bf0ed7..5b48808e44 100644 --- a/spec/bundler/cli_spec.rb +++ b/spec/bundler/cli_spec.rb @@ -26,6 +26,18 @@ RSpec.describe "bundle executable" do expect(out).to eq("Hello, world") end + context "with no arguments" do + it "prints a concise help message", :bundler => "2" do + bundle! "" + expect(last_command.stderr).to be_empty + expect(last_command.stdout).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 + end + context "when ENV['BUNDLE_GEMFILE'] is set to an empty string" do it "ignores it" do gemfile bundled_app("Gemfile"), <<-G |