views:

42

answers:

2

I find the integration with RSpec, Growl and rails particularly useful. However, it takes about two to three seconds before a change (save file) is picked up by autotest.

Is there a way to increase the interval by which autotest scans for filechanges?

+1  A: 

If you are on Mac OS X then you can try autotest-fsevent or autotest-inotify if you are on Linux. They will replace the standard Autotest filesystem polling to instead listen to events from the OS.

Jonas Elfström
I have installed autotest-fsevent as I'm on a Mac, but it does not seem to make a difference. There is a 3 second gap between the "save" and the running of the tests in the adjusted spec. I have verified this manually by having both textmate and activity monitor next to each other. Perhaps I'm missing something?
Tom
Did you add require 'autotest/fsevent' after all other requires in your ~/.autotest file?
Jonas Elfström
yep, but my ~/.autotest is rather empty. This is what I have in it:require 'autotest/growl'require 'autotest/fsevent'BTW: I'm also running spork, but that does not seem to make much difference
Tom
One of those seconds comes from the 1.0s latency in http://github.com/svoop/autotest-fsevent/blob/master/ext/fsevent/fsevent_sleep.c
Jonas Elfström
Well, how long does it take on average on your machine? I'm on a fairly quick macbook pro 2.4GHz
Tom
And another one from http://github.com/svoop/autotest-fsevent/blob/master/lib/autotest/fsevent.rb Kernel.sleep `self.sleep`. I suggest trying to change both of those to something low like 0.1 but not 0.
Jonas Elfström
I'm on an old Linux box and right now not even using autotest. The speed of the machine should have very little to do with it.
Jonas Elfström
Ok, not quite sure how to apply the changes; have to admit that I've only recently made the switch to Ruby (coming from .Net)
Tom
I understand. This is not changes one usually should have to make. The change of fsevent.rb is simple. Run `gem environment` to see where the gem files are and then fire up your text editor and change self.sleep to 0.1. The C code change is a bit trickier because you have to recompile it.
Jonas Elfström
A: 

Are you using Spork? Spork is a separate server that you can load Rails into for your test suite. Michael Hart's book shows you how to set it up.

monocle
Yes, I'm using spork (actually I'm following Michheal's tutorial to the letter). Having spork run in the background does not make a difference.
Tom