Skip to content

Conversation

@eregon
Copy link
Member

@eregon eregon commented Dec 5, 2025

What was the end-user or developer problem that led to this PR?

From https://github.com/ruby/rubygems/pull/9136/files#r2592366837

The suggestion of bundle config set default_cli_command install_or_cli_help --global is bad because it breaks on Bundler 2:

$ ruby --version
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-linux]
$ bundle --version     
Bundler version 2.4.19
$ bundle
Could not find command "".
zsh: exit 15    bundle

So the suggestion should be install and not install_or_cli_help.
And the install command can have that help behavior on missing gemfile, it's fine and simple.

What is your fix for the problem, implemented in this PR?

Make the behavior of install_or_cli_help part of install and suggest to config install as the default command in that warning, because install always existed, while install_or_cli_help is only in Bundler 4.

Make sure the following tasks are checked

* `install_or_cli_help` does not exist for older Bundler like Bundler 2
  and so results in a confusing error on Bundler 2:
  ```
  $ bundle
  Could not find command "".
  ```
* See https://github.com/ruby/rubygems/pull/9136/files#r2592366837
* Merge the behavior of `install_or_cli_help` in `install`.
@eregon eregon force-pushed the fix-broken-config-recommendation-in-default-command-warning branch from 41fadbe to 8395b28 Compare December 5, 2025 12:13

### Bug fixes:

- Fix the suggestion in the warning for the default `bundle` command [#9164](https://github.com/ruby/rubygems/pull/9164)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this. It will handle release script automatically.

end

desc "install_or_cli_help", "Tries to run bundle install but prints a summary of bundler commands if there is no Gemfile", hide: true
def install_or_cli_help
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep this task and warn to suggest update default_cli_command to install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants