I recently decided to write a Ruby wrapper for the oRTP library so I can eventually implement a little RTSP server in Ruby. I wanted to use autotest for my testing, but it didn’t work out of the box since I’m testing code that lives in the ext/ directory. I wanted autotest to rebuild my extension after each change to the source file. So I came up with an .autotest file that looks like this:
Autotest.add_hook :run_command do |at| puts "Re-building extensions..." Dir.chdir(File.dirname(__FILE__) + "/ext") do `make` end end Autotest.add_hook :initialize do |at| at.add_mapping(%r{^ext/(\w+)\.c$}) do |f, md| at.files_matching(%r{test/test_#{md[1]}.rb}) end end
The beginnings of my code for this project is on teh Githubz.
