aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/clojure.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Formula/clojure.rb')
-rw-r--r--Library/Formula/clojure.rb32
1 files changed, 18 insertions, 14 deletions
diff --git a/Library/Formula/clojure.rb b/Library/Formula/clojure.rb
index 997ed7d43..0d5f27b93 100644
--- a/Library/Formula/clojure.rb
+++ b/Library/Formula/clojure.rb
@@ -6,26 +6,26 @@ class Clojure < Formula
head 'https://github.com/clojure/clojure.git'
homepage 'http://clojure.org/'
- def jar
- 'clojure.jar'
- end
-
- def script
-<<-EOS
-#!/bin/sh
-# Runs clojure.
-# With no arguments, runs Clojure's REPL.
+ def script; <<-EOS.undent
+ #!/bin/sh
+ # Clojure wrapper script.
+ # With no arguments runs Clojure's REPL.
-# resolve links - $0 may be a softlink
-CLOJURE=$CLASSPATH:$(brew --cellar)/#{name}/#{version}/#{jar}
+ # Put the Clojure jar from the cellar and the current folder in the classpath.
+ CLOJURE=$CLASSPATH:#{prefix}/clojure.jar:${PWD}
-java -cp $CLOJURE clojure.main "$@"
-EOS
+ if [ "$#" -eq 0 ]; then
+ java -cp $CLOJURE clojure.main --repl
+ else
+ java -cp $CLOJURE clojure.main "$@"
+ fi
+ EOS
end
def install
system "ant" if ARGV.build_head?
- prefix.install jar
+ prefix.install 'clojure.jar'
+ (prefix+'classes').mkpath
(bin+'clj').write script
end
@@ -35,4 +35,8 @@ EOS
http://trac.macports.org/browser/trunk/dports/lang/clojure/files/clj-rlwrap.sh?format=txt
EOS
end
+
+ def test
+ system "clj -e \"(println \\\"Hello World\\\")\""
+ end
end