Skip to content

Instantly share code, notes, and snippets.

@chreekat
Forked from Fuuzetsu/hackagedocs
Last active January 2, 2016 08:49
Show Gist options
  • Select an option

  • Save chreekat/8278722 to your computer and use it in GitHub Desktop.

Select an option

Save chreekat/8278722 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
read -p "Package name: " package
read -p "Version: " version
read -p "Hackage user: " user
read -sp "Hackage password (not echoed): " password
echo "== BUILDING WITH DOCS"
echo
cabal configure
cabal build
cabal haddock --hyperlink-source
echo "== BUNDLING DOCS"
echo
cd dist/doc/html
DDIR="${package}-${version}-docs"
cp -r "${package}" "${DDIR}" && tar -c -v -z -Hustar -f "${DDIR}.tar.gz" "${DDIR}"
echo "== UPLOADING TO HACKAGE"
echo
curl -X PUT -H 'Content-Type: application/x-tar' \
-H 'Content-Encoding: gzip' --data-binary "@${DDIR}.tar.gz" \
"http://${user}:${password}@hackage.haskell.org/package/${package}-${version}/docs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment