clj.orcery

Language, Expression and Design

Tuesday

12

November 2013

Will the real file watcher please stand up?

by Chris Zheng, on random

These days, so many leiningen tools have a watch function - usually for plugins. When I run lein <command> watch, a process is spawned that looks at a directory, sees what files are changed and then does something with them. Most have to do with testing and documentation but tools like these are also slipping into development.

This is a really simple pattern and it should be standard but unfortunately it is not. Here are a bunch of implementations when I search for file watch clojure on google.

https://github.com/derekchiang/Clojure-Watch
https://github.com/marick/lein-midje
https://github.com/ibdknox/watchtower
https://github.com/klauern/java-watcher.clj
https://github.com/xsc/panoptic
https://github.com/weavejester/ns-tracker
https://github.com/stuartsierra/lazytest

I am sure there are many more libaries that implement this type of functionality. They all solve the same problem - Watch the directory for files that have changed; If files are changed, reload the files.

Node has an standard implementation clojure needs one too. Desperately.

comments powered by Disqus