-
-
Notifications
You must be signed in to change notification settings - Fork 115
/
build-docs.sh
executable file
·49 lines (41 loc) · 1.15 KB
/
build-docs.sh
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
46
47
48
49
#!/bin/bash
cd "$(dirname "$0")"
source ./script/setup.sh
rm -rf .site && mkdir .site
rm -rf .man && mkdir .man
build_version="0.0.0-SNAPSHOT"
while [[ $# -gt 0 ]]; do
case $1 in
--build-version) build_version="$2"; shift 2;;
*) echo "Unknown option $1" > /dev/stderr; exit 1 ;;
esac
done
cp-docs() {
cp -r docs/*.adoc "$1"
cp -r docs/assets "$1"
cp -r docs/util "$1"
cp -r docs/config-examples "$1"
sed -i '' "1 s/.*/v$build_version/" "$1/util/site-attributes.adoc"
}
build-site() {
cp-docs .site
cd .site
# Delete "aerospace " prefifx in synopsis
sed -E -i '' '/tag::synopsis/, /end::synopsis/ s/^(aerospace | {10})//' aerospace*
bundler exec asciidoctor ./guide.adoc ./commands.adoc ./goodness.adoc
rm -rf ./*.adoc
cd - > /dev/null
git rev-parse HEAD > .site/version.html
if ! test -z "$(git status --porcelain)"; then
echo "git working directory is dirty" >> .site/version.html
fi
}
build-man() {
cp-docs .man
cd .man
bundler exec asciidoctor -b manpage aerospace*.adoc
rm -rf -- *.adoc
cd - > /dev/null
}
build-site
build-man