forked from nikitabobko/AeroSpace
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-docs.sh
executable file
·40 lines (33 loc) · 894 Bytes
/
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
#!/bin/bash
cd "$(dirname "$0")"
source ./script/setup.sh
rm -rf .site && mkdir .site
rm -rf .man && mkdir .man
cp-docs() {
cp -r docs/*.adoc $1
cp -r docs/assets $1
cp -r docs/util $1
cp -r docs/config-examples $1
}
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