Skip to content

Instantly share code, notes, and snippets.

@ohneda
Created December 21, 2011 22:40
Show Gist options
  • Save ohneda/1508040 to your computer and use it in GitHub Desktop.
Save ohneda/1508040 to your computer and use it in GitHub Desktop.
Smart Bash/Zsh Aliases to Run Appropriate Grails Version
# 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