aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/clojure.rb
blob: 91f70ef128fefa163d75dfa162cfc668ca6f9cd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require 'formula'

class Clojure <Formula
  url 'http://clojure.googlecode.com/files/clojure-1.1.0.zip'
  md5 '9c9e92f85351721b76f40578f5c1a94a'
  head 'git://github.com/richhickey/clojure.git'
  homepage 'http://clojure.org/'
  JAR = "clojure.jar"

  def script
    DATA.read.gsub 'CLOJURE_JAR_PATH_PLACEHOLDER', prefix+JAR
  end

  def install
    prefix.install JAR
    (bin+'clj').write(script)
  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=$CLASSPATH: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