Skip to content

Instantly share code, notes, and snippets.

@cdimartino
Last active March 2, 2017 18:06
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 cdimartino/d0016f44dc73494bbe6184ac72373646 to your computer and use it in GitHub Desktop.
Save cdimartino/d0016f44dc73494bbe6184ac72373646 to your computer and use it in GitHub Desktop.
Yardoc git pre-commit hook
#!/bin/sh
# Regenerates documentaion and adds it to the commit
#
# This file must live in .git/hooks/pre-commit and be executable
#
# Setup:
#
# cp pre-commit .git/hooks/
# chmod +x .git/hooks/pre-commit
echo
echo "Regenerating Documentation"
echo
gem list | grep yard || gem install yard
yard -o docs --template-path ./.customtemplates
echo
echo
echo "Regeneration complete"
echo
echo "Adding updated docs to commit"
echo
git add -- docs .yardoc
git add -u -- docs .yardoc
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment