Skip to content

Instantly share code, notes, and snippets.

@huynhjl
Created April 14, 2012 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huynhjl/2384106 to your computer and use it in GitHub Desktop.
Save huynhjl/2384106 to your computer and use it in GitHub Desktop.
play 2.0 scripts for cygwin
#! /usr/bin/env sh
PLAY_VERSION="2.0"
if [ -z "${JPDA_PORT}" ]; then
DEBUG_PARAM=""
else
DEBUG_PARAM="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${JPDA_PORT}"
fi
java ${DEBUG_PARAM} -Xms512M -Xmx1136M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -Dfile.encoding=UTF8 -Dplay.version="${PLAY_VERSION}" -Dsbt.ivy.home=`dirname $0`/../repository -Dplay.home=`dirname $0` -Dsbt.boot.properties=$BOOTPROP`dirname $0`/sbt/sbt.boot.properties -jar `dirname $0`/sbt/sbt-launch.jar "$@"
#! /usr/bin/env sh
case `uname` in
CYGWIN*)
function dirname {
cygpath -m `command dirname $@`
}
typeset -fx dirname
export BOOTPROP="file:///"
;;
*)
export BOOTPROP=""
;;
esac
PRG="$0"
while [ -h "$PRG" ] ; do
PRG=`readlink "$PRG"`
done
dir=`dirname $PRG`
if [ -f conf/application.conf ]; then
if test "$1" = "clean-all"; then
rm -rf target
rm -rf tmp
rm -rf logs
rm -rf dist
rm -rf project/project
rm -rf project/target
if [ $# -ne 1 ]
then
shift
else
echo "[info] Done!"
exit 0
fi
fi
if test "$1" = "stop"; then
if [ -f RUNNING_PID ]; then
echo "[info] Stopping application (with PID `cat RUNNING_PID`)..."
kill `cat RUNNING_PID`
RESULT=$?
if test "$RESULT" = 0; then
echo "[info] Done!"
exit 0
else
echo "[\033[31merror\033[0m] Failed ($RESULT)"
exit $RESULT
fi
else
echo "[\033[31merror\033[0m] No RUNNING_PID file. Is this application running?"
exit 1
fi
fi
if test "$1" = "debug"; then
JPDA_PORT="9999"
shift
fi
if [ -n "$1" ]; then
JPDA_PORT="${JPDA_PORT}" $dir/framework/build "$@"
else
JPDA_PORT="${JPDA_PORT}" $dir/framework/build play
fi
else
java -Dsbt.ivy.home=$dir/repository -Dplay.home=$dir/framework -Dsbt.boot.properties=$BOOTPROP$dir/framework/sbt/play.boot.properties -jar $dir/framework/sbt/sbt-launch.jar "$@"
fi
function setplay {
echo "setting play environment"
alias play=/cygdrive/c/setup/playframework/play-2.0/play
export PATH="/cygdrive/c/util/java/jdk1.6.0_26/bin:$PATH"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment