Browse Source

Finally got grails working

msmith-techempower 10 years ago
parent
commit
ae124f217a

+ 1 - 2
frameworks/Groovy/grails/bash_profile.sh

@@ -1,5 +1,4 @@
 export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
 export RESIN_HOME=${IROOT}/resin-4.0.41
 
-export GRAILS_PATH=${IROOT}/grails-2.4.2/bin/
-export PATH=${GRAILS_PATH}:$PATH
+export GRAILS_PATH=${IROOT}/grails-2.4.2/bin/

+ 1 - 0
frameworks/Groovy/grails/hello/grails-app/conf/BuildConfig.groovy

@@ -31,6 +31,7 @@ if (System.getProperty("grails.yjp")) {
 
 grails.project.dependency.resolver = "maven" // or ivy
 grails.project.dependency.resolution = {
+    cacheDir "target/ivy-cache"
     // inherit Grails' default dependencies
     inherits("global") {
         // uncomment to disable ehcache

+ 0 - 24
frameworks/Groovy/grails/setup.py

@@ -1,24 +0,0 @@
-
-import subprocess
-import sys
-import setup_util
-
-def start(args, logfile, errfile):
-  setup_util.replace_text("grails/hello/grails-app/conf/DataSource.groovy", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
-  
-  try:
-    subprocess.check_call("grails -non-interactive -plain-output compile", shell=True, cwd="grails/hello", stderr=errfile, stdout=logfile)
-    subprocess.check_call("grails prod -non-interactive -plain-output war", shell=True, cwd="grails/hello", stderr=errfile, stdout=logfile)
-    subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("cp grails/hello/target/hello-0.1.war $RESIN_HOME/webapps/grails.war", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True, stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
-def stop(logfile, errfile):
-  try:
-    subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("rm -rf $RESIN_HOME/resin-data/*", shell=True, stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1

+ 13 - 0
frameworks/Groovy/grails/setup.sh

@@ -0,0 +1,13 @@
+#!/bin/bash
+
+sed -i 's|jdbc:mysql://.*:3306|jdbc:mysql://'"${DBHOST}"':3306|g' hello/grails-app/conf/DataSource.groovy
+
+export PATH=${GRAILS_PATH}:$PATH
+export GRAILS_AGENT_CACHE_DIR=${IROOT}/.grails/.slcache
+
+cd hello
+grails -Dgrails.work.dir=${IROOT}/.grails -non-interactive -plain-output compile
+grails -Dgrails.work.dir=${IROOT}/.grails prod -non-interactive -plain-output war
+rm -rf $RESIN_HOME/webapps/*
+cp target/hello-0.1.war $RESIN_HOME/webapps/grails.war
+$RESIN_HOME/bin/resinctl start

+ 4 - 2
toolset/setup/linux/frameworks/grails.sh

@@ -1,7 +1,9 @@
 #!/bin/bash
 
-RETCODE=$(fw_exists grails-2.4.2)
+RETCODE=$(fw_exists ${IROOT}/grails-2.4.2.installed)
 [ ! "$RETCODE" == 0 ] || { return 0; }
 
 fw_get http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/grails-2.4.2.zip -O grails-2.4.2.zip
-fw_unzip grails-2.4.2.zip
+fw_unzip grails-2.4.2.zip
+
+touch ${IROOT}/grails-2.4.2.installed