Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh
# change paths according to your repl setup
USER_HOME="/Users/antonio.garrote"
CLJR_HOME="/Users/antonio.garrote/.cljr"
CLASSPATH=src:test:.
if [ ! -n "$JVM_OPTS" ]; then
JVM_OPTS="-Xmx1G"
fi
if [ "$DISABLE_JLINE" = "true" ]; then
JLINE=""
else
JLINE="jline.ConsoleRunner"
fi
if [ "$1" = "repl" -o "$1" = "swingrepl" -o "$1" = "swank" -o "$1" = "run" ]; then
if [ -n "$CLOJURE_HOME" ]; then
for f in "$CLOJURE_HOME"/*.jar; do
CLASSPATH="$CLASSPATH":$f
done
fi
for f in "$CLJR_HOME"/lib/*.jar; do
CLASSPATH="$CLASSPATH":$f
done
if [ "$1" = "repl" ]; then
ng clojure.main -e "(require 'cljr.main) (cljr.main/initialize-classpath)" -r
else
ng cljr.App $*
fi
else
CLASSPATH="$CLASSPATH":"$CLJR_HOME"/cljr.jar
ng cljr.App $*
fi
#!/bin/sh
# change paths according to your cljr setup
USER_HOME="/Users/antonio.garrote"
CLJR_HOME="/Users/antonio.garrote/.cljr"
CLASSPATH=src:test:.
if [ ! -n "$JVM_OPTS" ]; then
JVM_OPTS="-Xmx1G"
fi
if [ "$DISABLE_JLINE" = "true" ]; then
JLINE=""
else
JLINE="jline.ConsoleRunner"
fi
if [ "$1" = "repl" -o "$1" = "swingrepl" -o "$1" = "swank" -o "$1" = "run" ]; then
if [ -n "$CLOJURE_HOME" ]; then
for f in "$CLOJURE_HOME"/*.jar; do
CLASSPATH="$CLASSPATH":$f
done
fi
for f in "$CLJR_HOME"/lib/*.jar; do
CLASSPATH="$CLASSPATH":$f
done
if [ "$1" = "repl" ]; then
java $JVM_OPTS -Dinclude.cljr.repo.jars=false -Duser.home="$USER_HOME" -Dclojure.home="$CLOJURE_HOME" -Dcljr.home="$CLJR_HOME" -cp "$CLASSPATH" $JLINE clojure.main -e "(require 'cljr.main\
) (cljr.main/initialize-classpath)" -r
else
java $JVM_OPTS -Dinclude.cljr.repo.jars=false -Duser.home="$USER_HOME" -Dclojure.home="$CLOJURE_HOME" -Dcljr.home="$CLJR_HOME" -cp "$CLASSPATH" cljr.App $*
fi
else
CLASSPATH="$CLASSPATH":"$CLJR_HOME"/cljr.jar:"$CLJR_HOME"/nailgun.jar
java $JVM_OPTS -Duser.home="$USER_HOME" -Dclojure.home="$CLOJURE_HOME" -Dcljr.home="$CLJR_HOME" -cp "$CLASSPATH" com.martiansoftware.nailgun.NGServer
fi
cljr + nailgun setup
---------------------
1. install cljr: http://github.com/liebke/cljr
2. install nailgun: http://martiansoftware.com/nailgun/index.html
2.1 download nailgun
2.2 unzip
2.3 compile: make
2.4 copy ng exec to your path
2.5 copy nailgun.jar to ~/.cljr/
3. create cljr-server script
3.1 cp ~/.cljr/bin/cljr ~/.cljr/bin/cljr-server
3.2 edit cljr-server file according to what is shown in the file above (change cljr app start by nailgun start)
4. create cljr-client script
4.1 cp ~/.cljr/bin/cljr ~/.cljr/bin/cljr-client
4.2 edit cljr-server file according to what is shown above (change java exec by ng exec)
5. running
5.1 start nailgun: ~/.cljr/bin/cljr-server
5.2 run cljr: ~/.cljr/bin/cljr-client repl
The first time you run cljr-client repl it can take a few seconds, second time it should be instantantly :)
@khinsen

This comment has been minimized.

Copy link

commented Jul 27, 2010

Nice idea... and it works fine for basic use, but it doesn't handle the classpath correctly. Directories added using "cljr add-classpath ..." are not taken into account. I guess this could be fixed using Stuart Sierra's classpath manager for nailgun (http://github.com/stuartsierra/classpath-manager).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.