doveva buggarsi proprio le 3 righe non coperte dai test.

This commit is contained in:
Enrico Fasoli 2015-04-29 17:17:36 +02:00
parent 0595fbc889
commit 1ac7124a01
2 changed files with 6 additions and 10 deletions

View File

@ -14,10 +14,6 @@ GitHubAPI = require 'github'
github = new GitHubAPI version: '3.0.0'
module.exports = (robot) ->
if process.env.AUTO_INFORM_ON_START
r = room: process.env.AUTO_INFORM_ON_START.replace(':','#')
robot.send r, 'asjon avviato e operativo!'
githubhook = (req, res) ->
res.send 200
dest = name: req.params.name, room: req.params.room.replace(':','#')

View File

@ -32,6 +32,10 @@ runCmd = (cmd,res,cb) ->
if cb? then cb err,stdout,stderr
module.exports = (robot) ->
if process.env.AUTO_INFORM_ON_START
r = room: process.env.AUTO_INFORM_ON_START.replace(':','#')
robot.send r, 'asjon avviato e operativo!'
robot.respond /aggiornati|scarica (?:gli )?aggiornamenti/i, (res) ->
if !isFromAdmin(res) then return res.send res.random nope
runCmd 'git pull && npm install', res
@ -51,12 +55,8 @@ module.exports = (robot) ->
# Run tests on boot and report to ADMIN
if process.env.AUTO_RUN_TESTS and process.env.ADMIN_ROOM
dest = room: process.env.ADMIN_ROOM.replace(':','#')
robot.send dest, 'Operazione in corso: npm test'
runCmd 'npm test', dest, (err,stdout,stderr) ->
if err
robot.send dest, 'ATTENZIONE: TEST FAILURE\n'+stdout+stderr
else
robot.send dest, 'Test superati con successo:\n'+stdout
dest.send = (x) -> robot.send dest, x
runCmd 'npm test', dest
robot.on 'githubhook', (data,params) ->
if data.ref is 'refs/heads/master' and process.env.AUTO_KILL_ON_UPDATE