Created
December 29, 2013 08:43
-
-
Save alonisser/8168644 to your computer and use it in GitHub Desktop.
git hook for bower install and npm install on bower.json/package.json change
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/sh | |
#Inspired by https://gist.github.com/jbergantine/3870080 | |
#Since every `git pull` is actually a merge. We can use it to automaticly run basic Django tasks after pulling from the upstream master branch (or any other) | |
#Notice: This won't run at git fetch. since fetch doesn't merge anything | |
#Installation: | |
# copy this script with the name:`post-merge.sh` to your project root folder | |
# symlink it to the ./git/hooks/post-merge: `ln post-merge.sh .git/hooks/post-merge | |
#You should have bash (windows users, means cygwin/mingw anything that works for you | |
#Based on the instructions here: https://oknesset-devel.readthedocs.org/en/latest/workflow.html#before-coding | |
if [ $(git diff HEAD@{1} HEAD --name-only | grep 'bower.json' -c) -ne 0 ] | |
then | |
bower install | |
fi | |
if [ $(git diff HEAD@{1} HEAD --name-only | grep 'package.json' -c) -ne 0 ] | |
then | |
npm install | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment