autobuildSite

Jody Winter Ralf D. Müller Jody Winter Ralf D. Müller Schrotti Tim Riemer Alexander Schwartz Julian Elve

1 minute to read

About This Task

This script starts an endless loop which checks for changes to your docs source then re-runs the generateSite-task whenever it detects changes. The output will be logged to build/generateSite.log.

Source

bin/autobuildSite.bash
#!/bin/bash
DIR_TO_WATCH='src/'
#COMMAND='rm -r build || true && mkdir -p build/microsite/output/images/ && ./dtcw generateSite 2>&1 | tee build/generateSite.log'
COMMAND='mkdir -p build/microsite/output/images/ && ./dtcw generateSite 2>&1 | tee build/generateSite.log'

#execute first time
cp src/docs/images/ready.png build/microsite/output/images/status.png
#eval $COMMAND

#wait for changes and execute
while true ; do
  watch --no-title --chgexit "ls -lR ${DIR_TO_WATCH} | sha1sum"
  cp src/docs/images/building.png build/microsite/output/images/status.png
  eval "$COMMAND"
  cp src/docs/images/ready.png build/microsite/output/images/status.png
  sleep 6
done