Skip to content

Instantly share code, notes, and snippets.

@mslinn
Created November 24, 2011 04:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mslinn/1390651 to your computer and use it in GitHub Desktop.
Save mslinn/1390651 to your computer and use it in GitHub Desktop.
Play Framework 2.0 start script for Cygwin (should work on all *nix variants)
#! /usr/bin/env bash
control_c() {
if $cygwin; then rm "$USERPROFILE"/play.boot.properties; fi
exit 1
}
case "`uname`" in
CYGWIN*) cygwin=true;;
esac
PLAY_HOME="$(dirname $BASH_SOURCE)"
if $cygwin; then
PLAY_HOME_MIXED="$(cygpath -m $(dirname $BASH_SOURCE))"
PLAY_BOOT_PROPS="$(cygpath -u $(dirname $BASH_SOURCE)/framework/sbt/)"play.boot.properties
trap control_c SIGINT
cp "$PLAY_BOOT_PROPS" "$USERPROFILE" # cannot get this bugger to read the file any other way!
else
PLAY_HOME_MIXED="$PLAY_HOME"
fi
if [ -f conf/application.conf ]; then
if [ "$1" = "clean" ]; then
"$PLAY_HOME"/framework/cleanIvyCache
fi
if [ -n "$1" ]; then
"$PLAY_HOME"/framework/build "$@"
else
"$PLAY_HOME"/framework/build play
fi
else
for sbt in "$PLAY_HOME_MIXED"/framework/sbt/sbt-launch-*.jar; do
SBT="$sbt" # set $SBT to newest file present
done
java -Dsbt.ivy.home="$PLAY_HOME_MIXED"/repository \
-Dplay.home="$PLAY_HOME_MIXED"/framework \
-Dsbt.boot.properties="play.boot.properties" \
-jar "$SBT" "$@"
if $cygwin; then rm "$USERPROFILE"/play.boot.properties; fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment