forked from Antisunny/doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-and-sync
executable file
·34 lines (31 loc) · 946 Bytes
/
update-and-sync
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# this script is used on hack.p6c.org as the 'doc.perl6.org' user to update
# the website.
source /home/rakudobrew/.rakudobrew-bash
set -e
set -x
cd ~/doc
git fetch
before=$(git rev-parse HEAD)
git checkout origin/master
after=$(git rev-parse HEAD)
if [ "$before" = "$after" ]
then
echo "nothing to do"
else
LOGDIR=$HOME/doc/html/build-log
mkdir -p "$LOGDIR"
DATE=$(date --iso-8601=minutes)
LOGFILE="$LOGDIR/build-$DATE.log";
echo "Writing logs to $LOGFILE";
exec >$LOGFILE 2>&1
echo 'Cleaning out old HTML files'
# don't clean out html/ entirely, because there are some files
# under version control there, and because of html/build-log/
find html/ -name '*.html' -delete
# if the htmilfy fails, sync the build log.
# since sync-build-log returns false, not the whole thing is synced
time ./htmlify.p6 || ./util/sync-build-log
./util/sync
fi
# vim: expandtab shiftwidth=4