Created
June 28, 2018 16:50
-
-
Save stephan-buckmaster/14e3ec39ab6640e31204c9bc63f3dc42 to your computer and use it in GitHub Desktop.
Pre-commit hook to remind committer to run rake-assets-precompile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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