Skip to content

Instantly share code, notes, and snippets.

@yuga
Created April 16, 2015 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuga/0700121987c6eb435950 to your computer and use it in GitHub Desktop.
Save yuga/0700121987c6eb435950 to your computer and use it in GitHub Desktop.
maoeさんのを手元環境で動くようにしたバージョン。
#!/bin/bash
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="${1}-${2}-docs"
cp -r "${1}" "${DDIR}" && tar -cvz --format=ustar -f "${DDIR}.tar.gz" "${DDIR}"
CS=$?
if [ "${CS}" -eq "0" ]; then
echo "Uploading to Hackage…"
echo "Username: ${3}"
read -p "Password: " -s raw_password
password=$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$raw_password")
endpoint="http://${3}:${password}@hackage.haskell.org/package/${1}-${2}/docs"
curl -v -g -X PUT -H 'Content-Type: application/x-tar' -H 'Content-Encoding: gzip' --data-binary "@${DDIR}.tar.gz" $endpoint
exit $?
else
echo "Error when packaging the documentation"
exit $CS
fi
else
echo "Error when trying to build the package."
exit $S
fi
@yuga
Copy link
Author

yuga commented Apr 23, 2015

haddockの引数の--html-locationや--contents-locationに$pkgを埋めると、そのとき必要とされているパッケージ名が埋まるとは知らなかった。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment