2013-09-30 22:33:58 +02:00
|
|
|
notification :tmux, :color_location => 'status-right-bg'
|
|
|
|
|
|
|
|
|
|
def run(command)
|
|
|
|
|
if system(command)
|
|
|
|
|
n "OK", "Ble", :success
|
|
|
|
|
else
|
|
|
|
|
n "BAD", "Ble", :failed
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def run_test(file)
|
|
|
|
|
run("PYTHONPATH=tests nosetests #{file}")
|
|
|
|
|
end
|
|
|
|
|
|
2013-07-25 22:08:03 +02:00
|
|
|
guard 'shell' do
|
2013-09-30 22:33:58 +02:00
|
|
|
watch(%r{src/(.+)\.py$}) do |m|
|
2013-07-25 22:08:03 +02:00
|
|
|
test_filename = "tests/#{m[1]}_test.py"
|
|
|
|
|
|
|
|
|
|
if File.exists?(test_filename)
|
2013-09-30 22:33:58 +02:00
|
|
|
run_test(test_filename)
|
2013-07-25 22:08:03 +02:00
|
|
|
end
|
|
|
|
|
end
|
2013-09-30 22:33:58 +02:00
|
|
|
|
|
|
|
|
watch(%r{tests/.+\.py$}) { |m| run_test(m[0]) }
|
2013-07-25 22:08:03 +02:00
|
|
|
end
|