Permalink
Browse files

Merge pull request #12 from jsimone/master

Add caching, always pre-compile, add packaging script
  • Loading branch information...
2 parents 103e945 + 6faa086 commit 2fa00a89b5f4bae3638c58d445f61bdfc05afa64 @jsimone jsimone committed Apr 2, 2012
Showing with 46 additions and 6 deletions.
  1. +27 −5 bin/compile
  2. +18 −0 opt/grails-version-package.sh
  3. +1 −1 test/compile_test.sh
View
@@ -86,16 +86,38 @@ export PATH=$GRAILS_HOME/bin:$PATH
cd $BUILD_DIR
+# if grails cache directory doesn't exist create it
+if [ ! -d $CACHE_DIR/.grails_cache ]; then
+ mkdir $CACHE_DIR/.grails_cache
+fi
+
+# Cache priming option
+# if a populated cache was checked in copy it into the cache
+# remove the checked in cache dir aftewards to save slug size
+if [ -d ivy-cache ]; then
+ echo "-----> Found ivy-cache directory in the repo. Using it to prime the cache"
+ cp -r ivy-cache $CACHE_DIR/.grails_cache/
+ rm -r ivy-cache
+fi
+
+# create .grails directory in the user home and write a settings.groovy that points grails
+# at the correct cache directory
+if [ ! -d $HOME/.grails ]; then
+ mkdir $HOME/.grails
+fi
+
+echo "grails.dependency.cache.dir = '$CACHE_DIR/.grails_cache'" >> $HOME/.grails/settings.groovy
+
# build app
if [ "$GRAILS_VERSION" != "1.3.7" ] ; then
BUILDCMD_OPT="-plain-output"
-else
- COMPILECMD="grails -Divy.default.ivy.user.dir=$CACHE_DIR compile"
- echo "-----> Executing $COMPILECMD"
- eval "$COMPILECMD" | sed -u 's/^/ /'
- check_build_status
fi
+COMPILECMD="grails -Divy.default.ivy.user.dir=$CACHE_DIR compile"
+echo "-----> Executing $COMPILECMD"
+eval "$COMPILECMD" | sed -u 's/^/ /'
+check_build_status
+
BUILDCMD="grails $BUILDCMD_OPT -Divy.default.ivy.user.dir=$CACHE_DIR war"
echo "-----> Executing $BUILDCMD"
eval "$BUILDCMD" | sed -u 's/^/ /'
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+#grails-version-deploy.sh <grails version number>
+#Do not run on OSX. Grails cannot deal with the resource forks (._ file copies) that HFS creates.
+GRAILS_VERSION=$1
+
+curl http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/grails-$GRAILS_VERSION.zip --output grails-$GRAILS_VERSION.zip
+mkdir .grails
+unzip grails-$GRAILS_VERSION.zip
+if [ -d .grails ]; then
+ rm -rf .grails
+fi
+mkdir .grails
+cp -r grails-$GRAILS_VERSION/* .grails
+
+curl http://repo1.maven.org/maven2/org/mortbay/jetty/jetty-runner/7.5.4.v20111024/jetty-runner-7.5.4.v20111024.jar --output .grails/jetty-runner-7.5.4.v20111024.jar
+
+tar cvf grails-$GRAILS_VERSION.tar .grails
+gzip grails-$GRAILS_VERSION.tar
@@ -97,8 +97,8 @@ testCompile_Version_2_0_0()
assertCaptured "Installing Grails ${grailsVersion}"
assertTrue "Grails should have been installed" "[ -d ${CACHE_DIR}/.grails ]"
assertEquals "Correct Grails version should have been installed" "${grailsVersion}" "$(getInstalledGrailsVersion)"
- assertNotCaptured "Grails 2.0.0 apps should not pre-compile" "grails -Divy.default.ivy.user.dir=${CACHE_DIR} compile"
assertCaptured "Grails non-1.3.7 apps should specify -plain-output flag" "grails -plain-output -Divy.default.ivy.user.dir=${CACHE_DIR} war"
+ assertTrue "Cache directory should have been created" "[ -d ${CACHE_DIR}/.grails_cache ]"
}
testCompile_VersionUpgrade()

0 comments on commit 2fa00a8

Please sign in to comment.