Extreme Feedback Device Jun 2015
lights takes your build server's status via http and controls a feedback device accordingly. As hardware lights is tied to Cleware's traffic lights - it uses a windows command for controlling the lamp.
While I currently use Jenkins as a build server lights could be adapted to any build server quite easily. Capturing the status via http has been implemented with Java's scripting API using Nashorn (Java 8 scripting engine). Example for integrating with jenkins:
function getScore(url) { var jsonStr = rest.get(url); var json = JSON.parse(jsonStr); if (json.healthReport.length == 1) { return 0; } var index = 0; if (json.healthReport.length == 2 && json.healthReport[1].description.startsWith("Testergebnis")) { index = 1; } return parseInt(json.healthReport[index].score); } var unitTestsScore = getScore("http://...:8080/job/projA/api/json"); var iTestsScore = getScore("http://...:8080/job/projB/api/json"); if (unitTestsScore == 0) { command.red.set(true, 2000, 2000); // blinking command.yellow.set(false); command.green.set(false); } else if (unitTestsScore < 100) { command.red.set(true); command.yellow.set(false); command.green.set(false); } else if (iTestsScore < 100) { ...
Souces available on GitHub: https://github.com/micgn/lights