Created
July 17, 2018 01:31
-
-
Save seven1m/5dcc4c9f47f066360f59139fe1884a8e to your computer and use it in GitHub Desktop.
Observr script for comiling a Rust project and running tests when files are saved.
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
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