about summary refs log blame commit diff
path: root/third_party/bazel/rules_haskell/serve-docs.sh
blob: 3ae4525fd84f76bbbf9c23d452cd26c0b898740d (plain) (tree)



























                                                          
#!/bin/sh
#
# Usage:
#
# ./serve-docs.sh [PORT_NUMBER]

set -e

SCRATCH=$(mktemp -d --tmpdir rules_haskell-docs.XXXX)
PORT=${1:-8000}

function finish {
    echo Deleting $SCRATCH ...
    rm -rf "$scratch"
}

trap finish EXIT

bazel build //docs:api_html
mkdir $SCRATCH/api
unzip -d $SCRATCH/api bazel-bin/docs/api_html-skydoc.zip

bazel build //docs:guide_html
mkdir $SCRATCH/guide
unzip -d $SCRATCH/guide bazel-genfiles/docs/guide_html.zip

cd $SCRATCH
python -m SimpleHTTPServer $PORT