Skip to content

Instantly share code, notes, and snippets.

@bryanwoods
Forked from PatrickTulskie/.autotest.rb
Created January 13, 2010 21:39
Show Gist options
  • Save bryanwoods/276601 to your computer and use it in GitHub Desktop.
Save bryanwoods/276601 to your computer and use it in GitHub Desktop.
require 'autotest/fsevent'
require 'autotest/growl'
require 'redgreen/autotest'
require 'autotest/restart'
require 'autotest/timestamp'
# require 'autotest/autoupdate'
# ===================================================
# = Monkey patch to make autotest not use unit diff =
# ===================================================
class Autotest
def make_test_cmd files_to_test
cmds = []
full, partial = reorder(files_to_test).partition { |k,v| v.empty? }
base_cmd = "#{ruby} -I#{libs} -rubygems"
unless full.empty? then
classes = full.map {|k,v| k}.flatten.uniq
classes.unshift testlib
cmds << "#{base_cmd} -e \"%w[#{classes.join(' ')}].each { |f| require f }\""
cmds << " | #{unit_diff}" if unit_diff
end
partial.each do |klass, methods|
regexp = Regexp.union(*methods).source
cmds << "#{base_cmd} #{klass} -n \"/^(#{regexp})$/\""
cmds << " | #{unit_diff}" if unit_diff
end
return cmds.join("#{SEP} ")
end
end
# =======================================
# = Configure Autotest's initialization =
# =======================================
Autotest.add_hook :initialize do |autotest|
%w{.git .svn .hg .DS_Store db log tmp vendor ._* .sqlite3}.each { |exception| autotest.add_exception(exception) }
autotest.unit_diff = nil
end
# ================================
# = Autotest Growl configuration =
# ================================
Autotest::Growl::show_modified_files = true
Autotest::Growl::one_notification_per_run = true
Autotest::Growl::clear_terminal = false
Autotest::Growl::hide_label = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment