Skip to content

Instantly share code, notes, and snippets.

@weavejester
Created March 9, 2009 02:02
Show Gist options
  • Save weavejester/76053 to your computer and use it in GitHub Desktop.
Save weavejester/76053 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Bash script to automatically run a test suite every time a file is modified
# in the src or test directories. Plays a sound file to tell the user what's
# happening in an unobtrusive fashion.
PLAY="mplayer -really-quiet -nolirc"
while true; do
# Wait until a file has been changed
inotifywait -e close_write -e move -e delete -qq -r src test
# If git registers a change
if git status | grep -q "git add"; then
$PLAY $HOME/Sounds/working.wav
# Run the unit tests quietly
if script/test -o quiet; then
$PLAY $HOME/Sounds/pass.wav
else
$PLAY $HOME/Sounds/fail.wav
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment