Created
November 12, 2011 05:26
-
-
Save jesseadams/1360090 to your computer and use it in GitHub Desktop.
Automatically execute phpunit
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
#!/bin/bash | |
# | |
# Automatically run phpunit when you save a test | |
# | |
# Requires: inotify-tools | |
# | |
################### | |
path=$1 | |
orig_dir=`pwd` | |
if [ -z $path ]; then | |
if [ -f "phpunit.xml" ]; then | |
path=`pwd` | |
else | |
echo "Please specify the path to your phpunit.xml" | |
exit 2 | |
fi | |
fi | |
while [ 1 ]; do | |
echo "Watching $path..." | |
inotifywait -qqr $path --exclude 'swp$' --event modify | |
cd $path | |
phpunit $path | |
cd $orig_dir | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment