Add Travis-CI build status check example

This commit is contained in:
Andrew Stewart 2013-10-24 15:53:51 -07:00
parent 612ddce142
commit b0346204a0
1 changed files with 39 additions and 0 deletions

39
examples/travis.coffee Normal file
View File

@ -0,0 +1,39 @@
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"
name = "gitnesse"
me.sphero.setRGB BLUE, true
every 10.seconds(), ->
Logger.info "Checking repo #{user}/#{name}"
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
.start()