From 579cf29231018a42c562698119adb962c11cddce Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 2 Nov 2016 15:44:08 +0000 Subject: [PATCH] Add a gendoc script Dumps output to .godoc --- .gitignore | 2 ++ gendoc.sh | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 gendoc.sh diff --git a/.gitignore b/.gitignore index a11dc93..9e11225 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.godoc + .*.swp # Compiled Object files, Static and Dynamic libs (Shared Objects) diff --git a/gendoc.sh b/gendoc.sh new file mode 100755 index 0000000..7cba3c1 --- /dev/null +++ b/gendoc.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# 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 +sleep 1 + +# 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". +wget -r -m -k -E -p --include-directories="/pkg,/lib" --exclude-directories="*" http://localhost:6060/pkg/github.com/matrix-org/go-neb/ + +# Stop the godoc server +kill -9 $DOC_PID + +mv localhost\:6060 .godoc +echo "Docs can be found in .godoc" +echo "Replace /lib and /pkg in the gh-pages branch to update gh-pages"