Observr script for comiling a Rust project and running tests when files are saved.
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
require 'open3' | |
def test | |
puts | |
puts '=========================================' | |
puts | |
_, stdout, wait_thr = Open3.popen2('cargo test -- --nocapture --test-threads=1') | |
print stdout.getc until stdout.eof? | |
wait_thr.value.success? | |
end | |
def build | |
puts | |
puts '=========================================' | |
puts | |
_, stdout, wait_thr = Open3.popen2('cargo build') | |
print stdout.getc until stdout.eof? | |
wait_thr.value.success? | |
end | |
def bench | |
puts | |
puts '=========================================' | |
puts | |
_, stdout, wait_thr = Open3.popen2('cargo bench -- --nocapture') | |
print stdout.getc until stdout.eof? | |
wait_thr.value.success? | |
end | |
watch('^src/.*') { test && build } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment