-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Remove portable ruby bin from PATH #21111
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
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 removes the portable Ruby bin directory from PATH in the shell script (ruby.sh) and adds a call to setup_gem_environment! in the valid_gem_groups method to restore gem environment setup through Ruby code instead. The main motivation is to fix a failing test (ruby_check_version_script_spec.rb) that was picking up the portable Ruby from PATH.
Key Changes
- Removed PATH modification in shell script that added portable Ruby bin directory
- Added
setup_gem_environment!call at the start ofvalid_gem_groupsmethod - Shifts PATH setup responsibility from shell to Ruby code
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Library/Homebrew/utils/ruby.sh | Removes the line that adds portable Ruby bin directory to PATH after installing bundler |
| Library/Homebrew/utils/gems.rb | Adds setup_gem_environment! call to valid_gem_groups to ensure gem environment is set up before querying bundler groups |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1b862c8 to
c9c6812
Compare
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
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 @cho-m!
brew lgtm(style, typechecking and tests) with your changes locally?Fixes #21109
This PR removes portable Ruby from PATH as parts of brew are written expecting only system paths like
brew/Library/Homebrew/extend/os/linux/cleanup.rb
Line 15 in 07a983c
I am not entirely sure on
setup_gem_environment!change, but it restores original behavior before 60fa368#diff-a1a5395d198aee1fb8c45c74bf9dd49ef5734887a17ee84000badc7d58b82e98L43 (called viainstall_bundler!)This mainly is used to avoid a failing test (utils/ruby_check_version_script_spec.rb).
Though maybe the test shouldn't be using Ruby from PATH as that is not how we interact with the script. We usually call the script like
<path/to/ruby> ruby_check_version_script_spec.rb ...so it doesn't matter whether or not portable Ruby is on the PATH.EDIT: After thinking over above, will just adjust test rather than adding
setup_gem_environment!. Also in line with the Copilot review thatsetup_gem_environment!has side effects that we may not have intended.May need to keep an eye out for unexpected failures though if any code is expecting portable Ruby on PATH.