Skip to content

Instantly share code, notes, and snippets.

@wbrady
Created March 12, 2013 14:34
Show Gist options
  • Save wbrady/5143367 to your computer and use it in GitHub Desktop.
Save wbrady/5143367 to your computer and use it in GitHub Desktop.
Website (rails) post-merge hook
#!/bin/sh
diff=`git diff --name-only HEAD@{1} HEAD`
gemfile=`expr "$diff" : ".*Gemfile.*"`
if [ ! "$gemfile" -eq 0 ]
then
echo "Running bundle install"
bundle install
fi
migrate=`expr "$diff" : ".*db/migrate/.*"`
if [ ! "$migrate" -eq 0 ]
then
echo "Migrating database"
bundle exec rake db:migrate
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment