trigger_switch_d 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. data/COPYING.txt +674 -0
  2. data/LICENSE.txt +54 -0
  3. data/README.rdoc +106 -0
  4. data/bin/teach +44 -0
  5. data/bin/tsd +68 -0
  6. data/bin/turn_off +42 -0
  7. data/bin/turn_on +39 -0
  8. data/doc/classes/Tellstick/Tellstick.html +117 -0
  9. data/doc/classes/Tellstick/TellstickIO.html +265 -0
  10. data/doc/classes/Tellstick/TellstickIO.src/M000020.html +18 -0
  11. data/doc/classes/Tellstick/TellstickIO.src/M000021.html +20 -0
  12. data/doc/classes/Tellstick/TellstickIO.src/M000022.html +26 -0
  13. data/doc/classes/Tellstick/TellstickIO.src/M000023.html +19 -0
  14. data/doc/classes/Tellstick/TellstickIO.src/M000024.html +26 -0
  15. data/doc/classes/Tellstick/TellstickIO.src/M000025.html +16 -0
  16. data/doc/classes/Tellstick/TellstickIO.src/M000026.html +16 -0
  17. data/doc/classes/Tellstick/TellstickIO.src/M000027.html +24 -0
  18. data/doc/classes/Tellstick.html +204 -0
  19. data/doc/classes/Tellstick.src/M000019.html +25 -0
  20. data/doc/classes/TriggerSwitchD/Action.html +165 -0
  21. data/doc/classes/TriggerSwitchD/Action.src/M000015.html +28 -0
  22. data/doc/classes/TriggerSwitchD/Action.src/M000016.html +18 -0
  23. data/doc/classes/TriggerSwitchD/Application.html +203 -0
  24. data/doc/classes/TriggerSwitchD/Application.src/M000017.html +21 -0
  25. data/doc/classes/TriggerSwitchD/Application.src/M000018.html +40 -0
  26. data/doc/classes/TriggerSwitchD/ConfigFactory/Config.html +127 -0
  27. data/doc/classes/TriggerSwitchD/ConfigFactory/Config.src/M000014.html +23 -0
  28. data/doc/classes/TriggerSwitchD/ConfigFactory.html +141 -0
  29. data/doc/classes/TriggerSwitchD/ConfigFactory.src/M000013.html +24 -0
  30. data/doc/classes/TriggerSwitchD/IPC.html +134 -0
  31. data/doc/classes/TriggerSwitchD/IPC.src/M000012.html +32 -0
  32. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.html +242 -0
  33. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000005.html +19 -0
  34. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000006.html +18 -0
  35. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000007.html +23 -0
  36. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000008.html +19 -0
  37. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000009.html +19 -0
  38. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000010.html +18 -0
  39. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000011.html +18 -0
  40. data/doc/classes/TriggerSwitchD/Schedule.html +147 -0
  41. data/doc/classes/TriggerSwitchD/Schedule.src/M000004.html +19 -0
  42. data/doc/classes/TriggerSwitchD/SwitchFactory.html +135 -0
  43. data/doc/classes/TriggerSwitchD/SwitchFactory.src/M000003.html +20 -0
  44. data/doc/classes/TriggerSwitchD.html +212 -0
  45. data/doc/classes/TriggerSwitchD.src/M000001.html +22 -0
  46. data/doc/classes/TriggerSwitchD.src/M000002.html +27 -0
  47. data/doc/created.rid +1 -0
  48. data/doc/files/lib/tellstick/protocol/nexa_rb.html +126 -0
  49. data/doc/files/lib/tellstick/protocol/not_connected_rb.html +126 -0
  50. data/doc/files/lib/tellstick/protocol/null_protocol_rb.html +126 -0
  51. data/doc/files/lib/tellstick/protocol/plain_text_rb.html +126 -0
  52. data/doc/files/lib/tellstick/protocol/proove_rb.html +126 -0
  53. data/doc/files/lib/tellstick/protocol/protocol_loader_rb.html +126 -0
  54. data/doc/files/lib/tellstick/protocol/rising_sun_rb.html +126 -0
  55. data/doc/files/lib/tellstick/protocol/waveman_rb.html +126 -0
  56. data/doc/files/lib/tellstick/tellstick_io_rb.html +135 -0
  57. data/doc/files/lib/tellstick/tellstick_rb.html +135 -0
  58. data/doc/files/lib/tellstick_rb.html +134 -0
  59. data/doc/files/lib/trigger_switch_d/action_rb.html +126 -0
  60. data/doc/files/lib/trigger_switch_d/application_rb.html +136 -0
  61. data/doc/files/lib/trigger_switch_d/config_rb.html +126 -0
  62. data/doc/files/lib/trigger_switch_d/daylight_rb.html +126 -0
  63. data/doc/files/lib/trigger_switch_d/ipc_rb.html +126 -0
  64. data/doc/files/lib/trigger_switch_d/schedule_rb.html +126 -0
  65. data/doc/files/lib/trigger_switch_d/switch_rb.html +126 -0
  66. data/doc/files/lib/trigger_switch_d/trigger_switch_d_helper_rb.html +126 -0
  67. data/doc/files/lib/trigger_switch_d_rb.html +140 -0
  68. data/doc/fr_class_index.html +38 -0
  69. data/doc/fr_file_index.html +46 -0
  70. data/doc/fr_method_index.html +53 -0
  71. data/doc/index.html +24 -0
  72. data/features/execute_schedule.feature +20 -0
  73. data/features/group_aliases.feature +31 -0
  74. data/features/handle_switches.feature +36 -0
  75. data/features/listen_for_client_call.feature +23 -0
  76. data/features/persistent_schedule.feature +70 -0
  77. data/features/proove_protocol.feature +20 -0
  78. data/features/schedule.feature +25 -0
  79. data/features/simple_string_protocol.feature +35 -0
  80. data/features/step_definitions/execute_schedule_steps.rb +16 -0
  81. data/features/step_definitions/group_aliases_steps.rb +24 -0
  82. data/features/step_definitions/handle_switches_steps.rb +21 -0
  83. data/features/step_definitions/listen_for_client_call_steps.rb +34 -0
  84. data/features/step_definitions/persistent_schedule_steps.rb +18 -0
  85. data/features/step_definitions/proove_protocol_steps.rb +3 -0
  86. data/features/step_definitions/schedule_steps.rb +9 -0
  87. data/features/step_definitions/shared_steps.rb +75 -0
  88. data/features/step_definitions/simple_string_protocol_steps.rb +3 -0
  89. data/features/step_definitions/sunrise_steps.rb +22 -0
  90. data/features/step_definitions/tellstick_connected_steps.rb +21 -0
  91. data/features/sunrise.feature +22 -0
  92. data/features/sunset.feature +22 -0
  93. data/features/support/action_helpers.rb +10 -0
  94. data/features/support/env.rb +7 -0
  95. data/features/support/listen_for_client_call_helper.rb +71 -0
  96. data/features/support/proove_helpers.rb +6 -0
  97. data/features/support/sunrise_helper.rb +8 -0
  98. data/features/tellstick_connected.feature +14 -0
  99. data/lib/tellstick/protocol/nexa.rb +48 -0
  100. data/lib/tellstick/protocol/not_connected.rb +42 -0
  101. data/lib/tellstick/protocol/null_protocol.rb +41 -0
  102. data/lib/tellstick/protocol/plain_text.rb +35 -0
  103. data/lib/tellstick/protocol/proove.rb +83 -0
  104. data/lib/tellstick/protocol/protocol_loader.rb +26 -0
  105. data/lib/tellstick/protocol/rising_sun.rb +42 -0
  106. data/lib/tellstick/protocol/waveman.rb +29 -0
  107. data/lib/tellstick/tellstick.rb +73 -0
  108. data/lib/tellstick/tellstick_io.rb +80 -0
  109. data/lib/tellstick.rb +20 -0
  110. data/lib/trigger_switch_d/action.rb +83 -0
  111. data/lib/trigger_switch_d/application.rb +89 -0
  112. data/lib/trigger_switch_d/config.rb +83 -0
  113. data/lib/trigger_switch_d/daylight.rb +114 -0
  114. data/lib/trigger_switch_d/ipc.rb +39 -0
  115. data/lib/trigger_switch_d/schedule.rb +95 -0
  116. data/lib/trigger_switch_d/switch.rb +37 -0
  117. data/lib/trigger_switch_d/trigger_switch_d_helper.rb +44 -0
  118. data/lib/trigger_switch_d.rb +26 -0
  119. data/spec/spec_helper.rb +22 -0
  120. data/spec/tellstick/protocol/nexa_spec.rb +57 -0
  121. data/spec/tellstick/protocol/proove_spec.rb +61 -0
  122. data/spec/tellstick/protocol/rising_sun_spec.rb +56 -0
  123. data/spec/tellstick/protocol/waveman_spec.rb +57 -0
  124. data/spec/tellstick/tellstick_io_spec.rb +31 -0
  125. data/spec/tellstick/tellstick_spec.rb +86 -0
  126. data/spec/trigger_switch_d/application_spec.rb +144 -0
  127. data/spec/trigger_switch_d/config_spec.rb +94 -0
  128. data/spec/trigger_switch_d/daylight_spec.rb +39 -0
  129. data/spec/trigger_switch_d/ipc_spec.rb +119 -0
  130. data/spec/trigger_switch_d/schedule_spec.rb +103 -0
  131. data/spec/trigger_switch_d/trigger_switch_d_spec_helpers.rb +24 -0
  132. data/trigger_switch_d.gemspec +43 -0
  133. metadata +206 -0
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>create (Tellstick)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/tellstick/tellstick.rb, line 36</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create</span>(<span class="ruby-identifier">output</span>,<span class="ruby-identifier">protocol_name</span>=<span class="ruby-value str">&quot;plain_text&quot;</span>)
15
+ <span class="ruby-identifier">protocol</span> = <span class="ruby-identifier">load</span>(<span class="ruby-identifier">protocol_name</span>)
16
+ <span class="ruby-identifier">dongle</span> = <span class="ruby-constant">Tellstick</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">output</span>)
17
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">connection_not_needed_for</span>(<span class="ruby-identifier">output</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">output</span>.<span class="ruby-identifier">connected?</span>
18
+ <span class="ruby-identifier">dongle</span>.<span class="ruby-identifier">extend</span> <span class="ruby-identifier">protocol</span>
19
+ <span class="ruby-keyword kw">else</span>
20
+ <span class="ruby-identifier">dongle</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">NotConnected</span>
21
+ <span class="ruby-keyword kw">end</span>
22
+ <span class="ruby-identifier">dongle</span>
23
+ <span class="ruby-keyword kw">end</span></pre>
24
+ </body>
25
+ </html>
@@ -0,0 +1,165 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: TriggerSwitchD::Action</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">TriggerSwitchD::Action</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/trigger_switch_d/action_rb.html">
59
+ lib/trigger_switch_d/action.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ Uses the ruby engine to transform code_line into method execute on an
84
+ instance of <a href="Action.html">Action</a>
85
+ </p>
86
+
87
+ </div>
88
+
89
+
90
+ </div>
91
+
92
+ <div id="method-list">
93
+ <h3 class="section-bar">Methods</h3>
94
+
95
+ <div class="name-list">
96
+ <a href="#M000015">new</a>&nbsp;&nbsp;
97
+ <a href="#M000016">to_s</a>&nbsp;&nbsp;
98
+ </div>
99
+ </div>
100
+
101
+ </div>
102
+
103
+
104
+ <!-- if includes -->
105
+
106
+ <div id="section">
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ <!-- if method_list -->
116
+ <div id="methods">
117
+ <h3 class="section-bar">Public Class methods</h3>
118
+
119
+ <div id="method-M000015" class="method-detail">
120
+ <a name="M000015"></a>
121
+
122
+ <div class="method-heading">
123
+ <a href="Action.src/M000015.html" target="Code" class="method-signature"
124
+ onclick="popupCode('Action.src/M000015.html');return false;">
125
+ <span class="method-name">new</span><span class="method-args">(code_line,devices,environment=Config.default_environment,date=Date.today)</span>
126
+ </a>
127
+ </div>
128
+
129
+ <div class="method-description">
130
+ <p>
131
+ Takes a code_line to be scheduled or executed together with the devices,
132
+ environment and date to validate it.
133
+ </p>
134
+ </div>
135
+ </div>
136
+
137
+ <h3 class="section-bar">Public Instance methods</h3>
138
+
139
+ <div id="method-M000016" class="method-detail">
140
+ <a name="M000016"></a>
141
+
142
+ <div class="method-heading">
143
+ <a href="Action.src/M000016.html" target="Code" class="method-signature"
144
+ onclick="popupCode('Action.src/M000016.html');return false;">
145
+ <span class="method-name">to_s</span><span class="method-args">()</span>
146
+ </a>
147
+ </div>
148
+
149
+ <div class="method-description">
150
+ </div>
151
+ </div>
152
+
153
+
154
+ </div>
155
+
156
+
157
+ </div>
158
+
159
+
160
+ <div id="validator-badges">
161
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
162
+ </div>
163
+
164
+ </body>
165
+ </html>
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>new (TriggerSwitchD::Action)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/trigger_switch_d/action.rb, line 26</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">code_line</span>,<span class="ruby-identifier">devices</span>,<span class="ruby-identifier">environment</span>=<span class="ruby-constant">Config</span>.<span class="ruby-identifier">default_environment</span>,<span class="ruby-identifier">date</span>=<span class="ruby-constant">Date</span>.<span class="ruby-identifier">today</span>)
15
+ <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">code_line</span>.<span class="ruby-identifier">strip</span>
16
+ <span class="ruby-ivar">@date</span> = <span class="ruby-identifier">date</span>
17
+ <span class="ruby-ivar">@at_location</span> = <span class="ruby-identifier">environment</span>[<span class="ruby-identifier">:at_location</span>]
18
+ <span class="ruby-ivar">@lookup</span> = <span class="ruby-identifier">environment</span>[<span class="ruby-identifier">:lookup</span>]
19
+ <span class="ruby-identifier">tokens</span> = <span class="ruby-identifier">code_line</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/(\w+) (\w+) (\w+) ([\w\d:]+)/</span><span class="ruby-identifier">u</span>).<span class="ruby-identifier">flatten</span>
20
+ (<span class="ruby-keyword kw">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>;<span class="ruby-keyword kw">self</span>;<span class="ruby-keyword kw">end</span>).<span class="ruby-identifier">methodize_device</span>(<span class="ruby-identifier">tokens</span>[<span class="ruby-value">1</span>],<span class="ruby-identifier">devices</span>[<span class="ruby-identifier">tokens</span>[<span class="ruby-value">1</span>]],<span class="ruby-ivar">@lookup</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">devices</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">tokens</span>[<span class="ruby-value">1</span>]
21
+ <span class="ruby-identifier">code</span> = <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">token</span><span class="ruby-operator">|</span>
22
+ (<span class="ruby-ivar">@lookup</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">token</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@lookup</span>[<span class="ruby-identifier">token</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">token</span>
23
+ <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">reverse</span>
24
+ <span class="ruby-ivar">@at</span>, <span class="ruby-identifier">executable</span> = <span class="ruby-identifier">send</span>(<span class="ruby-identifier">code</span>[<span class="ruby-value">3</span>], <span class="ruby-identifier">send</span>(<span class="ruby-identifier">code</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">send</span>(<span class="ruby-identifier">code</span>[<span class="ruby-value">1</span>], <span class="ruby-identifier">code</span>[<span class="ruby-value">0</span>])))
25
+ (<span class="ruby-keyword kw">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>;<span class="ruby-keyword kw">self</span>;<span class="ruby-keyword kw">end</span>).<span class="ruby-identifier">methodize_executable</span>(<span class="ruby-identifier">executable</span>)
26
+ <span class="ruby-keyword kw">end</span></pre>
27
+ </body>
28
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>to_s (TriggerSwitchD::Action)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/trigger_switch_d/action.rb, line 56</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
15
+ <span class="ruby-ivar">@name</span>
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,203 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: TriggerSwitchD::Application</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">TriggerSwitchD::Application</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/trigger_switch_d/application_rb.html">
59
+ lib/trigger_switch_d/application.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ starts an instance of the daemon.
84
+ </p>
85
+
86
+ </div>
87
+
88
+
89
+ </div>
90
+
91
+ <div id="method-list">
92
+ <h3 class="section-bar">Methods</h3>
93
+
94
+ <div class="name-list">
95
+ <a href="#M000017">new</a>&nbsp;&nbsp;
96
+ <a href="#M000018">start</a>&nbsp;&nbsp;
97
+ </div>
98
+ </div>
99
+
100
+ </div>
101
+
102
+
103
+ <!-- if includes -->
104
+
105
+ <div id="section">
106
+
107
+
108
+
109
+ <div id="aliases-list">
110
+ <h3 class="section-bar">External Aliases</h3>
111
+
112
+ <div class="name-list">
113
+ <table summary="aliases">
114
+ <tr class="top-aligned-row context-row">
115
+ <td class="context-item-name">devices</td>
116
+ <td>-&gt;</td>
117
+ <td class="context-item-value">list_devices</td>
118
+ </tr>
119
+ </table>
120
+ </div>
121
+ </div>
122
+
123
+
124
+ <div id="attribute-list">
125
+ <h3 class="section-bar">Attributes</h3>
126
+
127
+ <div class="name-list">
128
+ <table>
129
+ <tr class="top-aligned-row context-row">
130
+ <td class="context-item-name">devices</td>
131
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
132
+ <td class="context-item-desc"></td>
133
+ </tr>
134
+ <tr class="top-aligned-row context-row">
135
+ <td class="context-item-name">logger</td>
136
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
137
+ <td class="context-item-desc"></td>
138
+ </tr>
139
+ <tr class="top-aligned-row context-row">
140
+ <td class="context-item-name">schedule</td>
141
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
142
+ <td class="context-item-desc"></td>
143
+ </tr>
144
+ </table>
145
+ </div>
146
+ </div>
147
+
148
+
149
+
150
+ <!-- if method_list -->
151
+ <div id="methods">
152
+ <h3 class="section-bar">Public Class methods</h3>
153
+
154
+ <div id="method-M000017" class="method-detail">
155
+ <a name="M000017"></a>
156
+
157
+ <div class="method-heading">
158
+ <a href="Application.src/M000017.html" target="Code" class="method-signature"
159
+ onclick="popupCode('Application.src/M000017.html');return false;">
160
+ <span class="method-name">new</span><span class="method-args">(config_file)</span>
161
+ </a>
162
+ </div>
163
+
164
+ <div class="method-description">
165
+ <p>
166
+ Prepares the run by loading up the environment located in config/config.rb
167
+ </p>
168
+ </div>
169
+ </div>
170
+
171
+ <h3 class="section-bar">Public Instance methods</h3>
172
+
173
+ <div id="method-M000018" class="method-detail">
174
+ <a name="M000018"></a>
175
+
176
+ <div class="method-heading">
177
+ <a href="Application.src/M000018.html" target="Code" class="method-signature"
178
+ onclick="popupCode('Application.src/M000018.html');return false;">
179
+ <span class="method-name">start</span><span class="method-args">()</span>
180
+ </a>
181
+ </div>
182
+
183
+ <div class="method-description">
184
+ <p>
185
+ Runs the daemon untill process killed or it receives stop from client
186
+ connected via unix socket
187
+ </p>
188
+ </div>
189
+ </div>
190
+
191
+
192
+ </div>
193
+
194
+
195
+ </div>
196
+
197
+
198
+ <div id="validator-badges">
199
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
200
+ </div>
201
+
202
+ </body>
203
+ </html>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>new (TriggerSwitchD::Application)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/trigger_switch_d/application.rb, line 32</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">config_file</span>)
15
+ <span class="ruby-ivar">@current_date</span> = <span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>
16
+ <span class="ruby-constant">ConfigFactory</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">config_file</span>)
17
+ <span class="ruby-ivar">@logger</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Config</span>.<span class="ruby-identifier">log_object</span>)
18
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">&quot;Environment prepared&quot;</span>)
19
+ <span class="ruby-keyword kw">end</span></pre>
20
+ </body>
21
+ </html>
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>start (TriggerSwitchD::Application)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/trigger_switch_d/application.rb, line 41</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
15
+ <span class="ruby-identifier">com_thread</span> = <span class="ruby-constant">IPC</span>.<span class="ruby-identifier">create</span>(<span class="ruby-constant">Config</span>.<span class="ruby-identifier">unix_socket_path</span>)
16
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">&quot;IPC started&quot;</span>)
17
+ <span class="ruby-identifier">com_thread</span>[<span class="ruby-value str">&quot;received&quot;</span>] = <span class="ruby-value str">&quot;anything&quot;</span>
18
+ <span class="ruby-keyword kw">while</span> ((<span class="ruby-identifier">command</span> = <span class="ruby-identifier">com_thread</span>[<span class="ruby-value str">&quot;received&quot;</span>].<span class="ruby-identifier">to_sym</span>) <span class="ruby-operator">!=</span> <span class="ruby-identifier">:stop</span>)
19
+ <span class="ruby-identifier">now_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>
20
+ <span class="ruby-identifier">load_db</span>(<span class="ruby-identifier">now_time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">&quot;%Y-%m-%d %H:%M:%S&quot;</span>))
21
+ <span class="ruby-identifier">hhmm_now_time</span> = <span class="ruby-identifier">now_time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">&quot;%H:%M&quot;</span>)
22
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">command</span>.<span class="ruby-identifier">to_s</span>
23
+ <span class="ruby-identifier">com_thread</span>[<span class="ruby-value str">&quot;response&quot;</span>] = <span class="ruby-identifier">send</span>(<span class="ruby-identifier">command</span>).<span class="ruby-identifier">to_yaml</span>
24
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Received #{command} via IPC&quot;</span>)
25
+ <span class="ruby-constant">Config</span>.<span class="ruby-identifier">log_object</span>.<span class="ruby-identifier">flush</span>
26
+ <span class="ruby-identifier">com_thread</span>[<span class="ruby-value str">&quot;received&quot;</span>] = <span class="ruby-value str">&quot;anything&quot;</span>
27
+ <span class="ruby-identifier">com_thread</span>.<span class="ruby-identifier">run</span>
28
+ <span class="ruby-keyword kw">end</span>
29
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">schedule</span>.<span class="ruby-identifier">cronological</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">hhmm_now_time</span>)
30
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Executed #{schedule.cronological[hhmm_now_time].length} action(s) at #{hhmm_now_time}&quot;</span>)
31
+ <span class="ruby-constant">Config</span>.<span class="ruby-identifier">log_object</span>.<span class="ruby-identifier">flush</span>
32
+ <span class="ruby-identifier">schedule</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">hhmm_now_time</span>,<span class="ruby-constant">Config</span>.<span class="ruby-identifier">output</span>)
33
+ <span class="ruby-keyword kw">end</span>
34
+ <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">sleep</span>(<span class="ruby-value">1</span>)
35
+ <span class="ruby-identifier">com_thread</span>[<span class="ruby-value str">&quot;received&quot;</span>] = <span class="ruby-value str">&quot;anything&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">com_thread</span>[<span class="ruby-value str">&quot;received&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
36
+ <span class="ruby-keyword kw">end</span>
37
+ <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Received #{command} via IPC&quot;</span>)
38
+ <span class="ruby-keyword kw">end</span></pre>
39
+ </body>
40
+ </html>
@@ -0,0 +1,127 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: TriggerSwitchD::ConfigFactory::Config</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">TriggerSwitchD::ConfigFactory::Config</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ </td>
59
+ </tr>
60
+
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+
73
+ </div>
74
+
75
+ <div id="method-list">
76
+ <h3 class="section-bar">Methods</h3>
77
+
78
+ <div class="name-list">
79
+ <a href="#M000014">environment</a>&nbsp;&nbsp;
80
+ </div>
81
+ </div>
82
+
83
+ </div>
84
+
85
+
86
+ <!-- if includes -->
87
+
88
+ <div id="section">
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <!-- if method_list -->
98
+ <div id="methods">
99
+ <h3 class="section-bar">Public Class methods</h3>
100
+
101
+ <div id="method-M000014" class="method-detail">
102
+ <a name="M000014"></a>
103
+
104
+ <div class="method-heading">
105
+ <a href="Config.src/M000014.html" target="Code" class="method-signature"
106
+ onclick="popupCode('Config.src/M000014.html');return false;">
107
+ <span class="method-name">environment</span><span class="method-args">()</span>
108
+ </a>
109
+ </div>
110
+
111
+ <div class="method-description">
112
+ </div>
113
+ </div>
114
+
115
+
116
+ </div>
117
+
118
+
119
+ </div>
120
+
121
+
122
+ <div id="validator-badges">
123
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
124
+ </div>
125
+
126
+ </body>
127
+ </html>