From: dsc Date: Mon, 27 Feb 2012 19:41:41 +0000 (-0800) Subject: Adds a post-update webhook to the server to pull new files. X-Git-Url: http://git.less.ly:3516/?a=commitdiff_plain;h=0781b0826140dc029c30560822892744a7b75b5d;p=kraken-ui.git Adds a post-update webhook to the server to pull new files. --- diff --git a/lib/server/server.co b/lib/server/server.co index 3fe8f7a..aa110be 100755 --- a/lib/server/server.co +++ b/lib/server/server.co @@ -156,6 +156,19 @@ app.get '/:type/:action', (req, res, next) -> else next() +# Handle webhook notification to reload files +app.all '/webhook/post-update', (req, res) -> + + # exec the pull async... + console.log '[/webhook/post-update] $ git pull origin master' + child = exec 'git pull origin master', (err, stdout, stderr) -> + console.log '[/webhook/post-update] ', stdout + console.log '[/webhook/post-update] ', stderr + console.error '[/webhook/post-update] ERROR!', err if err + + # ...but return ok to caller right away + res.send 'ok!', 200 +