rake warehouse:sync in a cronjob?

Subscribe to rake warehouse:sync in a cronjob? 4 post(s), 2 voice(s)

 
Avatar MrKurt 35 post(s)

I’d really like to automate the warehouse sync thing, and it seems like a cron job might be the easiest way. I can’t get it to work, though.

Has anyone figured out how to do this?

 
Avatar Geoff 71 post(s)

Have you tried the post-commit hook?

 
Avatar MrKurt 35 post(s)

Just now, not with much success. Post commit hooks are mildly confusing to me. :)

I’ll keep messing with permissions and such to see if I can figure out why it’s not working.

 
Avatar Geoff 71 post(s)

I take it you have something like

#!/bin/sh
cd /path/to/warehouse/current
/usr/local/bin/rake warehouse:post_commit RAILS_ENV=production REPO_PATH=$1 REVISION=$2

It depends how you are using your SVN repository how you will need to setup the privileges for the hook, it needs to be executable for anyone who might commit to the repository

  • You only using svn+ssh:// then chmod u+x
  • UNIX user group of users using svn+ssh:// then chmod ug+x

Apache mod_dav_svn it depends how you’ve set it up. You will either need to chmod ug+x or chmod ugo+x to get it to work. When it doesn’t work though it does tell you at the end of your commit. If it doesn’t work then login to your server, switch to the warehouse root directory and run

rake warehouse:sync RAILS_ENV=production REPO=myrepo

and it should synchronize the changes you’ve made so far. A failure to run the post-commit hook does not constitute a failure to commit so the commit will have been successful.