2013-10-25 06:53:51 +08:00
|
|
|
Cylon = require '..'
|
|
|
|
Travis = require 'travis-ci'
|
|
|
|
|
|
|
|
travis = new Travis
|
|
|
|
version: '2.0.0'
|
|
|
|
|
|
|
|
BLUE = 0x0000ff
|
|
|
|
GREEN = 0x00ff00
|
|
|
|
RED = 0xff0000
|
|
|
|
|
|
|
|
Cylon.robot
|
|
|
|
connection:
|
|
|
|
name: 'sphero', adaptor: 'sphero', port: '/dev/rfcomm0'
|
|
|
|
|
|
|
|
device:
|
|
|
|
name: 'sphero', driver: 'sphero'
|
|
|
|
|
|
|
|
work: (me) ->
|
|
|
|
user = "hybridgroup"
|
2013-10-25 08:19:45 +08:00
|
|
|
name = "cylon"
|
2013-10-25 06:53:51 +08:00
|
|
|
|
2013-10-25 08:19:45 +08:00
|
|
|
me.checkTravis = ->
|
2013-10-25 06:53:51 +08:00
|
|
|
Logger.info "Checking repo #{user}/#{name}"
|
2013-10-25 08:19:45 +08:00
|
|
|
me.sphero.setRGB BLUE, true
|
2013-10-25 06:53:51 +08:00
|
|
|
|
|
|
|
travis.repos {
|
|
|
|
owner_name: user,
|
|
|
|
name: name
|
|
|
|
}, (err, res) ->
|
|
|
|
if res.repo
|
|
|
|
switch res.repo.last_build_state
|
|
|
|
when 'passed' then me.sphero.setRGB(GREEN, true)
|
|
|
|
when 'failed' then me.sphero.setRGB(RED, true)
|
|
|
|
else me.sphero.setRGB(BLUE, true)
|
|
|
|
else
|
|
|
|
me.sphero.setRGB BLUE, true
|
|
|
|
|
2013-10-25 08:19:45 +08:00
|
|
|
me.checkTravis()
|
|
|
|
|
|
|
|
every 10.seconds(), ->
|
|
|
|
me.checkTravis()
|
|
|
|
|
2013-10-25 06:53:51 +08:00
|
|
|
.start()
|