Last active
August 29, 2015 14:02
-
-
Save dpwiz/3967fc700c573d382572 to your computer and use it in GitHub Desktop.
rest-* documentation builder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The script utilizes `cabal sandbox` to keep the guts from spilling into system packages. | |
The documentation builder is `standalone-haddock`[1] so you have to install it and put on your PATH first. A `hscolour` have to be installed to provide source links. | |
[1]: https://hackage.haskell.org/package/standalone-haddock | |
[2]: https://hackage.haskell.org/package/hscolour |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
OUTPUT="docs-sh" | |
PACKAGES="rest-client rest-core rest-gen rest-happstack rest-snap rest-wai rest-types rest-stringmap code-builder" | |
PACKAGES_SANDBOX=".cabal-sandbox/*-packages.conf.d" | |
PACKAGE_DB=`readlink -f $PACKAGES_SANDBOX` | |
ARGS="${@:2}" | |
PACKAGE_ARGS="${ARGS:-$PACKAGES}" | |
function help { | |
echo "$0 <init|build|clean>" | |
exit | |
} | |
function init { | |
cabal sandbox init | |
CONFIG=`readlink -f cabal.sandbox.config` | |
for package in $PACKAGE_ARGS; do | |
echo $package | |
cd $package | |
CABAL_SANDBOX_CONFIG=$CONFIG cabal install -j | |
CABAL_SANDBOX_CONFIG=$CONFIG cabal configure | |
cd .. | |
done | |
} | |
function build { | |
standalone-haddock -o $OUTPUT --package-db $PACKAGE_DB --hyperlink-source $PACKAGE_ARGS | |
} | |
function clean { | |
cabal sandbox delete | |
} | |
case "x$1" in | |
"x") help ;; | |
"xinit") init ;; | |
"xbuild") build ;; | |
"xclean") clean ;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment