-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·62 lines (47 loc) · 1023 Bytes
/
update.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
#!/usr/bin/env bash
#
# Script for updating documentation.
#
# @copyright copyright (c) 2020-present by Harald Lapp
# @author Harald Lapp <harald@octris.org>
#
if [ "$1" = "" ]; then
echo "usage: update.sh <path> [<path> ...]"
exit
fi
if [ ! -d gh-pages ]; then
git clone git@github.com:octris/phpdoc.git gh-pages -b gh-pages --depth=1
else
(cd gh-pages && git pull)
fi
for i in $@; do
target_dir=$(pwd)/gh-pages/$(basename $i)
if [ ! -d $target_dir ]; then
mkdir $target_dir
fi
phpdoc -d $1 -t $target_dir
done
exec 3> $(pwd)/gh-pages/index.html
cat <<EOF >&3
<html>
<head>
<title>Octris project documentation</title>
</head>
<body>
<h1>Octris project documentation</h1>
<ul>
EOF
for i in $(find $(pwd)/gh-pages/* -type d -maxdepth 0); do
name="$(basename "$i")"
echo "<li><a href=\"$name/\">$name</a></li>" >&3
done
cat <<EOF >&3
</ul>
</body>
</html>
EOF
exec 3<&-
cd gh-pages && \
git add * && \
git commit -m "updated repository" && \
git push