-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathupload-docs
executable file
·31 lines (23 loc) · 995 Bytes
/
upload-docs
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
29
30
#! /bin/bash
set -e
# Maintainer script to upload docs configured with -flens
# http://fuuzetsu.co.uk/blog/posts/2014-01-06-Fix-your-Hackage-documentation.html
# http://fuuzetsu.co.uk/blog/posts/2014-01-06-Hackage-documentation-v2.html
# https://gist.github.com/Fuuzetsu/8276421
PKG=thyme
VER="$(sed -ne 's/^version: *//p' < $PKG.cabal)"
TAR="$PKG-$VER-docs"
USR="$(sed -ne 's/^username: *//p' < ~/.cabal/config)"
PAS="$(sed -ne 's/^password: *//p' < ~/.cabal/config)"
# link to real lens for documentation
cabal configure -fdocs -flens
cabal haddock --hyperlink-source --hoogle \
--contents-location='/package/$pkg' \
--html-location='/package/$pkg-$version/docs'
tar -C dist/doc/html --format=ustar --show-transformed-names \
--transform="s#^$PKG#$TAR#" -c -v -z -f "dist/$TAR.tar.gz" "$PKG"
curl -X PUT -u "$USR:$PAS" \
-H 'Content-Type: application/x-tar' \
-H 'Content-Encoding: gzip' \
--data-binary "@dist/$TAR.tar.gz" \
"http://hackage.haskell.org/package/$PKG-$VER/docs"