Last active
August 1, 2018 21:05
-
-
Save mfilej/4f3467acaff8c8a86407d4f1e7ea9e54 to your computer and use it in GitHub Desktop.
Switch ruby versions with direnv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source /usr/local/opt/chruby/share/chruby/chruby.sh | |
# Uncomment to use with rubies installed with ruby-build: | |
# RUBIES+=(~/.rbenv/versions/*) | |
# use ruby [version] | |
use_ruby() { | |
local ver=$1 | |
if [[ -z $ver ]] && [[ -f .ruby-version ]]; then | |
ver=$(cat .ruby-version) | |
fi | |
if [[ -z $ver ]]; then | |
echo Unknown ruby version | |
exit 1 | |
fi | |
chruby $ver | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Append the above to your
~/.direnvrc
. See article for details.