-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support for .ruby-version files #302
Conversation
Thanks Sam, this looks really good. I'm really happy to see Given the backwards compatibility of detecting either dot file, would you see this requiring a minor version bump if and when it's released? |
Glad you're on board, @fnichol! This is the last remaining issue before we release rbenv 0.4.0 (this week, assuming no major blockers). We will maintain backwards compatibility with existing |
Looks good! The only issue I see here is that |
@mislav It's by design. I'm open to reconsidering if you feel strongly about it, but I wanted to focus strictly on |
@@ -13,10 +13,18 @@ if [ -z "$RBENV_VERSION" ] || [ "$RBENV_VERSION" = "system" ]; then | |||
exit | |||
fi | |||
|
|||
RBENV_VERSION_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}" | |||
version_exists() { | |||
local version="$1" |
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.
Why the intermediate var?
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.
Since Bash lacks named function arguments, I tend to explicitly assign them to local variables for clarity.
👍 @sstephenson any estimate on a release for this? It looks like it's all that's remaining for |
This is cool, but I can't find an argument for making the change. What makes this change desirable? Just want to rename the file for clarity? |
@parkr compatibility with other ruby version managers (rvm, chruby, ...) |
@guilleiguaran @sethvargo Thanks! Just found that link after looking through a couple more issues here. A common ruby-version file will be nice. Thanks for the help in understanding, guys. |
Support for .ruby-version files
🎉 |
❤️ 👍 |
Support for .ruby-version files
This branch adds support for per-project
.ruby-version
files.rbenv treats
.ruby-version
files the same way as it has always treated.rbenv-version
files. A version specified in a.ruby-version
file maps directly to a directory in$RBENV_ROOT/versions
, without fuzzy version matching or other preprocessing (but with additional consideration for version names beginning withruby-
, as described below)..ruby-version
becomes the preferred file for storing local version specifications. Therbenv version-file
command now prefers.ruby-version
files when searching up the working directory tree. rbenv will still read versions specified in.rbenv-version
if a.ruby-version
file is not present.Setting the local version with
rbenv local
now writes a.ruby-version
file. If the local version was previously specified by.rbenv-version
, rbenv will remove it and print a migration notice to stderr.For compatibility with other version managers, if the version specification begins with
ruby-
but does not match a directory in$RBENV_ROOT/versions
, rbenv will try to match it by removing theruby-
prefix. If a match is found, rbenv accepts it but prints a warning to stderr./cc @mislav @jeremy