rconfig 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +7 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/Rakefile +11 -8
- data/doc/Array.html +184 -0
- data/doc/Hash.html +360 -0
- data/doc/NilClass.html +233 -0
- data/doc/RConfig.html +328 -0
- data/doc/RConfig/Callbacks.html +295 -0
- data/doc/RConfig/Cascade.html +316 -0
- data/doc/RConfig/Config.html +441 -0
- data/doc/RConfig/ConfigError.html +187 -0
- data/doc/RConfig/Constants.html +271 -0
- data/doc/RConfig/CoreMethods.html +814 -0
- data/doc/RConfig/DisabledLogger.html +424 -0
- data/doc/RConfig/Exceptions.html +266 -0
- data/doc/RConfig/Generators.html +186 -0
- data/doc/RConfig/Generators/InstallGenerator.html +233 -0
- data/doc/RConfig/InvalidLoadPathError.html +187 -0
- data/doc/RConfig/LoadPaths.html +375 -0
- data/doc/RConfig/Logger.html +184 -0
- data/doc/RConfig/PropertiesFile.html +399 -0
- data/doc/RConfig/Reload.html +481 -0
- data/doc/RConfig/Settings.html +188 -0
- data/doc/RConfig/Utils.html +841 -0
- data/doc/README_rdoc.html +331 -0
- data/doc/String.html +184 -0
- data/doc/created.rid +21 -1
- data/doc/index.html +423 -20
- data/doc/lib/generators/rconfig/install_generator_rb.html +52 -0
- data/doc/lib/generators/rconfig/templates/rconfig_rb.html +56 -0
- data/doc/lib/rconfig/callbacks_rb.html +52 -0
- data/doc/lib/rconfig/cascade_rb.html +52 -0
- data/doc/lib/rconfig/config_rb.html +61 -0
- data/doc/lib/rconfig/constants_rb.html +52 -0
- data/doc/lib/rconfig/core_ext/array_rb.html +52 -0
- data/doc/lib/rconfig/core_ext/hash_rb.html +61 -0
- data/doc/lib/rconfig/core_ext/nil_rb.html +52 -0
- data/doc/lib/rconfig/core_ext/string_rb.html +52 -0
- data/doc/lib/rconfig/core_methods_rb.html +55 -0
- data/doc/lib/rconfig/exceptions_rb.html +58 -0
- data/doc/lib/rconfig/load_paths_rb.html +52 -0
- data/doc/lib/rconfig/logger_rb.html +52 -0
- data/doc/lib/rconfig/properties_file_rb.html +93 -0
- data/doc/lib/rconfig/reload_rb.html +52 -0
- data/doc/lib/rconfig/settings_rb.html +52 -0
- data/doc/lib/rconfig/utils_rb.html +52 -0
- data/doc/lib/rconfig_rb.html +151 -0
- data/doc/rdoc.css +706 -0
- data/lib/rconfig.rb +1 -1
- data/lib/rconfig/load_paths.rb +2 -2
- data/lib/tasks/rdoc.rake +3 -4
- data/rconfig.gemspec +4 -2
- data/spec/config/erb_contents.yml +3 -0
- data/spec/config/props_config.conf +18 -0
- data/spec/config/spec.yml +17 -0
- data/spec/config/xml_config.xml +22 -0
- data/spec/config2/.gitkeep +0 -0
- data/spec/rconfig/load_paths_spec.rb +37 -0
- data/spec/rconfig/reload_spec.rb +37 -0
- data/spec/rconfig_spec.rb +61 -3
- data/spec/spec_helper.rb +12 -8
- metadata +82 -40
- data/doc/classes/ClassVariables.html +0 -111
- data/doc/classes/ConfigError.html +0 -120
- data/doc/classes/ConfigHash.html +0 -354
- data/doc/classes/Constants.html +0 -226
- data/doc/classes/Hash.html +0 -269
- data/doc/classes/InvalidConfigPathError.html +0 -119
- data/doc/classes/Object.html +0 -220
- data/doc/classes/PropertiesFileParser.html +0 -282
- data/doc/classes/RConfig.html +0 -1745
- data/doc/files/README_rdoc.html +0 -271
- data/doc/files/lib/rconfig/class_variables_rb.html +0 -107
- data/doc/files/lib/rconfig/config_hash_rb.html +0 -114
- data/doc/files/lib/rconfig/constants_rb.html +0 -101
- data/doc/files/lib/rconfig/core_ext/hash_rb.html +0 -114
- data/doc/files/lib/rconfig/core_ext/object_rb.html +0 -101
- data/doc/files/lib/rconfig/core_ext_rb.html +0 -114
- data/doc/files/lib/rconfig/exceptions_rb.html +0 -110
- data/doc/files/lib/rconfig/properties_file_parser_rb.html +0 -146
- data/doc/files/lib/rconfig/rconfig_rb.html +0 -186
- data/doc/files/lib/rconfig_rb.html +0 -117
- data/doc/fr_class_index.html +0 -35
- data/doc/fr_file_index.html +0 -37
- data/doc/fr_method_index.html +0 -75
- data/doc/rdoc-style.css +0 -208
- data/lib/tasks/gem.rake +0 -14
- data/lib/tasks/spec.rake +0 -25
- data/spec/core_ext/object_spec.rb +0 -44
@@ -1,146 +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>File: properties_file_parser.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>properties_file_parser.rb</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>lib/rconfig/properties_file_parser.rb
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Fri Feb 12 16:23:34 -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 <rahmal@gmail.com>
|
74
|
-
</p>
|
75
|
-
<p>
|
76
|
-
This class parses key/value based properties files used for configuration.
|
77
|
-
It is used by rconfig to import configuration files of the aforementioned
|
78
|
-
format. Unlike yaml, and xml files it can only support three levels. First,
|
79
|
-
it can have root level properties:
|
80
|
-
</p>
|
81
|
-
<pre>
|
82
|
-
server_url=host.domain.com
|
83
|
-
server_port=8080
|
84
|
-
</pre>
|
85
|
-
<p>
|
86
|
-
Secondly, it can have properties grouped into catagories. The group names
|
87
|
-
must be specified within brackets like [ … ]
|
88
|
-
</p>
|
89
|
-
<pre>
|
90
|
-
[server]
|
91
|
-
url=host.domain.com
|
92
|
-
port=8080
|
93
|
-
</pre>
|
94
|
-
<p>
|
95
|
-
Finally, groups can also be qualified with namespaces, similar to git
|
96
|
-
config files. Group names are same as before, but with namespace in within
|
97
|
-
the brackets like [ <group> "<name>" ]
|
98
|
-
</p>
|
99
|
-
<pre>
|
100
|
-
[host "dev"]
|
101
|
-
domain=dev.server.com
|
102
|
-
|
103
|
-
[host "prod"]
|
104
|
-
domain=www.server.com
|
105
|
-
</pre>
|
106
|
-
<p>
|
107
|
-
These can be retrieved using dot-notation or variable to do it dynamically.
|
108
|
-
</p>
|
109
|
-
<pre>
|
110
|
-
RConfig.props.host.dev.domain
|
111
|
-
- or -
|
112
|
-
RConfig.props.host[env].domain (where env is 'dev' or 'prod')
|
113
|
-
</pre>
|
114
|
-
|
115
|
-
</div>
|
116
|
-
|
117
|
-
|
118
|
-
</div>
|
119
|
-
|
120
|
-
|
121
|
-
</div>
|
122
|
-
|
123
|
-
|
124
|
-
<!-- if includes -->
|
125
|
-
|
126
|
-
<div id="section">
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
<!-- if method_list -->
|
136
|
-
|
137
|
-
|
138
|
-
</div>
|
139
|
-
|
140
|
-
|
141
|
-
<div id="validator-badges">
|
142
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
143
|
-
</div>
|
144
|
-
|
145
|
-
</body>
|
146
|
-
</html>
|
@@ -1,186 +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>File: rconfig.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>rconfig.rb</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>lib/rconfig/rconfig.rb
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Wed Jan 06 17:58:24 -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 <rahmal@gmail.com>
|
74
|
-
</p>
|
75
|
-
<hr size="10"></hr><p>
|
76
|
-
The complete solution for Ruby Configuration Management. <a
|
77
|
-
href="../../../classes/RConfig.html">RConfig</a> is a Ruby library that
|
78
|
-
manages configuration within Ruby applications. It bridges the gap between
|
79
|
-
yaml, xml, and key/value based properties files, by providing a centralized
|
80
|
-
solution to handle application configuration from one location. It provides
|
81
|
-
the simplicity of hash-based access, that Rubyists have come to know and
|
82
|
-
love, supporting your configuration style of choice, while providing many
|
83
|
-
new features, and an elegant API.
|
84
|
-
</p>
|
85
|
-
<hr size="10"></hr><ul>
|
86
|
-
<li>Simple, easy to install and use.
|
87
|
-
|
88
|
-
</li>
|
89
|
-
<li>Supports yaml, xml, and properties files.
|
90
|
-
|
91
|
-
</li>
|
92
|
-
<li>Yaml and xml files supprt infinite level of configuration grouping.
|
93
|
-
|
94
|
-
</li>
|
95
|
-
<li>Intuitive dot-notation ‘key chaining’ argument access.
|
96
|
-
|
97
|
-
</li>
|
98
|
-
<li>Simple well-known hash/array based argument access.
|
99
|
-
|
100
|
-
</li>
|
101
|
-
<li>Implements multilevel caching to reduce disk access.
|
102
|
-
|
103
|
-
</li>
|
104
|
-
<li>Short-hand access to ‘global’ application configuration, and
|
105
|
-
shell environment.
|
106
|
-
|
107
|
-
</li>
|
108
|
-
<li>Overlays multiple configuration files to support environment, host, and
|
109
|
-
even locale-specific configuration.
|
110
|
-
|
111
|
-
</li>
|
112
|
-
</ul>
|
113
|
-
<hr size="10"></hr><pre>
|
114
|
-
The overlay order of the config files is defined by SUFFIXES:
|
115
|
-
* nil
|
116
|
-
* _local
|
117
|
-
* _config
|
118
|
-
* _local_config
|
119
|
-
* _{environment} (.i.e _development)
|
120
|
-
* _{environment}_local (.i.e _development_local)
|
121
|
-
* _{hostname} (.i.e _whiskey)
|
122
|
-
* _{hostname}_config_local (.i.e _whiskey_config_local)
|
123
|
-
</pre>
|
124
|
-
<hr size="10"></hr><p>
|
125
|
-
Example:
|
126
|
-
</p>
|
127
|
-
<pre>
|
128
|
-
shell/console =>
|
129
|
-
export LANG=en
|
130
|
-
|
131
|
-
demo.yml =>
|
132
|
-
server:
|
133
|
-
address: host.domain.com
|
134
|
-
port: 81
|
135
|
-
...
|
136
|
-
|
137
|
-
application.properties =>
|
138
|
-
debug_level = verbose
|
139
|
-
...
|
140
|
-
</pre>
|
141
|
-
<p>
|
142
|
-
demo.rb =>
|
143
|
-
</p>
|
144
|
-
<pre>
|
145
|
-
require 'rconfig'
|
146
|
-
RConfig.config_paths = ['$HOME/config', '#{APP_ROOT}/config', '/demo/conf']
|
147
|
-
RConfig.demo[:server][:port] => 81
|
148
|
-
RConfig.demo.server.address => 'host.domain.com'
|
149
|
-
|
150
|
-
RConfig[:debug_level] => 'verbose'
|
151
|
-
RConfig[:lang] => 'en'
|
152
|
-
...
|
153
|
-
</pre>
|
154
|
-
|
155
|
-
</div>
|
156
|
-
|
157
|
-
|
158
|
-
</div>
|
159
|
-
|
160
|
-
|
161
|
-
</div>
|
162
|
-
|
163
|
-
|
164
|
-
<!-- if includes -->
|
165
|
-
|
166
|
-
<div id="section">
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
<!-- if method_list -->
|
176
|
-
|
177
|
-
|
178
|
-
</div>
|
179
|
-
|
180
|
-
|
181
|
-
<div id="validator-badges">
|
182
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
183
|
-
</div>
|
184
|
-
|
185
|
-
</body>
|
186
|
-
</html>
|
@@ -1,117 +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>File: rconfig.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>rconfig.rb</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>lib/rconfig.rb
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Fri Feb 05 16:15:47 -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
|
-
|
72
|
-
<div id="requires-list">
|
73
|
-
<h3 class="section-bar">Required files</h3>
|
74
|
-
|
75
|
-
<div class="name-list">
|
76
|
-
rubygems
|
77
|
-
active_support
|
78
|
-
rconfig/core_ext/object
|
79
|
-
rconfig/core_ext/hash
|
80
|
-
rconfig/config_hash
|
81
|
-
rconfig/properties_file_parser
|
82
|
-
rconfig/exceptions
|
83
|
-
rconfig/constants
|
84
|
-
rconfig/class_variables
|
85
|
-
rconfig/rconfig
|
86
|
-
</div>
|
87
|
-
</div>
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
|
92
|
-
</div>
|
93
|
-
|
94
|
-
|
95
|
-
<!-- if includes -->
|
96
|
-
|
97
|
-
<div id="section">
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
<!-- if method_list -->
|
107
|
-
|
108
|
-
|
109
|
-
</div>
|
110
|
-
|
111
|
-
|
112
|
-
<div id="validator-badges">
|
113
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
114
|
-
</div>
|
115
|
-
|
116
|
-
</body>
|
117
|
-
</html>
|