holy-project/auto-update
Yann Esposito (Yogsototh) 1076958f14 small updates
2013-11-21 17:16:47 +01:00

35 lines
930 B
Bash
Executable file

#!/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
}
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
tmp=$(date +"%s")
t=$tmp
while true; do
tmp=$t
t=$(date +"%s")
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 > $tmp )) && print $fic
done
sleep 1
done | relaunchCompilation
;;
esac