summaryrefslogtreecommitdiff
path: root/hooks/post-receive
blob: 78c0bd4113e6cd638834d76e854d00cda60470b0 (plain)
    1 #!/usr/bin/env bash
    2 
    3 _web="${WEB}/oper.io.git/master"
    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 [ "$(dirname ${i})" = 'src' ]; then
   19     recompile=1
   20 
   21   else
   22     # Don't want to use dest for this, as we don't want to change file
   23     # extentions
   24     install -D "${i}" "${_web}/${i}"
   25   fi
   26 done
   27 
   28 if [ "${recompile}" -eq 1 ]; then
   29     make src
   30     install -v -D index "${_web}/index"
   31 fi
   32 
   33 # Clean up any deleted files
   34 for i in ${FILES_D[*]}; do
   35   # Pre-determine path for processed files
   36   out="${_web}/html/$(basename ${i%.*}).html"
   37 
   38   if [ -e "${_web}/${i}" ]; then
   39     _log "Deleting file ${i}"
   40     rm -f "${_web}/${i}"
   41   elif [ -e "${out}" ]; then
   42     _log "Deleting post ${out}"
   43     rm -f "${out}"
   44   fi
   45 done

Generated by cgit