cylon/examples/travis.coffee

44 lines
897 B
CoffeeScript
Raw Normal View History

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 08:19:45 +08:00
me.checkTravis = ->
Logger.info "Checking repo #{user}/#{name}"
2013-10-25 08:19:45 +08:00
me.sphero.setRGB BLUE, true
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()
.start()