Skip to content

Instantly share code, notes, and snippets.

@kontur
Forked from digitaljhelms/post-rewrite
Created July 28, 2014 17:47
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 kontur/b8a8a2d6b76d2b2189c9 to your computer and use it in GitHub Desktop.
Save kontur/b8a8a2d6b76d2b2189c9 to your computer and use it in GitHub Desktop.
#!/bin/sh
echo "[post-rewrite hook: $1]"
# noah grant
# quick script to call bower install and npm install automatically if
# bower.json or package.json are changed, respectively
# this assumes one top-level file for each
changedfiles=( `git diff-tree --no-commit-id --name-only HEAD@{1} HEAD` )
if [[ "${changedfiles[*]}" =~ "bower.json" ]]; then
echo "bower installing"
bower install
fi
if [[ "${changedfiles[*]}" =~ "package.json" ]]; then
echo "npm installing"
npm install
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment