rconfigurator 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +34 -20
- data/doc/Gemfile.html +98 -0
- data/doc/LICENSE_txt.html +94 -0
- data/doc/RConfigurator.html +223 -0
- data/doc/RConfigurator/Configurator.html +332 -0
- data/doc/RConfigurator/StringUtilities.html +194 -0
- data/doc/README.html +203 -0
- data/doc/Rakefile.html +100 -0
- data/doc/bin/rconfig.html +58 -0
- data/doc/created.rid +11 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +76 -0
- data/doc/js/darkfish.js +116 -0
- data/doc/js/jquery.js +32 -0
- data/doc/js/quicksearch.js +114 -0
- data/doc/js/thickbox-compressed.js +10 -0
- data/doc/lib/rconfigurator/configurator_rb.html +55 -0
- data/doc/lib/rconfigurator/utilities_rb.html +52 -0
- data/doc/lib/rconfigurator/version_rb.html +52 -0
- data/doc/lib/rconfigurator_rb.html +56 -0
- data/doc/rdoc.css +763 -0
- data/doc/spec/rconfigurator/rconfigurator_spec_rb.html +54 -0
- data/lib/rconfigurator.rb +5 -0
- data/lib/rconfigurator/version.rb +1 -1
- data/spec/rconfigurator/rconfigurator_spec.rb +11 -3
- data/spec/resources/sample.yml +4 -0
- metadata +44 -4
@@ -0,0 +1,54 @@
|
|
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: rconfigurator_spec.rb [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>rconfigurator</li>
|
35
|
+
|
36
|
+
</ul>
|
37
|
+
</dd>
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
</dl>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="documentation">
|
45
|
+
|
46
|
+
<div class="description">
|
47
|
+
<h2>Description</h2>
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
</body>
|
53
|
+
</html>
|
54
|
+
|
data/lib/rconfigurator.rb
CHANGED
@@ -57,6 +57,7 @@ module RConfigurator
|
|
57
57
|
parse_and_recursively_create_constants!(hash[key], context, debug)
|
58
58
|
else
|
59
59
|
value_is_a_module = false
|
60
|
+
value_is_an_array = false
|
60
61
|
|
61
62
|
if value.is_a? String
|
62
63
|
if value.include? "::"
|
@@ -65,6 +66,10 @@ module RConfigurator
|
|
65
66
|
value = "\"#{value}\""
|
66
67
|
end
|
67
68
|
end
|
69
|
+
|
70
|
+
if value.is_a? Array
|
71
|
+
value = "[#{value.join(', ')}]"
|
72
|
+
end
|
68
73
|
|
69
74
|
if value_is_a_module
|
70
75
|
# explicitly build out this module (since it doesn't exist) so that we can talk about it
|
@@ -7,17 +7,25 @@ describe RConfigurator, "performs dynamic Ruby application initialization" do
|
|
7
7
|
it "parses a yaml configuration file and generates module constants" do
|
8
8
|
# p RConfigurator.methods - Module.methods
|
9
9
|
|
10
|
-
RConfigurator.configure!("ExampleModuleName", "spec/resources/sample.yml")
|
10
|
+
RConfigurator.configure!("ExampleModuleName", "spec/resources/sample.yml", false)
|
11
11
|
|
12
12
|
# n.b., these values are defined in the config file at spec/resources/sample.yml
|
13
13
|
ExampleModuleName::KEY.should == 'value'
|
14
14
|
end
|
15
|
+
|
16
|
+
|
17
|
+
it "should handle nested constants" do
|
18
|
+
ExampleModuleName::SampleModule::SOME_KEY.should == 'another value'
|
19
|
+
end
|
20
|
+
|
15
21
|
it "should construct numeric constants correctly" do
|
16
22
|
ExampleModuleName::NUMERIC_DATA.should == 3.221
|
17
23
|
end
|
18
24
|
|
19
|
-
|
20
|
-
|
25
|
+
|
26
|
+
it "should handle lists as arrays" do
|
27
|
+
ExampleModuleName::KEY_SHOULD_BE_ARRAY.should be_a_kind_of(Array)
|
28
|
+
ExampleModuleName::KEY_SHOULD_BE_ARRAY.should == [1,2]
|
21
29
|
end
|
22
30
|
|
23
31
|
it "should explicitly construct modules if passed as values" do
|
data/spec/resources/sample.yml
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rconfigurator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joseph Weissman
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-24 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: |-
|
@@ -37,6 +37,46 @@ files:
|
|
37
37
|
- Rakefile
|
38
38
|
- bin/rconfig
|
39
39
|
- configurator.gemspec
|
40
|
+
- doc/Gemfile.html
|
41
|
+
- doc/LICENSE_txt.html
|
42
|
+
- doc/RConfigurator.html
|
43
|
+
- doc/RConfigurator/Configurator.html
|
44
|
+
- doc/RConfigurator/StringUtilities.html
|
45
|
+
- doc/README.html
|
46
|
+
- doc/Rakefile.html
|
47
|
+
- doc/bin/rconfig.html
|
48
|
+
- doc/created.rid
|
49
|
+
- doc/images/brick.png
|
50
|
+
- doc/images/brick_link.png
|
51
|
+
- doc/images/bug.png
|
52
|
+
- doc/images/bullet_black.png
|
53
|
+
- doc/images/bullet_toggle_minus.png
|
54
|
+
- doc/images/bullet_toggle_plus.png
|
55
|
+
- doc/images/date.png
|
56
|
+
- doc/images/find.png
|
57
|
+
- doc/images/loadingAnimation.gif
|
58
|
+
- doc/images/macFFBgHack.png
|
59
|
+
- doc/images/package.png
|
60
|
+
- doc/images/page_green.png
|
61
|
+
- doc/images/page_white_text.png
|
62
|
+
- doc/images/page_white_width.png
|
63
|
+
- doc/images/plugin.png
|
64
|
+
- doc/images/ruby.png
|
65
|
+
- doc/images/tag_green.png
|
66
|
+
- doc/images/wrench.png
|
67
|
+
- doc/images/wrench_orange.png
|
68
|
+
- doc/images/zoom.png
|
69
|
+
- doc/index.html
|
70
|
+
- doc/js/darkfish.js
|
71
|
+
- doc/js/jquery.js
|
72
|
+
- doc/js/quicksearch.js
|
73
|
+
- doc/js/thickbox-compressed.js
|
74
|
+
- doc/lib/rconfigurator/configurator_rb.html
|
75
|
+
- doc/lib/rconfigurator/utilities_rb.html
|
76
|
+
- doc/lib/rconfigurator/version_rb.html
|
77
|
+
- doc/lib/rconfigurator_rb.html
|
78
|
+
- doc/rdoc.css
|
79
|
+
- doc/spec/rconfigurator/rconfigurator_spec_rb.html
|
40
80
|
- lib/rconfigurator.rb
|
41
81
|
- lib/rconfigurator/configurator.rb
|
42
82
|
- lib/rconfigurator/utilities.rb
|