-
-
Save nikushi/5458519 to your computer and use it in GitHub Desktop.
helper shell-script to run a ruby script on rvm enviroment
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
# encoding: utf-8 | |
#!/bin/sh | |
# | |
# Usage: | |
# | |
# APP_ROOT=/usr/local/app HOME=/home/app_user ./exec script/script.rb [options] | |
# | |
usage() | |
{ | |
echo "Usage:" >&2 | |
echo " $ APP_ROOT=/usr/local/app HOME=/home/app_user ./exec script/script.rb [options]" >&2 | |
exit 1 | |
} | |
if [ -z "$APP_ROOT" -o -z "$HOME" ]; then | |
usage | |
fi | |
source ~/.rvm/scripts/rvm | |
export PATH="~/.rvm/bin:$PATH" | |
#rvm rvmrc trust $APP_ROOT # You have to put .rvmrc or .ruby-version in the root of $APP_ROOT | |
cd $APP_ROOT | |
exec "$@" | |
usage() | |
{ | |
echo "Usage:" >&2 | |
echo " $ APP_ROOT=/usr/local/app HOME=/home/app_user ./exec script/script.rb [options]" >&2 | |
exit 1 | |
} | |
if [ -z "$APP_ROOT" -o -z "$HOME" ]; then | |
usage | |
fi | |
source ~/.rvm/scripts/rvm | |
rvm rvmrc trust $APP_ROOT # You have to put .rvmrc or .ruby-version in the root of $APP_ROOT | |
cd $APP_ROOT | |
exec "$@" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment