-
-
Save bdmac/e8097c41420570417ef4 to your computer and use it in GitHub Desktop.
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 | |
# source rvm and .rvmrc if present | |
[ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm" | |
[ -s "$PWD/.rvmrc" ] && . "$PWD/.rvmrc" | |
should_precompile=0 | |
# check if anything changed in app/assets | |
if git diff-index --name-only HEAD | egrep '^app/assets' >/dev/null ; then | |
should_precompile=1 | |
fi | |
# check if anything changed in vendor/assets | |
if git diff-index --name-only HEAD | egrep '^vendor/assets' >/dev/null ; then | |
should_precompile=1 | |
fi | |
# precompile assets if any have been updated | |
if [ $should_precompile -eq 1 ]; then | |
echo 'Precompiling assets...' | |
bundle exec rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets | |
git add public/assets/* | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment