Created
April 15, 2013 15:04
-
-
Save jaguerra/5388759 to your computer and use it in GitHub Desktop.
Git pre-commit hook to launch rake
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 | |
# Adapted from http://jimneath.org/2012/05/05/precompile-assets-using-a-git-hook.html | |
# source rvm and .rvmrc if present | |
[ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm" | |
[ -s "$PWD/.rvmrc" ] && . "$PWD/.rvmrc" | |
# precompile assets if any have been updated | |
if git diff-index --name-only HEAD | egrep '^css/sass' >/dev/null ; then | |
echo 'Precompiling assets...' | |
rake sass | |
git add css/*.css | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment