Created
July 15, 2009 23:23
-
-
Save dustin/148055 to your computer and use it in GitHub Desktop.
My post-receive hook.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby1.8 | |
require 'rubygems' | |
require 'sinatra' | |
require 'json' | |
base_repo_path = "/home/buildbot/repos" | |
post '/' do | |
push = JSON.parse(params[:payload]) | |
branch = push['ref'] | |
old = push['before'] | |
new = push['after'] | |
repo = push['repository']['name'] | |
repo_path = "#{base_repo_path}/#{repo}.git" | |
system("git --git-dir #{repo_path} remote update") | |
cmd = "/home/buildbot/bin/git_buildbot.py -c #{repo} -l /tmp/bb.log" | |
IO.popen("env GIT_DIR=#{repo_path} #{cmd}", "w") do |p| | |
p.write "#{old} #{new} #{branch}\n" | |
end | |
"I got a push to: #{branch} from #{old} to #{new}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment