Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pre-commit hook to remind committer to run rake-assets-precompile
#!/bin/bash
#
# if changed assets are being committed, prompt the user to confirm
# they have precompiled assets.
if test $(git diff --cached --name-only | grep app/assets | wc -l) != 0
then
# grab user input
exec < /dev/tty
echo "Assets have changed. Have you performed rake assets:precompile?"
read -p "Continue commit (Yes/No)?" choice
echo "Received answer $choice"
if [ "$choice" == "Yes" ]; then
exit 0
else
echo "Abandoning commit"
exit 1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment