summary refs log tree commit diff
path: root/third_party/bazel/rules_haskell/serve-docs.sh
blob: 3ae4525fd84f76bbbf9c23d452cd26c0b898740d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/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