Skip to content

Ruby Version Managers

Will Gray edited this page Nov 7, 2018 · 3 revisions

Depending on your Ruby installation you'll have to configure Prax so the correct Ruby version and environment is used 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 should be enough. You'll may also want to check the documentation of your version managers for instructions for use with Pow!!

Prax uses the following configuration files:

  • ~/.praxconfig for global configuration (similar to ~/.powconfig)
  • myapp/.praxrc for per-project configuration (similar to myapp/.powrc and myapp/.powenv)
  • myapp/.env for per-project environment configuration (equivalent to foreman's .env)

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"
unset RBENV_VERSION
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 from the ruby version of prax issue tracker. You'll may also be interested by https://rvm.io/integration/pow

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