Sha256: b50cab5f53baf566fef109d47e7c477b9d93827981a282edd757b5b3f1774d7c

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

#!/usr/bin/env ruby
# tdl-pairing-start - start listening for lighting messages, and change HUE
# lights when you or your pair run your specs
#
# Your config file should be at .test_driven_lighting.conf
#
# tdl-pairing-start

require 'yaml'
config = YAML::load_file File.expand_path('~/.test_driven_lighting.conf')

require 'test_driven_lighting'
include TestDrivenLighting

require 'pp'
puts '-' * 80
pp config
puts '-' * 80

hue_config = {
  hue_ip:  config[:hue_ip],
  hue_api_id:  config[:hue_api_id]
}

hue      = Hue.new hue_config
lamp     = Lamp.new config[:my_lamp_id]
receiver = Receiver.new config[:bunny]

receiver.listen(`whoami`) do |payload|
  puts "Receiving message with #{payload}"

  case payload['status']
  when 'fail'
    lamp.color = 'red'
  when 'pending'
    lamp.color = 'yellow'
  when 'pass'
    lamp.color = 'green'
  end

  hue.change! lamp
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
test_driven_lighting-1.1.0 bin/tdl-pairing-start