-
-
Save graemerocher/1231562 to your computer and use it in GitHub Desktop.
Grails LP
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
#!/usr/bin/env bash | |
# bin/compile <build-dir> <cache-dir> | |
# fail fast | |
set -e | |
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path | |
# parse args | |
BUILD_DIR=$1 | |
CACHE_DIR=$2 | |
if [ ! -d $CACHE_DIR ] ; then | |
mkdir $CACHE_DIR | |
fi | |
cd $CACHE_DIR | |
# install grails | |
GRAILS_URL="http://lang-pack-grails.s3.amazonaws.com/grails-1.3.7.tar.gz" | |
if [ ! -d .grails ]; then | |
echo -n "-----> Installing Grails 1.3.7....." | |
# curl --silent --max-time 60 --location $GRAILS_URL | tar xz | |
curl --silent --location $GRAILS_URL | tar xz | |
mv grails-1.3.7 .grails | |
echo " done" | |
fi | |
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk | |
export GRAILS_HOME=$CACHE_DIR/.grails | |
export PATH=$GRAILS_HOME/bin:$PATH | |
cd $BUILD_DIR | |
# build app | |
BUILDCMD="grails war" | |
echo "-----> executing $BUILDCMD" | |
$BUILDCMD 2>&1 | sed -u 's/^/ /' | |
if [ "${PIPESTATUS[*]}" != "0 0" ]; then | |
echo " ! Failed to build app" | |
exit 1 | |
fi | |
if [ ! -d server ] ; then | |
echo "-----> No server directory found. Adding jetty-runner 7.5.0.v20110901 automatically." | |
echo " To use your own server, read http://devcenter.heroku.com/articles/grails-custom-server." | |
mkdir server | |
cp $GRAILS_HOME/jetty-runner-7.5.0.v20110901.jar server/jetty-runner.jar | |
fi | |
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
#!/usr/bin/env bash | |
# bin/use <build-dir> | |
if [ -d $1/grails-app ]; then | |
echo "Grails" && exit 0 | |
else | |
echo "no" && exit 1 | |
fi |
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
#!/usr/bin/env bash | |
# bin/release <build-dir> | |
BUILD_DIR=$1 | |
cat <<EOF | |
--- | |
config_vars: | |
JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops | |
addons: | |
shared-database:5mb | |
default_process_types: | |
web: java \$JAVA_OPTS -jar server/jetty-runner.jar --port \$PORT target/*.war | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment