forked from php-build/php-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-docs.sh
executable file
·63 lines (49 loc) · 1.22 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
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
TEMP_PAGES_DIR=/var/tmp/php-build-gh-pages
GIT_REPO="[email protected]:php-build/php-build"
update_gh_pages() {
if [ -d "$TEMP_PAGES_DIR" ]; then
local cwd="$(pwd)"
cd "$TEMP_PAGES_DIR"
git pull --ff origin gh-pages
cd "$cwd"
else
git clone "$GIT_REPO" -b gh-pages "$TEMP_PAGES_DIR"
fi
cp -R man/ "$TEMP_PAGES_DIR/man"
local cwd="$(pwd)"
cd "$TEMP_PAGES_DIR"
git add --all "$TEMP_PAGES_DIR/man"
git commit -m "Update man pages"
git push origin gh-pages
cd "$cwd"
}
VERSION="$1"
if [ -z "$RONN_PATH" ]; then
ronn=$(which ronn)
else
ronn="$RONN_PATH"
fi
if [ -z "$ronn" ] || [ ! -f "$ronn" ]; then
echo "Seams like ronn is not installed." >&2
read -p "Install ronn? (y/n) " INSTALL_RONN
if [ -z "$INSTALL_RONN" ] || [ "$INSTALL_RONN" = "y" ]; then
sudo gem install ronn
else
exit 1
fi
fi
export RONN_MANUAL="php-build"
export RONN_ORGANIZATION="php-build $VERSION"
for manpage in man/*.ronn
do
echo "Building $manpage... " >&2
"$ronn" "$manpage"
echo "Done" >&2
done
if [ -z "$NO_GITHUB_PAGES" ]; then
echo
echo "Updating online man pages... " >&2
update_gh_pages
echo "Done" >&2
fi