holy-project/auto-update

36 lines
930 B
Text
Raw Normal View History

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"
2013-11-21 13:53:04 +00:00
cabal install && \
2013-11-20 21:08:22 +00:00
./.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
2013-11-21 16:16:47 +00:00
tmp=$(date +"%s")
t=$tmp
2013-11-21 11:25:34 +00:00
while true; do
2013-11-21 16:16:47 +00:00
tmp=$t
t=$(date +"%s")
2013-11-21 11:25:34 +00:00
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)
2013-11-21 16:16:47 +00:00
(( $modtime > $tmp )) && print $fic
2013-11-21 11:25:34 +00:00
done
sleep 1
done | relaunchCompilation
;;
esac