rconfig 0.3.3 → 0.4.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 (74) hide show
  1. data/.gitignore +17 -0
  2. data/.rspec +1 -0
  3. data/.rvmrc +1 -0
  4. data/ChangeLog +50 -0
  5. data/Credits +13 -0
  6. data/Gemfile +9 -0
  7. data/Gemfile.lock +30 -0
  8. data/LICENSE.txt +20 -0
  9. data/README.rdoc +0 -0
  10. data/Rakefile +11 -0
  11. data/demo/application.conf +3 -0
  12. data/demo/demo.conf +13 -0
  13. data/demo/demo.rb +14 -0
  14. data/demo/demo.xml +13 -0
  15. data/demo/demo.yml +12 -0
  16. data/doc/classes/ClassVariables.html +111 -0
  17. data/doc/classes/ConfigError.html +120 -0
  18. data/doc/classes/ConfigHash.html +354 -0
  19. data/doc/classes/Constants.html +226 -0
  20. data/doc/classes/Hash.html +269 -0
  21. data/doc/classes/InvalidConfigPathError.html +119 -0
  22. data/doc/classes/Object.html +220 -0
  23. data/doc/classes/PropertiesFileParser.html +282 -0
  24. data/doc/classes/RConfig.html +1745 -0
  25. data/doc/created.rid +1 -0
  26. data/doc/files/README_rdoc.html +271 -0
  27. data/doc/files/lib/rconfig/class_variables_rb.html +107 -0
  28. data/doc/files/lib/rconfig/config_hash_rb.html +114 -0
  29. data/doc/files/lib/rconfig/constants_rb.html +101 -0
  30. data/doc/files/lib/rconfig/core_ext/hash_rb.html +114 -0
  31. data/doc/files/lib/rconfig/core_ext/object_rb.html +101 -0
  32. data/doc/files/lib/rconfig/core_ext_rb.html +114 -0
  33. data/doc/files/lib/rconfig/exceptions_rb.html +110 -0
  34. data/doc/files/lib/rconfig/properties_file_parser_rb.html +146 -0
  35. data/doc/files/lib/rconfig/rconfig_rb.html +186 -0
  36. data/doc/files/lib/rconfig_rb.html +117 -0
  37. data/doc/fr_class_index.html +35 -0
  38. data/doc/fr_file_index.html +37 -0
  39. data/doc/fr_method_index.html +75 -0
  40. data/doc/index.html +24 -0
  41. data/doc/rdoc-style.css +208 -0
  42. data/lib/generators/rconfig/install_generator.rb +13 -0
  43. data/lib/generators/rconfig/templates/rconfig.rb +82 -0
  44. data/lib/rconfig.rb +98 -32
  45. data/lib/rconfig/callbacks.rb +46 -0
  46. data/lib/rconfig/cascade.rb +56 -0
  47. data/lib/rconfig/config.rb +78 -0
  48. data/lib/rconfig/constants.rb +58 -0
  49. data/lib/rconfig/core_ext/array.rb +3 -0
  50. data/lib/rconfig/core_ext/hash.rb +56 -57
  51. data/lib/rconfig/core_ext/nil.rb +5 -0
  52. data/lib/rconfig/core_ext/string.rb +3 -0
  53. data/lib/rconfig/core_methods.rb +276 -0
  54. data/lib/rconfig/exceptions.rb +21 -8
  55. data/lib/rconfig/load_paths.rb +55 -0
  56. data/lib/rconfig/logger.rb +86 -0
  57. data/lib/rconfig/properties_file.rb +138 -0
  58. data/lib/rconfig/reload.rb +75 -0
  59. data/lib/rconfig/settings.rb +93 -0
  60. data/lib/rconfig/utils.rb +175 -0
  61. data/lib/tasks/gem.rake +14 -0
  62. data/lib/tasks/rdoc.rake +11 -0
  63. data/lib/tasks/spec.rake +25 -0
  64. data/rconfig.gemspec +33 -0
  65. data/spec/core_ext/object_spec.rb +44 -0
  66. data/spec/rconfig_spec.rb +7 -0
  67. data/spec/spec.opts +4 -0
  68. data/spec/spec_helper.rb +16 -0
  69. metadata +128 -32
  70. data/lib/rconfig/config_hash.rb +0 -105
  71. data/lib/rconfig/core_ext.rb +0 -6
  72. data/lib/rconfig/properties_file_parser.rb +0 -80
  73. data/lib/rconfig/rconfig.rb +0 -871
  74. data/test/rconfig_test.rb +0 -381
data/doc/created.rid ADDED
@@ -0,0 +1 @@
1
+ Fri, 12 Feb 2010 17:04:46 -0600
@@ -0,0 +1,271 @@
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>File: README.rdoc</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="fileHeader">
50
+ <h1>README.rdoc</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README.rdoc
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Fri Feb 12 15:17:46 -0600 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h1><a href="../classes/RConfig.html">RConfig</a></h1>
73
+ <p>
74
+ The complete solution for Ruby Configuration Management. <a
75
+ href="../classes/RConfig.html">RConfig</a> is a Ruby library that manages
76
+ configuration within Ruby applications. It bridges the gap between yaml,
77
+ xml, and key/value based properties files, by providing a centralized
78
+ solution to handle application configuration from one location. It provides
79
+ the simplicity of hash-based access, that Rubyists have come to know and
80
+ love, supporting your configuration style of choice, while providing many
81
+ new features, and an elegant API.
82
+ </p>
83
+ <h2>Features</h2>
84
+ <ul>
85
+ <li>Simple, easy to install and use.
86
+
87
+ </li>
88
+ <li>Supports yaml, xml, and properties files.
89
+
90
+ </li>
91
+ <li>Yaml and xml files support infinite level of configuration grouping.
92
+
93
+ </li>
94
+ <li>Properties files support git config-like configuration grouping.
95
+
96
+ </li>
97
+ <li>Intuitive dot-notation &#8216;key chaining&#8217; argument access.
98
+
99
+ </li>
100
+ <li>Simple well-known hash/array based argument access.
101
+
102
+ </li>
103
+ <li>Implements multilevel caching to reduce disk access.
104
+
105
+ </li>
106
+ <li>Short-hand access to &#8216;global&#8217; application configuration, and
107
+ shell environment.
108
+
109
+ </li>
110
+ <li>Overlays multiple configuration files to support environment and
111
+ host-specific configuration.
112
+
113
+ </li>
114
+ <li>Onload callbacks for single, multiple, or any config file.
115
+
116
+ </li>
117
+ </ul>
118
+ <h2>Example</h2>
119
+ <pre>
120
+ shell/console =&gt;
121
+ export LANG=en
122
+
123
+ demo.yml =&gt;
124
+ server:
125
+ address: host.domain.com
126
+ port: 81
127
+ ...
128
+
129
+ application.properties =&gt;
130
+ debug_level=verbose
131
+ ...
132
+
133
+ demo.rb =&gt;
134
+ require 'rconfig'
135
+ RConfig.config_paths = ['$HOME/config', '#{APP_ROOT}/config', '/demo/conf']
136
+ RConfig.demo[:server][:port] =&gt; 81
137
+ RConfig.demo.server.address =&gt; 'host.domain.com'
138
+
139
+ RConfig[:debug_level] =&gt; 'verbose'
140
+ RConfig[:lang] =&gt; 'en'
141
+ ...
142
+ </pre>
143
+ <h2>Requirements</h2>
144
+ <ul>
145
+ <li>Ruby (Developed on 1.8.7)
146
+
147
+ </li>
148
+ <li>RubyGems (Developed on 1.3.5)
149
+
150
+ </li>
151
+ <li>activesupport (2.2.2+)
152
+
153
+ </li>
154
+ </ul>
155
+ <h2>Install</h2>
156
+ <pre>
157
+ sudo gem install rconfig
158
+ </pre>
159
+ <h2>ToDo</h2>
160
+ <ol>
161
+ <li>Finish JSpecs for existing code (Yeah, I know. You’re supposed to right
162
+ the JSpecs first.)
163
+
164
+ </li>
165
+ <li>Create re-factor goals based on Caliper metrics.
166
+
167
+ </li>
168
+ <li>Prep for cleaner, stabler release.
169
+
170
+ </li>
171
+ </ol>
172
+ <h2>Feature Ideas</h2>
173
+ <ul>
174
+ <li>Support for git-like config/properties files (You know, with the namespaced
175
+ header blocks.).
176
+
177
+ </li>
178
+ <li>Support for Database-driven configuration.
179
+
180
+ </li>
181
+ <li>Removing dependency on ActiveSupport (Pull in needed code.).
182
+
183
+ </li>
184
+ <li>These are features I’m considering. E-mail me &lt;rahmal@gmail.com&gt; If
185
+ you like to see a feature added or expedited.
186
+
187
+ </li>
188
+ </ul>
189
+ <h2>Known Issues</h2>
190
+ <ul>
191
+ <li>None
192
+
193
+ </li>
194
+ </ul>
195
+ <h2>License</h2>
196
+ <p>
197
+ (The MIT License)
198
+ </p>
199
+ <p>
200
+ Copyright (c) 2009 Rahmal Conda &lt;rahmal@gmail.com&gt;
201
+ </p>
202
+ <p>
203
+ Permission is hereby granted, free of charge, to any person obtaining a
204
+ copy of this software and associated documentation files (the
205
+ &#8216;Software&#8217;), to deal in the Software without restriction,
206
+ including without limitation the rights to use, copy, modify, merge,
207
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
208
+ permit persons to whom the Software is furnished to do so, subject to the
209
+ following conditions:
210
+ </p>
211
+ <p>
212
+ The above copyright notice and this permission notice shall be included in
213
+ all copies or substantial portions of the Software.
214
+ </p>
215
+ <p>
216
+ THE SOFTWARE IS PROVIDED &#8216;AS IS&#8217;, WITHOUT WARRANTY OF ANY KIND,
217
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
218
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
219
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
220
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
221
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
222
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
223
+ </p>
224
+ <h2>Credits</h2>
225
+ <p>
226
+ Thanks to everyone I included here. <a
227
+ href="../classes/RConfig.html">RConfig</a> would not exist without their
228
+ contributions.
229
+ </p>
230
+ <p>
231
+ Mike Sandler, Kurt Stephens, CashNetUSA (CNU):
232
+ </p>
233
+ <ul>
234
+ <li>Wrote the proprietary class <a href="../classes/RConfig.html">RConfig</a>
235
+ was originally based on.
236
+
237
+ </li>
238
+ </ul>
239
+
240
+ </div>
241
+
242
+
243
+ </div>
244
+
245
+
246
+ </div>
247
+
248
+
249
+ <!-- if includes -->
250
+
251
+ <div id="section">
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+ <!-- if method_list -->
261
+
262
+
263
+ </div>
264
+
265
+
266
+ <div id="validator-badges">
267
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
268
+ </div>
269
+
270
+ </body>
271
+ </html>
@@ -0,0 +1,107 @@
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>File: class_variables.rb</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="fileHeader">
50
+ <h1>class_variables.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/rconfig/class_variables.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Fri Feb 12 16:34:29 -0600 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ These are all the variables used to store RConfigs state.
74
+ </p>
75
+
76
+ </div>
77
+
78
+
79
+ </div>
80
+
81
+
82
+ </div>
83
+
84
+
85
+ <!-- if includes -->
86
+
87
+ <div id="section">
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <!-- if method_list -->
97
+
98
+
99
+ </div>
100
+
101
+
102
+ <div id="validator-badges">
103
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
104
+ </div>
105
+
106
+ </body>
107
+ </html>
@@ -0,0 +1,114 @@
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>File: config_hash.rb</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="fileHeader">
50
+ <h1>config_hash.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/rconfig/config_hash.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Wed Jan 06 00:15:55 -0600 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ Copyright (c) 2009 Rahmal Conda &lt;rahmal@gmail.com&gt;
74
+ </p>
75
+ <p>
76
+ <a href="../../../classes/ConfigHash.html">ConfigHash</a> is a special
77
+ class, derived from HashWithIndifferentAccess. It was specifically created
78
+ for handling config data or creating mock objects from yaml files. It
79
+ provides a dotted notation for accessing embedded hash values, similar to
80
+ the way one might traverse a object tree.
81
+ </p>
82
+
83
+ </div>
84
+
85
+
86
+ </div>
87
+
88
+
89
+ </div>
90
+
91
+
92
+ <!-- if includes -->
93
+
94
+ <div id="section">
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ <!-- if method_list -->
104
+
105
+
106
+ </div>
107
+
108
+
109
+ <div id="validator-badges">
110
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
111
+ </div>
112
+
113
+ </body>
114
+ </html>