2013-11-20 21:08:22 +00:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
|
|
|
relaunchCompilation() {
|
|
|
|
while read line; do
|
|
|
|
if (( $( print -- $line | grep '.cabal-sandbox' | wc -l) == 0 )); then
|
|
|
|
print "$line"
|
|
|
|
cabal install
|
|
|
|
./.cabal-sandbox/bin/test-holy-project
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2013-11-21 11:25:34 +00:00
|
|
|
case $(uname) in
|
|
|
|
Darwin)
|
|
|
|
# On mac OS X, use hobbes (cabal install hobbes)
|
|
|
|
# launch a cabal install and cabal test after each
|
|
|
|
# small haskell file modification
|
|
|
|
{hobbes "*.hs" | relaunchCompilation } &
|
|
|
|
hobbes "*.cabal" | relaunchCompilation
|
|
|
|
;;
|
|
|
|
*) # On other Unixes
|
|
|
|
currenttime=$(date +"%s")
|
|
|
|
while true; do
|
|
|
|
for fic in {src,test}/**/*.hs(.) *.cabal; do
|
|
|
|
# note to use on OS X, use "stat -f %m $checkfile" instead
|
|
|
|
modtime=$(stat --printf %Y $fic)
|
|
|
|
(( $modtime > $currenttime)) && print $fic
|
|
|
|
done
|
|
|
|
currenttime=$(date +"%s")
|
|
|
|
sleep 1
|
|
|
|
done | relaunchCompilation
|
|
|
|
;;
|
|
|
|
esac
|