-
Notifications
You must be signed in to change notification settings - Fork 192
Expand file tree
/
Copy pathpublish.sh
More file actions
68 lines (60 loc) · 3.27 KB
/
Copy pathpublish.sh
File metadata and controls
68 lines (60 loc) · 3.27 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# this script assumes that you have cloned https://github.com/lunduniversity/lunduniversity.github.io repo
# into the WEB_LOCAL_GITHUB dir
WEB_LOCAL_GITHUB=../lunduniversity.github.io
WEB_LOCAL_GITHUB_PATH=src/pgk/resources
WEB_LOCAL_GITHUB_DEST=$WEB_LOCAL_GITHUB/$WEB_LOCAL_GITHUB_PATH
WEB_REMOTE_LU=fileadmin.cs.lth.se
HERE=$(pwd)
echo "*** scp pdfs to $WEB_REMOTE_LU"
scp compendium/*.pdf slides/*.pdf quickref/quickref*.pdf plan/courseplan/courseplan.pdf $LUCATID@$WEB_REMOTE_LU:/Websites/Fileadmin/pgk/.
scp workspace/w01_kojo/kojo.scala $LUCATID@$WEB_REMOTE_LU:/Websites/Fileadmin/.
# English mirror (generated by the autotranslate sub-project; -en filenames don't clash with the
# Swedish ones, so they go in the same pgk/ dir). Only published if the *-en PDFs have been built
# (sbt pdfCompendiumEn ; sbt "pdfSlidesEn w01 w02 ..."); the guards skip silently if none exist yet.
echo "*** scp ENGLISH pdfs to $WEB_REMOTE_LU"
ls compendium-en/*.pdf >/dev/null 2>&1 && scp compendium-en/*.pdf $LUCATID@$WEB_REMOTE_LU:/Websites/Fileadmin/pgk/. || echo " (no compendium-en/*.pdf yet — run 'sbt pdfCompendiumEn')"
ls slides-en/*.pdf >/dev/null 2>&1 && scp slides-en/*.pdf $LUCATID@$WEB_REMOTE_LU:/Websites/Fileadmin/pgk/. || echo " (no slides-en/*.pdf yet — run 'sbt \"pdfSlidesEn w01 ...\"')"
for f in plan/*-generated.html glossary/*-generated.html
do
b=$(basename $f)
dest=$WEB_LOCAL_GITHUB_DEST/$b
echo "Checking changes to $f"
echo " vs $dest"
if ! cmp -s $f $dest
then
echo " outdated: $dest"
echo
echo "*** copy $b to local git and commit changes ***"
cp -i $f $dest && \
cd $WEB_LOCAL_GITHUB && \
source build.sh && \
git add $WEB_LOCAL_GITHUB_PATH/$b && \
git status && \
git commit -m "update $WEB_LOCAL_GITHUB_PATH/$b" && \
git push
cd $HERE
else
echo " no changes: $f"
fi
done
# ---------------------------------------------------------------------------------
# STALE-LINK WARNING -- the coupling that has no detector.
# muntabot deep-links into compendium.pdf by PHYSICAL PAGE NUMBER, so republishing the
# compendium re-paginates it and every muntabot link silently points into the PREVIOUS
# pagination until the headings are regenerated and muntabot is redeployed. Nothing
# catches this: the links still resolve, they just land on the wrong page. Hence a
# warning here rather than a check somewhere else.
# ---------------------------------------------------------------------------------
echo
echo "*** compendium.pdf was republished -- checking whether muntabot's links are now stale"
sbt --client checkMuntabot || echo " (checkMuntabot unavailable -- assume STALE and refresh)"
echo
echo " If that says STALE, refresh with:"
echo " sbt gen # re-read page numbers from the pdf just published"
echo " sbt syncMuntabot # copy the headings table AND the sv->en label map to a muntabot clone"
echo " (cd ../../bjornregnell/muntabot && ./publish.sh)"
echo " The English labels muntabot shows are what compendium-en.pdf prints, so if the"
echo " English headings changed, rebuild it first (sbt pdfCompendiumEn) or 'sbt gen' will"
echo " regenerate the map from the OLD English edition."
echo " Skip only if compendium.pdf did not actually change."
echo