45 lines
1.2 KiB
Bash
Executable file
45 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# TODO: this gives us a trailing colon
|
|
LIBS="$(find -H lib/ -mindepth 2> /dev/null 1 -maxdepth 1 -print0 | tr \\0 \:)"
|
|
# TODO: older versions of clojure in lib/ break leiningen
|
|
CLASSPATH="src/:classes/:$LIBS"
|
|
LEIN_JAR=$HOME/.leiningen.jar
|
|
|
|
# If we are not running from a checkout
|
|
if [ ! -r "bin/lein" ]; then
|
|
if [ ! -r "$LEIN_JAR" -a "$1" != "self-install" ]; then
|
|
echo "Leiningen is not installed. Please run \"lein self-install\"."
|
|
exit 1
|
|
fi
|
|
|
|
CLASSPATH="$CLASSPATH:$LEIN_JAR"
|
|
fi
|
|
|
|
if [ "$1" = "test" ]; then
|
|
CLASSPATH=test/:$CLASSPATH
|
|
fi
|
|
|
|
if [ "$1" = "compile" ]; then
|
|
# this needs to exist before the JVM is launched apparently
|
|
mkdir -p classes
|
|
fi
|
|
|
|
if [ $DEBUG ]; then
|
|
echo $CLASSPATH
|
|
fi
|
|
|
|
if [ "$1" = "repl" ]; then
|
|
# If repl used leiningen.core then there'd be no way to bootstrap AOT
|
|
java -cp "$CLASSPATH" clojure.main
|
|
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
|
|
else
|
|
exec java -client -cp "$CLASSPATH" leiningen.core $@
|
|
fi
|