Last active
December 28, 2015 19:08
-
-
Save gbonanome/7547674 to your computer and use it in GitHub Desktop.
Pre-commit hook to make tasks like: run composer, bower, grunt (less, requirejs).
Add everything.
And so commit.
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/bash | |
### Check the DIR | |
DIR=$(git rev-parse --show-toplevel) | |
### Composer update | |
echo "Updating Composer" | |
if [ -e "$DIR/composer.json" ]; then | |
if [ -d "$DIR/vendor" ]; then | |
composer install | |
else | |
composer update | |
fi | |
fi | |
### Bower update | |
echo "Updating Bower" | |
bower install | |
### Run grunt default task | |
echo "Running Grunt" | |
grunt default | |
### Add everything to the commit | |
echo "Add what is needed to the index" | |
git add -A | |
### Do the commit | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
P.S. remember to
chmod +x .git/hooks/pre-commit