Skip to content

Instantly share code, notes, and snippets.

@koko1000ban
Created May 21, 2012 06:08
Show Gist options
  • Save koko1000ban/2760708 to your computer and use it in GitHub Desktop.
Save koko1000ban/2760708 to your computer and use it in GitHub Desktop.
configuration example in watchr for c++, cmake
#-*- coding: utf-8 -*-
#-*- mode: ruby-mode;-*-
$out_dir = 'build'
def run_test
system("cd #{$out_dir}; make all && ./a.out -vmodule='hoge=0,foo=2' -logtostderr=1")
end
watch('CMakeLists.txt'){|md|
run_test
}
watch('^src/(.*)\.(c|cc|cpp|h|hpp)$'){|md|
run_test
}
watch('^srclib/(.*)\.(c|cc|cpp|h|hpp)$'){|md|
run_test
}
watch('^test/(.*)\.(c|cc|cpp|h|hpp)$'){|md|
run_test
}
watch('^include/(.*)\.(c|cc|cpp|h|hpp)$'){|md|
run_test
}
watch('^lib/(.*)\.(c|cc|cpp|h|hpp)$'){|md|
run_test
}
watch('\.watchr'){|md|
run_test
}
if !File.exists?($out_dir)
Dir.mkdir($out_dir)
system("cd #{$out_dir}; cmake ..")
end
Signal.trap('QUIT') do
puts " --- Running all tests ---\n\n"
run_test
end
Signal.trap('INT'){
abort("\n")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment