From 4dc1adf5e2e711837bd94f131a8a93c298bac8a8 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 2 Nov 2016 16:01:07 +0000 Subject: [PATCH] Allow gendoc.sh to be called multiple times --- .gitignore | 2 +- gendoc.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9e11225..2410f8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -.godoc +godoc .*.swp diff --git a/gendoc.sh b/gendoc.sh index 7cba3c1..1a5ede7 100755 --- a/gendoc.sh +++ b/gendoc.sh @@ -1,5 +1,7 @@ #!/bin/bash +DOC_DIR=godoc + # Run a godoc server which we will scrape. Clobber the GOPATH to include # only our dependencies. GOPATH=$(pwd):$(pwd)/vendor godoc -http=localhost:6060 & @@ -15,6 +17,9 @@ wget -r -m -k -E -p --include-directories="/pkg,/lib" --exclude-directories="*" # Stop the godoc server kill -9 $DOC_PID -mv localhost\:6060 .godoc -echo "Docs can be found in .godoc" +# Delete the old directory or else mv will put the localhost dir into .godoc +rm -rf $DOC_DIR +mv localhost\:6060 $DOC_DIR + +echo "Docs can be found in $DOC_DIR" echo "Replace /lib and /pkg in the gh-pages branch to update gh-pages"