Autotest and Me
Today, Mark and I were talking about some of the open source projects we've been working on. During our conversation, he mentioned how David's recent post about using Autotest on OSX was the catalyst for him to start using it on his projects. I decided that I would do the same, so I went about using it on a Ruby gem that I'm developing.
From the original post, using it on Rails is pretty straightforward, but getting it to work on a vanilla Ruby project requires a bit of tweaking. There's some outdated information out there, but I was able to find a solution that worked for me. My resulting .autotest file:
require 'autotest/growl' require 'autotest/fsevent' Autotest.add_hook :initialize do |at| at.clear_mappings at.add_mapping %r%/^lib/(.*).rb$% do |_, m| possible = File.basename(m[1]) files_matching %r%^test/.*(#{possible}_test|test_#{possible}).rb$% end at.add_mapping(%r%^test/.*.rb$%) {|filename, _| filename } end
With that patch in place, I get the results I want.
