Skip to content

Instantly share code, notes, and snippets.

@wayneeseguin
Forked from pillowfactory/scripting_rvm.sh
Created October 5, 2010 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wayneeseguin/611684 to your computer and use it in GitHub Desktop.
Save wayneeseguin/611684 to your computer and use it in GitHub Desktop.
function rvm_require_ruby
{
if ! rvm list strings | grep -q "^$1" ; then
echo "ERROR: Requires Ruby Version: '$1'"
return 1
fi
return 0
}
function rvm_use
{
rvm_require_ruby $1
if [[ $? -gt 0 ]] ; then
# handle the error
exit
fi
rvm use $1
return $?
}
function rvm_require_gemset
{
if ! rvm gemset list | grep -q "^$1" ; then
echo "ERROR: Requires RVM Gemset: '$1'"
return 1
fi
return 0
}
function rvm_gemset_use
{
rvm_require_gemset "$1"
if [[ $? -gt 0 ]] ; then
# handle the error
exit
fi
rvm gemset use "$1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment