Try a slightly revised generateStaticSite script

This commit is contained in:
dannyrb 2019-05-13 14:52:13 -04:00
parent 5e37931aad
commit 1679a0f93e

View File

@ -1,4 +1,9 @@
cd docs #!/bin/bash
# Set directory to location of this script
# https://stackoverflow.com/a/3355423/1867984
cd "$(dirname "$0")"
yarn -v yarn -v
node -v node -v
echo 'Installing Gitbook CLI' echo 'Installing Gitbook CLI'
@ -7,8 +12,11 @@ yarn global add gitbook-cli
echo 'Running Gitbook installation' echo 'Running Gitbook installation'
# Generate all version's GitBook output # Generate all version's GitBook output
# For each directory in /docs ...
cd ./docs/
for D in *; do for D in *; do
if [ -d "${D}" ]; then if [ -d "${D}" ]; then
echo "Generating output for: ${D}" echo "Generating output for: ${D}"
cd "${D}" cd "${D}"
@ -18,6 +26,7 @@ for D in *; do
gitbook build gitbook build
cd .. cd ..
fi fi
done done
@ -31,10 +40,12 @@ mkdir ./latest/_book/history
for D in *; do for D in *; do
if [ -d "${D}" ]; then if [ -d "${D}" ]; then
if [ "${D}" == v* ] ; then if [ "${D}" == v* ] ; then
echo "Moving ${D} to the latest version's history folder" echo "Moving ${D} to the latest version's history folder"
mkdir "./latest/_book/history/${D}" mkdir "./latest/_book/history/${D}"
mv -v "./${D}/_book"/**/* "./latest/_book/history/${D}" mv -v -r "./${D}/_book"/* "./latest/_book/history/${D}"
fi fi
fi fi
done done