Scope Autotest by filename

2007/02/28 16:23:16 +0000

In your ~/.autotest file:

Autotest.send(:alias_method, :real_find_files, :find_files)
Autotest.send(:define_method, :find_files) do |*args| 
  real_find_files.select do |k,v| 
     (ENV['AUTOTEST'] and ! ENV['AUTOTEST'].empty?) ?   
        Regexp.new(ENV['AUTOTEST']).match(k) : true
  end
end

And then set the AUTOTEST environment variable to a regex when you run it (even works for RSpec):

AUTOTEST='track|star|user' rake spec:autotest

No, I didn’t write this. If you did, please speak up! (It’s too many places on Google for me to deduce authorship.) You get a thousand kudos. Almost as many as Zenspider, who built Autotest, and therefor deserves more props than someone who mods it.

Comment on this post