Created
August 28, 2017 06:51
-
-
Save Integralist/548e1d149e15003b5c799da2520ed46c to your computer and use it in GitHub Desktop.
[Hugo build script for User page] #github #hugo #build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function contains { | |
local e match="$1" | |
shift | |
for e; do [[ "$e" == "$match" ]] && return 0; done | |
return 1 | |
} | |
function remove_toplevel { | |
local blacklist=(build.sh CNAME keybase.txt src) | |
local trigger=0 | |
for i in *; do | |
if contains "$i" "${blacklist[@]}"; then | |
trigger=1 | |
echo "this is a blacklist file: $i" | |
else | |
rm -rf "$i" | |
fi | |
done | |
if [[ $trigger -eq 1 ]]; then | |
printf "\n...we won't delete these files.\n\n" | |
fi | |
} | |
function build_site { | |
pushd "./src" 1>/dev/null | |
hugo | |
cp -r ./public/ ../ | |
popd 1>/dev/null | |
} | |
remove_toplevel | |
build_site |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment