Permalink
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...
1 parent 2bfac9d commit a29ee912836a81fc738f0a5245b3e81af6db6daf @andhapp andhapp committed with Apr 12, 2009
Showing with 5 additions and 10 deletions.
  1. +5 −10 git-pull-hook.rb
View
@@ -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

0 comments on commit a29ee91

Please sign in to comment.