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