#!/usr/bin/env bash
#Variables
# -------------------------
REPO="/home/vassilios/Sandbox/quartz"
SRC="$REPO/public/"
REMOTE="216.189.157.213"
DST="/var/www/htdocs/corruptlamar"
USERNAME="anoduck"
# ------------------------------------------
build() {
npx quartz build
}
alt_files() {
rg --files-with-matches\
--fixed-strings\
''\
| xargs -I % sed -i '//d' %
}
sync() {
# $SRC_PATH must be _closed_ and ends _with_ a "/".
# $DST_PATH must be _open_ and ends _with_ _NO_ "/".
rsync -azv -e ssh --delete "$SRC" "$USERNAME"@"$REMOTE":"$DST"
}
# ------------------------------------------
if [[ ! "$PWD" == "$REPO" ]]; then
cd "$REPO" || return
fi
build
cd "$SRC" || return
#alt_files
echo "Skipping cleaning of alt files"
cd "$REPO" || return
sync