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.

34 lines
984 B

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. while :
  10. do
  11. curl -s "http://localhost:6060" > /dev/null
  12. if [ $? -eq 0 ] # exit code is 0 if we connected
  13. then
  14. break
  15. fi
  16. done
  17. # Scrape the pkg directory for the API docs. Scrap lib for the CSS/JS. Ignore everything else.
  18. # The output is dumped to the directory "localhost:6060".
  19. wget -r -m -k -E -p -erobots=off --include-directories="/pkg,/lib" --exclude-directories="*" http://localhost:6060/pkg/github.com/matrix-org/go-neb/
  20. # Stop the godoc server
  21. kill -9 $DOC_PID
  22. # Delete the old directory or else mv will put the localhost dir into
  23. # the DOC_DIR if it already exists.
  24. rm -rf $DOC_DIR
  25. mv localhost\:6060 $DOC_DIR
  26. echo "Docs can be found in $DOC_DIR"
  27. echo "Replace /lib and /pkg in the gh-pages branch to update gh-pages"