Commits

tednaleid committed 5e6a692

added grails version switcher

  • Participants
  • Parent commits 0b453bb

Comments (0)

Files changed (1)

File zshrc_general

     time $1 test-app -no-reports -echoOut $2 $3 || testlog
 }
 
+
+alias grails=execute_grails_version
+
+function execute_grails_version() {
+    if [ -f application.properties ]; then
+        export GRAILS_VERSION=`grep app.grails.version application.properties | sed -E 's/.*=(.*)/\1/'`
+        export GRAILS_HOME="/usr/local/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
+
+    $GRAILS_HOME/bin/grails $*
+}
+
+
 alias gtas='splitTests.groovy'
 
 alias gp='grails package'