-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmake-gh-pages
executable file
·67 lines (53 loc) · 1.28 KB
/
make-gh-pages
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
63
64
65
66
67
#!/bin/sh -xe
PKG="github.com/xdrpp/stc"
MANS="stc"
rm -rf goroot gh-pages
make go1
git archive --prefix=goroot/src/$PKG/ go1 | tar xf -
GOPATH="$PWD/goroot" godoc -goroot "$PWD/goroot" -http localhost:6666 &
pid=$!
trap "kill $pid" 0
mkdir gh-pages
cd gh-pages
sleep 1
wget -r -m -k -E -p -erobots=off -nH \
--include-directories="/pkg/$PKG/,/lib" \
--exclude-directories="*" \
"http://localhost:6666/pkg/"
cat >> lib/godoc/style.css <<EOF
div#topbar {
visibility: hidden;
}
EOF
cat > index.html <<EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>moved</title>
<meta http-equiv="refresh" content="0; URL='pkg/$PKG/'" />
</head>
<body>
</body>
</html>
EOF
for man in $MANS; do
pandoc --self-contained ../cmd/$man/$man.1.md \
-c lib/godoc/style.css -c ../cmd/man.css \
-o "pkg/$PKG/cmd/$man/$man.1.html"
done
GIT_DIR=$(git rev-parse --git-dir)
export GIT_INDEX_FILE="$GIT_DIR/index.gh-pages"
rm -f "$GIT_INDEX_FILE"
git add -f .
tree=$(git write-tree --prefix=gh-pages)
commit=$(echo 'godoc output' | git commit-tree $tree)
git branch -f gh-pages $commit
if github=$(git remote -v | sed -ne '/git@github.com/{s/[ ].*//p;q;}')
then
cat <<EOF
Now you may want to run:
git push -f $github go1
git push -f $github gh-pages
EOF
fi