.autotest 596 B

1234567891011121314151617181920
  1. require 'autotest/restart'
  2. Autotest.add_hook :run_command do |at|
  3. at.unit_diff = 'cat'
  4. system "#{Gem.ruby} -rubygems #{Gem.bin_path 'rake', 'rake'} generate"
  5. end
  6. Autotest.add_hook :initialize do |at|
  7. at.testlib = 'minitest/unit' if at.respond_to? :testlib=
  8. def at.path_to_classname(s)
  9. sep = File::SEPARATOR
  10. f = s.sub(/^test#{sep}/, '').sub(/\.rb$/, '').split(sep)
  11. f = f.map { |path| path.split(/_|(\d+)/).map { |seg| seg.capitalize }.join }
  12. f = f.map { |path| path =~ /^Test/ ? path : "Test#{path}" }
  13. f.join('::').gsub('Rdoc', 'RDoc').gsub('Ri', 'RI')
  14. end
  15. end