librelist archives

« back to archive

(newbie/lein2) Executing a task on a source code change

(newbie/lein2) Executing a task on a source code change

From:
Colin Yates
Date:
2013-01-16 @ 13:03
Hi,

I have a bunch of coffeescript files that I want compiled whenever they
change.  I have a shell script to do this which calls the coffeescript
compiler but I have to run that manually (I realise the coffeescript
compiler has the ability to continuously watch a directory for me).  I
found one useful resource (

http://blog.arc90.com/2012/07/19/compile-your-coffeescript-along-with-your-clojure/)
which executes an external task whenever the code is compiled, but again
that is a one-off execution.

I want to do something similar to sbt's "~" functionality i.e. "sbt ~tests"
will run your tests whenever the source code changes.  Is this possible in
lein?

Any ideas?

Thanks in advance.

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

From:
Sean Corfield
Date:
2013-01-16 @ 16:47
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?

On Wed, Jan 16, 2013 at 5:03 AM, Colin Yates <colin.yates@gmail.com> wrote:
> Hi,
>
> I have a bunch of coffeescript files that I want compiled whenever they
> change.  I have a shell script to do this which calls the coffeescript
> compiler but I have to run that manually (I realise the coffeescript
> compiler has the ability to continuously watch a directory for me).  I found
> one useful resource
> 
(http://blog.arc90.com/2012/07/19/compile-your-coffeescript-along-with-your-clojure/)
> which executes an external task whenever the code is compiled, but again
> that is a one-off execution.
>
> I want to do something similar to sbt's "~" functionality i.e. "sbt ~tests"
> will run your tests whenever the source code changes.  Is this possible in
> lein?
>
> Any ideas?
>
> Thanks in advance.



-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

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

From:
Peter Buckley
Date:
2013-01-16 @ 17:13
I've used ruby's guard (https://github.com/guard/guard) for stuff like this
(even to watch and run python scripts when they changed). Might be a place
to look for ideas for a leiningen watcher meta-task as Sean mentions.

On Wednesday, January 16, 2013, Sean Corfield wrote:

> 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?
>
> On Wed, Jan 16, 2013 at 5:03 AM, Colin Yates 
<colin.yates@gmail.com<javascript:;>>
> wrote:
> > Hi,
> >
> > I have a bunch of coffeescript files that I want compiled whenever they
> > change.  I have a shell script to do this which calls the coffeescript
> > compiler but I have to run that manually (I realise the coffeescript
> > compiler has the ability to continuously watch a directory for me).  I
> found
> > one useful resource
> > (
> 
http://blog.arc90.com/2012/07/19/compile-your-coffeescript-along-with-your-clojure/
> )
> > which executes an external task whenever the code is compiled, but again
> > that is a one-off execution.
> >
> > I want to do something similar to sbt's "~" functionality i.e. "sbt
> ~tests"
> > will run your tests whenever the source code changes.  Is this possible
> in
> > lein?
> >
> > Any ideas?
> >
> > Thanks in advance.
>
>
>
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>


-- 
The king’s heart is like a stream of water directed by the Lord; He guides
it wherever He pleases.