Skip to content

Instantly share code, notes, and snippets.

@aiba
Created November 18, 2012 03:42
Show Gist options
  • Save aiba/4103370 to your computer and use it in GitHub Desktop.
Save aiba/4103370 to your computer and use it in GitHub Desktop.
Fast lein repl using drip
#!/bin/bash -e
if [ ! -f ./project.clj ]; then
echo "Run from a lein project directory."
exit 1
fi
mkdir -p ./.fastrepl/
if command -v md5 >/dev/null 2>&1; then
MD5=`md5 -q project.clj`
elif command -v md5sum >/dev/null 2>&1; then
MD5=`md5sum project.clj | cut -d' ' -f1`
else
echo "Requires md5 or md5sum command. Aborting."
exit 1
fi
CPFILE="./.fastrepl/classpath-$MD5"
if [ ! -f $CPFILE ]; then
echo "Generating classpath (happens once per change to project.clj)."
lein deps
lein classpath > $CPFILE
echo "Generated $CPFILE"
fi
breakchars="(){}[],^%$#@\"\";:''|\\"
rlwrap --remember --always-readline -b "$breakchars" \
drip -client -noverify -XX:+TieredCompilation \
-cp `cat $CPFILE` \
clojure.main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment