blob: 1d6437e8c794b5c67da9a3f4f4dc55c390e132e7 (
plain)
1 #!/usr/bin/env bash
2
3 _web="${WEB}/oper.io"
4 recompile=0
5
6 # Deploy any pages that were changed
7 for i in ${FILES_E[*]} ${FILES_A[*]} ${FILES_M[*]}; do
8 _log "Processing and installing ${i}"
9
10 if [ "${i##*.}" = 'adoc' ]; then
11 dest="${_web}/html/$(basename ${i%.*}).html"
12 make adoc SRC="${i}" DEST="${dest}"
13
14 elif [ "${i##*.}" = 'rst' ]; then
15 dest="${_web}/html/$(basename ${i%.*}).html"
16 make rst SRC="${i}" DEST="${dest}"
17
18 elif [ "${i##*.}" = 'md' ]; then
19 dest="${_web}/html/$(basename ${i%.*}).html"
20 make md SRC="${i}" DEST="${dest}"
21
22 elif [ "$(dirname ${i})" = 'src' ]; then
23 recompile=1
24
25 else
26 # Don't want to use dest for this, as we don't want to change file
27 # extentions
28 install -v -D "${i}" "${_web}/${i}"
29 fi
30 done
31
32 if [ "${recompile}" -eq 1 ]; then
33 make src
34 install -v -D index "${_web}/index"
35 fi
36
37 # Clean up any deleted files
38 for i in ${FILES_D[*]}; do
39 # Pre-determine path for processed files
40 out="${_web}/html/$(basename ${i%.*}).html"
41
42 if [ -e "${_web}/${i}" ]; then
43 _log "Deleting file ${i}"
44 rm -f "${_web}/${i}"
45 elif [ -e "${out}" ]; then
46 _log "Deleting post ${out}"
47 rm -f "${out}"
48 fi
49 done
|