diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2025-12-16 11:09:34 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-12-16 02:36:10 +0000 |
| commit | 060199910afeccd4c81f90beebbd406799c05c46 (patch) | |
| tree | df7fe29a0b59fa8ae7d0e5818665503a8c7aeb92 | |
| parent | 38d67986b044ec32681aabc3d9017c5bdb4e7289 (diff) | |
[ruby/rubygems] Allow to show cli_help with bundler executable
https://github.com/ruby/rubygems/commit/a091e3fd10
| -rw-r--r-- | lib/bundler/cli.rb | 2 | ||||
| -rw-r--r-- | spec/bundler/bundler/cli_spec.rb | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 17d8c42e6e..1f6a65ca57 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -104,7 +104,7 @@ module Bundler primary_commands = ["install", "update", "cache", "exec", "config", "help"] list = self.class.printable_commands(true) - by_name = list.group_by {|name, _message| name.match(/^bundle (\w+)/)[1] } + by_name = list.group_by {|name, _message| name.match(/^bundler? (\w+)/)[1] } utilities = by_name.keys.sort - primary_commands primary_commands.map! {|name| (by_name[name] || raise("no primary command #{name}")).first } utilities.map! {|name| by_name[name].first } diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb index 7bc8fd3d36..e2c64b9394 100644 --- a/spec/bundler/bundler/cli_spec.rb +++ b/spec/bundler/bundler/cli_spec.rb @@ -282,4 +282,15 @@ RSpec.describe "bundler executable" do bundler "--version" expect(out).to eq("#{Bundler::VERSION} (simulating Bundler 5)") end + + it "shows cli_help when bundler install and no Gemfile is found" do + bundler "install", raise_on_error: false + expect(err).to include("Could not locate Gemfile") + + 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 end |
