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: <oldrev> <newrev> <refname> 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/', # True if 'working_dir' is pointing to a bare repository 'is_bare' => true, # Repository owner contact info 'owner' => { 'name' => 'Big Boss Man', 'email' => 'bbm@example.com' } } # Links to objects in your repository. Put the wildcard '%s' where the reference should go. config.urls['commit'] = 'http://git.example.com/commits?id=%s' # '%s' will be replaced with the commit sha config.urls['branch'] = 'http://git.example.com/branches?id=%s' # '%s' will be the branch name # 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