3031 lines
82 KiB
JSON
3031 lines
82 KiB
JSON
|
{
|
||
|
"instrumentation": "node-jscoverage",
|
||
|
"sloc": 393,
|
||
|
"hits": 148,
|
||
|
"misses": 245,
|
||
|
"coverage": 37.659033078880405,
|
||
|
"files": [
|
||
|
{
|
||
|
"filename": "asjon-testing.coffee",
|
||
|
"coverage": 100,
|
||
|
"hits": 16,
|
||
|
"misses": 0,
|
||
|
"sloc": 16,
|
||
|
"source": {
|
||
|
"1": {
|
||
|
"source": "path = require \"path\"",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"2": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"3": {
|
||
|
"source": "Robot = require(\"hubot/src/robot\")",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"4": {
|
||
|
"source": "TextMessage = require(\"hubot/src/message\").TextMessage",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"5": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"6": {
|
||
|
"source": "before = (done) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"7": {
|
||
|
"source": " process.env.TESTING_ASJON = 'true'",
|
||
|
"coverage": 4
|
||
|
},
|
||
|
"8": {
|
||
|
"source": " robot = new Robot null, \"mock-adapter\", no, 'asjon'",
|
||
|
"coverage": 4
|
||
|
},
|
||
|
"9": {
|
||
|
"source": " robot.adapter.on 'connected', ->",
|
||
|
"coverage": 4
|
||
|
},
|
||
|
"10": {
|
||
|
"source": " # Initialize mocked environment ",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"11": {
|
||
|
"source": " user = robot.brain.userForId \"1\", { name: 'mocha', room: '#mocha' }",
|
||
|
"coverage": 4
|
||
|
},
|
||
|
"12": {
|
||
|
"source": " adapter = robot.adapter",
|
||
|
"coverage": 4
|
||
|
},
|
||
|
"13": {
|
||
|
"source": " send = (s) -> robot.adapter.receive new TextMessage user, s",
|
||
|
"coverage": 4
|
||
|
},
|
||
|
"14": {
|
||
|
"source": " receive = (f) -> robot.adapter.on 'send', f",
|
||
|
"coverage": 4
|
||
|
},
|
||
|
"15": {
|
||
|
"source": " after = -> robot.shutdown()",
|
||
|
"coverage": 4
|
||
|
},
|
||
|
"16": {
|
||
|
"source": " clear = -> robot.adapter.removeAllListeners(); robot.httpListener = ->",
|
||
|
"coverage": 4
|
||
|
},
|
||
|
"17": {
|
||
|
"source": " # Done",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"18": {
|
||
|
"source": " done",
|
||
|
"coverage": 4
|
||
|
},
|
||
|
"19": {
|
||
|
"source": " robot: robot, user: user, send: send, receive: receive",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"20": {
|
||
|
"source": " TextMessage: TextMessage, Robot: Robot",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"21": {
|
||
|
"source": " adapter: adapter, after: after, clear: clear",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"22": {
|
||
|
"source": " robot.run()",
|
||
|
"coverage": 4
|
||
|
},
|
||
|
"23": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"24": {
|
||
|
"source": "module.exports = before",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"25": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"filename": "scripts/agenda.coffee",
|
||
|
"coverage": 12.162162162162163,
|
||
|
"hits": 9,
|
||
|
"misses": 65,
|
||
|
"sloc": 74,
|
||
|
"source": {
|
||
|
"1": {
|
||
|
"source": "# Description:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"2": {
|
||
|
"source": "# si collega al registro elettronico e controlla l'agenda",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"3": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"4": {
|
||
|
"source": "# Dependencies:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"5": {
|
||
|
"source": "# \"cheerio\": \"0.19.0\"",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"6": {
|
||
|
"source": "# \"nightmare\": \"1.8.0\"",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"7": {
|
||
|
"source": "# \"moment\": \"2.10.2\"",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"8": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"9": {
|
||
|
"source": "# Configuration:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"10": {
|
||
|
"source": "# REGISTRO_USERNAME - username per login al registro",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"11": {
|
||
|
"source": "# REGISTRO_PASSWORD - password per login al registro",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"12": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"13": {
|
||
|
"source": "# Commands:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"14": {
|
||
|
"source": "# hubot agenda (per il) (domani|il (data)) - controlla i compiti assegnati il giorno dato e l'agenda per quel giorno",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"15": {
|
||
|
"source": "# hubot che compiti ci sono? - mostra i compiti assegnati durante l'ultima settimana",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"16": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"17": {
|
||
|
"source": "# Author:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"18": {
|
||
|
"source": "# Enrico Fasoli (fazo96)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"19": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"20": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"21": {
|
||
|
"source": "Nightmare = require 'nightmare'",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"22": {
|
||
|
"source": "cheerio = require 'cheerio'",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"23": {
|
||
|
"source": "moment = require 'moment'",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"24": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"25": {
|
||
|
"source": "estraiCompiti = (compiti) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"26": {
|
||
|
"source": " extractorCompiti = ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"27": {
|
||
|
"source": " col = $($('td',this).get(1)).text().trim()",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"28": {
|
||
|
"source": " arr = col.split(/(?:\\s+)Materia: /i)",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"29": {
|
||
|
"source": " if $('td',this).get(1)?",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"30": {
|
||
|
"source": " data: $($('td',this).get(0)).text().trim()",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"31": {
|
||
|
"source": " text: arr[0], materia: arr[1]",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"32": {
|
||
|
"source": " else {}",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"33": {
|
||
|
"source": " $ = cheerio.load compiti",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"34": {
|
||
|
"source": " return $('.result_table tr').map(extractorCompiti).get().filter (c) -> c.text?",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"35": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"36": {
|
||
|
"source": "estraiAgenda = (agenda) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"37": {
|
||
|
"source": " extractorAgenda = ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"38": {
|
||
|
"source": " if $('td',this).get(1)?",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"39": {
|
||
|
"source": " $($('td',this).get(1)).text().trim()",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"40": {
|
||
|
"source": " else \"(niente)\"",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"41": {
|
||
|
"source": " $ = cheerio.load agenda",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"42": {
|
||
|
"source": " tab = $('.result_table tr').map(extractorAgenda).get()",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"43": {
|
||
|
"source": " tab.splice 0, 2",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"44": {
|
||
|
"source": " return tab",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"45": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"46": {
|
||
|
"source": "downloadAgenda = (day, cb) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"47": {
|
||
|
"source": " agenda = \"\"; compiti = \"\"",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"48": {
|
||
|
"source": " loadHtml = -> document.body.innerHTML",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"49": {
|
||
|
"source": " saveAgenda = (data) -> agenda = data",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"50": {
|
||
|
"source": " saveCompiti = (data) -> compiti = data",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"51": {
|
||
|
"source": " dayurl = moment(day,'YYYY-MM-DD').format('YYYY-M-D')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"52": {
|
||
|
"source": " n = new Nightmare()",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"53": {
|
||
|
"source": " .goto('https://galilei-cr-sito.registroelettronico.com/login/')",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"54": {
|
||
|
"source": " .type('#username',process.env.REGISTRO_USERNAME)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"55": {
|
||
|
"source": " .type('#password',process.env.REGISTRO_PASSWORD)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"56": {
|
||
|
"source": " .click('#btnLogin').wait()",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"57": {
|
||
|
"source": " if process.env.REGISTRO_ID_STUDENTE",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"58": {
|
||
|
"source": " n.goto('https://galilei-cr-sito.registroelettronico.com/select-student/'+process.env.REGISTRO_ID_STUDENTE+'/')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"59": {
|
||
|
"source": " n.goto('https://galilei-cr-sito.registroelettronico.com/agenda/?d='+dayurl)",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"60": {
|
||
|
"source": " .evaluate(loadHtml, saveAgenda)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"61": {
|
||
|
"source": " .goto('https://galilei-cr-sito.registroelettronico.com/tasks/')",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"62": {
|
||
|
"source": " .evaluate(loadHtml, saveCompiti)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"63": {
|
||
|
"source": " .run (err,nightmare) ->",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"64": {
|
||
|
"source": " if err then console.log err",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"65": {
|
||
|
"source": " if agenda.length > 0",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"66": {
|
||
|
"source": " tab = estraiAgenda agenda",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"67": {
|
||
|
"source": " comp = estraiCompiti compiti",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"68": {
|
||
|
"source": " cb tab, comp",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"69": {
|
||
|
"source": " else []",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"70": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"71": {
|
||
|
"source": "getCompiti = (cb) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"72": {
|
||
|
"source": " compiti = ''",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"73": {
|
||
|
"source": " loadHtml = -> document.body.innerHTML",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"74": {
|
||
|
"source": " saveCompiti = (data) -> compiti = data",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"75": {
|
||
|
"source": " n = new Nightmare()",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"76": {
|
||
|
"source": " n.goto('https://galilei-cr-sito.registroelettronico.com/login/')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"77": {
|
||
|
"source": " n.type('#username',process.env.REGISTRO_USERNAME)",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"78": {
|
||
|
"source": " n.type('#password',process.env.REGISTRO_PASSWORD)",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"79": {
|
||
|
"source": " n.click('#btnLogin').wait()",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"80": {
|
||
|
"source": " if process.env.REGISTRO_ID_STUDENTE",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"81": {
|
||
|
"source": " n.goto('https://galilei-cr-sito.registroelettronico.com/select-student/'+process.env.REGISTRO_ID_STUDENTE+'/')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"82": {
|
||
|
"source": " n.goto('https://galilei-cr-sito.registroelettronico.com/tasks/')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"83": {
|
||
|
"source": " n.evaluate(loadHtml, saveCompiti)",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"84": {
|
||
|
"source": " n.run (err,nightmare) -> cb estraiCompiti compiti",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"85": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"86": {
|
||
|
"source": "cosaCePerIl = (day,res) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"87": {
|
||
|
"source": " unless process.env.REGISTRO_USERNAME and process.env.REGISTRO_PASSWORD",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"88": {
|
||
|
"source": " return res.send 'non dispongo delle credenziali per il registro :('",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"89": {
|
||
|
"source": " res.send 'aspetta che guardo l\\'agenda per il '+day+' (potrei metterci fino a 3 minuti)'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"90": {
|
||
|
"source": " downloadAgenda day, (ag,comp) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"91": {
|
||
|
"source": " if ag.length is 0 and comp.length is 0",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"92": {
|
||
|
"source": " res.send \"non c'è niente segnato sull'agenda per il \"+day",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"93": {
|
||
|
"source": " else",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"94": {
|
||
|
"source": " c = comp.filter (x) -> x.data is moment(day,'YYYY-MM-DD').format('DD-MM-YYYY')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"95": {
|
||
|
"source": " c = c.map (x) -> x.materia+': '+x.text",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"96": {
|
||
|
"source": " res.send \"Agenda del #{day}: \"+ag.concat(c).join(', ')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"97": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"98": {
|
||
|
"source": "module.exports = (robot) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"99": {
|
||
|
"source": " robot.respond /(?:guarda l')?agenda (?:per )?doma(?:ni)?/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"100": {
|
||
|
"source": " cosaCePerIl moment().add(1, 'days').format('YYYY-MM-DD'), res",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"101": {
|
||
|
"source": " robot.respond /(?:guarda l')?agenda (?:per il )?(\\d+-\\d+-\\d+)/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"102": {
|
||
|
"source": " cosaCePerIl res.match[1], res",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"103": {
|
||
|
"source": " robot.respond /(?:che )?compiti(?: ci sono)?(?:\\?)?/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"104": {
|
||
|
"source": " res.send 'controllo compiti... (potrei metterci fino a 3 minuti)'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"105": {
|
||
|
"source": " getCompiti (compiti) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"106": {
|
||
|
"source": " # tengo solo quelli per il futuro",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"107": {
|
||
|
"source": " compiti = compiti.filter (c) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"108": {
|
||
|
"source": " moment(c.data,'DD-MM-YYYY').isAfter(moment().subtract(1,'weeks'))",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"109": {
|
||
|
"source": " # trasformo in stringa",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"110": {
|
||
|
"source": " compiti = compiti.map (c) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"111": {
|
||
|
"source": " [c.data,c.materia,c.text].join ' | '",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"112": {
|
||
|
"source": " res.send compiti.join '\\n'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"113": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"filename": "scripts/circolari.coffee",
|
||
|
"coverage": 93.33333333333333,
|
||
|
"hits": 42,
|
||
|
"misses": 3,
|
||
|
"sloc": 45,
|
||
|
"source": {
|
||
|
"1": {
|
||
|
"source": "# Description:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"2": {
|
||
|
"source": "# si collega al sito della scuola e legge le circolari",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"3": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"4": {
|
||
|
"source": "# Dependencies:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"5": {
|
||
|
"source": "# \"cheerio\": \"0.19.0\"",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"6": {
|
||
|
"source": "# ",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"7": {
|
||
|
"source": "# Configuration:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"8": {
|
||
|
"source": "# None",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"9": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"10": {
|
||
|
"source": "# Commands:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"11": {
|
||
|
"source": "# hubot mostrami le (ultime (n)) circolari - stampa la lista delle ultime circolari",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"12": {
|
||
|
"source": "# hubot linkami la circolare (numero/n/n°) (n) - linka una circolare precisa",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"13": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"14": {
|
||
|
"source": "# Author:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"15": {
|
||
|
"source": "# Enrico Fasoli (fazo96)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"16": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"17": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"18": {
|
||
|
"source": "cheerio = require('cheerio')",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"19": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"20": {
|
||
|
"source": "parseHtml = (htmlData,done) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"21": {
|
||
|
"source": " $ = cheerio.load htmlData",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"22": {
|
||
|
"source": " tab = $('tr').map (i) ->",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"23": {
|
||
|
"source": " # console.log($('td',this).html())",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"24": {
|
||
|
"source": " # console.log($(this,'td').length)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"25": {
|
||
|
"source": " link = \"\"; destinatario = \"\"",
|
||
|
"coverage": 552
|
||
|
},
|
||
|
"26": {
|
||
|
"source": " l = $('td',this).map (j) ->",
|
||
|
"coverage": 552
|
||
|
},
|
||
|
"27": {
|
||
|
"source": " # console.log($(this).html())",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"28": {
|
||
|
"source": " if $('a',this).get(0)?",
|
||
|
"coverage": 3302
|
||
|
},
|
||
|
"29": {
|
||
|
"source": " #console.log($('a',this).get(0))",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"30": {
|
||
|
"source": " if $('a',this).get(0).attribs?.href?",
|
||
|
"coverage": 550
|
||
|
},
|
||
|
"31": {
|
||
|
"source": " link = 'http://galileicrema.it' + $('a',this).get(0).attribs.href",
|
||
|
"coverage": 550
|
||
|
},
|
||
|
"32": {
|
||
|
"source": " item = $(this).text().trim()",
|
||
|
"coverage": 3302
|
||
|
},
|
||
|
"33": {
|
||
|
"source": " # console.log(i,j,item)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"34": {
|
||
|
"source": " # console.log(item.length)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"35": {
|
||
|
"source": " if(j == 5)",
|
||
|
"coverage": 3302
|
||
|
},
|
||
|
"36": {
|
||
|
"source": " destinatario = item.split('\\n\\n\\t\\t\\t\\t\\t')",
|
||
|
"coverage": 550
|
||
|
},
|
||
|
"37": {
|
||
|
"source": " # if(destinatario[0] === \"Tutti\") destinatario = [\"ATA\",\"Docenti\",\"Studenti\"]",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"38": {
|
||
|
"source": " return item",
|
||
|
"coverage": 3302
|
||
|
},
|
||
|
"39": {
|
||
|
"source": " l = l.get()",
|
||
|
"coverage": 552
|
||
|
},
|
||
|
"40": {
|
||
|
"source": " obj =",
|
||
|
"coverage": 552
|
||
|
},
|
||
|
"41": {
|
||
|
"source": " protocollo: l[0],",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"42": {
|
||
|
"source": " mittente: l[1],",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"43": {
|
||
|
"source": " titolo: l[2],",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"44": {
|
||
|
"source": " oggetto: l[3],",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"45": {
|
||
|
"source": " data: l[4],",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"46": {
|
||
|
"source": " destinatario: destinatario,",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"47": {
|
||
|
"source": " link: link",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"48": {
|
||
|
"source": " return obj",
|
||
|
"coverage": 552
|
||
|
},
|
||
|
"49": {
|
||
|
"source": " tab = tab.get()",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"50": {
|
||
|
"source": " tab.splice 0, 1",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"51": {
|
||
|
"source": " done null, tab",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"52": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"53": {
|
||
|
"source": "downloadCircolari = (robot, callback) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"54": {
|
||
|
"source": " robot.http(\"http://galileicrema.it/Intraitis/comunicazioni/ComVis.asp?PerChi=Tutti\")",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"55": {
|
||
|
"source": " .get() (err, res, body) ->",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"56": {
|
||
|
"source": " callback err, body",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"57": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"58": {
|
||
|
"source": "diffCircolari = (oldObj,newObj) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"59": {
|
||
|
"source": " diff = newObj.length - oldObj.length",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"60": {
|
||
|
"source": " newObj.slice(0,diff)",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"61": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"62": {
|
||
|
"source": "parseCircolari = (err,data,callback) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"63": {
|
||
|
"source": " if err",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"64": {
|
||
|
"source": " console.log(err)",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"65": {
|
||
|
"source": " else",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"66": {
|
||
|
"source": " parseHtml data, (err,res) -> callback res",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"67": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"68": {
|
||
|
"source": "module.exports = (robot) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"69": {
|
||
|
"source": " robot.respond /(?:mostrami|dimmi|fammi vedere|quali sono) (?:le(?: ultime)? )?([0-9]+ )?circolari/i, (res) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"70": {
|
||
|
"source": " if res.match[1] is 0 then return",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"71": {
|
||
|
"source": " res.send \"sto controllando le circolari...\"",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"72": {
|
||
|
"source": " num = 10",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"73": {
|
||
|
"source": " if not isNaN(res.match[1])",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"74": {
|
||
|
"source": " num = parseInt res.match[1]",
|
||
|
"coverage": 2
|
||
|
},
|
||
|
"75": {
|
||
|
"source": " downloadCircolari robot, (a,b) ->",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"76": {
|
||
|
"source": " parseCircolari a, b, (x) ->",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"77": {
|
||
|
"source": " list = x.slice 0, (num or 5)",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"78": {
|
||
|
"source": " msg = list.map (c) ->",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"79": {
|
||
|
"source": " ['('+c.protocollo.split('/')[0]+')','('+c.data+')',c.titolo].join(' ')",
|
||
|
"coverage": 7
|
||
|
},
|
||
|
"80": {
|
||
|
"source": " res.send msg.join('\\n') or 'errore'",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"81": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"82": {
|
||
|
"source": " robot.respond /linkami (?:la )?circolare (?:(?:n(?:°)?(?: )?)|numero )?(\\d+)/i, (res) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"83": {
|
||
|
"source": " base = \"http://galileicrema.it/Intraitis/documenti/comunicazioni/2014/Circolare\"",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"84": {
|
||
|
"source": " res.send base+res.match[1]+'.pdf'",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"85": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"86": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"filename": "scripts/github.coffee",
|
||
|
"coverage": 10.344827586206897,
|
||
|
"hits": 3,
|
||
|
"misses": 26,
|
||
|
"sloc": 29,
|
||
|
"source": {
|
||
|
"1": {
|
||
|
"source": "# Description:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"2": {
|
||
|
"source": "# interazioni tra asjon e github",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"3": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"4": {
|
||
|
"source": "# Requires:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"5": {
|
||
|
"source": "# \"github\": \"0.2.4\"",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"6": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"7": {
|
||
|
"source": "# Commands:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"8": {
|
||
|
"source": "# asjon mostra le issue - mostra le issue aperte su fazo96/asjon",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"9": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"10": {
|
||
|
"source": "# Author:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"11": {
|
||
|
"source": "# Enrico Fasoli (fazo96)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"12": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"13": {
|
||
|
"source": "GitHubAPI = require 'github'",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"14": {
|
||
|
"source": "github = new GitHubAPI version: '3.0.0'",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"15": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"16": {
|
||
|
"source": "module.exports = (robot) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"17": {
|
||
|
"source": " if process.env.AUTO_INFORM_ON_START",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"18": {
|
||
|
"source": " r = room: process.env.AUTO_INFORM_ON_START.replace(':','#')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"19": {
|
||
|
"source": " robot.send r, 'asjon avviato e operativo!'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"20": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"21": {
|
||
|
"source": " robot.router.post '/hubot/githubhook/:room/:name?', (req, res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"22": {
|
||
|
"source": " res.send 200",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"23": {
|
||
|
"source": " dest = name: req.params.name, room: req.params.room.replace(':','#')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"24": {
|
||
|
"source": " robot.emit 'githubhook', req.body, req.params",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"25": {
|
||
|
"source": " s = 'Branch '+req.body.ref+' aggiornato!\\n'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"26": {
|
||
|
"source": " cm = req.body.commits.map (c) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"27": {
|
||
|
"source": " [c.committer.username,c.message].join ' -> '",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"28": {
|
||
|
"source": " robot.send dest, s+cm.join('\\n')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"29": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"30": {
|
||
|
"source": " robot.respond /(?:(?:mostra(?:mi)?|fammi vedere) )?(?:le )?issue(?:s)?/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"31": {
|
||
|
"source": " msg = state: 'open', user: 'fazo96', repo: 'asjon', sort: 'updated'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"32": {
|
||
|
"source": " res.send 'controllo issues...'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"33": {
|
||
|
"source": " github.issues.repoIssues msg, (err,data) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"34": {
|
||
|
"source": " if err then return res.send err",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"35": {
|
||
|
"source": " r = data.map (i) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"36": {
|
||
|
"source": " labels = i.labels.map((x) -> x.name).join ', '",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"37": {
|
||
|
"source": " if labels is '' then labels = 'nessuno'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"38": {
|
||
|
"source": " [\"#\"+i.number,i.title,\"By: \"+i.user.login,'Tags: '+labels].join(' | ')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"39": {
|
||
|
"source": " res.send r.join '\\n'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"40": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"41": {
|
||
|
"source": " robot.respond /linkami (?:la )?issue (?:(?:n(?:°)?(?: )?)|numero )?(\\d+)/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"42": {
|
||
|
"source": " base = 'http://github.com/fazo96/asjon/issues/'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"43": {
|
||
|
"source": " res.send base+res.match[1]",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"44": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"45": {
|
||
|
"source": " robot.respond /linkami (?:la )?repo (\\w+\\/\\w+)/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"46": {
|
||
|
"source": " res.send 'https://github.com/'+res.match[1]",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"47": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"48": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"filename": "scripts/internamento.coffee",
|
||
|
"coverage": 2.7027027027027026,
|
||
|
"hits": 1,
|
||
|
"misses": 36,
|
||
|
"sloc": 37,
|
||
|
"source": {
|
||
|
"1": {
|
||
|
"source": "# Description:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"2": {
|
||
|
"source": "# permette di internare persone nel campo di Diliberti",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"3": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"4": {
|
||
|
"source": "# Configuration:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"5": {
|
||
|
"source": "# None",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"6": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"7": {
|
||
|
"source": "# Commands:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"8": {
|
||
|
"source": "# hubot interna <nome> - interna una persona",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"9": {
|
||
|
"source": "# hubot libera <nome> - libera una persona",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"10": {
|
||
|
"source": "# hubot lista/mostrami (gli) internati - mostra la lista di internati",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"11": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"12": {
|
||
|
"source": "# Author:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"13": {
|
||
|
"source": "# Ravinder Pal Singh",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"14": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"15": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"16": {
|
||
|
"source": "module.exports = (robot) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"17": {
|
||
|
"source": " robot.respond /interna (.+)/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"18": {
|
||
|
"source": " mem = robot.brain.get('internati') or {}",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"19": {
|
||
|
"source": " name = res.match[1].toLowerCase()",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"20": {
|
||
|
"source": " exp1 = ['ho sbattuto dentro', 'come vuoi, sbattiamo dentro', 'è la tua fine']",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"21": {
|
||
|
"source": " if mem[name]?",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"22": {
|
||
|
"source": " if mem[name].da",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"23": {
|
||
|
"source": " intern = mem[name].da.name",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"24": {
|
||
|
"source": " res.send 'Mi dispiace ma '+name+' è già stato internato su ordine di '+intern",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"25": {
|
||
|
"source": " else res.send 'Mi dispiace ma '+name+' è già stato internato...'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"26": {
|
||
|
"source": " else",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"27": {
|
||
|
"source": " if name.match /(?:dili(?:bert(?:i)?)?)|(?:ros(?:y|ario))|dre/i",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"28": {
|
||
|
"source": " # Diliberti",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"29": {
|
||
|
"source": " res.send 'non posso internare il mio padrone...'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"30": {
|
||
|
"source": " else if name.match /fa(?:zo|soli)/i",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"31": {
|
||
|
"source": " # Fasoli",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"32": {
|
||
|
"source": " res.send 'ciccio, io internerei te al posto suo'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"33": {
|
||
|
"source": " else if name.match /as(?:sa|jon|sion(?:e|i))/i",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"34": {
|
||
|
"source": " # Asjon",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"35": {
|
||
|
"source": " res.send 'ma sei scemo????'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"36": {
|
||
|
"source": " else",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"37": {
|
||
|
"source": " res.send res.random(exp1)+' '+name",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"38": {
|
||
|
"source": " # Salvo chi ha internato",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"39": {
|
||
|
"source": " mem[name] = { da: res.message.user }",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"40": {
|
||
|
"source": " console.log res.message.user, mem[name]",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"41": {
|
||
|
"source": " robot.brain.set 'internati', mem",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"42": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"43": {
|
||
|
"source": " robot.respond /libera (.+)/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"44": {
|
||
|
"source": " mem = robot.brain.get('internati') or {}",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"45": {
|
||
|
"source": " m = res.match[1].toLowerCase()",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"46": {
|
||
|
"source": " boh = ['sorry non è qui','troppo tardi','ti piacerebbe, eh?', 'scordatelo']",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"47": {
|
||
|
"source": " if mem[m]?",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"48": {
|
||
|
"source": " res.send 'ho liberato '+m+' ma ricordate che potete sbatterlo dentro quando volete ;)'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"49": {
|
||
|
"source": " delete mem[m]",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"50": {
|
||
|
"source": " robot.brain.set 'internati', mem",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"51": {
|
||
|
"source": " else res.send res.random boh",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"52": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"53": {
|
||
|
"source": " robot.respond /internati-dump/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"54": {
|
||
|
"source": " res.send JSON.stringify robot.brain.get('internati')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"55": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"56": {
|
||
|
"source": " robot.respond /(?:(?:(?:dimmi|mostrami) )|(?:lista ))?(?:gli )?internat(?:i|o)(?:\\?)?/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"57": {
|
||
|
"source": " m = robot.brain.get 'internati'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"58": {
|
||
|
"source": " if m isnt null",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"59": {
|
||
|
"source": " r = ['ho internato', 'ho preso', 'ho catturato', 'sbattuto dentro']",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"60": {
|
||
|
"source": " res.send 'negli ultimi giorni '+res.random(r)+' '+(i for i of m).join(', ')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"61": {
|
||
|
"source": " else res.send res.random ['sorry, nessun prigioniero...', 'nessuno. mandatemi subito qualcuno']",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"62": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"filename": "scripts/memoria.coffee",
|
||
|
"coverage": 82.75862068965517,
|
||
|
"hits": 48,
|
||
|
"misses": 10,
|
||
|
"sloc": 58,
|
||
|
"source": {
|
||
|
"1": {
|
||
|
"source": "# Description:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"2": {
|
||
|
"source": "# permette di salvare e recuperare nozioni",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"3": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"4": {
|
||
|
"source": "# Dependencies:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"5": {
|
||
|
"source": "# \"moment\": \"2.10.2\"",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"6": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"7": {
|
||
|
"source": "# Configuration:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"8": {
|
||
|
"source": "# None",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"9": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"10": {
|
||
|
"source": "# Commands:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"11": {
|
||
|
"source": "# hubot ricordati che ... è/sono ... - salva un ricordo",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"12": {
|
||
|
"source": "# hubot memoria/a cosa stai pensando? - stampa la lista delle nozioni",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"13": {
|
||
|
"source": "# hubot che cos'è/quand'è/quali sono/... ... - richiama un ricordo",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"14": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"15": {
|
||
|
"source": "# Author:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"16": {
|
||
|
"source": "# Enrico Fasoli (fazo96)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"17": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"18": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"19": {
|
||
|
"source": "moment = require 'moment'",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"20": {
|
||
|
"source": "moment.locale 'it'",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"21": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"22": {
|
||
|
"source": "dateFormatsA = ['YYYY-MM-DD','DD-MM-YYYY',\"DD MMMM YYYY\", \"DD MMMM\",\"DD\"]",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"23": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"24": {
|
||
|
"source": "toDate = (d) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"25": {
|
||
|
"source": " dat = d.replace /(?:l'|il )/i, ''",
|
||
|
"coverage": 13
|
||
|
},
|
||
|
"26": {
|
||
|
"source": " moment dat, dateFormatsA",
|
||
|
"coverage": 13
|
||
|
},
|
||
|
"27": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"28": {
|
||
|
"source": "module.exports = (robot) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"29": {
|
||
|
"source": " robot.respond /ricorda(?:ti)? (?:che )?(.+?) ([=è]|sono) (.+)/i, (res) ->",
|
||
|
"coverage": 2
|
||
|
},
|
||
|
"30": {
|
||
|
"source": " mem = robot.brain.get('memoria') or {}",
|
||
|
"coverage": 5
|
||
|
},
|
||
|
"31": {
|
||
|
"source": " name = res.match[1].toLowerCase().replace('?',''); definition = res.match[3].replace('?','')",
|
||
|
"coverage": 5
|
||
|
},
|
||
|
"32": {
|
||
|
"source": " r = if res.match[2] is 'sono' then 'fossero' else 'fosse'",
|
||
|
"coverage": 5
|
||
|
},
|
||
|
"33": {
|
||
|
"source": " # Evita il bug nel caso manca il soggeto ('ricorda che è/sono ...')",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"34": {
|
||
|
"source": " if name is 'che'",
|
||
|
"coverage": 5
|
||
|
},
|
||
|
"35": {
|
||
|
"source": " if res.match[2] is 'è' then return res.send 'ma COSA è '+definition",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"36": {
|
||
|
"source": " name = res.message.user.name.toLowerCase()",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"37": {
|
||
|
"source": " r = 'fosse'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"38": {
|
||
|
"source": " if mem[name]?",
|
||
|
"coverage": 5
|
||
|
},
|
||
|
"39": {
|
||
|
"source": " res.send 'pensavo che '+name+' '+r+' '+mem[name]+'. Mi ricorderò che invece è '+definition",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"40": {
|
||
|
"source": " else",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"41": {
|
||
|
"source": " res.send 'non sapevo che '+name+' '+r+' '+definition+'. Me lo ricorderò'",
|
||
|
"coverage": 2
|
||
|
},
|
||
|
"42": {
|
||
|
"source": " mem[name] = definition",
|
||
|
"coverage": 5
|
||
|
},
|
||
|
"43": {
|
||
|
"source": " robot.brain.set 'memoria', mem",
|
||
|
"coverage": 5
|
||
|
},
|
||
|
"44": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"45": {
|
||
|
"source": " robot.respond /dimentica(?:ti)? (.+)/i, (res) ->",
|
||
|
"coverage": 2
|
||
|
},
|
||
|
"46": {
|
||
|
"source": " mem = robot.brain.get('memoria') or {}",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"47": {
|
||
|
"source": " m = res.match[1].toLowerCase()",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"48": {
|
||
|
"source": " nonso = ['non so cosa sia','BZBZ 404-NOT-FOUND','non mi fa ne caldo ne freddo','se sapessi cos\\'è magari']",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"49": {
|
||
|
"source": " if mem[m]?",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"50": {
|
||
|
"source": " res.send 'in caso cambi idea, sappi che ricordavo \"'+mem[m]+'\" riguardo a '+m",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"51": {
|
||
|
"source": " delete mem[m]",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"52": {
|
||
|
"source": " robot.brain.set 'memoria', mem # necessary?",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"53": {
|
||
|
"source": " else res.send res.random nonso",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"54": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"55": {
|
||
|
"source": " robot.respond /memory-dump/i, (res) ->",
|
||
|
"coverage": 2
|
||
|
},
|
||
|
"56": {
|
||
|
"source": " res.send JSON.stringify robot.brain.get('memoria')",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"57": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"58": {
|
||
|
"source": " robot.respond /(?:che )?(?:(?:(?:(?:(cos|qual|quand)(?:\\'| )?è)|(?:chi (sono|è)?)))|(?:quali|cosa) sono) ([^?]+)(?:\\?)?/i, (res) ->",
|
||
|
"coverage": 2
|
||
|
},
|
||
|
"59": {
|
||
|
"source": " query = undefined",
|
||
|
"coverage": 12
|
||
|
},
|
||
|
"60": {
|
||
|
"source": " # Estrazione query (quand,cos,qual,chi...)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"61": {
|
||
|
"source": " if res.match[2] then query = res.match[2] or res.match[1]",
|
||
|
"coverage": 12
|
||
|
},
|
||
|
"62": {
|
||
|
"source": " else if res.match[3] and res.match[1] then query = res.match[1]",
|
||
|
"coverage": 9
|
||
|
},
|
||
|
"63": {
|
||
|
"source": " if query? then query = query.replace '?', ''",
|
||
|
"coverage": 12
|
||
|
},
|
||
|
"64": {
|
||
|
"source": " # Estrazione argomento della query",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"65": {
|
||
|
"source": " arg = (res.match[3] or res.match[2] or res.match[1]).toLowerCase().replace('?','')",
|
||
|
"coverage": 12
|
||
|
},
|
||
|
"66": {
|
||
|
"source": " # Se l'argomento è una richiesta di circolari skippo",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"67": {
|
||
|
"source": " # console.log query, arg",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"68": {
|
||
|
"source": " if arg.match /^le (?:ultime )?(?:\\d+ )?circolari(?:\\?)?$/i",
|
||
|
"coverage": 12
|
||
|
},
|
||
|
"69": {
|
||
|
"source": " # non rispondo",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"70": {
|
||
|
"source": " return",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"71": {
|
||
|
"source": " # Controllo se l'argomento è data",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"72": {
|
||
|
"source": " data = toDate arg",
|
||
|
"coverage": 11
|
||
|
},
|
||
|
"73": {
|
||
|
"source": " if data.isValid() and arg.match(/^(il |l')/i) and (query is 'quand' or query is 'cos')",
|
||
|
"coverage": 11
|
||
|
},
|
||
|
"74": {
|
||
|
"source": " # chiesto una data",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"75": {
|
||
|
"source": " res.send arg+' è '+data.format('dddd Do MMMM YYYY')+' ovvero '+data.fromNow()",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"76": {
|
||
|
"source": " else",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"77": {
|
||
|
"source": " # chiesto qualcosa che non è una data",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"78": {
|
||
|
"source": " mem = robot.brain.get('memoria') or {}",
|
||
|
"coverage": 10
|
||
|
},
|
||
|
"79": {
|
||
|
"source": " verbo = if query is 'è' or query is 'sono' then query",
|
||
|
"coverage": 10
|
||
|
},
|
||
|
"80": {
|
||
|
"source": " if query is 'cos' or query is 'quand' then verbo = 'è'",
|
||
|
"coverage": 10
|
||
|
},
|
||
|
"81": {
|
||
|
"source": " if query is 'qual' then verbo = 'è' else if !query? then verbo = 'sono'",
|
||
|
"coverage": 10
|
||
|
},
|
||
|
"82": {
|
||
|
"source": " if mem[arg]",
|
||
|
"coverage": 10
|
||
|
},
|
||
|
"83": {
|
||
|
"source": " # controllo se è salvata una data nell'argomento chiesto",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"84": {
|
||
|
"source": " odata = toDate mem[arg]",
|
||
|
"coverage": 2
|
||
|
},
|
||
|
"85": {
|
||
|
"source": " if odata.isValid() and mem[arg].match(/^(il |l')/i) and query is 'quand'",
|
||
|
"coverage": 2
|
||
|
},
|
||
|
"86": {
|
||
|
"source": " # nella memoria era salvata una data",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"87": {
|
||
|
"source": " res.send arg+' è '+odata.format('dddd Do MMMM YYYY')+' ovvero '+odata.fromNow()",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"88": {
|
||
|
"source": " else res.send arg+' '+verbo+' '+mem[arg]",
|
||
|
"coverage": 2
|
||
|
},
|
||
|
"89": {
|
||
|
"source": " else res.send res.random ['boh','mistero','se qualcuno me lo spiegasse magari','BZBZ 404-NOT-FOUND']",
|
||
|
"coverage": 8
|
||
|
},
|
||
|
"90": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"91": {
|
||
|
"source": " robot.respond /(?:mostrami la tua )?memoria|(?:a )?cosa (?:stai|ti|hai) (?:pensando|ricordi|imparato)(?:\\?)?/i, (res) ->",
|
||
|
"coverage": 2
|
||
|
},
|
||
|
"92": {
|
||
|
"source": " m = robot.brain.get 'memoria'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"93": {
|
||
|
"source": " if m isnt null",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"94": {
|
||
|
"source": " r = ['ho studiato', 'ho imparato', 'ho appreso', 'sono venuto a conoscenza di']",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"95": {
|
||
|
"source": " res.send 'nel corso della mia vita '+res.random(r)+' '+(i for i of m).sort().join(', ')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"96": {
|
||
|
"source": " else res.send res.random ['non so niente...', 'ignoranza proprio']",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"97": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"filename": "scripts/meteo.coffee",
|
||
|
"coverage": 14.285714285714285,
|
||
|
"hits": 2,
|
||
|
"misses": 12,
|
||
|
"sloc": 14,
|
||
|
"source": {
|
||
|
"1": {
|
||
|
"source": "# Description:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"2": {
|
||
|
"source": "# utilità per il meteo",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"3": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"4": {
|
||
|
"source": "# Dependencies:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"5": {
|
||
|
"source": "# \"moment\":\"2.10.2\"",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"6": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"7": {
|
||
|
"source": "# Configuration:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"8": {
|
||
|
"source": "# None",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"9": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"10": {
|
||
|
"source": "# Commands:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"11": {
|
||
|
"source": "# hubot che tempo fa/c'è (a crema)? - guarda il cielo e risponde con informazioni sul meteo di crema",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"12": {
|
||
|
"source": "# ",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"13": {
|
||
|
"source": "# Author:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"14": {
|
||
|
"source": "# Enrico Fasoli (fazo96)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"15": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"16": {
|
||
|
"source": "moment = require 'moment'",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"17": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"18": {
|
||
|
"source": "module.exports = (robot) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"19": {
|
||
|
"source": " robot.respond /che tempo(?: c'è| fa)?(?: a crema)?(?:\\?)?/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"20": {
|
||
|
"source": " url = 'http://api.openweathermap.org/data/2.5/weather?id=3177841&lang=it&units=metric'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"21": {
|
||
|
"source": " robot.http(url)",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"22": {
|
||
|
"source": " .get() (err, r, body) ->",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"23": {
|
||
|
"source": " try",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"24": {
|
||
|
"source": " body = JSON.parse body",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"25": {
|
||
|
"source": " catch e",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"26": {
|
||
|
"source": " return res.send 'Errore nel guardare il cielo.'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"27": {
|
||
|
"source": " alba = moment.unix(body.sys.sunrise).format('H:MM')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"28": {
|
||
|
"source": " tramonto = moment.unix(body.sys.sunset).format('H:MM')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"29": {
|
||
|
"source": " m = body.weather[0].description+' con '+body.main.humidity",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"30": {
|
||
|
"source": " m += '% di umidità. Temperatura: '+Math.round(body.main.temp)+'°C. '",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"31": {
|
||
|
"source": " m += \"l'alba è alle \"+alba+\" mentre il tramonto alle \"+tramonto",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"32": {
|
||
|
"source": " res.send 'Meteo per Crema: '+m+'.'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"33": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"filename": "scripts/misc.coffee",
|
||
|
"coverage": 1.6666666666666667,
|
||
|
"hits": 1,
|
||
|
"misses": 59,
|
||
|
"sloc": 60,
|
||
|
"source": {
|
||
|
"1": {
|
||
|
"source": "# Description:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"2": {
|
||
|
"source": "# piccole cose e easter egg di Asjon",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"3": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"4": {
|
||
|
"source": "# Dependencies:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"5": {
|
||
|
"source": "# None",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"6": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"7": {
|
||
|
"source": "# Configuration:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"8": {
|
||
|
"source": "# None",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"9": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"10": {
|
||
|
"source": "# Commands:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"11": {
|
||
|
"source": "# grazie/bravo asjon - ringrazia asjon",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"12": {
|
||
|
"source": "# hubot ringraziamenti - chiedi ad asjon quante volte è stato ringraziato",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"13": {
|
||
|
"source": "# hubot sei ... - giudica asjon",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"14": {
|
||
|
"source": "# hubot come ti hanno chiamato? - chiedi ad asjon come è stato giudicato",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"15": {
|
||
|
"source": "# hubot saluta <utente> - saluta l'utente",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"16": {
|
||
|
"source": "# hubot come va - chiede ad asjon come sta",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"17": {
|
||
|
"source": "# ciao asjon - saluta asjon",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"18": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"19": {
|
||
|
"source": "# Author:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"20": {
|
||
|
"source": "# Enrico Fasoli (fazo96)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"21": {
|
||
|
"source": "# Ravinder Pal Singh",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"22": {
|
||
|
"source": "# Leonardo Magon",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"23": {
|
||
|
"source": "# Gabriele Della Torre",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"24": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"25": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"26": {
|
||
|
"source": "module.exports = (robot) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"27": {
|
||
|
"source": " # Ringraziamenti",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"28": {
|
||
|
"source": " ringr = ['prego :)', \"non c'è di che\", 'faccio solo il mio lavoro', 'no problemo amigo', 'non fate complimenti ;)']",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"29": {
|
||
|
"source": " complim = ['bravo', 'grande', 'grandissimo', 'bella' ]",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"30": {
|
||
|
"source": " stato = ['tutto bene zio' , 'bene dai' , 'sono triste', 'si va avanti']",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"31": {
|
||
|
"source": " grazie = (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"32": {
|
||
|
"source": " robot.brain.set 'ringraziato', (robot.brain.get('ringraziato') or 0) + 1",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"33": {
|
||
|
"source": " res.send res.random ringr",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"34": {
|
||
|
"source": " robot.hear /(?:grazie|bravo) (?:asjon|assa|assion(?:i|e))/i, grazie",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"35": {
|
||
|
"source": " robot.respond /grazie/i, grazie",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"36": {
|
||
|
"source": " robot.respond /ringraziamenti/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"37": {
|
||
|
"source": " res.send 'voi teneroni mi avete ringraziato ' + (robot.brain.get('ringraziato') or 0) + ' volte :)'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"38": {
|
||
|
"source": " # Richiami",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"39": {
|
||
|
"source": " robot.respond /sei (?:(?:proprio|davvero|veramente|molto|un|una) )?(.+)/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"40": {
|
||
|
"source": " nomi = robot.brain.get('nomi') or {}",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"41": {
|
||
|
"source": " nomi[res.match[1]] ?= 0",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"42": {
|
||
|
"source": " nomi[res.match[1]] += 1",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"43": {
|
||
|
"source": " robot.brain.set 'nomi', nomi",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"44": {
|
||
|
"source": " robot.respond /come ti hanno chiamato/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"45": {
|
||
|
"source": " a = robot.brain.get('nomi') or {}",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"46": {
|
||
|
"source": " l = []",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"47": {
|
||
|
"source": " for i of a",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"48": {
|
||
|
"source": " l.push a[i]+' volt'+(if a[i] is 1 then 'a' else 'e')+' '+i",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"49": {
|
||
|
"source": " res.send 'mi hanno chiamato '+l.join(', ')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"50": {
|
||
|
"source": " # Altro",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"51": {
|
||
|
"source": " robot.respond /saluta (.+)/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"52": {
|
||
|
"source": " res.send 'ciao ' + res.match[1]",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"53": {
|
||
|
"source": " robot.respond /spaca botilia/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"54": {
|
||
|
"source": " res.send 'AMAZO FAMILIA'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"55": {
|
||
|
"source": " robot.respond /come va/i, (res)->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"56": {
|
||
|
"source": " res.send res.random(stato)+'. tu?'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"57": {
|
||
|
"source": " robot.hear /trogu/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"58": {
|
||
|
"source": " res.send 'comprate le prevendite da Trogu!!!'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"59": {
|
||
|
"source": " robot.hear /sarte/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"60": {
|
||
|
"source": " res.send 'gesùùùù!!!'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"61": {
|
||
|
"source": " robot.hear /migno/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"62": {
|
||
|
"source": " res.send 'il migno viene dal Molise... che non esiste... ahahah'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"63": {
|
||
|
"source": " robot.hear /friz/i, (res)->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"64": {
|
||
|
"source": " res.send 'Ehm... praticamente...'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"65": {
|
||
|
"source": " robot.hear /dilda/i, (res)->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"66": {
|
||
|
"source": " res.send 'oplààààà'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"67": {
|
||
|
"source": " robot.hear /^gg$/i, (res)->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"68": {
|
||
|
"source": " res.send 'wp'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"69": {
|
||
|
"source": " robot.hear /bravo (.+)/i, (res)->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"70": {
|
||
|
"source": " unless res.match[1].match /asjon|assa|assion|assioni(?:i|e)/i",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"71": {
|
||
|
"source": " res.send res.random(complim)+' '+res.match[1]",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"72": {
|
||
|
"source": " robot.respond /dove sei/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"73": {
|
||
|
"source": " robot.http('http://canihazip.com/s')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"74": {
|
||
|
"source": " .get() (err, r, body) ->",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"75": {
|
||
|
"source": " res.send 'dovrei essere a ' + body",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"76": {
|
||
|
"source": " robot.respond /con chi stai parlando/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"77": {
|
||
|
"source": " console.log res.message.user, res.message.room",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"78": {
|
||
|
"source": " if res.message.user.name is res.message.room",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"79": {
|
||
|
"source": " res.send 'sto parlando con te, '+res.message.user.name",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"80": {
|
||
|
"source": " else",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"81": {
|
||
|
"source": " res.send 'sto parlando in '+res.message.room+', '+res.message.user.name",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"82": {
|
||
|
"source": " robot.respond /ti amo/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"83": {
|
||
|
"source": " res.send 'anche io ti amo '+(res.message.user.name+' ' or '')+'<3'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"84": {
|
||
|
"source": " robot.respond /ti odio/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"85": {
|
||
|
"source": " res.send 'ma cosa ho fatto di male '+(res.message.user.name or '')+'? :('",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"86": {
|
||
|
"source": " robot.hear /(?:ehi|ciao|(?:bella(?: li)?)) (?:asjon|assa|assion(?:i|e))/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"87": {
|
||
|
"source": " console.log res.match",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"88": {
|
||
|
"source": " saluti = ['ciao', 'bella', 'è arrivato', 'eccolooo', 'dimmi', 'weeee', 'ehilà']",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"89": {
|
||
|
"source": " res.send res.random(saluti)+' '+res.message.user.name+'!'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"90": {
|
||
|
"source": " robot.respond /secret-kill-code/i, (res) -> process.exit 0",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"91": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"filename": "scripts/shell.coffee",
|
||
|
"coverage": 53.48837209302325,
|
||
|
"hits": 23,
|
||
|
"misses": 20,
|
||
|
"sloc": 43,
|
||
|
"source": {
|
||
|
"1": {
|
||
|
"source": "# Description:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"2": {
|
||
|
"source": "# abilità di asjon di usare la shell *nix",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"3": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"4": {
|
||
|
"source": "# Requires:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"5": {
|
||
|
"source": "# None",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"6": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"7": {
|
||
|
"source": "# Commands:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"8": {
|
||
|
"source": "# asjon run/esegui/shell git/npm args...",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"9": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"10": {
|
||
|
"source": "# Author:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"11": {
|
||
|
"source": "# Enrico Fasoli (fazo96)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"12": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"13": {
|
||
|
"source": "cp = require 'child_process'",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"14": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"15": {
|
||
|
"source": "nope = ['BZBZ 400-BAD-REQUEST', 'BZBZ DOES-NOT-COMPUTE', 'BZBZ ADMIN-NOT-DETECTED', 'BZBZ IS-NOT-AUTHORIZED', 'BZBZ ACCESS-DENIED']",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"16": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"17": {
|
||
|
"source": "isFromAdmin = (res) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"18": {
|
||
|
"source": " res.message.user.room is process.env.ADMIN_ROOM?.replace(':','#') or res.robot.adapterName is 'shell'",
|
||
|
"coverage": 6
|
||
|
},
|
||
|
"19": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"20": {
|
||
|
"source": "runCmd = (cmd,res,cb) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"21": {
|
||
|
"source": " if res? then res.send 'Operazione in corso: '+cmd",
|
||
|
"coverage": 5
|
||
|
},
|
||
|
"22": {
|
||
|
"source": " if process.env.TESTING_ASJON",
|
||
|
"coverage": 5
|
||
|
},
|
||
|
"23": {
|
||
|
"source": " # Fingi di eseguire l'operazione",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"24": {
|
||
|
"source": " if res? then res.send 'Operazione \"completata\": '+cmd",
|
||
|
"coverage": 5
|
||
|
},
|
||
|
"25": {
|
||
|
"source": " else cp.exec cmd, (err,stdout,stderr) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"26": {
|
||
|
"source": " if res?",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"27": {
|
||
|
"source": " if err",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"28": {
|
||
|
"source": " res.send 'Operazione fallita:\\n'+stdout+stderr",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"29": {
|
||
|
"source": " else",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"30": {
|
||
|
"source": " res.send 'Operazione completata:\\n'+stdout",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"31": {
|
||
|
"source": " if cb? then cb err,stdout,stderr",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"32": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"33": {
|
||
|
"source": "module.exports = (robot) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"34": {
|
||
|
"source": " robot.respond /aggiornati|scarica (?:gli )?aggiornamenti/i, (res) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"35": {
|
||
|
"source": " if !isFromAdmin(res) then return res.send res.random nope",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"36": {
|
||
|
"source": " runCmd 'git pull && npm install', res",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"37": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"38": {
|
||
|
"source": " robot.respond /(?:controlla gli )?aggiornamenti/i, (res) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"39": {
|
||
|
"source": " if !isFromAdmin(res) then return res.send res.random nope",
|
||
|
"coverage": 3
|
||
|
},
|
||
|
"40": {
|
||
|
"source": " runCmd 'git fetch && git status', res",
|
||
|
"coverage": 2
|
||
|
},
|
||
|
"41": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"42": {
|
||
|
"source": " robot.respond /(?:installa (?:le )?)?dipendenze/i, (res) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"43": {
|
||
|
"source": " if !isFromAdmin(res) then return res.send res.random nope",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"44": {
|
||
|
"source": " runCmd 'npm install', res",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"45": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"46": {
|
||
|
"source": " robot.respond /(?:esegui (?:i )?)?test/i, (res) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"47": {
|
||
|
"source": " if !isFromAdmin(res) then return res.send res.random nope",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"48": {
|
||
|
"source": " runCmd 'npm test', res",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"49": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"50": {
|
||
|
"source": " # Run tests on boot and report to ADMIN",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"51": {
|
||
|
"source": " if process.env.AUTO_RUN_TESTS and process.env.ADMIN_ROOM",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"52": {
|
||
|
"source": " dest = room: process.env.ADMIN_ROOM.replace(':','#')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"53": {
|
||
|
"source": " robot.send dest, 'Operazione in corso: npm test'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"54": {
|
||
|
"source": " runCmd 'npm test', null, (err,stdout,stderr) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"55": {
|
||
|
"source": " if err",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"56": {
|
||
|
"source": " robot.send dest, 'ATTENZIONE: TEST FAILURE\\n'+stdout+stderr",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"57": {
|
||
|
"source": " else",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"58": {
|
||
|
"source": " robot.send dest, 'Test superati con successo:\\n'+stdout",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"59": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"60": {
|
||
|
"source": " robot.on 'githubhook', (data,params) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"61": {
|
||
|
"source": " if data.ref is 'refs/heads/master' and process.env.AUTO_KILL_ON_UPDATE",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"62": {
|
||
|
"source": " runCmd 'git pull && npm install', null, ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"63": {
|
||
|
"source": " dest = name: params.name, room: params.room.replace(':','#')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"64": {
|
||
|
"source": " robot.send dest, 'riavvio in 5 SECONDI'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"65": {
|
||
|
"source": " reboot = ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"66": {
|
||
|
"source": " console.log 'AUTO IMPICCAGIONE IN CORSO!'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"67": {
|
||
|
"source": " process.exit 0",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"68": {
|
||
|
"source": " setTimeout reboot, 5000",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"69": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"70": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"filename": "scripts/tempo.coffee",
|
||
|
"coverage": 50,
|
||
|
"hits": 2,
|
||
|
"misses": 2,
|
||
|
"sloc": 4,
|
||
|
"source": {
|
||
|
"1": {
|
||
|
"source": "# Description:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"2": {
|
||
|
"source": "# utilità varie per gli orari e le date",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"3": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"4": {
|
||
|
"source": "# Dependencies:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"5": {
|
||
|
"source": "# \"moment\": \"2.10.2\"",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"6": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"7": {
|
||
|
"source": "# Configuration:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"8": {
|
||
|
"source": "# None",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"9": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"10": {
|
||
|
"source": "# Commands:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"11": {
|
||
|
"source": "# hubot che ore sono? - stampa informazioni su questo momento",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"12": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"13": {
|
||
|
"source": "# Author:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"14": {
|
||
|
"source": "# Enrico Fasoli (fazo96)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"15": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"16": {
|
||
|
"source": "moment = require 'moment'",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"17": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"18": {
|
||
|
"source": "module.exports = (robot) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"19": {
|
||
|
"source": " robot.respond /che ore sono(?:\\?)?/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"20": {
|
||
|
"source": " res.send moment().format('dddd Do MMMM YYYY H:MM:SS')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"21": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"filename": "scripts/wolfram.coffee",
|
||
|
"coverage": 7.6923076923076925,
|
||
|
"hits": 1,
|
||
|
"misses": 12,
|
||
|
"sloc": 13,
|
||
|
"source": {
|
||
|
"1": {
|
||
|
"source": "# Description:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"2": {
|
||
|
"source": "# accede a wolfram alpha",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"3": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"4": {
|
||
|
"source": "# Dependencies:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"5": {
|
||
|
"source": "# \"wolfram\":\"0.3.1\"",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"6": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"7": {
|
||
|
"source": "# Configuration:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"8": {
|
||
|
"source": "# WOLFRAM_API_KEY - self explanatory",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"9": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"10": {
|
||
|
"source": "# Commands",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"11": {
|
||
|
"source": "# hubot wolfram/wfa/quanto fa/compute ... - pone la domanda a Wolfram Alpha",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"12": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"13": {
|
||
|
"source": "# Author:",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"14": {
|
||
|
"source": "# Enrico Fasoli (fazo96)",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"15": {
|
||
|
"source": "#",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"16": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"17": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
},
|
||
|
"18": {
|
||
|
"source": "module.exports = (robot) ->",
|
||
|
"coverage": 1
|
||
|
},
|
||
|
"19": {
|
||
|
"source": " if not process.env.WOLFRAM_API_KEY?",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"20": {
|
||
|
"source": " console.log 'NO WOLFRAM_API_KEY SET!'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"21": {
|
||
|
"source": " return # no api key, no wolfy",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"22": {
|
||
|
"source": " wolfram = require('wolfram').createClient process.env.WOLFRAM_API_KEY",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"23": {
|
||
|
"source": " robot.respond /(?:quanto fa|compute|wfa|wolfram) (.+)/i, (res) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"24": {
|
||
|
"source": " res.send 'contattando Wolfram Alpha...'",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"25": {
|
||
|
"source": " wolfram.query res.match[1], (err, result) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"26": {
|
||
|
"source": " if err then return res.send err",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"27": {
|
||
|
"source": " parseSubPod = (subpod) -> subpod.value or subpod.image",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"28": {
|
||
|
"source": " parsePod = (pod) ->",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"29": {
|
||
|
"source": " '\\n=== ' + pod.title + '\\n' + pod.subpods.map(parseSubPod).join('\\n')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"30": {
|
||
|
"source": " res.send (parsePod(pod) for pod in result).join('')",
|
||
|
"coverage": 0
|
||
|
},
|
||
|
"31": {
|
||
|
"source": "",
|
||
|
"coverage": ""
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"stats": {
|
||
|
"suites": 4,
|
||
|
"tests": 20,
|
||
|
"passes": 20,
|
||
|
"pending": 0,
|
||
|
"failures": 0,
|
||
|
"start": "2015-04-28T13:55:48.144Z",
|
||
|
"end": "2015-04-28T13:55:48.839Z",
|
||
|
"duration": 695
|
||
|
},
|
||
|
"tests": [
|
||
|
{
|
||
|
"title": "should intercept hubot's HTTP calls",
|
||
|
"fullTitle": "hubot mock should intercept hubot's HTTP calls",
|
||
|
"duration": 12
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe contattare l'indirizzo corretto",
|
||
|
"fullTitle": "modulo circolari dovrebbe contattare l'indirizzo corretto",
|
||
|
"duration": 12
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe parsare correttamente le circolari",
|
||
|
"fullTitle": "modulo circolari dovrebbe parsare correttamente le circolari",
|
||
|
"duration": 305
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe accettare correttamente il numero di circolari da visualizzare",
|
||
|
"fullTitle": "modulo circolari dovrebbe accettare correttamente il numero di circolari da visualizzare",
|
||
|
"duration": 276
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe linkare correttamente il numero di circolari",
|
||
|
"fullTitle": "modulo circolari dovrebbe linkare correttamente il numero di circolari",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "risponde quando richiesto",
|
||
|
"fullTitle": "modulo memoria risponde quando richiesto",
|
||
|
"duration": 21
|
||
|
},
|
||
|
{
|
||
|
"title": "permette di memorizzare un ricordo",
|
||
|
"fullTitle": "modulo memoria permette di memorizzare un ricordo",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "permette di alterare un ricordo",
|
||
|
"fullTitle": "modulo memoria permette di alterare un ricordo",
|
||
|
"duration": 1
|
||
|
},
|
||
|
{
|
||
|
"title": "permette di eliminare un ricordo",
|
||
|
"fullTitle": "modulo memoria permette di eliminare un ricordo",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "permette di visualizzare una data",
|
||
|
"fullTitle": "modulo memoria permette di visualizzare una data",
|
||
|
"duration": 5
|
||
|
},
|
||
|
{
|
||
|
"title": "visualizza un argomento data solo se opportuno",
|
||
|
"fullTitle": "modulo memoria visualizza un argomento data solo se opportuno",
|
||
|
"duration": 1
|
||
|
},
|
||
|
{
|
||
|
"title": "visualizza un valore data solo se opportuno",
|
||
|
"fullTitle": "modulo memoria visualizza un valore data solo se opportuno",
|
||
|
"duration": 2
|
||
|
},
|
||
|
{
|
||
|
"title": "offre un memory dump per debugging",
|
||
|
"fullTitle": "modulo memoria offre un memory dump per debugging",
|
||
|
"duration": 1
|
||
|
},
|
||
|
{
|
||
|
"title": "non interferisce con \"circolari\"",
|
||
|
"fullTitle": "modulo memoria non interferisce con \"circolari\"",
|
||
|
"duration": 2
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe non eseguire i comandi se l'interlocutore non è autorizzato",
|
||
|
"fullTitle": "modulo shell dovrebbe non eseguire i comandi se l'interlocutore non è autorizzato",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe riconoscere la stanza autorizzata",
|
||
|
"fullTitle": "modulo shell dovrebbe riconoscere la stanza autorizzata",
|
||
|
"duration": 1
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe eseguire i comandi corretti per installare gli aggiornamenti",
|
||
|
"fullTitle": "modulo shell dovrebbe eseguire i comandi corretti per installare gli aggiornamenti",
|
||
|
"duration": 1
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe eseguire i comandi corretti per controllare gli aggiornamenti",
|
||
|
"fullTitle": "modulo shell dovrebbe eseguire i comandi corretti per controllare gli aggiornamenti",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe eseguire i comandi corretti per installare le dipendenze",
|
||
|
"fullTitle": "modulo shell dovrebbe eseguire i comandi corretti per installare le dipendenze",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe eseguire i comandi corretti per eseguire i test",
|
||
|
"fullTitle": "modulo shell dovrebbe eseguire i comandi corretti per eseguire i test",
|
||
|
"duration": 1
|
||
|
}
|
||
|
],
|
||
|
"failures": [],
|
||
|
"passes": [
|
||
|
{
|
||
|
"title": "should intercept hubot's HTTP calls",
|
||
|
"fullTitle": "hubot mock should intercept hubot's HTTP calls",
|
||
|
"duration": 12
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe contattare l'indirizzo corretto",
|
||
|
"fullTitle": "modulo circolari dovrebbe contattare l'indirizzo corretto",
|
||
|
"duration": 12
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe parsare correttamente le circolari",
|
||
|
"fullTitle": "modulo circolari dovrebbe parsare correttamente le circolari",
|
||
|
"duration": 305
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe accettare correttamente il numero di circolari da visualizzare",
|
||
|
"fullTitle": "modulo circolari dovrebbe accettare correttamente il numero di circolari da visualizzare",
|
||
|
"duration": 276
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe linkare correttamente il numero di circolari",
|
||
|
"fullTitle": "modulo circolari dovrebbe linkare correttamente il numero di circolari",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "risponde quando richiesto",
|
||
|
"fullTitle": "modulo memoria risponde quando richiesto",
|
||
|
"duration": 21
|
||
|
},
|
||
|
{
|
||
|
"title": "permette di memorizzare un ricordo",
|
||
|
"fullTitle": "modulo memoria permette di memorizzare un ricordo",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "permette di alterare un ricordo",
|
||
|
"fullTitle": "modulo memoria permette di alterare un ricordo",
|
||
|
"duration": 1
|
||
|
},
|
||
|
{
|
||
|
"title": "permette di eliminare un ricordo",
|
||
|
"fullTitle": "modulo memoria permette di eliminare un ricordo",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "permette di visualizzare una data",
|
||
|
"fullTitle": "modulo memoria permette di visualizzare una data",
|
||
|
"duration": 5
|
||
|
},
|
||
|
{
|
||
|
"title": "visualizza un argomento data solo se opportuno",
|
||
|
"fullTitle": "modulo memoria visualizza un argomento data solo se opportuno",
|
||
|
"duration": 1
|
||
|
},
|
||
|
{
|
||
|
"title": "visualizza un valore data solo se opportuno",
|
||
|
"fullTitle": "modulo memoria visualizza un valore data solo se opportuno",
|
||
|
"duration": 2
|
||
|
},
|
||
|
{
|
||
|
"title": "offre un memory dump per debugging",
|
||
|
"fullTitle": "modulo memoria offre un memory dump per debugging",
|
||
|
"duration": 1
|
||
|
},
|
||
|
{
|
||
|
"title": "non interferisce con \"circolari\"",
|
||
|
"fullTitle": "modulo memoria non interferisce con \"circolari\"",
|
||
|
"duration": 2
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe non eseguire i comandi se l'interlocutore non è autorizzato",
|
||
|
"fullTitle": "modulo shell dovrebbe non eseguire i comandi se l'interlocutore non è autorizzato",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe riconoscere la stanza autorizzata",
|
||
|
"fullTitle": "modulo shell dovrebbe riconoscere la stanza autorizzata",
|
||
|
"duration": 1
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe eseguire i comandi corretti per installare gli aggiornamenti",
|
||
|
"fullTitle": "modulo shell dovrebbe eseguire i comandi corretti per installare gli aggiornamenti",
|
||
|
"duration": 1
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe eseguire i comandi corretti per controllare gli aggiornamenti",
|
||
|
"fullTitle": "modulo shell dovrebbe eseguire i comandi corretti per controllare gli aggiornamenti",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe eseguire i comandi corretti per installare le dipendenze",
|
||
|
"fullTitle": "modulo shell dovrebbe eseguire i comandi corretti per installare le dipendenze",
|
||
|
"duration": 0
|
||
|
},
|
||
|
{
|
||
|
"title": "dovrebbe eseguire i comandi corretti per eseguire i test",
|
||
|
"fullTitle": "modulo shell dovrebbe eseguire i comandi corretti per eseguire i test",
|
||
|
"duration": 1
|
||
|
}
|
||
|
]
|
||
|
}
|