Skip to content

Instantly share code, notes, and snippets.

@wbrady
Last active December 11, 2015 18:09
Show Gist options
  • Save wbrady/4639822 to your computer and use it in GitHub Desktop.
Save wbrady/4639822 to your computer and use it in GitHub Desktop.
NIC+ post-merge git hook
#!/bin/sh
diff=`git diff --name-only HEAD@{1} HEAD`
packages=`expr "$diff" : ".*package.json.*"`
if [ ! "$packages" -eq 0 ]
then
echo "Installing new packages"
npm install
fi
migrate=`expr "$diff" : ".*migrations/.*"`
if [ ! "$migrate" -eq 0 ]
then
echo "Migrating dev database"
db-migrate up
echo "Migrating test database"
db-migrate up -e test
fi
seed=`expr "$diff" : ".*seed/.*"`
if [ ! "$seed" -eq 0 ]
then
echo "Seeding data"
node seed
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment