lifx_dash 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.travis.yml +18 -12
- data/CHANGELOG.md +5 -1
- data/lib/lifx_dash/version.rb +1 -1
- data/lifx_dash.gemspec +1 -1
- metadata +36 -47
- data/features/lifx_dash.feature +0 -17
- data/features/step_definitions/lifx_dash_steps.rb +0 -4
- data/features/support/env.rb +0 -1
- data/test/lifx_dash/lifx_http_api_test.rb +0 -73
- data/test/test_helper.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YjBlMWRjMmRmOWZlZDY1NjJiODA1NDNmZTIyZWVlZDYxNTkyOWFhMw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTQyZDA5Yjc1ZDM4NGFjODU2ZWM3NmQzODQ5YTM2MWI3MzUxZWZkMw==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YzIzY2FjNmYyYzRkODc1YjRmZjIzMDc0MGZjN2ZiOWJhYjQxOGJjNWRkNWYy
|
10
|
+
MTEwMmNjY2QzN2QwYzIzODUyNzQ2NTg4OTE1Y2E5MGVkMzdhOGM0ODBjNWY1
|
11
|
+
MjhjMmQ1MmFiYzhlZjUyMjJmNzQ2OGE5NDg4Y2RlMWM1NmY0MTQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NWZmYjlmZDMzOTlhNGUwNGZiYjlkYzBkYzAxNjU4OGM3NzA0YTE1ZDdkZDhk
|
14
|
+
YWMwZTdkZDc0ZGZiODU2NDcyNGFmMmM0ZjNkYzJkMGEzZjNkMDQwMWNkN2Q4
|
15
|
+
YjE0ODRlMWMxZDQzNzZjZmFmNjM1MGEyNTFjN2ZiZDcwMzQ3NmQ=
|
data/.travis.yml
CHANGED
@@ -1,20 +1,26 @@
|
|
1
1
|
sudo: required
|
2
2
|
language: ruby
|
3
3
|
before_install:
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
- sudo apt-get install libpcap-dev -qq
|
5
|
+
- gem update --system
|
6
|
+
- gem --version
|
7
7
|
rvm:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
- 2.0.0
|
9
|
+
- 2.1.10
|
10
|
+
- 2.2.5
|
11
|
+
- 2.3.1
|
12
|
+
- ruby-head
|
14
13
|
matrix:
|
15
14
|
allow_failures:
|
16
|
-
|
17
|
-
|
15
|
+
- rvm: ruby-head
|
18
16
|
branches:
|
19
17
|
except:
|
20
|
-
|
18
|
+
- gh-pages
|
19
|
+
deploy:
|
20
|
+
provider: rubygems
|
21
|
+
api_key:
|
22
|
+
secure: euHHSO+aPoarCl+Xa5ZBl4yrIAzaXFbMjgDhrNRFhNiRWr49HQ0pPQXGKw1zTL+WfWniLTfMTl7gk7cqRQiqoyod5iqiyvd8z3NQqL6hyNJjZ9ZVpZzA8dYmag5AO4mxf2b/v68CbnuR5O0V8UZZ31dGq0LyZh0y+wwMP7AmKzoJz5IfbzRA3E94uOSoa/1177BacTbJGXVxtJTfMeOS08RcGyK/DyEZsmPXoEfhDoKS3xAG5+rJiLuLvKDO2A/xoVKxtFWGPdX1n+Y3EUc/nWZ7a/ye96S8+27fzphb5X1jN3/ebc0nueWmq4lx1wI18j6nbuVQ9uk/RQHFv/ArFmIE0cpwH2/8YdhMgXUOpfjcWKoZH2eG/4l2/Oz8S2m3UN0MrXOpAzcb/wd9EGIoA08B31aykco2170CXVBeMaKksGcOr34RCirz2t8jXMEOzgN5e6jxjot+y/3XH+nPDU5pWRQoR6hzJPQLvXUgszF4X9AbrFWJR/xO3j8HQieNm0YPdP78PgpN/k1A2o/YJsQ1qsRyl8QtVKweX3wN0Ssyk433VkJEDFSQGPImtVqyTjcCgjyYeqxkzJfqiyIqe531JSXiZttjxj67oTpuASVTRIjotazjN03qohhv009fi+4BQGd6fX4QL9BylHC1ft0eQjIkzILrzAIY4LoLfa8=
|
23
|
+
gem: lifx_dash
|
24
|
+
on:
|
25
|
+
tags: true
|
26
|
+
repo: matthutchinson/lifx_dash
|
data/CHANGELOG.md
CHANGED
@@ -7,11 +7,15 @@ project adheres to [Semantic Versioning][Semver].
|
|
7
7
|
|
8
8
|
* Validation of all command line flag values, iface/mac/token etc.
|
9
9
|
|
10
|
+
## [0.1.1][] (30 Jun 2016)
|
11
|
+
* Testing auto-releasing gem from Travis CI
|
12
|
+
|
10
13
|
## [0.1.0][] (30 Jun 2016)
|
11
14
|
* Initial gem release, config/help/snoop/monitor commands working
|
12
15
|
* Includes dameonizing option for monitor command (writing to a log file)
|
13
16
|
* Built with gli command-suite gem
|
14
17
|
|
15
|
-
[Unreleased]: https://github.com/matthutchinson/lifx_dash/compare/v0.1.
|
18
|
+
[Unreleased]: https://github.com/matthutchinson/lifx_dash/compare/v0.1.1...HEAD
|
19
|
+
[0.1.1]: https://github.com/matthutchinson/lifx_dash/compare/v0.1.0...v0.1.1
|
16
20
|
[0.1.0]: https://github.com/matthutchinson/lifx_dash/releases/tag/v0.1.0
|
17
21
|
[Semver]: http://semver.org
|
data/lib/lifx_dash/version.rb
CHANGED
data/lifx_dash.gemspec
CHANGED
@@ -45,7 +45,7 @@ Gem::Specification.new do |spec|
|
|
45
45
|
spec.required_ruby_version = ">= 2.0.0"
|
46
46
|
spec.requirements << 'an Amazon Dash button'
|
47
47
|
spec.requirements << 'one or more LIFX bulbs'
|
48
|
-
spec.requirements << 'root
|
48
|
+
spec.requirements << 'root access'
|
49
49
|
|
50
50
|
# external gems
|
51
51
|
spec.add_runtime_dependency "gli", "2.14.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lifx_dash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Hutchinson
|
@@ -42,134 +42,133 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: ronn
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rdoc
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ! '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ! '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: minitest
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ! '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ! '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: webmock
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ! '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ! '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: aruba
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ! '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ! '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: simplecov
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ! '>='
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ! '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: coveralls
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ! '>='
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ! '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
-
description:
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
network packet sniffing.
|
167
|
+
description: ! " A command line tool to listen for Amazon Dash button presses and
|
168
|
+
toggle LIFX\n lights ON and OFF (via the LIFX HTTP API). With options to configure:
|
169
|
+
the Dash\n MAC address, network interface and LIFX bulb selector. Inspired by Ted\n
|
170
|
+
\ Benson's hack (http://tinyurl.com/zba3da2). Root access is required for\n network
|
171
|
+
packet sniffing.\n"
|
173
172
|
email:
|
174
173
|
- matt@hiddenloop.com
|
175
174
|
executables:
|
@@ -179,10 +178,10 @@ extra_rdoc_files:
|
|
179
178
|
- README.md
|
180
179
|
- LICENSE.txt
|
181
180
|
files:
|
182
|
-
-
|
183
|
-
-
|
184
|
-
-
|
185
|
-
-
|
181
|
+
- .coveralls.yml
|
182
|
+
- .gitignore
|
183
|
+
- .simplecov
|
184
|
+
- .travis.yml
|
186
185
|
- CHANGELOG.md
|
187
186
|
- CODE_OF_CONDUCT.md
|
188
187
|
- CONTRIBUTING.md
|
@@ -193,9 +192,6 @@ files:
|
|
193
192
|
- bin/console
|
194
193
|
- bin/lifx_dash
|
195
194
|
- bin/setup
|
196
|
-
- features/lifx_dash.feature
|
197
|
-
- features/step_definitions/lifx_dash_steps.rb
|
198
|
-
- features/support/env.rb
|
199
195
|
- lib/lifx_dash.rb
|
200
196
|
- lib/lifx_dash/capturer.rb
|
201
197
|
- lib/lifx_dash/configuration.rb
|
@@ -208,8 +204,6 @@ files:
|
|
208
204
|
- man/lifx_dash.1
|
209
205
|
- man/lifx_dash.1.html
|
210
206
|
- man/lifx_dash.1.ronn
|
211
|
-
- test/lifx_dash/lifx_http_api_test.rb
|
212
|
-
- test/test_helper.rb
|
213
207
|
homepage: http://github.com/matthutchinson/lifx_dash
|
214
208
|
licenses:
|
215
209
|
- MIT
|
@@ -217,35 +211,30 @@ metadata:
|
|
217
211
|
allowed_push_host: https://rubygems.org
|
218
212
|
post_install_message:
|
219
213
|
rdoc_options:
|
220
|
-
-
|
214
|
+
- --title
|
221
215
|
- lifx_dash
|
222
|
-
-
|
216
|
+
- --main
|
223
217
|
- README.md
|
224
|
-
-
|
218
|
+
- -ri
|
225
219
|
require_paths:
|
226
220
|
- lib
|
227
221
|
required_ruby_version: !ruby/object:Gem::Requirement
|
228
222
|
requirements:
|
229
|
-
- -
|
223
|
+
- - ! '>='
|
230
224
|
- !ruby/object:Gem::Version
|
231
225
|
version: 2.0.0
|
232
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
227
|
requirements:
|
234
|
-
- -
|
228
|
+
- - ! '>='
|
235
229
|
- !ruby/object:Gem::Version
|
236
230
|
version: '0'
|
237
231
|
requirements:
|
238
232
|
- an Amazon Dash button
|
239
233
|
- one or more LIFX bulbs
|
240
|
-
- root
|
234
|
+
- root access
|
241
235
|
rubyforge_project:
|
242
|
-
rubygems_version: 2.
|
236
|
+
rubygems_version: 2.5.1
|
243
237
|
signing_key:
|
244
238
|
specification_version: 4
|
245
239
|
summary: Toggle LIFX lights with an Amazon Dash button
|
246
|
-
test_files:
|
247
|
-
- features/lifx_dash.feature
|
248
|
-
- features/step_definitions/lifx_dash_steps.rb
|
249
|
-
- features/support/env.rb
|
250
|
-
- test/lifx_dash/lifx_http_api_test.rb
|
251
|
-
- test/test_helper.rb
|
240
|
+
test_files: []
|
data/features/lifx_dash.feature
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
Feature: Show help information
|
2
|
-
In order to show command line help
|
3
|
-
|
4
|
-
Scenario: Show general command line help
|
5
|
-
When I get help for "lifx_dash"
|
6
|
-
Then the output should contain " lifx_dash - Toggle LIFX lights with an Amazon Dash button"
|
7
|
-
Then the output should match / config - (.*)/
|
8
|
-
Then the output should match / help - (.*)/
|
9
|
-
Then the output should match / monitor - (.*)/
|
10
|
-
Then the output should match / snoop - (.*)/
|
11
|
-
And the exit status should be 0
|
12
|
-
|
13
|
-
Scenario: Show config help
|
14
|
-
When I run `lifx_dash help config`
|
15
|
-
Then the output should contain " config - Set (and persist) default options for commands"
|
16
|
-
Then the output should contain " -s, --[no-]show - Show the config file"
|
17
|
-
And the exit status should be 0
|
data/features/support/env.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'aruba/cucumber'
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__)+'/../test_helper')
|
2
|
-
|
3
|
-
class TestLifxHTTPApi < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@logger = MiniTest::Mock.new
|
7
|
-
@api_client = LifxDash::LifxHTTPApi.new('my-token', @logger)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_toggles_lights_logging_successful
|
11
|
-
selector = "d073d500ec8e"
|
12
|
-
body = { results: [{ id: "d073d500ec8e", label: "Golden Boy", status: "ok" } ]}.to_json
|
13
|
-
stub_request(:post, lifx_url(selector)).to_return(body: body, status: 207)
|
14
|
-
|
15
|
-
@logger.expect(:info, nil, ["Toggling lights! (via #{LifxDash::LifxHTTPApi::BASE_URI})"])
|
16
|
-
@logger.expect(:info, nil, ["Lights toggled successfully!"])
|
17
|
-
@logger.expect(:info, nil, ["API reply (207): #{body}"])
|
18
|
-
@api_client.toggle(selector)
|
19
|
-
|
20
|
-
assert @logger.verify
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_toggles_lights_logging_warnings
|
24
|
-
selector = "all"
|
25
|
-
http_responses = {
|
26
|
-
401 => { error: "Invalid token" }, # invalid token in header
|
27
|
-
500 => nil, # server issue
|
28
|
-
207 => "{}" # server OK, but results not present
|
29
|
-
}
|
30
|
-
|
31
|
-
http_responses.each do |code, api_response_body|
|
32
|
-
stub_request(:post, lifx_url(selector)).
|
33
|
-
to_return(body: api_response_body.to_json, status: code)
|
34
|
-
|
35
|
-
@logger.expect(:info, nil, ["Toggling lights! (via #{LifxDash::LifxHTTPApi::BASE_URI})"])
|
36
|
-
@logger.expect(:warn, nil, ["Warning: Possible issue with LIFX lights or HTTP API response"])
|
37
|
-
@logger.expect(:warn, nil, ["API reply (#{code}): #{api_response_body.to_json}"])
|
38
|
-
@api_client.toggle(selector)
|
39
|
-
|
40
|
-
assert @logger.verify
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_raises_error_on_toggle_when_http_errors
|
45
|
-
assert_raises(Errno::ECONNRESET) do
|
46
|
-
@logger.expect(:info, nil, ["Toggling lights! (via #{LifxDash::LifxHTTPApi::BASE_URI})"])
|
47
|
-
@logger.expect(:error, nil, ["Error: POST request to #{LifxDash::LifxHTTPApi::BASE_URI} failed: Connection reset by peer"])
|
48
|
-
|
49
|
-
net_error = -> (uri) { raise Errno::ECONNRESET.new }
|
50
|
-
Net::HTTP::Post.stub :new, net_error do
|
51
|
-
@api_client.toggle('all')
|
52
|
-
end
|
53
|
-
|
54
|
-
assert @logger.verify
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_raises_error_on_toggle_with_bad_selector
|
59
|
-
assert_raises(URI::InvalidURIError) do
|
60
|
-
bad_selector = "im a bad bulb selector"
|
61
|
-
@logger.expect(:error, nil, ["Error: POST request to #{LifxDash::LifxHTTPApi::BASE_URI} failed: bad URI(is not URI?): #{lifx_url(bad_selector)}"])
|
62
|
-
@api_client.toggle(bad_selector)
|
63
|
-
|
64
|
-
assert @logger.verify
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
private
|
69
|
-
|
70
|
-
def lifx_url(selector)
|
71
|
-
"https://#{LifxDash::LifxHTTPApi::BASE_URI}/lights/#{selector}/toggle"
|
72
|
-
end
|
73
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
if ENV['COVERAGE']
|
2
|
-
if ENV['TRAVIS']
|
3
|
-
require 'coveralls'
|
4
|
-
Coveralls.wear!
|
5
|
-
else
|
6
|
-
require 'simplecov'
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
require 'lifx_dash'
|
11
|
-
require 'minitest/autorun'
|
12
|
-
require 'webmock/minitest'
|
13
|
-
|
14
|
-
# set a quiet logger to /dev/null
|
15
|
-
LOGGER = Logger.new("/dev/null")
|