Skip to content

Commit 0601999

Browse files
hsbtmatzbot
authored andcommitted
[ruby/rubygems] Allow to show cli_help with bundler executable
ruby/rubygems@a091e3fd10
1 parent 38d6798 commit 0601999

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/bundler/cli.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def cli_help
104104
primary_commands = ["install", "update", "cache", "exec", "config", "help"]
105105

106106
list = self.class.printable_commands(true)
107-
by_name = list.group_by {|name, _message| name.match(/^bundle (\w+)/)[1] }
107+
by_name = list.group_by {|name, _message| name.match(/^bundler? (\w+)/)[1] }
108108
utilities = by_name.keys.sort - primary_commands
109109
primary_commands.map! {|name| (by_name[name] || raise("no primary command #{name}")).first }
110110
utilities.map! {|name| by_name[name].first }

spec/bundler/bundler/cli_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,15 @@ def out_with_macos_man_workaround
282282
bundler "--version"
283283
expect(out).to eq("#{Bundler::VERSION} (simulating Bundler 5)")
284284
end
285+
286+
it "shows cli_help when bundler install and no Gemfile is found" do
287+
bundler "install", raise_on_error: false
288+
expect(err).to include("Could not locate Gemfile")
289+
290+
expect(out).to include("Bundler version #{Bundler::VERSION}").
291+
and include("\n\nBundler commands:\n\n").
292+
and include("\n\n Primary commands:\n").
293+
and include("\n\n Utilities:\n").
294+
and include("\n\nOptions:\n")
295+
end
285296
end

0 commit comments

Comments
 (0)