aframe-switch 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.rdoc +0 -0
- data/Rakefile +0 -0
- data/aframe-switch.gemspec +1 -1
- data/lib/switch.rb +4 -5
- data/test/switch_test.rb +8 -1
- metadata +12 -31
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
data.tar.gz: c3269238199697ba9480b7168176617deba42fcb
|
4
|
+
metadata.gz: b4b1845456bb4112508f4190645b5f5aa2bdaecc
|
5
|
+
SHA512:
|
6
|
+
data.tar.gz: a351fd795a6020bbdf6f65a9d894121ec132493234d8622ac255666ae619f8332baf2a5524d444b7348de47f699c667636416b5ebcbd73ae3071cd61e3020688
|
7
|
+
metadata.gz: a27bbda8e1af6327e0ed900d93ec715ae90d486a433e9b3e9da0cb71b466b130371d3a48b0b68b3f5609117f10f8843eff7d74aa0a29d9fbc57b6502da4500e8
|
data/README.rdoc
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/aframe-switch.gemspec
CHANGED
data/lib/switch.rb
CHANGED
@@ -16,11 +16,10 @@ class Switch
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def get_switch
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
19
|
+
return ON_MESSAGE if ! File.exist? @file
|
20
|
+
result = File.open(@file, 'r').read
|
21
|
+
return ON_MESSAGE unless [ON_MESSAGE, OFF_MESSAGE].include?(result)
|
22
|
+
result
|
24
23
|
end
|
25
24
|
|
26
25
|
def set_switch message
|
data/test/switch_test.rb
CHANGED
@@ -40,7 +40,14 @@ class SwitchTest < Test::Unit::TestCase
|
|
40
40
|
assert_equal @session.last_response.status, 404
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def test_it_defaults_to_on_when_no_file_present
|
44
|
+
@session.get "/switch/light"
|
45
|
+
assert_equal @session.last_response.status, 200
|
46
|
+
assert_include @session.last_response.body, "light is ON"
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_it_defaults_to_on_when_file_contains_unrecognised_value
|
50
|
+
File.open(state_file, 'w') {|f| f.write("SOMETHING") }
|
44
51
|
@session.get "/switch/light"
|
45
52
|
assert_equal @session.last_response.status, 200
|
46
53
|
assert_include @session.last_response.body, "light is ON"
|
metadata
CHANGED
@@ -1,13 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aframe-switch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
4
|
+
version: 0.0.2
|
11
5
|
platform: ruby
|
12
6
|
authors:
|
13
7
|
- mikesten
|
@@ -18,20 +12,14 @@ cert_chain: []
|
|
18
12
|
date: 2014-10-29 00:00:00 Z
|
19
13
|
dependencies:
|
20
14
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
|
15
|
+
name: rack
|
16
|
+
prerelease: false
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
18
|
requirements:
|
24
19
|
- - ">="
|
25
20
|
- !ruby/object:Gem::Version
|
26
|
-
hash: 31
|
27
|
-
segments:
|
28
|
-
- 1
|
29
|
-
- 2
|
30
|
-
- 0
|
31
21
|
version: 1.2.0
|
32
|
-
|
33
|
-
name: rack
|
34
|
-
prerelease: false
|
22
|
+
version_requirements: *id001
|
35
23
|
type: :runtime
|
36
24
|
description: Set and retrieve an arbitrary switch flag via GET and POST.
|
37
25
|
email: hi@aframe.com
|
@@ -50,35 +38,28 @@ files:
|
|
50
38
|
homepage: http://github.com/Allinthedata/switch
|
51
39
|
licenses: []
|
52
40
|
|
41
|
+
metadata: {}
|
42
|
+
|
53
43
|
post_install_message:
|
54
44
|
rdoc_options: []
|
55
45
|
|
56
46
|
require_paths:
|
57
47
|
- lib
|
58
48
|
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
49
|
requirements:
|
61
|
-
-
|
50
|
+
- &id002
|
51
|
+
- ">="
|
62
52
|
- !ruby/object:Gem::Version
|
63
|
-
hash: 3
|
64
|
-
segments:
|
65
|
-
- 0
|
66
53
|
version: "0"
|
67
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
55
|
requirements:
|
70
|
-
-
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
hash: 3
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
56
|
+
- *id002
|
76
57
|
requirements: []
|
77
58
|
|
78
59
|
rubyforge_project:
|
79
|
-
rubygems_version:
|
60
|
+
rubygems_version: 2.0.14
|
80
61
|
signing_key:
|
81
|
-
specification_version:
|
62
|
+
specification_version: 4
|
82
63
|
summary: Set and retrieve an arbitrary Rack switch.
|
83
64
|
test_files: []
|
84
65
|
|