forked from djpowell/liverepl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
liverepl.sh
executable file
·36 lines (26 loc) · 1.06 KB
/
liverepl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
# Starter script for Clojure liverepl
[ -z "$JDK_HOME" ] && JDK_HOME=/usr/lib/jvm/default-java
LIVEREPL_HOME="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
MAIN=net.djpowell.liverepl.client.Main
CLOJURE_JAR=$(find $LIVEREPL_HOME/build -name 'clojure-*[0-9].jar' | head -1)
AGENT_JAR="$LIVEREPL_HOME/build/liverepl-agent.jar"
SERVER_JAR="$LIVEREPL_HOME/build/liverepl-server.jar"
if [ "Darwin" = "`uname -s`" ]; then
CLASSPATH="${CLASSPATH}${JAVA_HOME}/bundle/Classes/classes.jar"
elif [ ! -f "$JDK_HOME/lib/tools.jar" ]; then
echo 'Unable to find $JDK_HOME/lib/tools.jar'
echo "Please set the JDK_HOME environment variable to the location of your JDK."
exit 1
else
CLASSPATH="${CLASSPATH}${JDK_HOME}/lib/tools.jar"
fi
if [ "$TERM" != "dumb" ]; then
if which rlwrap >/dev/null ; then
echo "Found rlwrap"
breakchars="(){}[],^%$#@\"\";:''|\\"
WRAP="exec rlwrap --remember -c -b \"$breakchars\" "
fi
fi
CLASSPATH="$CLASSPATH:$AGENT_JAR"
${WRAP}java -cp $CLASSPATH $MAIN "$CLOJURE_JAR" "$AGENT_JAR" "$SERVER_JAR" "$@"