Created
July 21, 2011 08:42
-
-
Save martinrehfeld/1096802 to your computer and use it in GitHub Desktop.
Erlang "autotest" -- run your eunit suites automatically when changing files (uses rebar + Ruby guard)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
group :development, :test do | |
gem 'guard-shell' | |
gem 'rb-fsevent' | |
gem 'growl' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# automatically run the eunit tests | |
def run_eunit(src, suite) | |
if File.exist?(File.join(File.dirname(__FILE__), 'test', "#{suite}_tests.erl")) | |
cmd = "./rebar eunit skip_deps=true suite=#{suite}" | |
puts "Executing #{cmd}" | |
puts `#{cmd}` | |
if $? == 0 | |
Growl.notify_ok "#{suite}: eunit passed." | |
else | |
Growl.notify_error "#{suite}: eunit failed." | |
end | |
else | |
puts "No tests for #{suite.inspect}" | |
Growl.notify_warning "No tests for #{suite}!" | |
end | |
end | |
guard 'shell' do | |
watch(%r{(src|test)/([^.].*?)(_tests)?.erl}) {|m| run_eunit(m[1], m[2]) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment