2

We use Git Tower to manage our git repositories, and we want to set up the ability to run an automatic rake db:migrate whenever we pull down a new update. I've modified the post-merge git hook to look like this:

#!/bin/bash
bundle exec rake db:migrate

If I run this from the command line, it works just fine. However, if I try to run a git pull within Tower itself, I get the following error:

/Library/Ruby/Gems/1.8/gems/bundler-1.1.4/lib/bundler/spec_set.rb:90:in 'materialize': Could not find sass-3.2.1 in any of the sources (Bundler::GemNotFound)

Does anyone have any experience getting Tower to run automatic migrations on git pull?

EricBoersma
  • 1,019
  • 1
  • 8
  • 19

1 Answers1

0

put this in a script:

#!/bin/bash
bundle exec rake db:migrate

then in .git/hook/post-merge file:

exec <path/to/script/based/on/repo/directory>/<script_name> &

you need the & at the end of the line. the hooks script has to return immediately or git gets unhappy.

sb

scott
  • 56
  • 2
  • I don't see how having the script return immediately is going to cause rake to stop throwing an exception from missing a sass gem. – EricBoersma Sep 07 '12 at 20:34