2014-12-14 08:19:25 +08:00
|
|
|
"use strict";
|
2013-10-29 12:43:27 +08:00
|
|
|
|
2014-12-14 08:19:25 +08:00
|
|
|
var Cylon = require("../.."),
|
|
|
|
Travis = require("travis-ci");
|
|
|
|
|
|
|
|
var travis = new Travis({version: "2.0.0"});
|
2013-10-29 12:43:27 +08:00
|
|
|
|
|
|
|
Cylon.robot({
|
2014-11-26 08:01:31 +08:00
|
|
|
connections: {
|
2014-12-14 08:19:25 +08:00
|
|
|
sphero: { adaptor: "sphero", port: "/dev/rfcomm0" }
|
2014-11-26 08:01:31 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
devices: {
|
2014-12-14 08:19:25 +08:00
|
|
|
sphero: { driver: "sphero" }
|
2014-11-26 08:01:31 +08:00
|
|
|
},
|
2014-03-27 07:25:09 +08:00
|
|
|
|
|
|
|
work: function(my) {
|
|
|
|
var user = "hybridgroup",
|
|
|
|
name = "cylon";
|
|
|
|
|
|
|
|
var checkTravis = function() {
|
|
|
|
console.log("Checking repo " + user + "/" + name);
|
2014-12-14 08:19:25 +08:00
|
|
|
my.sphero.setColor("blue", true);
|
2014-03-27 07:25:09 +08:00
|
|
|
|
|
|
|
travis.repos({ owner_name: user, name: name }, function(err, res) {
|
2014-12-14 08:19:25 +08:00
|
|
|
if (res.repo === undefined) { my.sphero.setColor("blue", true); }
|
2014-03-27 07:25:09 +08:00
|
|
|
|
|
|
|
switch (res.repo.last_build_state) {
|
2014-12-14 08:19:25 +08:00
|
|
|
case "passed":
|
|
|
|
my.sphero.setColor("green", true);
|
2014-03-27 07:25:09 +08:00
|
|
|
break;
|
2014-12-14 08:19:25 +08:00
|
|
|
case "failed":
|
|
|
|
my.sphero.setColor("red", true);
|
2014-03-27 07:25:09 +08:00
|
|
|
break;
|
|
|
|
default:
|
2014-12-14 08:19:25 +08:00
|
|
|
my.sphero.setColor("blue", true);
|
2014-03-27 07:25:09 +08:00
|
|
|
}
|
|
|
|
});
|
2014-12-14 08:19:25 +08:00
|
|
|
};
|
2013-10-29 12:43:27 +08:00
|
|
|
|
2014-03-27 07:25:09 +08:00
|
|
|
checkTravis();
|
2013-10-29 12:43:27 +08:00
|
|
|
|
2014-03-27 07:25:09 +08:00
|
|
|
every((10).seconds(), checkTravis);
|
2013-10-29 12:43:27 +08:00
|
|
|
}
|
|
|
|
}).start();
|