-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Add --ruby option to brew sh
#21223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --ruby option to brew sh
#21223
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new brew ruby-sh developer command that provides an interactive shell configured with Homebrew's Ruby environment, making it easier to work with Homebrew's development tools like RuboCop, Sorbet, and RSpec. It also fixes zsh shell configuration by ensuring .zshenv is properly symlinked when using custom ZDOTDIR settings.
- Adds
ruby-shcommand for interactive Ruby environment shell access - Includes support for non-interactive execution via
-cflag and file arguments - Updates shell utility to symlink
.zshenvfor proper zsh environment initialization
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Library/Homebrew/dev-cmd/ruby-sh.rb | New command implementation that sets up Ruby environment and starts an interactive or non-interactive shell |
| Library/Homebrew/test/dev-cmd/ruby-sh_spec.rb | Basic test file covering argument parsing for the new command |
| Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/ruby_sh.rbi | Auto-generated Sorbet type signatures for the RubySh command class |
| Library/Homebrew/utils/shell.rb | Adds .zshenv to the list of symlinked files when using custom ZDOTDIR to ensure proper zsh initialization |
Files not reviewed (1)
- Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/ruby_sh.rbi: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
carlocab
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of overlap with brew sh here. Maybe we can just add an extra flag to brew sh to get the desired behaviour here?
Alternatively, we should consider extracting the common code between this and sh.rb elsewhere so they can remain identical in sh.rb and ruby-sh.rb.
e52575c to
f7e83a7
Compare
|
Good suggestion! I changed this to be a |
f7e83a7 to
4f1551b
Compare
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Sometimes I want to be able to interact with Homebrew
rubyandbundledirectly to do various things.This PR adds a
--rubyoption tobrew shthat starts an interactive shell with Homebrew'srubyandbundleset up so you can runbundle execand other commands directly.