I've been using this technique in most of my Ruby projects lately where Ruby versions are required:
- Create
.rbenv-versioncontaining the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far... - Create
.rvmrc(withrvm --create --rvmrc "1.9.3@myapp") and edit theenvironment_id=line to fetch the Ruby version from.rbenv-version(example below).
Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.
What if we had an ecosystem of fabulous Ruby managers that all understood the semantics of a generic dotfile such as .ruby-version? The file's contents would be nothing more than a string representing a version of Ruby.
Without a more thorough investigation (here be dragons?), the project-level updates might be:
- rvm: A modification to scripts/functions/rvmrc to check for
.rvmrcand then.ruby-version(invoking something likervm use $(cat $working_dir/.ruby-version)). If the user requires a customized.rvmrcthey can wire in.ruby-versionthemselves (i.e.environment_id="$(cat .ruby-version)@gemset"). - rbenv: A modification to libexec/rbenv-version-file to check for
.rbenv-versionand then.ruby-version. - rbfu: A modifcation to bin/rbfu to first check for
.rbfu-versionand then.ruby-version.
In all 3 cases, it seems reasonable to prefer an implementation-specific file over the generic version--no loss of default behavior.
Feedback? Ideas? Questions?
rbenv is not support specify
2.1in .ruby-version, But rvm can auto use the latest ruby version which match2.1 serious.
e.g. if you have ruby 2.1.2 installed, and project root exist .ruby-version, content is
2.1, rbenv is halted,but rvm can auto use 2.1.2. it you install 2.1.3 with rvm, it auto use 2.1.3 too.