First attempt at a post-receive hook that posts directly to Resque

This commit is contained in:
Ariejan de Vroom 2011-12-13 01:03:26 +01:00
parent 1c9b9b7a3b
commit bc0155fbaa
5 changed files with 30 additions and 14 deletions

View file

@ -31,6 +31,17 @@ class Repository
project.id
end
# repo.update_hook('post-receive', File.read('some-hook'))
def update_hook(name, content)
hook_file = File.join(project.path_to_repo, 'hooks', name)
File.open(hook_file, 'w') do |f|
f.write(content)
end
File.chmod(0775, hook_file)
end
def repo
@repo ||= Grit::Repo.new(project.path_to_repo)
end