Last active
January 2, 2016 13:39
-
-
Save kitop/8311448 to your computer and use it in GitHub Desktop.
Git post commit hook to remind to precompile some assets
This file contains 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/sh | |
# | |
# A hook script to remind us to precompile the assets. | |
color='\033[0;35m' | |
NC='\033[0m' # No Color | |
changes=$(git diff --name-only HEAD^) | |
echo $changes | grep ^app/assets > /dev/null | |
assets_changed=$? | |
echo $changes | grep ^public/assets > /dev/null | |
assets_precompiled=$? | |
# here we check if any asset changend, and if there are no precompiled assets | |
if [ $assets_changed -eq 0 -a $assets_precompiled -eq 1 ]; then | |
echo -e "${color}HEADS UP!${NC}" | |
echo "Seems you’ve changed some assets but didn’t add any precompiled ones." | |
echo "Don't forget to precompile them before deploying!" | |
echo "---------------------------------------------------------------------" | |
fi | |
exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment