On Sun, 14 Feb 2010 22:32:45 -0800 (PST)
ataggart <alex.tagg...@gmail.com> wrote:

> On Feb 14, 6:47 pm, Mike Meyer <mwm-keyword-googlegroups.
> 620...@mired.org> wrote:
> > So, the next question - possibly another name-space question.
> >
> > Is there any way to tell if inside a .clj file if it was invoked as a
> > script by clojure.main, vs. being loaded for use elsewhere?
> No.

To bad. It's really handy, especially as it starts trickling into
system modules. You get one file that provides the simple command line
usage plus functions that allow user to get to advanced usage. It also
restores functionality that appears to be available in Java but not
clojure, in that properly written scripts can then be invoked either
from the command line, or as a function by an external caller.

Wouldn't be hard to do, either. Just bind *script-name* (or some such)
to the path in script-opt, and let the client decide if it's the same
as *file*.

> > What I'd like to do is make my unit tests usable in two modes: While
> > working on a bug, I'd like to be able to load them in the REPL to
> > rerun the subset of interest - possibly just the test which is
> > failing. However, I'd also like to be able to feed the script to
> > clojure.main with something like "clj test.clj" and have it run them
> > all.
> 
> java -cp path/to/clojure.jar:path/to/your/src clojure.main -e "(run-
> tests 'your.namespace)"

This doesn't work - run-tests isn't defined, you have to load
clojure.test to get it. Even if you wrap the clojure invocation up in
a shell script, it's still sort of ugly.

  <mike
-- 
Mike Meyer <m...@mired.org>             http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to