2016-11-02 15:44:08 +00:00
|
|
|
#!/bin/bash
|
2016-11-02 16:52:11 +00:00
|
|
|
set -u
|
2016-11-02 15:44:08 +00:00
|
|
|
|
2016-11-02 16:01:07 +00:00
|
|
|
DOC_DIR=godoc
|
|
|
|
|
2016-11-02 15:44:08 +00:00
|
|
|
# Run a godoc server which we will scrape. Clobber the GOPATH to include
|
|
|
|
# only our dependencies.
|
|
|
|
GOPATH=$(pwd):$(pwd)/vendor godoc -http=localhost:6060 &
|
|
|
|
DOC_PID=$!
|
|
|
|
|
|
|
|
# Wait for the server to init
|
2018-05-26 10:51:03 +00:00
|
|
|
until curl -fs "http://localhost:6060/pkg/github.com/matrix-org/go-neb/" > /dev/null
|
2016-11-02 16:52:11 +00:00
|
|
|
do
|
2018-05-26 10:48:15 +00:00
|
|
|
# no-op
|
|
|
|
:
|
2016-11-02 16:52:11 +00:00
|
|
|
done
|
2016-11-02 15:44:08 +00:00
|
|
|
|
|
|
|
# Scrape the pkg directory for the API docs. Scrap lib for the CSS/JS. Ignore everything else.
|
|
|
|
# The output is dumped to the directory "localhost:6060".
|
2016-11-09 14:06:01 +00:00
|
|
|
wget -r -m -k -E -p -erobots=off --include-directories="/pkg,/lib" --exclude-directories="*" http://localhost:6060/pkg/github.com/matrix-org/go-neb/
|
2016-11-02 15:44:08 +00:00
|
|
|
|
|
|
|
# Stop the godoc server
|
|
|
|
kill -9 $DOC_PID
|
|
|
|
|
2016-11-02 16:03:27 +00:00
|
|
|
# Delete the old directory or else mv will put the localhost dir into
|
|
|
|
# the DOC_DIR if it already exists.
|
2016-11-02 16:01:07 +00:00
|
|
|
rm -rf $DOC_DIR
|
|
|
|
mv localhost\:6060 $DOC_DIR
|
|
|
|
|
|
|
|
echo "Docs can be found in $DOC_DIR"
|
2016-11-02 15:44:08 +00:00
|
|
|
echo "Replace /lib and /pkg in the gh-pages branch to update gh-pages"
|