Skip to content

Instantly share code, notes, and snippets.

@jaguerra
Created April 15, 2013 15:04
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 jaguerra/5388759 to your computer and use it in GitHub Desktop.
Save jaguerra/5388759 to your computer and use it in GitHub Desktop.
Git pre-commit hook to launch rake
#!/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