blinky 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- blinky (0.0.4)
4
+ blinky (0.0.5)
5
+ chicanery (~> 0.0.7)
5
6
  libusb (~> 0.2.2)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
11
+ chicanery (0.0.7)
12
+ nokogiri (~> 1)
10
13
  diff-lcs (1.1.3)
11
14
  ffi (1.2.0)
12
15
  libusb (0.2.2)
13
16
  ffi (>= 1.0)
14
- rake (10.0.2)
17
+ nokogiri (1.5.5)
18
+ rake (10.0.3)
15
19
  rspec (2.11.0)
16
20
  rspec-core (~> 2.11.0)
17
21
  rspec-expectations (~> 2.11.0)
@@ -1,6 +1,9 @@
1
1
  = blinky
2
2
 
3
- blinky helps you see the light - plug and play set up for build lights - get a build light up and running in a few minutes.
3
+ blinky helps you see the light
4
+
5
+ * plug and play set up for build lights
6
+ * get a build light up and running in a few minutes.
4
7
 
5
8
  == Why blinky?
6
9
 
@@ -11,6 +14,7 @@ blinky is an attempt to fix that.
11
14
  blinky aims to supply plug and play support for all combinations of
12
15
  * USB Light Model (or any other USB Device used to indicate build status)
13
16
  * Operating System
17
+ * CI Server
14
18
 
15
19
  == How do I use blinky?
16
20
 
@@ -19,13 +23,21 @@ Plug in your USB light, and then do something like this
19
23
  require 'rubygems'
20
24
  require 'blinky'
21
25
 
22
- blinky = Blinky.new.light
26
+ blinky = Blinky.new.light
27
+ light.watch_cctray_server http://your.ci.server/cctray.xml
28
+
29
+ Or, with basic authentication
30
+
31
+ light.watch_cctray_server http://your.ci.server/cctray.xml, {:user => 'user', :password => 'password'}
32
+
33
+ Or, you can just control the light directly
34
+
23
35
  light.success!
24
36
  light.failure!
25
37
  light.building!
26
38
  light.warning!
27
39
  light.off!
28
-
40
+
29
41
  == What if I have more than one light?
30
42
 
31
43
  Want to plug in more than one light on the same machine?
@@ -53,6 +65,14 @@ Not sure which light is which?
53
65
  * Linux
54
66
  * Windows
55
67
 
68
+ === CI Servers
69
+ Any server that supports the {cctray}[http://confluence.public.thoughtworks.org/display/CI/Multiple+Project+Summary+Reporting+Standard] xml format, including among others:
70
+
71
+ * Go - watch https://go-server:8154/go/cctray.xml
72
+ * Jenkins/Hudson - watch http://jenkins-server:8080/cc.xml
73
+ * travis - watch https://api.travis-ci.org/repositories/owner/project/cc.xml
74
+ * tddium - watch 'Configure with CCMenu' (something like https://api.tddium.com/cc/long_uuid_string/cctray.xml)
75
+
56
76
  == How Do I install blinky?
57
77
 
58
78
  === 1) Install support for lib-usb-1.0 (http://www.libusb.org)
@@ -98,11 +118,21 @@ Plug in your light and then do this:
98
118
  blinky.light.watch_test_server
99
119
 
100
120
  Watch the pretty lights!
101
-
102
- == How do I contribute support for more lights
103
121
 
104
- COMING SOON
122
+ == Blinky doesn't quite do what I want
123
+
124
+ The watch_cctray_server method is a very simple approach, but its easy to do something more sophisticated by writing your own plugin - see "How do I contribute support for more ci servers?" below.
125
+
126
+ Or if you want to get really fancy, take a look at {Chicanery}[http://github.com/markryall/chicanery] and use it to control blinky any way you want.
127
+
128
+ == How do I contribute support for more lights?
129
+
130
+ Take a look at the classes in device_recipes then write your own!
131
+
132
+ == How do I contribute support for more ci servers?
105
133
 
134
+ Take a look at the classes in ci_server plugins then write your own!
135
+ You will probably find {Chicanery}[http://github.com/markryall/chicanery] very useful when doing this.
106
136
 
107
137
  == Copyright
108
138
 
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.add_dependency "libusb", "~> 0.2.2"
21
+ gem.add_dependency "chicanery", "~>0.0.7"
21
22
 
22
23
  gem.add_development_dependency "rspec", "~> 2.11.0"
23
24
  gem.add_development_dependency "rake", "~> 10.0.2"
@@ -1,3 +1,3 @@
1
1
  module Blinky
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1,22 @@
1
+ require 'chicanery/cctray'
2
+ require 'chicanery'
3
+ module Blinky
4
+ module CCTrayServer
5
+ include Chicanery
6
+
7
+ def watch_cctray_server url, options = {}
8
+ server Chicanery::Cctray.new 'blinky build', url, options
9
+
10
+ when_run do |current_state|
11
+ current_state.has_failure? ? failure! : success!
12
+ end
13
+
14
+ begin
15
+ run_every 15
16
+ rescue => e
17
+ warning!
18
+ raise e
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1 +1,2 @@
1
- plugin TestCiServer
1
+ plugin TestCiServer
2
+ plugin CCTrayServer
@@ -6,7 +6,8 @@ module Blinky
6
6
  describe "that has a supported device connected" do
7
7
 
8
8
  before(:each) do
9
- @supported_device = double("supported device",:idVendor => 0x2000, :idProduct => 0x2222)
9
+ @supported_device = double("supported device",:idVendor => 0x2000, :idProduct => 0x2222)
10
+ @supported_device.stub(:open).and_return(@supported_device)
10
11
  self.connected_devices = [
11
12
  double("unsupported device A",:idVendor => 0x1234, :idProduct => 0x5678),
12
13
  @supported_device,
@@ -46,7 +47,8 @@ module Blinky
46
47
  describe "that supports two devices from the same vendor" do
47
48
 
48
49
  it "can provide a light that can control the first device" do
49
- supported_device_one = double("supported device one", :idVendor => 0x1000, :idProduct => 0x1111)
50
+ supported_device_one = double("supported device one", :idVendor => 0x1000, :idProduct => 0x1111)
51
+ supported_device_one.stub(:open).and_return(supported_device_one)
50
52
  self.connected_devices = [supported_device_one]
51
53
  @blinky = Blinky.new("#{File.dirname(__FILE__)}/fixtures")
52
54
  supported_device_one.should_receive(:indicate_success)
@@ -54,7 +56,8 @@ module Blinky
54
56
  end
55
57
 
56
58
  it "can provide a light that can control the second device" do
57
- supported_device_two = double("supported device two", :idVendor => 0x1000, :idProduct => 0x2222)
59
+ supported_device_two = double("supported device two", :idVendor => 0x1000, :idProduct => 0x2222)
60
+ supported_device_two.stub(:open).and_return(supported_device_two)
58
61
  self.connected_devices = [supported_device_two]
59
62
  @blinky = Blinky.new("#{File.dirname(__FILE__)}/fixtures")
60
63
  supported_device_two.should_receive(:indicate_success)
@@ -101,9 +104,11 @@ module Blinky
101
104
  describe "that has two supported devices connected" do
102
105
 
103
106
  before(:each) do
104
- @supported_device_one = double("supported device A",:idVendor => 0x1000, :idProduct => 0x1111)
107
+ @supported_device_one = double("supported device A",:idVendor => 0x1000, :idProduct => 0x1111)
108
+ @supported_device_one.stub(:open).and_return(@supported_device_one)
105
109
  @supported_device_two = double("supported device B",:idVendor => 0x2000, :idProduct => 0x2222)
106
-
110
+ @supported_device_two.stub(:open).and_return(@supported_device_two)
111
+
107
112
  self.connected_devices = [
108
113
  double("unsupported device", :idVendor => 0x1234, :idProduct => 0x5678),
109
114
  @supported_device_one,
@@ -127,8 +132,10 @@ module Blinky
127
132
 
128
133
  describe "that provides a light that is asked to watch a supported CI server" do
129
134
 
130
- before(:each) do
131
- self.connected_devices = [double("device",:idVendor => 0x1000, :idProduct => 0x1111)]
135
+ before(:each) do
136
+ device = double("device",:idVendor => 0x1000, :idProduct => 0x1111)
137
+ device.stub(:open).and_return(device)
138
+ self.connected_devices = [device]
132
139
  @light = Blinky.new("#{File.dirname(__FILE__)}/fixtures").light
133
140
  end
134
141
 
@@ -0,0 +1,59 @@
1
+ require File.join(File.dirname(__FILE__), '..', '/spec_helper')
2
+ require 'ci_server_plugins/cctray_server_plugin'
3
+ module Blinky
4
+
5
+ class StubBlinky
6
+ end
7
+
8
+ describe "CCTrayServer" do
9
+
10
+ before(:each) do
11
+ @blinky = StubBlinky.new
12
+ @blinky.extend(CCTrayServer)
13
+ @blinky.stub(:run_every)
14
+
15
+ @stub_cctray = double("CCTRay ")
16
+ Chicanery::Cctray.stub(:new).and_return(@stub_cctray)
17
+ end
18
+
19
+ it "watches a Chicanery Cctray server at the provided url" do
20
+ Chicanery::Cctray.should_receive(:new).with("blinky build", "SOME_URL", {}).and_return(@stub_cctray)
21
+ @blinky.watch_cctray_server "SOME_URL"
22
+ end
23
+
24
+ it "watches a Chicanery Cctray server at the provided url and options" do
25
+ Chicanery::Cctray.should_receive(:new).with("blinky build", "SOME_URL", {:foo => :bar}).and_return(@stub_cctray)
26
+ @blinky.watch_cctray_server "SOME_URL", {:foo => :bar}
27
+ end
28
+
29
+ it "polls every 15 seconds" do
30
+ @blinky.should_receive(:run_every).with(15)
31
+ @blinky.watch_cctray_server "SOME_URL"
32
+ end
33
+
34
+ it "warns if something goes wrong" do
35
+ @blinky.should_receive(:run_every).and_raise "oh no!"
36
+ @blinky.should_receive(:warning!)
37
+ expect{@blinky.watch_cctray_server "SOME_URL"}.to raise_error("oh no!")
38
+ end
39
+
40
+ it "registers a chinanery run halder that indicates failure when current status has failures" do
41
+ run_handler = nil
42
+ @blinky.should_receive(:when_run) { |&block| run_handler = block }
43
+ @blinky.watch_cctray_server "SOME_URL"
44
+
45
+ @blinky.should_receive(:failure!)
46
+ run_handler.call double("status", :has_failure? => true)
47
+ end
48
+
49
+ it "registers a chinanery run halder that indicates success when current status has no failures" do
50
+ run_handler = nil
51
+ @blinky.should_receive(:when_run) { |&block| run_handler = block }
52
+ @blinky.watch_cctray_server "SOME_URL"
53
+
54
+ @blinky.should_receive(:success!)
55
+ run_handler.call double("status", :has_failure? => false)
56
+ end
57
+
58
+ end
59
+ end
@@ -13,7 +13,9 @@ module Blinky
13
13
  before do
14
14
 
15
15
  @device_one = double("device one", :idVendor => 0x1234, :idProduct => 0x5678)
16
+ @device_one.stub(:open).and_return(@device_one)
16
17
  @device_two = double("device two",:idVendor => 0x5678, :idProduct => 0x1234)
18
+ @device_two.stub(:open).and_return(@device_two)
17
19
  @connected_devices = [@device_one, @device_two]
18
20
  self.connected_devices = @connected_devices
19
21
 
@@ -28,7 +28,7 @@ module Blinky
28
28
  describe "that has been constructed with a device, a device recipe, and some CI plugins" do
29
29
 
30
30
  before(:each) do
31
- @supported_device = double("supported device",:idVendor => 0x2000, :idProduct => 0x2222)
31
+ @supported_device = double("supported device",:idVendor => 0x2000, :idProduct => 0x2222)
32
32
  @light = Light.new(@supported_device, TestEngineering::TestModel, [MockCiPlugin, AnotherMockCiPlugin ] )
33
33
  end
34
34
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blinky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-12 00:00:00.000000000 Z
12
+ date: 2012-12-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: libusb
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.2.2
30
+ - !ruby/object:Gem::Dependency
31
+ name: chicanery
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.0.7
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.0.7
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: rspec
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -79,6 +95,7 @@ files:
79
95
  - lib/blinky/light_factory.rb
80
96
  - lib/blinky/no_supported_devices_found.rb
81
97
  - lib/blinky/version.rb
98
+ - lib/ci_server_plugins/cctray_server_plugin.rb
82
99
  - lib/ci_server_plugins/test_server_plugin.rb
83
100
  - lib/device_recipes/delcom_engineering/visual_indicator_gen_one.rb
84
101
  - lib/device_recipes/delcom_engineering/visual_indicator_gen_two.rb
@@ -87,6 +104,7 @@ files:
87
104
  - notes.txt
88
105
  - spec/acceptance_spec.rb
89
106
  - spec/blinky_spec.rb
107
+ - spec/ci_server_plugins/cctray_server_plugin_spec.rb
90
108
  - spec/ci_server_plugins/test_server_plugin_spec.rb
91
109
  - spec/fixtures/ci_server_plugins/mock_ci_server.rb
92
110
  - spec/fixtures/device_recipes/aenima_engineering/model_462.rb
@@ -124,6 +142,7 @@ summary: helps you see the light
124
142
  test_files:
125
143
  - spec/acceptance_spec.rb
126
144
  - spec/blinky_spec.rb
145
+ - spec/ci_server_plugins/cctray_server_plugin_spec.rb
127
146
  - spec/ci_server_plugins/test_server_plugin_spec.rb
128
147
  - spec/fixtures/ci_server_plugins/mock_ci_server.rb
129
148
  - spec/fixtures/device_recipes/aenima_engineering/model_462.rb