hue-lib 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 888f312d7fd5cbc97e0420cdfd93c81ce2384dfc
4
+ data.tar.gz: b4925347b45be059603fda074dcdbed11311942f
5
+ SHA512:
6
+ metadata.gz: 565dcd5268b7948a36bd1bb70f0527015a82609cf02b13d3cc5a323ba912a732fe0dab58b35dc9543f1141a2d762f2c5ae40a69a3ef84358138c52f7e5d82bf2
7
+ data.tar.gz: 12675f32773730f522c984812f29ba118db9880bd45a9733702478c8d0b9277a5976c38afb6c42be8ed617b3e3ec74a7901beb8c1c6240c2927dbb865ffade1f
data/Rakefile CHANGED
@@ -26,8 +26,8 @@ namespace :gem do
26
26
 
27
27
  desc 'Publish the gem'
28
28
  task :publish do
29
- gem = `ls pkg`
30
- # `gem push pkg/#{gem}`
29
+ gem = `ls pkg | sort | tail -n 1`
30
+ exec("gem push pkg/#{gem}")
31
31
  end
32
32
 
33
33
  desc 'Install the gem locally'
data/hue-lib.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "hue-lib"
6
- s.version = '0.7.2'
6
+ s.version = '0.7.3'
7
7
  s.authors = ["Birkir A. Barkarson", "Aaron Hurley"]
8
8
  s.email = ["birkirb@stoicviking.net"]
9
9
  s.homepage = "https://github.com/birkirb/hue-lib"
data/lib/hue.rb CHANGED
@@ -18,7 +18,7 @@ module Hue
18
18
  end
19
19
 
20
20
  def self.register_default
21
- if default = (Hue::Config::Application.default rescue nil)
21
+ if (Hue::Config::Application.default rescue nil)
22
22
  raise Hue::Error.new(ERROR_DEFAULT_EXISTS)
23
23
  else
24
24
  bridge_config = register_bridges.values.first # Assuming one bridge for now
@@ -85,6 +85,7 @@ ST: ssdp:all
85
85
  end
86
86
 
87
87
  rescue Hue::Error
88
+ logger.info("UDPSocket timed out.")
88
89
  bridges
89
90
  end
90
91
 
data/lib/hue/bulb.rb CHANGED
@@ -163,7 +163,7 @@ module Hue
163
163
  def flash
164
164
  self.alert = 'select'
165
165
  # immediately update to expected state
166
- @status['state']['alert'] = NONE
166
+ status['state']['alert'] = NONE
167
167
  end
168
168
 
169
169
  # transition time in seconds
@@ -197,9 +197,9 @@ module Hue
197
197
  end
198
198
  end
199
199
 
200
- def set_status(settings, key = nil)
200
+ def set_status(settings, start_key = nil)
201
201
  if @status
202
- status = key ? @status[key] : @status
202
+ status = start_key ? @status[start_key] : @status
203
203
  settings.each do |key, value|
204
204
  status[key.to_s] = value
205
205
  end
data/spec/hue_spec.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper.rb'
2
2
 
3
3
  describe Hue do
4
-
5
4
  mock_application_config_path
6
5
  mock_bridge_config_path
7
6
 
@@ -21,7 +20,7 @@ describe Hue do
21
20
  described_class.application.should be_a(described_class::Bridge)
22
21
  end
23
22
 
24
- context 'when discovering new bridges' do
23
+ context 'when discovering a bridge on the network' do
25
24
  it 'should return a list discovered bridges' do
26
25
  bridges = Hue.discover
27
26
  bridges.should == {TEST_UDP_BRIDGE_UUID => TEST_UDP_BRIDGE_URI}
@@ -36,6 +35,17 @@ describe Hue do
36
35
  end
37
36
  end
38
37
 
38
+ context 'when attempting discover without a bridge on the network' do
39
+ before(:each) do
40
+ mock_udp_no_reply
41
+ end
42
+
43
+ it 'should return an empty list of bridges' do
44
+ bridges = Hue.discover
45
+ bridges.should == {}
46
+ end
47
+ end
48
+
39
49
  context 'after discovering bridges' do
40
50
  before(:each) do
41
51
  mock_udp_replies(TEST_BRIDGE_UUID, 'new_host')
@@ -64,7 +74,7 @@ describe Hue do
64
74
  with_temp_config_path do
65
75
  with_fake_post(nil, {}, 'post_success', TEST_UDP_BRIDGE_URI)
66
76
  with_stdout(/Registering app...(.*)$/) do
67
- instance = described_class.register_default
77
+ described_class.register_default
68
78
  end
69
79
  end
70
80
  end
@@ -72,7 +82,7 @@ describe Hue do
72
82
  it 'should allow un-registering the default' do
73
83
  with_temp_config_path(true) do
74
84
  with_fake_delete("config/whitelist/#{TEST_APPLICATION_UUID}")
75
- instance = described_class.remove_default
85
+ described_class.remove_default
76
86
  end
77
87
  end
78
88
  end
data/spec/spec_helper.rb CHANGED
@@ -107,6 +107,20 @@ def mock_udp_replies(uuid = TEST_UDP_BRIDGE_UUID, hostname = TEST_UDP_BRIDGE_HOS
107
107
  UDPSocket.stubs(:new).returns(socket)
108
108
  end
109
109
 
110
+ def mock_udp_no_reply
111
+ socket = Object.new
112
+ socket.stubs(:send).returns(nil)
113
+ socket.instance_eval do
114
+ def recvfrom(args)
115
+ while(true) do
116
+ # Waiting for timeout.
117
+ end
118
+ end
119
+ end
120
+ UDPSocket.stubs(:new).returns(socket)
121
+ end
122
+
123
+
110
124
  # BRIDGE - API CALLS
111
125
 
112
126
  TEST_BRIDGE_URI = 'http://localhost/api'
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hue-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
5
- prerelease:
4
+ version: 0.7.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Birkir A. Barkarson
@@ -10,75 +9,67 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-09-04 00:00:00.000000000 Z
12
+ date: 2015-08-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: json
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - '>='
21
19
  - !ruby/object:Gem::Version
22
20
  version: '0'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - '>='
29
26
  - !ruby/object:Gem::Version
30
27
  version: '0'
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: rspec
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
- - - ! '>='
32
+ - - '>='
37
33
  - !ruby/object:Gem::Version
38
34
  version: 2.6.0
39
35
  type: :development
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
- - - ! '>='
39
+ - - '>='
45
40
  - !ruby/object:Gem::Version
46
41
  version: 2.6.0
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: mocha
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
- - - ! '>='
46
+ - - '>='
53
47
  - !ruby/object:Gem::Version
54
48
  version: 0.9.0
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
- - - ! '>='
53
+ - - '>='
61
54
  - !ruby/object:Gem::Version
62
55
  version: 0.9.0
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: webmock
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
- - - ! '>='
60
+ - - '>='
69
61
  - !ruby/object:Gem::Version
70
62
  version: 1.8.0
71
63
  type: :development
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
- - - ! '>='
67
+ - - '>='
77
68
  - !ruby/object:Gem::Version
78
69
  version: 1.8.0
79
- description: ! "Library allowing registration and invocation of a registered Philips
80
- Hue app.\n Convinient objects allow executing commands on the bridge or individual
81
- bulbs."
70
+ description: |-
71
+ Library allowing registration and invocation of a registered Philips Hue app.
72
+ Convinient objects allow executing commands on the bridge or individual bulbs.
82
73
  email:
83
74
  - birkirb@stoicviking.net
84
75
  executables: []
@@ -134,26 +125,25 @@ files:
134
125
  - test/connectivity.rb
135
126
  homepage: https://github.com/birkirb/hue-lib
136
127
  licenses: []
128
+ metadata: {}
137
129
  post_install_message:
138
130
  rdoc_options: []
139
131
  require_paths:
140
132
  - lib
141
133
  required_ruby_version: !ruby/object:Gem::Requirement
142
- none: false
143
134
  requirements:
144
- - - ! '>='
135
+ - - '>='
145
136
  - !ruby/object:Gem::Version
146
137
  version: '0'
147
138
  required_rubygems_version: !ruby/object:Gem::Requirement
148
- none: false
149
139
  requirements:
150
- - - ! '>='
140
+ - - '>='
151
141
  - !ruby/object:Gem::Version
152
142
  version: '0'
153
143
  requirements: []
154
144
  rubyforge_project: hue-lib
155
- rubygems_version: 1.8.23
145
+ rubygems_version: 2.0.3
156
146
  signing_key:
157
- specification_version: 3
147
+ specification_version: 4
158
148
  summary: Ruby library for controlling the Philips Hue system's lights and bridge.
159
149
  test_files: []