#!/usr/bin/env bash deploy() { local path="${1}" local recompile=0 # Deploy any pages that were changed for i in ${FILES_E[*]} ${FILES_A[*]} ${FILES_M[*]}; do _log "Processing and installing ${i}" if [ "${i##*.}" = 'adoc' ]; then dest="${path}/html/$(basename ${i%.*}).html" make adoc SRC="${i}" DEST="${dest}" elif [ "${i##*.}" = 'rst' ]; then dest="${path}/html/$(basename ${i%.*}).html" make rst SRC="${i}" DEST="${dest}" elif [ "${i##*.}" = 'md' ]; then dest="${path}/html/$(basename ${i%.*}).html" make md SRC="${i}" DEST="${dest}" elif [ "$(dirname ${i})" = 'src' ]; then recompile=1 else # Don't want to use dest for this, as we don't want to change file # extentions install -v -D "${i}" "${path}/${i}" fi done if [ "${recompile}" -eq 1 ]; then make src install -v -D index "${path}/index" fi # Clean up any deleted files for i in ${FILES_D[*]}; do # Pre-determine path for processed files out="${path}/html/$(basename ${i%.*}).html" if [ -e "${path}/${i}" ]; then _log "Deleting file ${i}" rm -f "${path}/${i}" elif [ -e "${out}" ]; then _log "Deleting post ${out}" rm -f "${out}" fi done } deploy "${WEB}/oper.io"