3 ms·
Copying my comment from the blog: Instead of running a sync script every minute, you can just use filesystem events [1] notification to run your commit script
by aeontech 16y ago
Copying my comment from the blog:
Instead of running a sync script every minute, you can just use filesystem events [1] notification to run your commit script every time a file is changed. I have used the ruby wrapper for it [2], but apparently there's a perl one as well [3].
[1]: http://en.wikipedia.org/wiki/FSEvents http://en.wikipedia.org/wiki/FSEvents
[2]: https://github.com/sandro/ruby-fsevent https://github.com/sandro/ruby-fsevent
[3]: http://search.cpan.org/~agrundma/Mac-FSEvents-0.04/lib/Mac/FSEvents.pm http://search.cpan.org/~agrundma/Mac-FSEvents-0.04/lib/Mac/F...
- steveivy 16y agoOh, interesting; I was looking for something like this but hadn't worked out what to search for. Will read up on it for sure.
- steveivy 16y agoAlso, I'm told that the "modern" perl way to do this is AnyEvent: http://search.cpan.org/~mgrimes/AnyEvent-Filesys-Notify-0.05/lib/AnyEvent/Filesys/Notify.pm http://search.cpan.org/~mgrimes/AnyEvent-Filesys-Notify-0.05... Still backed by OS X's FSEvents, so you're not reinventing the wheel.
- aeontech 16y agoAh, nice. I just mentioned the first perl fsevents google result, AnyEvent definitely looks nicer :)