Skip to content

Instantly share code, notes, and snippets.

@jousby
Forked from mslinn/play
Created October 20, 2012 06:05
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 jousby/3922247 to your computer and use it in GitHub Desktop.
Save jousby/3922247 to your computer and use it in GitHub Desktop.
Play Framework 2.0 start scripts for Cygwin
#! /usr/bin/env sh
PLAY_VERSION="2.0.4"
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 -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M \
-Dfile.encoding=UTF8 \
-Dplay.version=$PLAY_VERSION \
-Dsbt.boot.properties=$SBT_BOOT_PROPS \
$JAVA_CMD_TAIL
#! /usr/bin/env sh
PRG="$0"
while [ -h "$PRG" ] ; do
PRG=`readlink "$PRG"`
done
dir=`dirname $PRG`
PLAY_HOME=$(cygpath -w -a $dir)
PLAY_FRAMEWORK_HOME=$(cygpath -w -a $PLAY_HOME/framework)
PLAY_BOOT_PROPS=file:///$(cygpath -m -a $PLAY_FRAMEWORK_HOME/sbt/play.boot.properties)
SBT_IVY_HOME=$(cygpath -w -a $PLAY_HOME/repository)
SBT_LAUNCH_JAR=$(cygpath -w -a $PLAY_FRAMEWORK_HOME/sbt/sbt-launch.jar)
export SBT_BOOT_PROPS=file:///$(cygpath -m -a $PLAY_FRAMEWORK_HOME/sbt/sbt.boot.properties)
JLINE_TERMINAL=-Djline.terminal=jline.UnixTerminal
stty -icanon min 1 -echo
export JAVA_CMD_TAIL="$JLINE_TERMINAL -Dsbt.ivy.home=$SBT_IVY_HOME -Dplay.home=$PLAY_FRAMEWORK_HOME -jar $SBT_LAUNCH_JAR $@"
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.cygwin.sh "$@"
else
JPDA_PORT="${JPDA_PORT}" $dir/framework/build.cygwin.sh play
fi
else
java -Dsbt.boot.properties=$PLAY_BOOT_PROPS $JAVA_CMD_TAIL
fi
stty echo icanon
@jousby
Copy link
Author

jousby commented Oct 20, 2012

Alternatives for the following two files in the framework distribution to be used under cygwin on Windows.

PLAY_HOME/play
PLAY_HOME/framework/build

Caveats:

  1. Note that the play REPL doesn't seem to recognise enter / end of file so you need to run everything as a play command i.e 'play.cygwin.sh ~run'
  2. You need to use 'Ctl-C' to exit your process, not 'Ctl-D' as stated by the ascii start up banner.

@jousby
Copy link
Author

jousby commented Oct 21, 2012

Updated based on this gist -> https://gist.github.com/3923047

The caveats mentioned above are fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment