2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-09-25 21:44:35 +00:00
|
|
|
|
|
|
|
class Clojure <Formula
|
|
|
|
url 'http://clojure.googlecode.com/files/clojure_1.0.0.zip'
|
2009-10-17 00:50:48 +00:00
|
|
|
head 'git://github.com/richhickey/clojure.git'
|
2009-09-25 21:44:35 +00:00
|
|
|
homepage 'http://clojure.org/'
|
|
|
|
md5 'e7a50129040df7fe52287006988ecbb2'
|
|
|
|
JAR = "clojure-1.0.0.jar"
|
|
|
|
|
|
|
|
def install
|
|
|
|
prefix.install JAR
|
|
|
|
|
|
|
|
# create helpful scripts to start clojure
|
|
|
|
bin.mkdir
|
2009-10-06 00:16:42 +00:00
|
|
|
clojure_exec = bin + 'clj'
|
2009-09-25 21:44:35 +00:00
|
|
|
|
2009-10-06 00:16:42 +00:00
|
|
|
script = DATA.read
|
|
|
|
script.sub! "CLOJURE_JAR_PATH_PLACEHOLDER", "#{prefix}/#{JAR}"
|
|
|
|
|
|
|
|
clojure_exec.write script
|
2009-09-25 21:44:35 +00:00
|
|
|
|
2009-10-06 00:16:42 +00:00
|
|
|
File.chmod(0755, clojure_exec)
|
2009-09-25 21:44:35 +00:00
|
|
|
end
|
|
|
|
end
|
2009-10-06 00:16:42 +00:00
|
|
|
|
|
|
|
__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
|
2009-10-17 00:52:41 +00:00
|
|
|
CLOJURE=$CLASSPATH:CLOJURE_JAR_PATH_PLACEHOLDER
|
2009-10-06 00:16:42 +00:00
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
java -server -cp $CLOJURE clojure.lang.Repl
|
|
|
|
else
|
|
|
|
scriptname=$1
|
|
|
|
java -server -cp $CLOJURE clojure.lang.Script $scriptname -- $*
|
|
|
|
fi
|