-
-
Save petRUShka/8f84f0361cfb3b216f83 to your computer and use it in GitHub Desktop.
watchr for c\ccp files and unit testing with Google Test Frameforwk
This file contains 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
ENV["WATCHR"] = "1" | |
system 'clear' | |
def run(cmd) | |
puts(cmd) | |
system(cmd) | |
end | |
def growl(result) | |
message = result ? "OK" : "FAILED" | |
growlnotify = `which notify-send`.chomp | |
title = "Watchr Test Results" | |
image = (result) ? ".watchr_images/passed.png" : ".watchr_images/failed.png" | |
options = %("#{title}" "#{message}" -i #{File.expand_path(image)}) | |
system %(#{growlnotify} #{options} &) | |
end | |
watch( '(.+)(\.c|_test\.cpp|\.h)$' ) do |md| | |
result = run("g++ #{md[1]}_test.cpp #{md[1]}.c -lgtest_main -lgtest -pthread -o #{md[1]}_test && ./#{md[1]}_test") | |
growl result | |
puts ("\n\n") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment