Created
December 21, 2011 22:40
-
-
Save ohneda/1508040 to your computer and use it in GitHub Desktop.
Smart Bash/Zsh Aliases to Run Appropriate Grails Version
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
# via http://naleid.com/blog/2011/09/26/smart-bash-zsh-aliases-to-run-appropriate-grails-version/ | |
GRAILS_CMD=$1 | |
shift | |
if [ -f application.properties ]; then | |
export GRAILS_VERSION=`grep app.grails.version application.properties | sed -E 's/.*=(.*)/\1/'` | |
export GRAILS_HOME="/Users/ohneda/opt/grails-$GRAILS_VERSION" | |
echo "application.properties found, using \$GRAILS_HOME of $GRAILS_HOME" | |
else | |
echo "application.properties NOT found, leaving \$GRAILS_HOME as $GRAILS_HOME" | |
fi | |
if [ ! -d $GRAILS_HOME ]; then | |
echo "ERROR: Unable to find \$GRAILS_HOME directory at $GRAILS_HOME" | |
exit 1 | |
fi | |
echo $GRAILS_HOME/bin/$GRAILS_CMD $* | |
$GRAILS_HOME/bin/$GRAILS_CMD $* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment