diff options
| author | dbr | 2009-10-06 01:16:42 +0100 |
|---|---|---|
| committer | Max Howell | 2009-10-12 17:26:28 +0100 |
| commit | 4d692df330863dfea7db77eba3513d30b24ba449 (patch) | |
| tree | a2979b4b7089793b475116d52adb98c6525b5540 /Library/Formula/clojure.rb | |
| parent | cecaf35fbf3c2bbb263768ba97ada13524088653 (diff) | |
| download | homebrew-4d692df330863dfea7db77eba3513d30b24ba449.tar.bz2 | |
Improved clojure formula.
Merged the clj_repl and clj commands into one clj command, which either
invokes the REPL, or runs a script (similar to how the python command works).
Moved the script to DATA, instead of inline
Diffstat (limited to 'Library/Formula/clojure.rb')
| -rw-r--r-- | Library/Formula/clojure.rb | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/Library/Formula/clojure.rb b/Library/Formula/clojure.rb index 022068f12..fdd0d7cb2 100644 --- a/Library/Formula/clojure.rb +++ b/Library/Formula/clojure.rb @@ -11,19 +11,30 @@ class Clojure <Formula # create helpful scripts to start clojure bin.mkdir - clojure_exec = bin+'clj' - clojure_exec.write <<-EOS -#!/bin/sh -java -Xmx512M -cp #{prefix}/#{JAR} clojure.lang.Script "$@" -EOS + clojure_exec = bin + 'clj' - File.chmod(0755, clojure_exec) + script = DATA.read + script.sub! "CLOJURE_JAR_PATH_PLACEHOLDER", "#{prefix}/#{JAR}" + + clojure_exec.write script - clojure_repl_exec = bin+'clj_repl' - clojure_repl_exec.write <<-EOS -#!/bin/sh -java -Xmx512M -cp #{prefix}/#{JAR} clojure.lang.Repl "$@" -EOS - File.chmod(0755, clojure_repl_exec) + File.chmod(0755, clojure_exec) end end + +__END__ +#!/bin/bash +# Runs clojure. +# With no arguments, runs Clojure's REPL. +# With one or more arguments, the first is treated as a script name, the rest +# passed as command-line arguments. + +# resolve links - $0 may be a softlink +CLOJURE='CLOJURE_JAR_PATH_PLACEHOLDER' + +if [ -z "$1" ]; then + java -server -cp $CLOJURE clojure.lang.Repl +else + scriptname=$1 + java -server -cp $CLOJURE clojure.lang.Script $scriptname -- $* +fi |
