rconfigurator 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/README +34 -20
  2. data/doc/Gemfile.html +98 -0
  3. data/doc/LICENSE_txt.html +94 -0
  4. data/doc/RConfigurator.html +223 -0
  5. data/doc/RConfigurator/Configurator.html +332 -0
  6. data/doc/RConfigurator/StringUtilities.html +194 -0
  7. data/doc/README.html +203 -0
  8. data/doc/Rakefile.html +100 -0
  9. data/doc/bin/rconfig.html +58 -0
  10. data/doc/created.rid +11 -0
  11. data/doc/images/brick.png +0 -0
  12. data/doc/images/brick_link.png +0 -0
  13. data/doc/images/bug.png +0 -0
  14. data/doc/images/bullet_black.png +0 -0
  15. data/doc/images/bullet_toggle_minus.png +0 -0
  16. data/doc/images/bullet_toggle_plus.png +0 -0
  17. data/doc/images/date.png +0 -0
  18. data/doc/images/find.png +0 -0
  19. data/doc/images/loadingAnimation.gif +0 -0
  20. data/doc/images/macFFBgHack.png +0 -0
  21. data/doc/images/package.png +0 -0
  22. data/doc/images/page_green.png +0 -0
  23. data/doc/images/page_white_text.png +0 -0
  24. data/doc/images/page_white_width.png +0 -0
  25. data/doc/images/plugin.png +0 -0
  26. data/doc/images/ruby.png +0 -0
  27. data/doc/images/tag_green.png +0 -0
  28. data/doc/images/wrench.png +0 -0
  29. data/doc/images/wrench_orange.png +0 -0
  30. data/doc/images/zoom.png +0 -0
  31. data/doc/index.html +76 -0
  32. data/doc/js/darkfish.js +116 -0
  33. data/doc/js/jquery.js +32 -0
  34. data/doc/js/quicksearch.js +114 -0
  35. data/doc/js/thickbox-compressed.js +10 -0
  36. data/doc/lib/rconfigurator/configurator_rb.html +55 -0
  37. data/doc/lib/rconfigurator/utilities_rb.html +52 -0
  38. data/doc/lib/rconfigurator/version_rb.html +52 -0
  39. data/doc/lib/rconfigurator_rb.html +56 -0
  40. data/doc/rdoc.css +763 -0
  41. data/doc/spec/rconfigurator/rconfigurator_spec_rb.html +54 -0
  42. data/lib/rconfigurator.rb +5 -0
  43. data/lib/rconfigurator/version.rb +1 -1
  44. data/spec/rconfigurator/rconfigurator_spec.rb +11 -3
  45. data/spec/resources/sample.yml +4 -0
  46. metadata +44 -4
data/README CHANGED
@@ -1,8 +1,6 @@
1
1
  === Welcome to RConfigurator!
2
2
 
3
- --- Configuration shouldn't be hard...
4
-
5
- ...and loading configuration for your Ruby application has never been easier.
3
+ --- Abstract
6
4
 
7
5
  RConfigurator automatically "hydrates" your application's module constants by walking
8
6
  through a .yml file. If you've got module constants strewn throughout your project,
@@ -10,13 +8,14 @@ you can use RConfigurator to aggregate these into one place.
10
8
 
11
9
  --- Usage
12
10
 
13
- To get this going, you just have to require 'rconfigurator' and provide use with the
14
- name of the project and the location of the configuration file:
11
+ Just require 'rconfigurator', provide the location of the configuration file and the
12
+ name of a project, and then call RConfigurator.configure!:
15
13
 
16
14
  require 'rconfigurator'
17
15
  RConfigurator.configure! "ExampleModule", "/path/to/my/config"
18
16
 
19
- Configurator will analyze the file and 'inflate' your module constants using the data it finds there. Let's say you've got the following module constants:
17
+ Configurator will analyze the file and 'inflate' your module constants using the data
18
+ it finds there. Let's say you've got the following module constants:
20
19
 
21
20
  ExampleModule::KEY = 'value'
22
21
  ExampleModule::NUMERIC_DATA = 3.221
@@ -38,12 +37,13 @@ when the value is itself a module. RConfigurator will construct the module conte
38
37
  in place just before it needs a reference.
39
38
 
40
39
  For a better feel of how this ends up being useful, or perhaps some inspiration,
41
- here's an example of part of a real configuration file I am using for another small project:
40
+ here's an example of part of a real configuration file I am using for another
41
+ small project:
42
42
 
43
43
  version: 0.3.9
44
44
  release: alpha
45
45
  authors: joseph weissman
46
- license: artistic license <http://www.perlfoundation.org/artistic_license_2_0>
46
+ license: artistic <http://www.perlfoundation.org/artistic_license_2_0>
47
47
 
48
48
  # support module config
49
49
  support:
@@ -63,25 +63,39 @@ here's an example of part of a real configuration file I am using for another sm
63
63
  # ...
64
64
 
65
65
 
66
- --- RConfig
66
+ --- Tools
67
67
 
68
- RConfigurator comes with a debugger that will output the statements it will 'eval'. You can
69
- invoke this utility as 'rconfig [file1] [file2] ...' assuming you have installed the gem.
70
68
 
71
- Running rconfig over the first example yaml file gives us the module structure we are expecting:
69
+ RConfigurator comes with a command line utility called 'rconfig' for debugging
70
+ your configuration files. Invoking the utility against a configuration file
71
+ attempts to perform the configuration, logging the statements RConfigurator.config!
72
+ would normally just silently 'eval'. Invoke this utility as 'rconfig [file1] [file2] ...'
73
+ (assuming you have installed the gem.)
72
74
 
73
- module HypotheticalParentModule; module SampleModule; SOME_KEY = "another value"; end; ; end
74
- module I; module Am; module A; module Module; end; end; end; end;
75
- module HypotheticalParentModule; KEY_SHOULD_BE_MODULE = I::Am::A::Module; ; end
76
- module HypotheticalParentModule; KEY = "value"; ; end
77
- module HypotheticalParentModule; NUMERIC_DATA = 3.221; ; end
75
+ Running rconfig over the first example yaml file gives us the module structure
76
+ we are expecting. It uses "HypotheticalParentModule" as the root project module
77
+ Note the output from rconfig is the unindented 'compact' form we actually evaluate,
78
+ with one key-value pair per line.
78
79
 
80
+ module HypotheticalParentModule; module SampleModule; SOME_KEY = "another value"; end; ; end
81
+ module I; module Am; module A; module Module; end; end; end; end;
82
+ module HypotheticalParentModule; KEY_SHOULD_BE_MODULE = I::Am::A::Module; ; end
83
+ module HypotheticalParentModule; KEY = "value"; ; end
84
+ module HypotheticalParentModule; NUMERIC_DATA = 3.221; ; end
79
85
 
86
+ Please note that I have added this tool as a convenience, and I should point out
87
+ that developing the configuration file is generally quite straightforward. Using
88
+ rconfig to 'validate' is probably not necessary. This tool is included for sanity-
89
+ inducing purposes (and perhaps more involved use-cases where it could be helpful
90
+ in the scenario where a complex config file has become subtly incorrect.)
80
91
 
81
92
  --- Problems?
82
93
 
83
- Please log bug reports and enhancement proposals here, or feel free to email the author/maintainer of RConfigurator, Joseph Weissman, jweissman1986 (at) gmail.com
94
+ Please log bug reports and enhancement proposals here, or feel free to email the
95
+ author/maintainer of RConfigurator, Joseph Weissman, jweissman1986 (at) gmail.com
84
96
 
85
- --- Conclusion
97
+ --- Afterword
86
98
 
87
- So far in practice, I have found that it is definitely convenient to be able to architecturally separate 'tuning' from code. I like that I can instantiate complex module structures just by adding a few lines of YAML.
99
+ So far in practice, I have found that it is definitely convenient to be able to
100
+ architecturally separate 'tuning' from code. I like that I can instantiate complex
101
+ module structures just by adding a few lines of YAML.
@@ -0,0 +1,98 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: Gemfile [RDoc Documentation]</title>
10
+
11
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="./js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="./js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="./js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="./Gemfile.html">Gemfile</a></li>
43
+
44
+ <li class="file"><a href="./LICENSE_txt.html">LICENSE.txt</a></li>
45
+
46
+ <li class="file"><a href="./README.html">README</a></li>
47
+
48
+ <li class="file"><a href="./Rakefile.html">Rakefile</a></li>
49
+
50
+ </ul>
51
+ </div>
52
+
53
+
54
+ <div id="classindex-section" class="section project-section">
55
+ <h3 class="section-header">Class Index
56
+ <span class="search-toggle"><img src="./images/find.png"
57
+ height="16" width="16" alt="[+]"
58
+ title="show/hide quicksearch" /></span></h3>
59
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
60
+ <fieldset>
61
+ <legend>Quicksearch</legend>
62
+ <input type="text" name="quicksearch" value=""
63
+ class="quicksearch-field" />
64
+ </fieldset>
65
+ </form>
66
+
67
+ <ul class="link-list">
68
+
69
+ <li><a href="./RConfigurator.html">RConfigurator</a></li>
70
+
71
+ <li><a href="./RConfigurator/Configurator.html">RConfigurator::Configurator</a></li>
72
+
73
+ <li><a href="./RConfigurator/StringUtilities.html">RConfigurator::StringUtilities</a></li>
74
+
75
+ </ul>
76
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
77
+ </div>
78
+
79
+
80
+ </div>
81
+ </div>
82
+
83
+ <div id="documentation">
84
+
85
+ <p>source “<a href="http://rubygems.org">rubygems.org</a>”</p>
86
+
87
+ <p># Specify your gem’s dependencies in configurator.gemspec gem “rspec”</p>
88
+
89
+ </div>
90
+
91
+ <div id="validator-badges">
92
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
93
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
94
+ Rdoc Generator</a> 2</small>.</p>
95
+ </div>
96
+ </body>
97
+ </html>
98
+
@@ -0,0 +1,94 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: LICENSE.txt [RDoc Documentation]</title>
10
+
11
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="./js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="./js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="./js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="./Gemfile.html">Gemfile</a></li>
43
+
44
+ <li class="file"><a href="./LICENSE_txt.html">LICENSE.txt</a></li>
45
+
46
+ <li class="file"><a href="./README.html">README</a></li>
47
+
48
+ <li class="file"><a href="./Rakefile.html">Rakefile</a></li>
49
+
50
+ </ul>
51
+ </div>
52
+
53
+
54
+ <div id="classindex-section" class="section project-section">
55
+ <h3 class="section-header">Class Index
56
+ <span class="search-toggle"><img src="./images/find.png"
57
+ height="16" width="16" alt="[+]"
58
+ title="show/hide quicksearch" /></span></h3>
59
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
60
+ <fieldset>
61
+ <legend>Quicksearch</legend>
62
+ <input type="text" name="quicksearch" value=""
63
+ class="quicksearch-field" />
64
+ </fieldset>
65
+ </form>
66
+
67
+ <ul class="link-list">
68
+
69
+ <li><a href="./RConfigurator.html">RConfigurator</a></li>
70
+
71
+ <li><a href="./RConfigurator/Configurator.html">RConfigurator::Configurator</a></li>
72
+
73
+ <li><a href="./RConfigurator/StringUtilities.html">RConfigurator::StringUtilities</a></li>
74
+
75
+ </ul>
76
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
77
+ </div>
78
+
79
+
80
+ </div>
81
+ </div>
82
+
83
+ <div id="documentation">
84
+
85
+ </div>
86
+
87
+ <div id="validator-badges">
88
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
89
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
90
+ Rdoc Generator</a> 2</small>.</p>
91
+ </div>
92
+ </body>
93
+ </html>
94
+
@@ -0,0 +1,223 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Module: RConfigurator</title>
9
+
10
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="module">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="./index.html">Home</a>
25
+ <a href="./index.html#classes">Classes</a>
26
+ <a href="./index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="./lib/rconfigurator/utilities_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="lib/rconfigurator/utilities.rb">lib/rconfigurator/utilities.rb</a></li>
39
+
40
+ <li><a href="./lib/rconfigurator/version_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
41
+ class="thickbox" title="lib/rconfigurator/version.rb">lib/rconfigurator/version.rb</a></li>
42
+
43
+ <li><a href="./lib/rconfigurator_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
44
+ class="thickbox" title="lib/rconfigurator.rb">lib/rconfigurator.rb</a></li>
45
+
46
+ </ul>
47
+ </div>
48
+ </div>
49
+
50
+
51
+ </div>
52
+
53
+ <div id="class-metadata">
54
+
55
+
56
+
57
+
58
+
59
+ <!-- Namespace Contents -->
60
+ <div id="namespace-list-section" class="section">
61
+ <h3 class="section-header">Namespace</h3>
62
+ <ul class="link-list">
63
+
64
+ <li><span class="type">MODULE</span> <a href="RConfigurator/StringUtilities.html">RConfigurator::StringUtilities</a></li>
65
+
66
+ <li><span class="type">CLASS</span> <a href="RConfigurator/Configurator.html">RConfigurator::Configurator</a></li>
67
+
68
+ </ul>
69
+ </div>
70
+
71
+
72
+
73
+ <!-- Method Quickref -->
74
+ <div id="method-list-section" class="section">
75
+ <h3 class="section-header">Methods</h3>
76
+ <ul class="link-list">
77
+
78
+ <li><a href="#method-c-configure-21">::configure!</a></li>
79
+
80
+ </ul>
81
+ </div>
82
+
83
+
84
+
85
+ </div>
86
+
87
+ <div id="project-metadata">
88
+
89
+
90
+ <div id="fileindex-section" class="section project-section">
91
+ <h3 class="section-header">Files</h3>
92
+ <ul>
93
+
94
+ <li class="file"><a href="./Gemfile.html">Gemfile</a></li>
95
+
96
+ <li class="file"><a href="./LICENSE_txt.html">LICENSE.txt</a></li>
97
+
98
+ <li class="file"><a href="./README.html">README</a></li>
99
+
100
+ <li class="file"><a href="./Rakefile.html">Rakefile</a></li>
101
+
102
+ </ul>
103
+ </div>
104
+
105
+
106
+ <div id="classindex-section" class="section project-section">
107
+ <h3 class="section-header">Class/Module Index
108
+ <span class="search-toggle"><img src="./images/find.png"
109
+ height="16" width="16" alt="[+]"
110
+ title="show/hide quicksearch" /></span></h3>
111
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
112
+ <fieldset>
113
+ <legend>Quicksearch</legend>
114
+ <input type="text" name="quicksearch" value=""
115
+ class="quicksearch-field" />
116
+ </fieldset>
117
+ </form>
118
+
119
+ <ul class="link-list">
120
+
121
+ <li><a href="./RConfigurator.html">RConfigurator</a></li>
122
+
123
+ <li><a href="./RConfigurator/Configurator.html">RConfigurator::Configurator</a></li>
124
+
125
+ <li><a href="./RConfigurator/StringUtilities.html">RConfigurator::StringUtilities</a></li>
126
+
127
+ </ul>
128
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
129
+ </div>
130
+
131
+
132
+ </div>
133
+ </div>
134
+
135
+ <div id="documentation">
136
+ <h1 class="module">RConfigurator</h1>
137
+
138
+ <div id="description" class="description">
139
+
140
+ </div><!-- description -->
141
+
142
+
143
+
144
+
145
+ <div id="5Buntitled-5D" class="documentation-section">
146
+
147
+
148
+
149
+
150
+
151
+ <!-- Constants -->
152
+ <div id="constants-list" class="section">
153
+ <h3 class="section-header">Constants</h3>
154
+ <dl>
155
+
156
+ <dt><a name="VERSION">VERSION</a></dt>
157
+
158
+ <dd class="description"></dd>
159
+
160
+
161
+ </dl>
162
+ </div>
163
+
164
+
165
+
166
+
167
+ <!-- Methods -->
168
+
169
+ <div id="public-class-method-details" class="method-section section">
170
+ <h3 class="section-header">Public Class Methods</h3>
171
+
172
+
173
+ <div id="configure-21-method" class="method-detail ">
174
+ <a name="method-c-configure-21"></a>
175
+
176
+
177
+ <div class="method-heading">
178
+ <span class="method-name">configure!</span><span
179
+ class="method-args">(name, file, debug=false)</span>
180
+ <span class="method-click-advice">click to toggle source</span>
181
+ </div>
182
+
183
+
184
+ <div class="method-description">
185
+
186
+ <p>Use this configure! method to both create a new configurator AND launch the
187
+ configuration process in one go.</p>
188
+
189
+
190
+
191
+ <div class="method-source-code" id="configure-21-source">
192
+ <pre>
193
+ <span class="ruby-comment"># File lib/rconfigurator.rb, line 15</span>
194
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">configure!</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">debug</span>=<span class="ruby-keyword">false</span>)
195
+ <span class="ruby-identifier">configurator</span> = <span class="ruby-constant">Configurator</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">file</span>)
196
+ <span class="ruby-identifier">configurator</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-identifier">debug</span>)
197
+ <span class="ruby-keyword">end</span></pre>
198
+ </div><!-- configure-21-source -->
199
+
200
+ </div>
201
+
202
+
203
+
204
+
205
+ </div><!-- configure-21-method -->
206
+
207
+
208
+ </div><!-- public-class-method-details -->
209
+
210
+ </div><!-- 5Buntitled-5D -->
211
+
212
+
213
+ </div><!-- documentation -->
214
+
215
+ <div id="validator-badges">
216
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
217
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
218
+ Rdoc Generator</a> 2</small>.</p>
219
+ </div>
220
+
221
+ </body>
222
+ </html>
223
+