#!/usr/bin/env bash
#
# Try to run ruby on Unix machines.
#
# We assume you are using RVM. If you are not, well, this isn't going to work.
# We also assume you've executed `bundle install` already in this directory.
#
rvm_user_script=~/.rvm/scripts/rvm
rvm_system_script=/usr/local/rvm/scripts/rvm
if [ -f /etc/profile.d/rvm.sh ]; then
echo source /etc/profile.d/rvm.sh
source /etc/profile.d/rvm.sh
elif [ -f $rvm_user_script ]; then
echo sourcing $rvm_user_script
source $rvm_user_script
elif [ -f $rvm_system_script ]; then
echo sourcing $rvm_system_script
source $rvm_system_script
fi
rvm_check=`type rvm | head -1`
#echo rvm_check $rvm_check
if [[ $rvm_check == *'rvm is a function'* ]]; then
echo RVM is loaded
# rvm info
else
echo RVM is NOT loaded
exit 1
fi
echo ruby $*
ruby $*