Created
May 22, 2012 18:36
-
-
Save ddeyoung/2770827 to your computer and use it in GitHub Desktop.
Grails Environment Switching
This file contains 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
# GRAILS | |
GRAILS_CELLAR=/usr/local/Cellar/grails | |
GRAILS_BIN=/usr/local/bin/grails | |
GRAILS_START=/usr/local/bin/startGrails | |
GRAILS_DEBUG=/usr/local/bin/grails-debug | |
GRAILS_CURRENT=$GRAILS_CELLAR/current | |
usegrails() { | |
gversion=$1 | |
if [ -d $GRAILS_CELLAR/$gversion ]; then | |
if [ -d $GRAILS_CURRENT ]; then rm $GRAILS_CURRENT; fi && ln -s $GRAILS_CELLAR/$gversion $GRAILS_CURRENT | |
if [ -d $GRAILS_CURRENT ]; then rm $GRAILS_BIN; fi && ln -s $GRAILS_CELLAR/current/libexec/bin/grails $GRAILS_BIN | |
if [ -d $GRAILS_CURRENT ]; then rm $GRAILS_START; fi && ln -s $GRAILS_CELLAR/current/libexec/bin/startGrails $GRAILS_START | |
if [ -d $GRAILS_CURRENT ]; then rm $GRAILS_DEBUG; fi && ln -s $GRAILS_CELLAR/current/libexec/bin/grails-debug $GRAILS_DEBUG | |
else | |
echo "Grails $gversion not found" | |
fi | |
} | |
export GRAILS_HOME=$GRAILS_CURRENT/libexec | |
if [ ! -d $GRAILS_HOME ]; then | |
usegrails 1.3.7 | |
fi |
This file contains 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
brew versions grails | |
# Install 1.3.7 | |
git checkout 232acd0 /usr/local/Library/Formula/grails.rb | |
brew install grails | |
# Install 2.0.3 | |
git checkout af73ab0 /usr/local/Library/Formula/grails.rb | |
brew install grails | |
# Update bash profile | |
## See .bash_profile snippet | |
# Switch grails at the command line | |
usegrails 1.3.7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment