Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added brackets to the method headers(matter of taste) and sanitised t…

…he require at the top

Signed-off-by: Alcides Fonseca <me@alcidesfonseca.com>
  • Loading branch information...
commit a29ee912836a81fc738f0a5245b3e81af6db6daf 1 parent 2bfac9d
@andhapp andhapp authored committed
Showing with 5 additions and 10 deletions.
  1. +5 −10 git-pull-hook.rb
View
15 git-pull-hook.rb
@@ -1,27 +1,22 @@
-require 'rubygems'
-require 'sinatra'
-require 'json'
-require 'yaml'
+%w{rubygems sinatra json yaml}.each{|x| require x}
config = YAML::load_file('repos.yml')
-
-def get_local_path remote
+def get_local_path(remote)
config['repo_home'] + config['repos'][remote]
end
post '/' do
push = JSON.parse(params[:payload])
remote_repo = push['repository']['name']
- local_repo = get_local_path remote_repo
+ local_repo = get_local_path(remote_repo)
`cd #{local_repo} && git pull origin master`
"ok"
end
# GET /remote-repo used for debugging
-
get '/:remote' do
remote_repo = push['repository']['name']
- local_repo = get_local_path remote_repo
+ local_repo = get_local_path(remote_repo)
`cd #{local_repo} && git pull origin master`
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.