Permalink
Browse files

error checking when local repo config not found

  • Loading branch information...
1 parent c9f29aa commit f988077b309aad9c0feac2c188d0205bc8beaa01 @zmcartor committed Mar 16, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 poked.rb
View
@@ -5,7 +5,6 @@
require 'logger'
configure do
- enable :logging
Log = Logger.new("debug.log")
Log.level = Logger::INFO
set :port, 3333
@@ -18,8 +17,12 @@
post '/poked' do
json_push = JSON.parse params[:payload]
local_repo = $configuration[json_push['repository']['name']]
- Log.info "New info from repo named: #{local_repo}"
- Log.info params
+
+ if local_repo.nil?
+ Log.info "Sorry, no configuration for repo named #{json_push['repository']['name']}"
+ halt 200
+ end
+
Log.info "Updating #{local_repo}"
out = `cd #{local_repo} && git pull origin master`
Log.info "Result of update #{out}"

0 comments on commit f988077

Please sign in to comment.