-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs.sh
More file actions
executable file
·45 lines (41 loc) · 1.11 KB
/
docs.sh
File metadata and controls
executable file
·45 lines (41 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
# Check working directory is the root directory of the PCT repository
if [ ! -d "docs/md" ]; then
echo 'Please run this script from the root directory of the PCT project.'
exit 1
fi
# Check hugo extended is installed
if ! hugo version | grep -q 'extended'; then
echo 'The "extended" version of hugo was not found, please install it.'
exit
fi
# Check git is installed
if ! type "git" > /dev/null; then
echo "Git version control was not found, please install it."
exit
fi
# Check if npm is installed
if ! type "npm" > /dev/null; then
echo "NPM was not found, please install it."
exit
fi
if [ ! -d "docs/site" ]; then
git clone https://github.com/puppetlabs/devx.git docs/site
cd docs/site
echo "replace github.com/jay7x/pct/docs/md => ../md" >> go.mod
npm install
else
cd docs/site
git pull
hugo mod clean
fi
# Check for -D flag to see if user wants to run the site with draft pages displayed
flag=''
while getopts 'D' opt; do
case $opt in
D) flag='-D' ;;
esac
done
git submodule update --init --recursive --depth 50
hugo mod get
hugo server $flag