2009-11-02 06:21:50 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2009-11-12 05:24:48 +00:00
|
|
|
# TODO: this gives us a trailing colon
|
2009-11-10 06:22:09 +00:00
|
|
|
LIBS="$(find -H lib/ -mindepth 2> /dev/null 1 -maxdepth 1 -print0 | tr \\0 \:)"
|
2009-11-12 05:24:48 +00:00
|
|
|
# TODO: older versions of clojure in lib/ break leiningen
|
2009-11-06 04:36:27 +00:00
|
|
|
CLASSPATH="src/:classes/:$LIBS"
|
2009-11-12 05:24:48 +00:00
|
|
|
LEIN_JAR=$HOME/.leiningen.jar
|
2009-11-06 04:36:27 +00:00
|
|
|
|
2009-11-12 05:24:48 +00:00
|
|
|
# If we are not running from a checkout
|
2009-11-06 04:36:27 +00:00
|
|
|
if [ ! -r "bin/lein" ]; then
|
2009-11-12 05:24:48 +00:00
|
|
|
if [ ! -r "$LEIN_JAR" -a $1 != "self-install" ]; then
|
|
|
|
echo "Leiningen is not installed. Please run \"lein self-install\"."
|
|
|
|
exit 1
|
2009-11-10 06:22:09 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
CLASSPATH="$CLASSPATH:$LEIN_JAR"
|
2009-11-02 06:21:50 +00:00
|
|
|
fi
|
|
|
|
|
2009-11-02 06:38:59 +00:00
|
|
|
if [ $1 = "test" ]; then
|
2009-11-02 06:47:41 +00:00
|
|
|
CLASSPATH=test/:$CLASSPATH
|
2009-11-02 06:38:59 +00:00
|
|
|
fi
|
|
|
|
|
2009-11-12 05:24:48 +00:00
|
|
|
if [ $1 = "compile" ]; then
|
|
|
|
# this needs to exist before the JVM is launched apparently
|
|
|
|
mkdir -p classes
|
|
|
|
fi
|
|
|
|
|
2009-11-10 06:22:09 +00:00
|
|
|
if [ $DEBUG ]; then
|
|
|
|
echo $CLASSPATH
|
|
|
|
fi
|
|
|
|
|
2009-11-02 06:38:59 +00:00
|
|
|
if [ $1 = "repl" ]; then
|
2009-11-06 04:36:27 +00:00
|
|
|
# If repl used leiningen.core then there'd be no way to bootstrap AOT
|
|
|
|
java -cp "$CLASSPATH" clojure.main
|
2009-11-10 06:22:09 +00:00
|
|
|
elif [ $1 = "self-install" ]; then
|
|
|
|
echo "Downloading Leiningen now..."
|
|
|
|
LEIN_URL=http://repo.technomancy.us/leiningen.jar
|
|
|
|
if [ -x curl ]; then
|
|
|
|
exec curl -o $LEIN_JAR $LEIN_URL
|
|
|
|
else
|
|
|
|
exec wget -O $LEIN_JAR $LEIN_URL
|
|
|
|
fi
|
2009-11-02 06:38:59 +00:00
|
|
|
else
|
2009-11-03 06:20:29 +00:00
|
|
|
exec java -cp "$CLASSPATH" leiningen.core $@
|
2009-11-02 06:38:59 +00:00
|
|
|
fi
|