inotify support for autotest
autotest is a really great tool. But my laptop is too old and the current autotest method to detect modifications is a bit heavy for it.
Like Mark Scottishclimbs, I thought about using ruby-inotify to detect changes in source files.
Add to your .autotest file this piece of code to add inotify support. A small change in Autotest#wait_for_changes replaces the simple sleep by a waiting of an inotify event.
Update: ruby-inotify seems buggy. I’ve switched successfully the implementation to inotify. Just download INotify-0.3.0.rb into your load path (such /usr/local/lib/site_ruby/1.8). No native library is required.
December 19th, 2007 at 1:20 pm
I dunno what lappy you’re running on, but it ran very light on my 12″ pb (1.2Mhz PPC G4?).
autotest’s file scan runs proportional to the number of files in the directory tree it starts in (obviously) minus the files you tell it to exclude.
If you’re doing rails development and have a way packed vendor dir, add vendor to the exclusions regexp (it’ll be a much cleaner process in the next release of zentest) and you should see a drop in CPU.
January 6th, 2008 at 3:22 am
I ran into this problem too with a packed vendor directory and the rspec_on_rails plugin. Here’s my solution: http://blog.netphase.com/2008/01/05/autotest-cpu-fix/
January 22nd, 2008 at 3:00 am
What bugs did you run into with ruby-inotify? You solution requires that /dev/inotify exist, and that doesn’t exist on my system (I heard that it got phased out, something about inotifyfs)… I also ran across RInotify which i haven’t tried yet: http://rubyforge.org/projects/rinotify/
anyways, I wrote a little script with ruby-inotify and it’s been working ok to monitor directory changes for the last 15 minutes or so, just curious what I have to watch out for.
February 27th, 2008 at 3:09 pm
Are there really bugs in ruby-inotify?
I am a bit unsure now, would be nice if you could explain what is the problem
April 23rd, 2008 at 9:23 am
If you’re running high CPU on autotest, you either have too much crap in your project and/or you’re not excluding enough in your .autotest.
I won’t be touching inotify or any other platform specific hacks.