You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
913 B

8 years ago
8 years ago
8 years ago
8 years ago
  1. #!/bin/bash
  2. set -u
  3. DOC_DIR=godoc
  4. # Run a godoc server which we will scrape. Clobber the GOPATH to include
  5. # only our dependencies.
  6. GOPATH=$(pwd):$(pwd)/vendor godoc -http=localhost:6060 &
  7. DOC_PID=$!
  8. # Wait for the server to init
  9. until curl -s "http://localhost:6060" > /dev/null
  10. do
  11. # no-op
  12. :
  13. done
  14. # Scrape the pkg directory for the API docs. Scrap lib for the CSS/JS. Ignore everything else.
  15. # The output is dumped to the directory "localhost:6060".
  16. wget -r -m -k -E -p -erobots=off --include-directories="/pkg,/lib" --exclude-directories="*" http://localhost:6060/pkg/github.com/matrix-org/go-neb/
  17. # Stop the godoc server
  18. kill -9 $DOC_PID
  19. # Delete the old directory or else mv will put the localhost dir into
  20. # the DOC_DIR if it already exists.
  21. rm -rf $DOC_DIR
  22. mv localhost\:6060 $DOC_DIR
  23. echo "Docs can be found in $DOC_DIR"
  24. echo "Replace /lib and /pkg in the gh-pages branch to update gh-pages"