From dc2fd65e6bfeaa2c475d5042f64263ac9427c22f Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Tue, 8 Nov 2022 10:28:58 -0800 Subject: completely changed backend --- build.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 build.sh (limited to 'build.sh') diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..831304c --- /dev/null +++ b/build.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# Date: 9/30/2022 +# Author: Preston Pan +# Description: A generic static site generator with plugin support written in exclusively POSIX shell. +# Automatically deploys website to git and web servers. + + +# edit the following variables if you are to change the project layout +# Also edit the variables for the lite version of the website. +echo "Making main website..." +export TEMPLATE_DIR="./templates" +export TEMPLATE_BUILD_DIR="./build_template" +export DEFAULT_TEMPLATE="$TEMPLATE_DIR/base.html" +export BUILD_DIR="./build" +export PLUG_DIR="./plugins" + +# we want to rebuild the entire thing every time +rm -rf "$BUILD_DIR" +mkdir "$BUILD_DIR" +rm -rf "$TEMPLATE_BUILD_DIR" +cp -r "$TEMPLATE_DIR" "$TEMPLATE_BUILD_DIR" + +# copy directory structure of website without copying the files +find ./website -type d | xargs -I{} mkdir -p "$BUILD_DIR/{}" + +# With all the preparation done, it hands execution over to the process_file script. +find ./website -type f -exec ./process_file {} \; || exit 1 + +./finalize_build.sh +if [ $# -eq 0 ]; then + exit 0 # and exits 0 if successful and no commit message was supplied. +fi + +# Change this line if you are a future PSIIan maintaining this. +rsync -uvrP --delete-after "$BUILD_DIR/website/" root@prestonpan.tech:/var/www/prestonpan +git add . + +git commit -m "$1" +git push origin master -- cgit