configatron 1.2.2 → 2.0.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 (37) hide show
  1. data/README +61 -34
  2. data/doc/classes/Configatron.html +241 -0
  3. data/doc/classes/Configatron/ProtectedParameter.html +146 -0
  4. data/doc/classes/Configatron/Store.html +241 -121
  5. data/doc/classes/Kernel.html +13 -20
  6. data/doc/created.rid +1 -1
  7. data/doc/files/README.html +85 -43
  8. data/doc/files/lib/configatron/{configuration_rb.html → configatron_rb.html} +11 -4
  9. data/doc/files/lib/configatron/{helpers_rb.html → errors_rb.html} +4 -4
  10. data/doc/files/lib/configatron/kernel_rb.html +1 -1
  11. data/doc/files/lib/configatron/store_rb.html +1 -1
  12. data/doc/files/lib/configatron_rb.html +1 -2
  13. data/doc/fr_class_index.html +2 -4
  14. data/doc/fr_file_index.html +2 -3
  15. data/doc/fr_method_index.html +15 -21
  16. data/lib/configatron.rb +5 -44
  17. data/lib/configatron/configatron.rb +44 -0
  18. data/lib/configatron/errors.rb +7 -0
  19. data/lib/configatron/kernel.rb +3 -9
  20. data/lib/configatron/store.rb +148 -56
  21. data/spec/lib/configatron_spec.rb +293 -0
  22. data/spec/lib/futurama.yml +6 -0
  23. data/spec/spec_helper.rb +3 -2
  24. metadata +11 -18
  25. data/doc/classes/Configatron/Configuration.html +0 -402
  26. data/doc/classes/Configatron/Helpers.html +0 -174
  27. data/doc/classes/Configatron/YamlStore.html +0 -203
  28. data/doc/classes/Hash.html +0 -193
  29. data/doc/files/lib/configatron/yaml_store_rb.html +0 -101
  30. data/lib/configatron/configuration.rb +0 -112
  31. data/lib/configatron/helpers.rb +0 -27
  32. data/lib/configatron/yaml_store.rb +0 -33
  33. data/spec/unit/configuration_spec.rb +0 -299
  34. data/spec/unit/family_guy.yml +0 -2
  35. data/spec/unit/helpers_spec.rb +0 -115
  36. data/spec/unit/kernel_spec.rb +0 -48
  37. data/spec/unit/store_spec.rb +0 -91
@@ -1,174 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
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: Configatron::Helpers</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
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">Configatron::Helpers</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../files/lib/configatron/helpers_rb.html">
59
- lib/configatron/helpers.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- </table>
66
- </div>
67
- <!-- banner header -->
68
-
69
- <div id="bodyContent">
70
-
71
-
72
-
73
- <div id="contextContent">
74
-
75
-
76
-
77
- </div>
78
-
79
- <div id="method-list">
80
- <h3 class="section-bar">Methods</h3>
81
-
82
- <div class="name-list">
83
- <a href="#M000003">exists?</a>&nbsp;&nbsp;
84
- <a href="#M000004">retrieve</a>&nbsp;&nbsp;
85
- </div>
86
- </div>
87
-
88
- </div>
89
-
90
-
91
- <!-- if includes -->
92
-
93
- <div id="section">
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
- <!-- if method_list -->
103
- <div id="methods">
104
- <h3 class="section-bar">Public Instance methods</h3>
105
-
106
- <div id="method-M000003" class="method-detail">
107
- <a name="M000003"></a>
108
-
109
- <div class="method-heading">
110
- <a href="#M000003" class="method-signature">
111
- <span class="method-name">exists?</span><span class="method-args">(name)</span>
112
- </a>
113
- </div>
114
-
115
- <div class="method-description">
116
- <p>
117
- Checks whether or not configuration parameter exists.
118
- </p>
119
- <p><a class="source-toggle" href="#"
120
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
121
- <div class="method-source-code" id="M000003-source">
122
- <pre>
123
- <span class="ruby-comment cmt"># File lib/configatron/helpers.rb, line 5</span>
124
- 5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">name</span>)
125
- 6: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">name</span>)
126
- 7: <span class="ruby-keyword kw">end</span>
127
- </pre>
128
- </div>
129
- </div>
130
- </div>
131
-
132
- <div id="method-M000004" class="method-detail">
133
- <a name="M000004"></a>
134
-
135
- <div class="method-heading">
136
- <a href="#M000004" class="method-signature">
137
- <span class="method-name">retrieve</span><span class="method-args">(name, default_value = ArgumentError)</span>
138
- </a>
139
- </div>
140
-
141
- <div class="method-description">
142
- <p>
143
- Retrieves the specified config parameter. An optional second parameter can
144
- be passed that will be returned if the config parameter doesn&#8216;t
145
- exist.
146
- </p>
147
- <p><a class="source-toggle" href="#"
148
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
149
- <div class="method-source-code" id="M000004-source">
150
- <pre>
151
- <span class="ruby-comment cmt"># File lib/configatron/helpers.rb, line 20</span>
152
- 20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">retrieve</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">default_value</span> = <span class="ruby-constant">ArgumentError</span>)
153
- 21: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">name</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">name</span>)
154
- 22: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">default_value</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">default_value</span> <span class="ruby-operator">==</span> <span class="ruby-constant">ArgumentError</span>
155
- 23: <span class="ruby-identifier">handle_missing_parameter</span>(<span class="ruby-identifier">name</span>)
156
- 24: <span class="ruby-keyword kw">end</span>
157
- </pre>
158
- </div>
159
- </div>
160
- </div>
161
-
162
-
163
- </div>
164
-
165
-
166
- </div>
167
-
168
-
169
- <div id="validator-badges">
170
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
171
- </div>
172
-
173
- </body>
174
- </html>
@@ -1,203 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
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: Configatron::YamlStore</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
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">Configatron::YamlStore</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../files/lib/configatron/yaml_store_rb.html">
59
- lib/configatron/yaml_store.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
- <a href="Store.html">
69
- Configatron::Store
70
- </a>
71
- </td>
72
- </tr>
73
- </table>
74
- </div>
75
- <!-- banner header -->
76
-
77
- <div id="bodyContent">
78
-
79
-
80
-
81
- <div id="contextContent">
82
-
83
- <div id="description">
84
- <p>
85
- Used to store each of the &#8216;sets&#8217; of configuration parameters
86
- that came from a YAML file.
87
- </p>
88
-
89
- </div>
90
-
91
-
92
- </div>
93
-
94
- <div id="method-list">
95
- <h3 class="section-bar">Methods</h3>
96
-
97
- <div class="name-list">
98
- <a href="#M000011">new</a>&nbsp;&nbsp;
99
- <a href="#M000012">reload</a>&nbsp;&nbsp;
100
- </div>
101
- </div>
102
-
103
- </div>
104
-
105
-
106
- <!-- if includes -->
107
-
108
- <div id="section">
109
-
110
-
111
-
112
-
113
-
114
- <div id="attribute-list">
115
- <h3 class="section-bar">Attributes</h3>
116
-
117
- <div class="name-list">
118
- <table>
119
- <tr class="top-aligned-row context-row">
120
- <td class="context-item-name">file_location</td>
121
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
122
- <td class="context-item-desc"></td>
123
- </tr>
124
- </table>
125
- </div>
126
- </div>
127
-
128
-
129
-
130
- <!-- if method_list -->
131
- <div id="methods">
132
- <h3 class="section-bar">Public Class methods</h3>
133
-
134
- <div id="method-M000011" class="method-detail">
135
- <a name="M000011"></a>
136
-
137
- <div class="method-heading">
138
- <a href="#M000011" class="method-signature">
139
- <span class="method-name">new</span><span class="method-args">(file_location)</span>
140
- </a>
141
- </div>
142
-
143
- <div class="method-description">
144
- <p>
145
- Takes the full path to the YAML file.
146
- </p>
147
- <p><a class="source-toggle" href="#"
148
- onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
149
- <div class="method-source-code" id="M000011-source">
150
- <pre>
151
- <span class="ruby-comment cmt"># File lib/configatron/yaml_store.rb, line 9</span>
152
- 9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">file_location</span>)
153
- 10: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">params_from_yaml</span>(<span class="ruby-identifier">file_location</span>))
154
- 11: <span class="ruby-ivar">@file_location</span> = <span class="ruby-identifier">file_location</span>
155
- 12: <span class="ruby-keyword kw">end</span>
156
- </pre>
157
- </div>
158
- </div>
159
- </div>
160
-
161
- <h3 class="section-bar">Public Instance methods</h3>
162
-
163
- <div id="method-M000012" class="method-detail">
164
- <a name="M000012"></a>
165
-
166
- <div class="method-heading">
167
- <a href="#M000012" class="method-signature">
168
- <span class="method-name">reload</span><span class="method-args">()</span>
169
- </a>
170
- </div>
171
-
172
- <div class="method-description">
173
- <p>
174
- Re-reads the YAML file.
175
- </p>
176
- <p><a class="source-toggle" href="#"
177
- onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
178
- <div class="method-source-code" id="M000012-source">
179
- <pre>
180
- <span class="ruby-comment cmt"># File lib/configatron/yaml_store.rb, line 15</span>
181
- 15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload</span>
182
- 16: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">file_location</span>
183
- 17: <span class="ruby-identifier">params_from_yaml</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">file_location</span>)
184
- 18: <span class="ruby-keyword kw">end</span>
185
- 19: <span class="ruby-keyword kw">end</span>
186
- </pre>
187
- </div>
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>
@@ -1,193 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
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: Hash</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
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">Hash</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/configatron_rb.html">
59
- lib/configatron.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
-
82
-
83
- </div>
84
-
85
- <div id="method-list">
86
- <h3 class="section-bar">Methods</h3>
87
-
88
- <div class="name-list">
89
- <a href="#M000001">recursive_merge</a>&nbsp;&nbsp;
90
- <a href="#M000002">recursive_merge!</a>&nbsp;&nbsp;
91
- </div>
92
- </div>
93
-
94
- </div>
95
-
96
-
97
- <!-- if includes -->
98
-
99
- <div id="section">
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
- <!-- if method_list -->
109
- <div id="methods">
110
- <h3 class="section-bar">Public Instance methods</h3>
111
-
112
- <div id="method-M000001" class="method-detail">
113
- <a name="M000001"></a>
114
-
115
- <div class="method-heading">
116
- <a href="#M000001" class="method-signature">
117
- <span class="method-name">recursive_merge</span><span class="method-args">(other)</span>
118
- </a>
119
- </div>
120
-
121
- <div class="method-description">
122
- <p>
123
- Same as Hash#merge but recursively merges sub-hashes.
124
- </p>
125
- <p><a class="source-toggle" href="#"
126
- onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
127
- <div class="method-source-code" id="M000001-source">
128
- <pre>
129
- <span class="ruby-comment cmt"># File lib/configatron.rb, line 17</span>
130
- 17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">recursive_merge</span>(<span class="ruby-identifier">other</span>)
131
- 18: <span class="ruby-identifier">hash</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
132
- 19: <span class="ruby-identifier">other</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
133
- 20: <span class="ruby-identifier">myval</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">key</span>]
134
- 21: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">myval</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
135
- 22: <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">myval</span>.<span class="ruby-identifier">recursive_merge</span>(<span class="ruby-identifier">value</span>)
136
- 23: <span class="ruby-keyword kw">else</span>
137
- 24: <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>
138
- 25: <span class="ruby-keyword kw">end</span>
139
- 26: <span class="ruby-keyword kw">end</span>
140
- 27: <span class="ruby-identifier">hash</span>
141
- 28: <span class="ruby-keyword kw">end</span>
142
- </pre>
143
- </div>
144
- </div>
145
- </div>
146
-
147
- <div id="method-M000002" class="method-detail">
148
- <a name="M000002"></a>
149
-
150
- <div class="method-heading">
151
- <a href="#M000002" class="method-signature">
152
- <span class="method-name">recursive_merge!</span><span class="method-args">(other)</span>
153
- </a>
154
- </div>
155
-
156
- <div class="method-description">
157
- <p>
158
- Same as Hash#merge! but recursively merges sub-hashes.
159
- </p>
160
- <p><a class="source-toggle" href="#"
161
- onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
162
- <div class="method-source-code" id="M000002-source">
163
- <pre>
164
- <span class="ruby-comment cmt"># File lib/configatron.rb, line 32</span>
165
- 32: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">recursive_merge!</span>(<span class="ruby-identifier">other</span>)
166
- 33: <span class="ruby-identifier">other</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
167
- 34: <span class="ruby-identifier">myval</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">key</span>]
168
- 35: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">myval</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
169
- 36: <span class="ruby-identifier">myval</span>.<span class="ruby-identifier">recursive_merge!</span>(<span class="ruby-identifier">value</span>)
170
- 37: <span class="ruby-keyword kw">else</span>
171
- 38: <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>
172
- 39: <span class="ruby-keyword kw">end</span>
173
- 40: <span class="ruby-keyword kw">end</span>
174
- 41: <span class="ruby-keyword kw">self</span>
175
- 42: <span class="ruby-keyword kw">end</span>
176
- </pre>
177
- </div>
178
- </div>
179
- </div>
180
-
181
-
182
- </div>
183
-
184
-
185
- </div>
186
-
187
-
188
- <div id="validator-badges">
189
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
190
- </div>
191
-
192
- </body>
193
- </html>