sinatra-switch 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -4
- data/lib/sinatra/switch.rb +1 -1
- data/sinatra-switch.gemspec +1 -1
- data/test/switch_test.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -6,7 +6,7 @@ Set and retrieve an arbitrary switch flag via get and post.
|
|
6
6
|
|
7
7
|
require "sinatra/switch"
|
8
8
|
|
9
|
-
use_switch "light"
|
9
|
+
use_switch "light", { :file_location => "/tmp" }
|
10
10
|
|
11
11
|
== Functionality
|
12
12
|
|
@@ -21,11 +21,11 @@ Set and retrieve an arbitrary switch flag via get and post.
|
|
21
21
|
A route for flicking the switch to OFF:
|
22
22
|
/switch/light/off
|
23
23
|
|
24
|
-
The switch state is stored in a file:
|
25
|
-
/var/light_switch
|
26
|
-
|
27
24
|
== Switch state possibilities
|
28
25
|
|
26
|
+
The switch state is stored in a file:
|
27
|
+
/tmp/light_switch
|
28
|
+
|
29
29
|
File doesn't exist
|
30
30
|
switch is on
|
31
31
|
File contains ON
|
data/lib/sinatra/switch.rb
CHANGED
@@ -7,7 +7,7 @@ module Sinatra
|
|
7
7
|
def use_switch app_name, options = {}
|
8
8
|
defaults = { :file_location => "/tmp" }
|
9
9
|
options = defaults.merge(options)
|
10
|
-
file = File.join(options[:file_location], app_name)
|
10
|
+
file = File.join(options[:file_location], "#{app_name}_switch")
|
11
11
|
on_message = "ON"
|
12
12
|
off_message = "OFF"
|
13
13
|
|
data/sinatra-switch.gemspec
CHANGED
data/test/switch_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-switch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -52,7 +52,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
52
|
version: '0'
|
53
53
|
segments:
|
54
54
|
- 0
|
55
|
-
hash:
|
55
|
+
hash: -3401378227648049844
|
56
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|