2019-05-13 14:52:13 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# Set directory to location of this script
|
|
|
|
|
# https://stackoverflow.com/a/3355423/1867984
|
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
|
2019-02-02 11:10:56 +00:00
|
|
|
yarn -v
|
2018-12-02 08:23:43 +01:00
|
|
|
node -v
|
2018-07-23 10:19:52 +02:00
|
|
|
echo 'Installing Gitbook CLI'
|
2019-03-04 12:51:53 +01:00
|
|
|
yarn global add gitbook-cli
|
2018-07-23 10:19:52 +02:00
|
|
|
|
|
|
|
|
echo 'Running Gitbook installation'
|
2019-03-04 12:51:53 +01:00
|
|
|
|
|
|
|
|
# Generate all version's GitBook output
|
2019-05-13 14:52:13 -04:00
|
|
|
# For each directory in /docs ...
|
|
|
|
|
cd ./docs/
|
2019-03-04 12:51:53 +01:00
|
|
|
for D in *; do
|
|
|
|
|
if [ -d "${D}" ]; then
|
|
|
|
|
|
2019-05-13 14:52:13 -04:00
|
|
|
echo "Generating output for: ${D}"
|
|
|
|
|
cd "${D}"
|
|
|
|
|
|
|
|
|
|
# Clear previous output, generate new
|
|
|
|
|
rm -rf _book
|
|
|
|
|
gitbook install
|
|
|
|
|
gitbook build
|
|
|
|
|
|
|
|
|
|
cd ..
|
2019-03-04 12:51:53 +01:00
|
|
|
|
2019-05-13 14:52:13 -04:00
|
|
|
fi
|
2019-03-04 12:51:53 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Move CNAME File into `latest`
|
2019-04-17 14:04:31 -04:00
|
|
|
cp CNAME ./latest/_book/CNAME
|
2019-03-04 12:51:53 +01:00
|
|
|
|
|
|
|
|
# Create a history folder in our latest version's output
|
|
|
|
|
mkdir ./latest/_book/history
|
|
|
|
|
|
|
|
|
|
# Move each version's files to latest's history folder
|
|
|
|
|
for D in *; do
|
|
|
|
|
if [ -d "${D}" ]; then
|
2019-05-13 14:31:00 -04:00
|
|
|
if [ "${D}" == v* ] ; then
|
2019-05-13 14:52:13 -04:00
|
|
|
|
|
|
|
|
echo "Moving ${D} to the latest version's history folder"
|
2019-03-04 12:51:53 +01:00
|
|
|
|
|
|
|
|
mkdir "./latest/_book/history/${D}"
|
2019-05-13 15:07:02 -04:00
|
|
|
cp -v -r "./${D}/_book"/* "./latest/_book/history/${D}"
|
2019-05-13 14:52:13 -04:00
|
|
|
|
2019-03-04 12:51:53 +01:00
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
done
|
2018-07-23 10:19:52 +02:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
|
|
# Build and copy the StandaloneViewer into the static directory
|
2019-04-29 07:03:54 -04:00
|
|
|
mkdir ./docs/latest/_book/demo/
|
2019-04-28 15:25:53 -04:00
|
|
|
yarn install
|
2019-04-29 07:03:54 -04:00
|
|
|
yarn build:web:ci
|