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
This commit is contained in:
parent
8072aff04e
commit
9b5e711fd9
1 changed files with 23 additions and 12 deletions
|
@ -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'
|
||||
|
||||
script = DATA.read
|
||||
script.sub! "CLOJURE_JAR_PATH_PLACEHOLDER", "#{prefix}/#{JAR}"
|
||||
|
||||
clojure_exec.write script
|
||||
|
||||
File.chmod(0755, clojure_exec)
|
||||
|
||||
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)
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue