adding docs
permission
tuning doc.sh
check for dirty working tree, handle failure to commit
Merge pull request #380 from AWinterman/docs

Move docs into master, add script to compile them in the gh-pages branch