Skip to content

Instantly share code, notes, and snippets.

@danielctull
Created December 26, 2010 00:08
Show Gist options
  • Save danielctull/755114 to your computer and use it in GitHub Desktop.
Save danielctull/755114 to your computer and use it in GitHub Desktop.
A script that uses appledoc by tomaz to generate documentation. Default branches are "develop" for the code and "gh-pages" for the documentation branch (to work with github pages to serve the docs).
#!/bin/bash
codebranch="develop"
docbranch="gh-pages"
projectname=$(pwd | sed "s/^.*\///g")
docdirectory="Documentation"
defaultcommitmessage="Update documentation."
# Switches to the codebranch
# Generates the documentation to /tmp/gitappledoc/
# Switches to the docbranch
# git rm the docdirectory (to make sure stale docs are removed -
# re-adding will cause an update)
# Move the directory to docdirectory
# Add directory to git
# Commit with a message, but allow editing
echo "Generating documentation for $projectname"
git checkout $codebranch
mkdir -p -v /tmp/gitappledoc/
appledoc --templates ~/.appledoc -p $projectname -o /tmp/gitappledoc/ "$@" ./
git checkout $docbranch
git rm -r $docdirectory
mv -v /tmp/gitappledoc/html "$docdirectory"
rm -r /tmp/gitappledoc/
git add -f "$docdirectory"
git commit -m $defaultcommitmessage -e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment