PushHandler
PushHandler takes push information and converts it into a format that Github Services can read and distribute.
Config
- Download and install Github Services
- Start the Sinatra server by running
ruby github-services.rb
- Install the gem
gem install push-handler
- In
.git/hooks/
directory of your repository, create a file calledpost-receive
. Add the following text to
post-receive
, filling in your information:!/usr/bin/ruby
require 'rubygems' require 'push_handler'
Through STDIN git passes us:
args = STDIN.readlines.first.split(/\s+/)
PushHandler.configure do |config| config.repo = { # Where to see the repository on the web 'url' => 'http://git.example.com',
# Repository name 'name' => 'Suppa Time', # Directory on the machine where the contents of your .git folder lives 'working_dir' => '/mnt/suppa_time.git/', # Repository owner contact info 'owner' => { 'name' => 'Big Boss Man', 'email' => '[email protected]' }
}
# This is the link to the commit. Put the wildcard '%s' where the commit sha should go. config.commit_url = 'http://git.example.com/commits?id=%s'
# The url that the github-services server is running. config.services['url'] = 'http://localhost:8080'
# This is your configuration for 3rd parties. config.services['data'] = { 'hipchat' => { 'auth_token' => '9082afake90210', 'room' => 12345, 'notify' => true } } end
PushHandler.send_to_services(*args)
Note
To see the parameters that each service requires you'll have to:
- Go to the
github-services/
directory - Execute
rake services:config
- Open
config/services.json
and look up the requirements