-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Resolve ruby version file relative to bundle root #6892
Conversation
This is a follow up to rubygems#6742. This change makes it so that the version file is resolved relative to the Bundle root instead of the working directory. Why is this useful? If you run a commnad (eg `rails`) from the `app/` directory, your bundle would fail to load.
@deivid-rodriguez @martinemde I attempted to use |
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.
Makes sense, thanks for the quick fix!
|
||
before do | ||
allow(Bundler).to receive(:read_file).with(project_root.join("foo")).and_return("#{version}\n") | ||
allow(Bundler).to receive(:root).and_return(Pathname.new("/path/to/project")) |
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.
allow(Bundler).to receive(:root).and_return(Pathname.new("/path/to/project")) | |
allow(Bundler).to receive(:root).and_return(project_root) |
Just a nitpick.
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.
Good point, Martin! Want me to open another PR to fix or you will just fix it on master
?
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.
It's very tiny. Maybe it can get thrown into a follow up PR. #6895 wants to add .tool-versions
support.
I'm ignoring my nitpick and getting this merged so that the feature works on master as intended. Thank you for testing and fixing this so quickly! |
Resolve ruby version file relative to bundle root (cherry picked from commit cabe7bb)
Resolve ruby version file relative to bundle root (cherry picked from commit cabe7bb)
This is a follow up to #6876. This change makes it so that the version file is resolved relative to the Bundle root instead of the working directory.
Why is this useful?
If you run a commnad (eg
rails
) from theapp/
directory, your bundle would fail to load.What was the end-user or developer problem that led to this PR?
Running
rails
from a subdirectory in your project would fail because the version file would be resolved in the working directory...and therefore be not found.What is your fix for the problem, implemented in this PR?
Resolve from
Bundle.root
.Make sure the following tasks are checked