Permalink
Browse files

Update clj-bin files.

  • Loading branch information...
1 parent 99adb09 commit 099fdf65e04d4b45cd256db40c96087536d10b76 @mmcgrana committed Dec 27, 2009
Showing with 48 additions and 107 deletions.
  1. +4 −19 clj-bin/clj
  2. +24 −0 clj-bin/cljcp
  3. +4 −4 clj-bin/cljd
  4. +0 −29 clj-bin/clji
  5. +3 −19 clj-bin/cljp
  6. +11 −0 clj-bin/run.clj
  7. +2 −36 clj-bin/user.clj
View
@@ -1,25 +1,10 @@
#!/bin/bash
USER_CLJ_DIR=/Users/mmcgrana/Clojure
-SHARED_JARS_DIR=$USER_CLJ_DIR/jars
-
-# Local src, test, and classes
-CP=src/:test/:classes/
-
-# Local jars
-if [ -d jars ]; then
- for file in jars/*.jar; do
- CP=$CP:$file
- done
-fi
-
-# Global jars.
-for file in $SHARED_JARS_DIR/*.jar; do
- CP=$CP:$file
-done
if [ -z "$1" ]; then
- echo "USAGE: cljp <script_file.clj>"
+ rlwrap java -Xmx2g -cp `cljcp` clojure.contrib.repl_ln
else
- java -cp $CP clojure.main $@
-fi
+ java -server -Xmx2g -cp `cljcp` clojure.main $USER_CLJ_DIR/run.clj $@
+ # java -server -Xmx2g -cp `cljcp` clojure.main $@
+fi
View
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+USER_CLJ_DIR=/Users/mmcgrana/Clojure
+
+# Local src, test, and classes
+CP=./:src/:src/clj/:src/main/clojure/
+CP=$CP:test/:src/test/clojure/
+CP=$CP:classes/
+
+# Either local or glocal jars, but not both
+if [ -d lib ]; then
+ for file in lib/*.jar; do
+ CP=$CP:$file
+ done
+else
+ for file in $USER_CLJ_DIR/jars/*.jar; do
+ CP=$CP:$file
+ done
+fi
+
+# For user.clj
+CP=$CP:$USER_CLJ_DIR
+
+echo $CP
View
@@ -2,8 +2,8 @@
SHARED_JARS_DIR = "/Users/mmcgrana/Clojure/jars"
-if (ARGV.size == 0) || (ARGV[1] == "help"):
- puts "cljd <qi install uninstall extract list>"
+if (ARGV.size == 0) || (ARGV[0] == "help"):
+ puts "Usage: cljd <qi install uninstall extract list>"
elsif ARGV[0] == "qi"
if ARGV.size != 1
@@ -25,7 +25,7 @@ elsif ARGV[0] == "install":
elsif ARGV[0] == "uninstall"
if ARGV.size != 2
- puts "install <jar>"
+ puts "install <jar-file>"
else
jar = ARGV[1]
file = File.join(SHARED_JARS_DIR, jar)
@@ -39,7 +39,7 @@ elsif ARGV[0] == "uninstall"
elsif ARGV[0] == "extract":
if ARGV.size != 3
- puts "cljd extract <jar> <dir>"
+ puts "cljd extract <jar-file> <dir>"
else
jar = ARGV[1]
dir = ARGV[2]
View
@@ -1,29 +0,0 @@
-#!/bin/bash
-
-USER_CLJ_DIR=/Users/mmcgrana/Clojure
-SHARED_JARS_DIR=$USER_CLJ_DIR/jars
-
-BREAK_CHARS="(){}[],^%$#@\"\";:''|\\"
-COMPS=$USER_CLJ_DIR/completions
-
-# Local src, test, and classes
-CP=src/:test/:classes/
-
-# Local jars
-if [ -d jars ]; then
- for file in jars/*.jar; do
- CP=$CP:$file
- done
-fi
-
-# Global jars.
-for file in $SHARED_JARS_DIR/*.jar; do
- CP=$CP:$file
-done
-
-CP=$CP:$USER_CLJ_DIR
-if [ -z "$1" ]; then
- rlwrap --remember -c -b $BREAK_CHARS -f $COMPS java -cp $CP clojure.main -r
-else
- rlwrap --remember -c -b $BREAK_CHARS -f $COMPS java -cp $CP clojure.main -i $1 -r
-fi
View
@@ -1,26 +1,10 @@
#!/bin/bash
USER_CLJ_DIR=/Users/mmcgrana/Clojure
-SHARED_JARS_DIR=$USER_CLJ_DIR/jars
YOURKIT_DYLB="/Applications/YourKit.app/bin/mac/libyjpagent.jnilib"
-# Local src, test, and classes
-CP=src/:test/:classes/
-
-# Local jars
-if [ -d jars ]; then
- for file in jars/*.jar; do
- CP=$CP:$file
- done
-fi
-
-# Global jars.
-for file in $SHARED_JARS_DIR/*.jar; do
- CP=$CP:$file
-done
-
if [ -z "$1" ]; then
- echo "USAGE: cljp <script_file.clj>"
+ echo "Usage: cljp <script_file.clj>"
else
- java -cp $CP -agentpath:$YOURKIT_DYLB clojure.main $@
-fi
+ java -server -agentpath:$YOURKIT_DYLB -Xmx2g -cp `cljcp` clojure.main $USER_CLJ_DIR/run.clj $@
+fi
View
@@ -0,0 +1,11 @@
+(use 'clj-stacktrace.repl)
+(import 'clojure.lang.Compiler)
+
+(let [script-path (first *command-line-args*)
+ script-args (rest *command-line-args*)]
+ (binding [*command-line-args* script-args]
+ (try
+ (Compiler/loadFile script-path)
+ (catch Exception e
+ (pst-on *err* true e)
+ (System/exit 1)))))
View
@@ -1,42 +1,8 @@
-;; Announce
-(println "REPL Extensions")
-
-;; Always-used libs
(use
- '(clojure.contrib repl-utils repl-ln duck-streams)
- 'clj-backtrace.repl)
-
-;; Macroexpansion utils
-(defn- mapr
- "recursively maps a function to a sequence and
- subsequences within the map results."
- [f & sequence]
- (defn maprec [form]
- (if (seq? form)
- (map maprec (f form))
- form))
- (first (maprec sequence)))
-
-(defn macroexpand-r
- "Expands all macros in a form and its subforms."
- [forms]
- (mapr macroexpand forms))
-
-(defn macroexpand-only
- "Expands all macros in a form and its subforms that match a given symbol."
- [macro forms]
- (mapr
- (fn [f] (if (= macro (first f)) (macroexpand f) f))
- forms))
+ '(clojure.contrib repl-utils)
+ '(clj-stacktrace repl))
-;; General REPL functions
(defn quit
"Quit the clojure process with a 0 status code."
[]
(System/exit 0))
-
-(defn r
- "Enter the line-numbering repl"
- []
- (repl))
-

0 comments on commit 099fdf6

Please sign in to comment.