diff options
author | Valery Sizov <vsv2711@gmail.com> | 2011-12-28 01:21:26 +0400 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2011-12-28 01:21:26 +0400 |
commit | 66fb3909a564d2e7905f5b720fd55ea61286605e (patch) | |
tree | f84c4d7d378b37ae1c2ec35ae3bedf42dcf393b8 /lib | |
parent | fbf412eaa0ee68812cdbab9e96f194e03fedd334 (diff) | |
parent | 5ca836048d4f3319d24d2d4580912102eed54618 (diff) |
Merge branch 'web_hooks' of https://github.com/ariejan/gitlabhq into ariejan-web_hooks
Conflicts:
app/models/project.rb
config/routes.rb
db/schema.rb
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlabhq/gitolite.rb | 4 | ||||
-rwxr-xr-x | lib/post-receive-hook | 12 | ||||
-rw-r--r-- | lib/tasks/resque.rake | 1 |
3 files changed, 15 insertions, 2 deletions
diff --git a/lib/gitlabhq/gitolite.rb b/lib/gitlabhq/gitolite.rb index 0822c25e621..e6eb8e5144b 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 diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake new file mode 100644 index 00000000000..9b30bb0a292 --- /dev/null +++ b/lib/tasks/resque.rake @@ -0,0 +1 @@ +require 'resque/tasks' |