rconfigurator 0.0.2 → 0.0.3

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 (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
@@ -0,0 +1,203 @@
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: README [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
+ <h3>Welcome to <a href="RConfigurator.html">RConfigurator</a>!</h3>
86
+
87
+ <p>— Abstract</p>
88
+
89
+ <p><a href="RConfigurator.html">RConfigurator</a> automatically “hydrates”
90
+ your application’s module constants by walking through a .yml file. If
91
+ you’ve got module constants strewn throughout your project, you can use
92
+ <a href="RConfigurator.html">RConfigurator</a> to aggregate these into one
93
+ place.</p>
94
+
95
+ <p>— Usage</p>
96
+
97
+ <p>Just require ‘rconfigurator’, provide the location of the configuration
98
+ file and the name of a project, and then call <a
99
+ href="RConfigurator.html#method-c-configure-21">RConfigurator.configure!</a>:</p>
100
+
101
+ <pre>require 'rconfigurator'
102
+ RConfigurator.configure! &quot;ExampleModule&quot;, &quot;/path/to/my/config&quot;</pre>
103
+
104
+ <p>Configurator will analyze the file and ‘inflate’ your module constants
105
+ using the data it finds there. Let’s say you’ve got the following
106
+ module constants:</p>
107
+
108
+ <pre>ExampleModule::KEY = 'value'
109
+ ExampleModule::NUMERIC_DATA = 3.221
110
+ ExampleModule::SampleModule::SOME_KEY = 'another value'
111
+ ExampleModule::KEY_SHOULD_BE_MODULE = I::Am::A::Module</pre>
112
+
113
+ <p><a href="RConfigurator.html">RConfigurator</a> can create these for you
114
+ (before you’ve even defined the modules themselves!) if you point it to
115
+ the following .yml file:</p>
116
+
117
+ <pre>key: value
118
+ numeric_data: 3.221
119
+ sample_module:
120
+ some_key: another value
121
+ key_should_be_module: I::Am::A::Module</pre>
122
+
123
+ <p><a href="RConfigurator.html">RConfigurator</a> even handles some common
124
+ edge cases for you, in particular the case when the value is itself a
125
+ module. <a href="RConfigurator.html">RConfigurator</a> will construct the
126
+ module context in place just before it needs a reference.</p>
127
+
128
+ <p>For a better feel of how this ends up being useful, or perhaps some
129
+ inspiration, here’s an example of part of a real configuration file I am
130
+ using for another small project:</p>
131
+
132
+ <pre>version: 0.3.9
133
+ release: alpha
134
+ authors: joseph weissman
135
+ license: artistic &lt;http://www.perlfoundation.org/artistic_license_2_0&gt;
136
+
137
+ # support module config
138
+ support:
139
+ logging:
140
+ use_chainsaw: true
141
+ chainsaw:
142
+ hostname: 'localhost'
143
+ port: 8071
144
+
145
+ # graphics subsystem config
146
+ graphics:
147
+ default_window_options:
148
+ fullscreen: true
149
+ width: 1920
150
+ height: 1080
151
+
152
+ # ...</pre>
153
+
154
+ <p>— Tools</p>
155
+
156
+ <p><a href="RConfigurator.html">RConfigurator</a> comes with a command line
157
+ utility called ‘rconfig’ for debugging your configuration files.
158
+ Invoking the utility against a configuration file attempts to perform the
159
+ configuration, logging the statements RConfigurator.config! would normally
160
+ just silently ‘eval’. Invoke this utility as ‘rconfig [file1] [file2]
161
+ …’ (assuming you have installed the gem.)</p>
162
+
163
+ <p>Running rconfig over the first example yaml file gives us the module
164
+ structure we are expecting. It uses “HypotheticalParentModule” as the
165
+ root project module Note the output from rconfig is the unindented
166
+ ‘compact’ form we actually evaluate, with one key-value pair per line.</p>
167
+
168
+ <pre>module HypotheticalParentModule; module SampleModule; SOME_KEY = &quot;another value&quot;; end; ; end
169
+ module I; module Am; module A; module Module; end; end; end; end;
170
+ module HypotheticalParentModule; KEY_SHOULD_BE_MODULE = I::Am::A::Module; ; end
171
+ module HypotheticalParentModule; KEY = &quot;value&quot;; ; end
172
+ module HypotheticalParentModule; NUMERIC_DATA = 3.221; ; end</pre>
173
+
174
+ <p>Please note that I have added this tool as a convenience, and I should
175
+ point out that developing the configuration file is generally quite
176
+ straightforward. Using rconfig to ‘validate’ is probably not
177
+ necessary. This tool is included for sanity- inducing purposes (and perhaps
178
+ more involved use-cases where it could be helpful in the scenario where a
179
+ complex config file has become subtly incorrect.)</p>
180
+
181
+ <p>— Problems?</p>
182
+
183
+ <p>Please log bug reports and enhancement proposals here, or feel free to
184
+ email the author/maintainer of <a
185
+ href="RConfigurator.html">RConfigurator</a>, Joseph Weissman, jweissman1986
186
+ (at) gmail.com</p>
187
+
188
+ <p>— Afterword</p>
189
+
190
+ <p>So far in practice, I have found that it is definitely convenient to be
191
+ able to architecturally separate ‘tuning’ from code. I like that I can
192
+ instantiate complex module structures just by adding a few lines of YAML.</p>
193
+
194
+ </div>
195
+
196
+ <div id="validator-badges">
197
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
198
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
199
+ Rdoc Generator</a> 2</small>.</p>
200
+ </div>
201
+ </body>
202
+ </html>
203
+
@@ -0,0 +1,100 @@
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: Rakefile [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>require “bundler/gem_tasks” require ‘rspec/core/rake_task’</p>
86
+
87
+ <p>RSpec::Core::RakeTask.new(:spec)</p>
88
+
89
+ <p>task :default =&gt; [ :spec, :install ]</p>
90
+
91
+ </div>
92
+
93
+ <div id="validator-badges">
94
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
95
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
96
+ Rdoc Generator</a> 2</small>.</p>
97
+ </div>
98
+ </body>
99
+ </html>
100
+
@@ -0,0 +1,58 @@
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: rconfig [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 file-popup">
24
+ <div id="metadata">
25
+ <dl>
26
+ <dt class="modified-date">Last Modified</dt>
27
+ <dd class="modified-date">Fri Sep 23 20:04:01 -0400 2011</dd>
28
+
29
+
30
+ <dt class="requires">Requires</dt>
31
+ <dd class="requires">
32
+ <ul>
33
+
34
+ <li>rubygems</li>
35
+
36
+ <li>rconfigurator</li>
37
+
38
+ <li>yaml</li>
39
+
40
+ </ul>
41
+ </dd>
42
+
43
+
44
+
45
+ </dl>
46
+ </div>
47
+
48
+ <div id="documentation">
49
+
50
+ <div class="description">
51
+ <h2>Description</h2>
52
+
53
+ </div>
54
+
55
+ </div>
56
+ </body>
57
+ </html>
58
+
@@ -0,0 +1,11 @@
1
+ Fri, 23 Sep 2011 20:04:24 -0400
2
+ ./lib/rconfigurator/configurator.rb Fri, 23 Sep 2011 20:04:01 -0400
3
+ ./Gemfile Fri, 23 Sep 2011 20:04:01 -0400
4
+ ./bin/rconfig Fri, 23 Sep 2011 20:04:01 -0400
5
+ ./LICENSE.txt Fri, 23 Sep 2011 20:04:01 -0400
6
+ ./lib/rconfigurator/version.rb Fri, 23 Sep 2011 20:04:01 -0400
7
+ ./lib/rconfigurator.rb Fri, 23 Sep 2011 20:04:01 -0400
8
+ ./spec/rconfigurator/rconfigurator_spec.rb Fri, 23 Sep 2011 20:04:01 -0400
9
+ ./README Fri, 23 Sep 2011 20:04:01 -0400
10
+ ./lib/rconfigurator/utilities.rb Fri, 23 Sep 2011 20:04:01 -0400
11
+ ./Rakefile Fri, 23 Sep 2011 20:04:01 -0400
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,76 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
+
9
+ <title>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" charset="utf-8"></script>
14
+ <script src="js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
16
+ <script src="js/darkfish.js" type="text/javascript" charset="utf-8"></script>
17
+
18
+ </head>
19
+ <body class="indexpage">
20
+
21
+
22
+ <h1>RDoc Documentation</h1>
23
+
24
+
25
+ <p>This is the API documentation for 'RDoc Documentation'.</p>
26
+
27
+
28
+
29
+
30
+ <h2>Files</h2>
31
+ <ul>
32
+
33
+ <li class="file"><a href="Gemfile.html">Gemfile</a></li>
34
+
35
+ <li class="file"><a href="LICENSE_txt.html">LICENSE.txt</a></li>
36
+
37
+ <li class="file"><a href="README.html">README</a></li>
38
+
39
+ <li class="file"><a href="Rakefile.html">Rakefile</a></li>
40
+
41
+ </ul>
42
+
43
+
44
+ <h2 id="classes">Classes/Modules</h2>
45
+ <ul>
46
+
47
+ <li class="module"><a href="RConfigurator.html">RConfigurator</a></li>
48
+
49
+ <li class="class"><a href="RConfigurator/Configurator.html">RConfigurator::Configurator</a></li>
50
+
51
+ <li class="module"><a href="RConfigurator/StringUtilities.html">RConfigurator::StringUtilities</a></li>
52
+
53
+ </ul>
54
+
55
+ <h2 id="methods">Methods</h2>
56
+ <ul>
57
+
58
+ <li><a href="RConfigurator.html#method-c-configure-21">::configure! &mdash; RConfigurator</a></li>
59
+
60
+ <li><a href="RConfigurator/Configurator.html#method-c-new">::new &mdash; RConfigurator::Configurator</a></li>
61
+
62
+ <li><a href="RConfigurator/Configurator.html#method-i-configure">#configure &mdash; RConfigurator::Configurator</a></li>
63
+
64
+ <li><a href="RConfigurator/StringUtilities.html#method-i-convert_string_to_camel_case">#convert_string_to_camel_case &mdash; RConfigurator::StringUtilities</a></li>
65
+
66
+ <li><a href="RConfigurator/Configurator.html#method-i-parse_and_recursively_create_constants-21">#parse_and_recursively_create_constants! &mdash; RConfigurator::Configurator</a></li>
67
+
68
+ </ul>
69
+
70
+ <div id="validator-badges">
71
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
72
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
73
+ Rdoc Generator</a> 2</small>.</p>
74
+ </div>
75
+ </body>
76
+ </html>