librelist archives

« back to archive

Re: [leiningen] (newbie/lein2) Executing a task on a source code change

Re: [leiningen] (newbie/lein2) Executing a task on a source code change

From:
Phil Hagelberg
Date:
2013-01-16 @ 18:04
Sean Corfield writes:

> Hmm, this sounds like a useful meta-task. Currently lein-autoexpect
> (and others) watch for source code changes and run specific tasks but
> it seems like it would be worth abstracting that out into a watcher
> meta-task?

Yeah, it's silly that every plugin would have to re-invent this; it's
basically a textbook case for when a higher-order task would make sense.
Could probably be done trivially with Ojo, though you would need some
rules to map file changes to task arguments.

  https://github.com/drakerlabs/ojo

-Phil

Re: [leiningen] (newbie/lein2) Executing a task on a source code change

From:
Jake McCrary
Date:
2013-01-16 @ 21:18
lein-autoexpect leans on clojure/tools.namespace for detecting changes.
Pretty trivial to detect file changes by just using
clojure.tools.namespace.dir/scan
and a loop.


https://github.com/clojure/tools.namespace/blob/master/src/main/clojure/clojure/tools/namespace/dir.clj



https://github.com/jakemcc/lein-autoexpect/blob/master/autoexpect/src/autoexpect/runner.clj



On Wed, Jan 16, 2013 at 12:04 PM, Phil Hagelberg <phil@hagelb.org> wrote:

>
> Sean Corfield writes:
>
> > Hmm, this sounds like a useful meta-task. Currently lein-autoexpect
> > (and others) watch for source code changes and run specific tasks but
> > it seems like it would be worth abstracting that out into a watcher
> > meta-task?
>
> Yeah, it's silly that every plugin would have to re-invent this; it's
> basically a textbook case for when a higher-order task would make sense.
> Could probably be done trivially with Ojo, though you would need some
> rules to map file changes to task arguments.
>
>   https://github.com/drakerlabs/ojo
>
> -Phil