Skip to content

Commit

Permalink
Better factored haddock upload script.
Browse files Browse the repository at this point in the history
  • Loading branch information
acowley committed Jan 13, 2015
1 parent 2fc668d commit 71c62a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hackagedocs.sh
@@ -1,18 +1,19 @@
#!/bin/sh
# Based on https://gist.github.com/Fuuzetsu/8276421
# Usage: sh hackagedocs.sh 0.7.1 UserName Password
PKG_NAME=vinyl-gl

cabal configure && cabal build && cabal haddock --hyperlink-source --html-location='http://hackage.haskell.org/package/$pkg/docs' \
--contents-location='http://hackage.haskell.org/package/$pkg'
S=$?
if [ "${S}" -eq "0" ]; then
cd "dist/doc/html"
DDIR="vinyl-gl-${1}-docs"
cp -r "vinyl-gl" "${DDIR}" && tar -c -v -z --format ustar -f "${DDIR}.tar.gz" "${DDIR}"
DDIR="${PKG_NAME}-${1}-docs"
cp -r "${PKG_NAME}" "${DDIR}" && tar -c -v -z --format ustar -f "${DDIR}.tar.gz" "${DDIR}"
CS=$?
if [ "${CS}" -eq "0" ]; then
echo "Uploading to Hackage…"
curl -X PUT -H 'Content-Type: application/x-tar' -H 'Content-Encoding: gzip' --data-binary "@${DDIR}.tar.gz" "http://${2}:${3}@hackage.haskell.org/package/vinyl-gl-${1}/docs"
curl -X PUT -H 'Content-Type: application/x-tar' -H 'Content-Encoding: gzip' --data-binary "@${DDIR}.tar.gz" "http://${2}:${3}@hackage.haskell.org/package/${PKG_NAME}-${1}/docs"
exit $?
else
echo "Error when packaging the documentation"
Expand Down

0 comments on commit 71c62a0

Please sign in to comment.