Skip to content

Instantly share code, notes, and snippets.

@bbozo
Created November 20, 2014 07:24
Show Gist options
  • Save bbozo/1235c9305f18d28e6f51 to your computer and use it in GitHub Desktop.
Save bbozo/1235c9305f18d28e6f51 to your computer and use it in GitHub Desktop.
.rvmrc for 2+ ruby versions
#!/bin/bash
function rvmrc-production {
export WTGW_ENV_CHOICE='production' # for use in database.yml for example
rvm use jruby-1.7.12 --create
export JRUBY_OPTS=--2.0
}
function rvmrc-development {
export WTGW_ENV_CHOICE='development' # for use in database.yml for example
rvm use ruby-2.1.4 --create
}
PRESELECT_WTGW_ENVIRONMENT=development
if [ "$PRESELECT_WTGW_ENVIRONMENT" != "" ]; then # this is set by script/jenkins.sh for example
rvmrc-$PRESELECT_WTGW_ENVIRONMENT
return
fi
echo
echo "Please choose the profile: "
echo " 1. development (default)"
echo " 2. production"
while true; do
profile=$PRESELECT_WTGW_ENVIRONMENT
read -n1 profile
case $profile in
[2]* ) rvmrc-production;;
* ) rvmrc-development;;
esac
break # something happened by now
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment