Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 26 lines (22 sloc) 0.543 kb
601e5ca8 »
2011-08-23 logging
1 %w{rubygems sinatra json yaml logger}.each{|x| require x}
7c9fda31 » alcides
2008-12-08 Initial Import
2
93511f88 »
2011-08-23 simple
3 log = Logger.new('/home/node/git-pull-hook.log')
601e5ca8 »
2011-08-23 logging
4 log.level = Logger::DEBUG
7c9fda31 » alcides
2008-12-08 Initial Import
5
93511f88 »
2011-08-23 simple
6 def pull(repo)
7 name = repo['repository']['name']
cc585b22 »
2011-08-23 updated the pull hook
8 log.warn 'updating repo #{name}'
93511f88 »
2011-08-23 simple
9 `cd ${name} && git pull origin master`
2bfac9d5 » alcides
2008-12-30 Refactored some code
10 end
11
93511f88 »
2011-08-23 simple
12 post '/pull' do
601e5ca8 »
2011-08-23 logging
13 begin
cc585b22 »
2011-08-23 updated the pull hook
14 repo = JSON.parse(params[:payload])
15 name = repo['repository']['name']
16 log.warn "updating repo #{name}"
17 `cd #{name} && git pull origin master`
601e5ca8 »
2011-08-23 logging
18 "ok"
19 rescue Exception => e
20 log.error e
21 end
28f82592 » alcides
2008-12-08 Moved from fetch to pull for obvious reasons
22 end
23
24 get '/:remote' do
93511f88 »
2011-08-23 simple
25 "running"
a29ee912 » andhapp
2009-04-13 Added brackets to the method headers(matter of taste) and sanitised t…
26 end
Something went wrong with that request. Please try again.