Last Updated: February 25, 2016
·
647
· shinn

POW!! with RVM

Recently come across in developing a few applications which is domain name dependent.
Instead of using the default rails 3000 port and the ugly 127.0.0.1:3000 domain, I use pow, which is an easy and handy rack server.

However it doesn't work out of the box with RVM so I've to manually create the following configuration file, .powenv which is meant to place under your application directory.

# 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

And don't forget to run touch tmp/restart.txt after creating .powenv

sources: http://rvm.io/integration/pow