configatron 2.2.2 → 2.3.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.
data/lib/configatron.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  base = File.join(File.dirname(__FILE__), 'configatron')
2
- require 'yaml'
2
+ require 'yamler'
3
3
  require File.join(base, 'configatron')
4
4
  require File.join(base, 'store')
5
5
  require File.join(base, 'errors')
@@ -50,5 +50,6 @@ class Configatron
50
50
 
51
51
  undef :inspect # :nodoc:
52
52
  undef :nil? # :nodoc:
53
+ undef :test # :nodoc:
53
54
 
54
55
  end
@@ -58,7 +58,7 @@ class Configatron
58
58
  # loaded from the file.
59
59
  def configure_from_yaml(path, opts = {})
60
60
  begin
61
- yml = YAML.load(File.read(path))
61
+ yml = ::Yamler.load(path)
62
62
  yml = yml[opts[:hash]] unless opts[:hash].nil?
63
63
  configure_from_hash(yml)
64
64
  rescue Errno::ENOENT => e
@@ -251,5 +251,7 @@ class Configatron
251
251
  end
252
252
  end
253
253
 
254
- end
255
- end
254
+ undef :test # :nodoc:
255
+
256
+ end # Store
257
+ end # Configatron
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configatron
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,10 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-16 00:00:00 -05:00
12
+ date: 2009-04-22 00:00:00 -04:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: yamler
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.1.0
24
+ version:
16
25
  description: "Configatron was developed by: markbates"
17
26
  email: mark@mackframework.com
18
27
  executables: []
@@ -31,27 +40,6 @@ files:
31
40
  - lib/configatron/store.rb
32
41
  - lib/configatron.rb
33
42
  - README
34
- - doc/classes/Class.html
35
- - doc/classes/Configatron/LockedNamespace.html
36
- - doc/classes/Configatron/ProtectedParameter.html
37
- - doc/classes/Configatron/Store.html
38
- - doc/classes/Configatron.html
39
- - doc/classes/Kernel.html
40
- - doc/created.rid
41
- - doc/files/lib/configatron/configatron_rb.html
42
- - doc/files/lib/configatron/core_ext/class_rb.html
43
- - doc/files/lib/configatron/core_ext/kernel_rb.html
44
- - doc/files/lib/configatron/core_ext/object_rb.html
45
- - doc/files/lib/configatron/core_ext/string_rb.html
46
- - doc/files/lib/configatron/errors_rb.html
47
- - doc/files/lib/configatron/store_rb.html
48
- - doc/files/lib/configatron_rb.html
49
- - doc/files/README.html
50
- - doc/fr_class_index.html
51
- - doc/fr_file_index.html
52
- - doc/fr_method_index.html
53
- - doc/index.html
54
- - doc/rdoc-style.css
55
43
  has_rdoc: true
56
44
  homepage: http://www.mackframework.com
57
45
  post_install_message:
@@ -59,7 +47,6 @@ rdoc_options: []
59
47
 
60
48
  require_paths:
61
49
  - lib
62
- - lib
63
50
  required_ruby_version: !ruby/object:Gem::Requirement
64
51
  requirements:
65
52
  - - ">="
@@ -79,11 +66,5 @@ rubygems_version: 1.3.1
79
66
  signing_key:
80
67
  specification_version: 2
81
68
  summary: A powerful Ruby configuration system.
82
- test_files:
83
- - spec/lib
84
- - spec/lib/class_spec.rb
85
- - spec/lib/configatron_spec.rb
86
- - spec/lib/futurama.yml
87
- - spec/lib/lost.yml
88
- - spec/spec.opts
89
- - spec/spec_helper.rb
69
+ test_files: []
70
+
@@ -1,170 +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: Class</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">Class</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/configatron/core_ext/class_rb.html">
59
- lib/configatron/core_ext/class.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">to_configatron</a>&nbsp;&nbsp;
90
- </div>
91
- </div>
92
-
93
- </div>
94
-
95
-
96
- <!-- if includes -->
97
-
98
- <div id="section">
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
- <!-- if method_list -->
108
- <div id="methods">
109
- <h3 class="section-bar">Public Instance methods</h3>
110
-
111
- <div id="method-M000001" class="method-detail">
112
- <a name="M000001"></a>
113
-
114
- <div class="method-heading">
115
- <a href="#M000001" class="method-signature">
116
- <span class="method-name">to_configatron</span><span class="method-args">()</span>
117
- </a>
118
- </div>
119
-
120
- <div class="method-description">
121
- <p>
122
- Returns access to configuration parameters named after the class.
123
- </p>
124
- <p>
125
- Examples:
126
- </p>
127
- <pre>
128
- configatron.foo.bar = :bar
129
- configatron.a.b.c.d = 'D'
130
-
131
- class Foo
132
- end
133
-
134
- module A
135
- module B
136
- class C
137
- end
138
- end
139
- end
140
-
141
- Foo.to_configatron.bar # =&gt; :bar
142
- A::B::C.to_configatron.d # =&gt; 'D'
143
- </pre>
144
- <p><a class="source-toggle" href="#"
145
- onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
146
- <div class="method-source-code" id="M000001-source">
147
- <pre>
148
- <span class="ruby-comment cmt"># File lib/configatron/core_ext/class.rb, line 21</span>
149
- 21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_configatron</span>
150
- 22: <span class="ruby-identifier">name_spaces</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;::&quot;</span>).<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">methodize</span>}
151
- 23: <span class="ruby-identifier">configatron</span>.<span class="ruby-identifier">send_with_chain</span>(<span class="ruby-identifier">name_spaces</span>)
152
- 24: <span class="ruby-keyword kw">end</span>
153
- </pre>
154
- </div>
155
- </div>
156
- </div>
157
-
158
-
159
- </div>
160
-
161
-
162
- </div>
163
-
164
-
165
- <div id="validator-badges">
166
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
167
- </div>
168
-
169
- </body>
170
- </html>
@@ -1,303 +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</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</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/configatron/configatron_rb.html">
59
- lib/configatron/configatron.rb
60
- </a>
61
- <br />
62
- <a href="../files/lib/configatron/errors_rb.html">
63
- lib/configatron/errors.rb
64
- </a>
65
- <br />
66
- <a href="../files/lib/configatron/store_rb.html">
67
- lib/configatron/store.rb
68
- </a>
69
- <br />
70
- </td>
71
- </tr>
72
-
73
- <tr class="top-aligned-row">
74
- <td><strong>Parent:</strong></td>
75
- <td>
76
- Object
77
- </td>
78
- </tr>
79
- </table>
80
- </div>
81
- <!-- banner header -->
82
-
83
- <div id="bodyContent">
84
-
85
-
86
-
87
- <div id="contextContent">
88
-
89
-
90
-
91
- </div>
92
-
93
- <div id="method-list">
94
- <h3 class="section-bar">Methods</h3>
95
-
96
- <div class="name-list">
97
- <a href="#M000002">method_missing</a>&nbsp;&nbsp;
98
- <a href="#M000003">reset!</a>&nbsp;&nbsp;
99
- <a href="#M000004">temp</a>&nbsp;&nbsp;
100
- <a href="#M000006">temp_end</a>&nbsp;&nbsp;
101
- <a href="#M000005">temp_start</a>&nbsp;&nbsp;
102
- </div>
103
- </div>
104
-
105
- </div>
106
-
107
-
108
- <!-- if includes -->
109
- <div id="includes">
110
- <h3 class="section-bar">Included Modules</h3>
111
-
112
- <div id="includes-list">
113
- <span class="include-name">Singleton</span>
114
- </div>
115
- </div>
116
-
117
- <div id="section">
118
-
119
- <div id="class-list">
120
- <h3 class="section-bar">Classes and Modules</h3>
121
-
122
- Class <a href="Configatron/LockedNamespace.html" class="link">Configatron::LockedNamespace</a><br />
123
- Class <a href="Configatron/ProtectedParameter.html" class="link">Configatron::ProtectedParameter</a><br />
124
- Class <a href="Configatron/Store.html" class="link">Configatron::Store</a><br />
125
-
126
- </div>
127
-
128
-
129
- <div id="aliases-list">
130
- <h3 class="section-bar">External Aliases</h3>
131
-
132
- <div class="name-list">
133
- <table summary="aliases">
134
- <tr class="top-aligned-row context-row">
135
- <td class="context-item-name">send</td>
136
- <td>-&gt;</td>
137
- <td class="context-item-value">send!</td>
138
- </tr>
139
- </table>
140
- </div>
141
- </div>
142
-
143
-
144
-
145
-
146
-
147
- <!-- if method_list -->
148
- <div id="methods">
149
- <h3 class="section-bar">Public Instance methods</h3>
150
-
151
- <div id="method-M000002" class="method-detail">
152
- <a name="M000002"></a>
153
-
154
- <div class="method-heading">
155
- <a href="#M000002" class="method-signature">
156
- <span class="method-name">method_missing</span><span class="method-args">(sym, *args)</span>
157
- </a>
158
- </div>
159
-
160
- <div class="method-description">
161
- <p>
162
- Forwards the method call onto the &#8216;namespaced&#8217; <a
163
- href="Configatron/Store.html">Configatron::Store</a>
164
- </p>
165
- <p><a class="source-toggle" href="#"
166
- onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
167
- <div class="method-source-code" id="M000002-source">
168
- <pre>
169
- <span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 14</span>
170
- 14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
171
- 15: <span class="ruby-ivar">@_store</span>[<span class="ruby-ivar">@_namespace</span>.<span class="ruby-identifier">last</span>].<span class="ruby-identifier">send</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
172
- 16: <span class="ruby-keyword kw">end</span>
173
- </pre>
174
- </div>
175
- </div>
176
- </div>
177
-
178
- <div id="method-M000003" class="method-detail">
179
- <a name="M000003"></a>
180
-
181
- <div class="method-heading">
182
- <a href="#M000003" class="method-signature">
183
- <span class="method-name">reset!</span><span class="method-args">()</span>
184
- </a>
185
- </div>
186
-
187
- <div class="method-description">
188
- <p>
189
- Removes ALL configuration parameters
190
- </p>
191
- <p><a class="source-toggle" href="#"
192
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
193
- <div class="method-source-code" id="M000003-source">
194
- <pre>
195
- <span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 19</span>
196
- 19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset!</span>
197
- 20: <span class="ruby-ivar">@_store</span> = {<span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Store</span>.<span class="ruby-identifier">new</span>}
198
- 21: <span class="ruby-keyword kw">end</span>
199
- </pre>
200
- </div>
201
- </div>
202
- </div>
203
-
204
- <div id="method-M000004" class="method-detail">
205
- <a name="M000004"></a>
206
-
207
- <div class="method-heading">
208
- <a href="#M000004" class="method-signature">
209
- <span class="method-name">temp</span><span class="method-args">(options = nil) {|| ...}</span>
210
- </a>
211
- </div>
212
-
213
- <div class="method-description">
214
- <p>
215
- Allows for the temporary overriding of parameters in a block. Takes an
216
- optional Hash of parameters that will be applied before the block gets
217
- called. At the end of the block, the temporary settings are deleted and the
218
- original settings are reinstated.
219
- </p>
220
- <p><a class="source-toggle" href="#"
221
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
222
- <div class="method-source-code" id="M000004-source">
223
- <pre>
224
- <span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 27</span>
225
- 27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">temp</span>(<span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
226
- 28: <span class="ruby-keyword kw">begin</span>
227
- 29: <span class="ruby-identifier">temp_start</span>(<span class="ruby-identifier">options</span>)
228
- 30: <span class="ruby-keyword kw">yield</span>
229
- 31: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
230
- 32: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
231
- 33: <span class="ruby-keyword kw">ensure</span>
232
- 34: <span class="ruby-identifier">temp_end</span>
233
- 35: <span class="ruby-keyword kw">end</span>
234
- 36: <span class="ruby-keyword kw">end</span>
235
- </pre>
236
- </div>
237
- </div>
238
- </div>
239
-
240
- <div id="method-M000006" class="method-detail">
241
- <a name="M000006"></a>
242
-
243
- <div class="method-heading">
244
- <a href="#M000006" class="method-signature">
245
- <span class="method-name">temp_end</span><span class="method-args">()</span>
246
- </a>
247
- </div>
248
-
249
- <div class="method-description">
250
- <p><a class="source-toggle" href="#"
251
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
252
- <div class="method-source-code" id="M000006-source">
253
- <pre>
254
- <span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 47</span>
255
- 47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">temp_end</span>
256
- 48: <span class="ruby-ivar">@_store</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-ivar">@_namespace</span>.<span class="ruby-identifier">pop</span>)
257
- 49: <span class="ruby-keyword kw">end</span>
258
- </pre>
259
- </div>
260
- </div>
261
- </div>
262
-
263
- <div id="method-M000005" class="method-detail">
264
- <a name="M000005"></a>
265
-
266
- <div class="method-heading">
267
- <a href="#M000005" class="method-signature">
268
- <span class="method-name">temp_start</span><span class="method-args">(options = nil)</span>
269
- </a>
270
- </div>
271
-
272
- <div class="method-description">
273
- <p><a class="source-toggle" href="#"
274
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
275
- <div class="method-source-code" id="M000005-source">
276
- <pre>
277
- <span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 38</span>
278
- 38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">temp_start</span>(<span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
279
- 39: <span class="ruby-identifier">n_space</span> = <span class="ruby-identifier">rand</span>
280
- 40: <span class="ruby-ivar">@_store</span>[<span class="ruby-identifier">n_space</span>] = <span class="ruby-ivar">@_store</span>[<span class="ruby-ivar">@_namespace</span>.<span class="ruby-identifier">last</span>].<span class="ruby-identifier">deep_clone</span>
281
- 41: <span class="ruby-ivar">@_namespace</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">n_space</span>
282
- 42: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>
283
- 43: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">:configure_from_hash</span>, <span class="ruby-identifier">options</span>)
284
- 44: <span class="ruby-keyword kw">end</span>
285
- 45: <span class="ruby-keyword kw">end</span>
286
- </pre>
287
- </div>
288
- </div>
289
- </div>
290
-
291
-
292
- </div>
293
-
294
-
295
- </div>
296
-
297
-
298
- <div id="validator-badges">
299
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
300
- </div>
301
-
302
- </body>
303
- </html>