diff options
author | Ariejan de Vroom <ariejan@ariejan.net> | 2011-12-13 04:03:26 +0400 |
---|---|---|
committer | Ariejan de Vroom <ariejan@ariejan.net> | 2011-12-13 04:03:26 +0400 |
commit | bc0155fbaa1261f348324c1ddf5d1eaba5907f77 (patch) | |
tree | 3c8f651b1572b9a515a994b8d015ee770885fdc1 /lib | |
parent | 1c9b9b7a3b0ae2ee60e4cda5d1ac2541c17302f8 (diff) |
First attempt at a post-receive hook that posts directly to Resque
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlabhq/gitolite.rb | 4 | ||||
-rwxr-xr-x | lib/post-receive-hook | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/gitlabhq/gitolite.rb b/lib/gitlabhq/gitolite.rb index e79afb55577..f3d8584f014 100644 --- a/lib/gitlabhq/gitolite.rb +++ b/lib/gitlabhq/gitolite.rb @@ -43,14 +43,14 @@ module Gitlabhq def destroy_project(project) FileUtils.rm_rf(project.path_to_repo) - + ga_repo = ::Gitolite::GitoliteAdmin.new(File.join(@local_dir,'gitolite')) conf = ga_repo.config conf.rm_repo(project.path) ga_repo.save end - #update or create + #update or create def update_keys(user, key) File.open(File.join(@local_dir, 'gitolite/keydir',"#{user}.pub"), 'w') {|f| f.write(key.gsub(/\n/,'')) } end diff --git a/lib/post-receive-hook b/lib/post-receive-hook new file mode 100755 index 00000000000..ec7c607f75d --- /dev/null +++ b/lib/post-receive-hook @@ -0,0 +1,12 @@ +#!/bin/bash + +# This file was placed here by Gitlab. It makes sure that your pushed commits +# will be processed properly. + +while read oldrev newrev ref +do + # For every branch or tag that was pushed, create a Resque job in redis. + pwd=`pwd` + reponame=`basename "$pwd" | cut -d. -f1` + env -i redis-cli rpush "resque:queue:post-receive" "{\"class\":\"PostReceive\",\"args\":[\"$reponame\",\"$oldrev\",\"$newrev\",\"$ref\"]}" > /dev/null 2>&1 +done |