Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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