-
Notifications
You must be signed in to change notification settings - Fork 49
Ruby Version Managers
Depending on your Ruby installation you'll have to configure Prax so the correct Ruby version and environment is used when starting Prax itself, and then when starting your Ruby applications, which may use another environment.
Please take note that Ruby uses bash
to start itself and your Rack applications. Keep that in mind if you want to use another version manager than listed below. Please feel free to add the configuration for other version managers, and to open an issue to discuss and fix an existing configuration.
Most of the time, just following the bash
instructions for your version manager is enough.
Create a .praxconfig
file in your $HOME
with the following contents, then restart Prax:
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
Create a .praxconfig
file in your $HOME
with the following contents, then restart Prax:
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
Create a .praxconfig
file in your $HOME
with the following contents, then restart Prax:
# detect `$rvm_path`
if [ -z "${rvm_path:-}" ] && [ -x "${HOME:-}/.rvm/bin/rvm" ]
then rvm_path="${HOME:-}/.rvm"
fi
if [ -z "${rvm_path:-}" ] && [ -x "/usr/local/rvm/bin/rvm" ]
then rvm_path="/usr/local/rvm"
fi
# load environment of current project ruby
if
[ -n "${rvm_path:-}" ] &&
[ -x "${rvm_path:-}/bin/rvm" ] &&
rvm_project_environment=`"${rvm_path:-}/bin/rvm" . do rvm env --path 2>/dev/null` &&
[ -n "${rvm_project_environment:-}" ] &&
[ -s "${rvm_project_environment:-}" ]
then
echo "RVM loading: ${rvm_project_environment:-}"
\. "${rvm_project_environment:-}"
else
echo "RVM project not found at: $PWD"
fi
Read more in #36, #77 and #91. You may also be interested by the rvm branch.
Create a .praxconfig
file in your $HOME
with the following contents, then restart Prax:
export PATH="$HOME/.local/bin:$PATH"
eval "$(ry setup)"
You'll also have to configure each project using ry setup $MY_RUBY > .praxrc
To use the default Ruby version you have set in your $HOME/.tool-versions
you can symlink it to the directory prax runs in:
sudo ln -s ~/.tool-versions /opt/prax/.tool-versions
Alternatively, you can specify a custom Ruby version for prax by creating a .tool-versions
file with the Ruby version you want to use:
sudo echo "ruby 2.3.0" > /opt/prax/.tool-versions