ballast 1.2.0 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3388a7a801511693256a1137f34b3825e377e485
4
- data.tar.gz: cbe11293e58b2fbdc4d04297e3d188ce1001165c
3
+ metadata.gz: d3677739c7345fff51757aa4480042825e1933c2
4
+ data.tar.gz: baa5609857d7f710b8a771e684fff697d4acf049
5
5
  SHA512:
6
- metadata.gz: a95df246c2fa28afefc163e7a1732b3cf7f2f96e448d00e0af0e48fa71b0a026b0399f889231fe6cff8ffc1c7f523495c5b4fd490ac07b910a3f0bbde3680641
7
- data.tar.gz: f40b1b1dab152befbcb2c305f98971d0ed28489b443ff1ca768c2b6752ce9df5f9bb4ccd34e450c0009da20c094b9fad85618245fb4dd4c60abb613b2b2d7698
6
+ metadata.gz: a530c3ccf4f1b983497b5f281cbae6dbc266e5c21f8b51db3350203270706767129de7f291126023dcabd63b2272fe6bb80acbfee411aac87496726657628fa5
7
+ data.tar.gz: 06cf71b6ebcdc5797a46a812353fc540156ad4a236998b55c65dd81d14bb01e0c4a0a1b3e9efbdc42548be2c3267cfaef5cf2f0a64d666212b79727b0426cace
@@ -1,6 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
+ - 2.1.0
5
+ before_install: gem install bundler -v "1.5.1"
4
6
  script: bundle exec rake spec:coverage
5
7
  gemfile: .travis-gemfile
6
8
  notifications:
@@ -1,3 +1,7 @@
1
+ ### 1.3.0 / 2013-12-30
2
+
3
+ * Added ApplicationConfiguration class.
4
+
1
5
  ### 1.2.0 / 2013-12-25
2
6
 
3
7
  * Changed Javascript parameters output interface.
@@ -80,7 +80,7 @@
80
80
 
81
81
  <dt class="r1 last">Defined in:</dt>
82
82
  <dd class="r1 last">lib/ballast/errors.rb<span class="defines">,<br />
83
- lib/ballast/context.rb,<br /> lib/ballast/version.rb,<br /> lib/ballast/operation.rb,<br /> lib/ballast/concerns/view.rb,<br /> lib/ballast/concerns/ajax.rb,<br /> lib/ballast/concerns/common.rb,<br /> lib/ballast/operations_chain.rb,<br /> lib/ballast/request_domain_matcher.rb,<br /> lib/ballast/concerns/errors_handling.rb,<br /> lib/ballast/middlewares/default_host.rb</span>
83
+ lib/ballast/version.rb,<br /> lib/ballast/context.rb,<br /> lib/ballast/operation.rb,<br /> lib/ballast/configuration.rb,<br /> lib/ballast/concerns/view.rb,<br /> lib/ballast/concerns/ajax.rb,<br /> lib/ballast/concerns/common.rb,<br /> lib/ballast/operations_chain.rb,<br /> lib/ballast/request_domain_matcher.rb,<br /> lib/ballast/middlewares/default_host.rb,<br /> lib/ballast/concerns/errors_handling.rb</span>
84
84
  </dd>
85
85
 
86
86
  </dl>
@@ -105,7 +105,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
105
105
 
106
106
 
107
107
 
108
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Ballast/Context.html" title="Ballast::Context (class)">Context</a></span>, <span class='object_link'><a href="Ballast/Operation.html" title="Ballast::Operation (class)">Operation</a></span>, <span class='object_link'><a href="Ballast/OperationsChain.html" title="Ballast::OperationsChain (class)">OperationsChain</a></span>, <span class='object_link'><a href="Ballast/RequestDomainMatcher.html" title="Ballast::RequestDomainMatcher (class)">RequestDomainMatcher</a></span>
108
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Ballast/Configuration.html" title="Ballast::Configuration (class)">Configuration</a></span>, <span class='object_link'><a href="Ballast/Context.html" title="Ballast::Context (class)">Context</a></span>, <span class='object_link'><a href="Ballast/Operation.html" title="Ballast::Operation (class)">Operation</a></span>, <span class='object_link'><a href="Ballast/OperationsChain.html" title="Ballast::OperationsChain (class)">OperationsChain</a></span>, <span class='object_link'><a href="Ballast/RequestDomainMatcher.html" title="Ballast::RequestDomainMatcher (class)">RequestDomainMatcher</a></span>
109
109
 
110
110
 
111
111
  </p>
@@ -121,9 +121,9 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Wed Dec 25 15:52:53 2013 by
124
+ Generated on Mon Dec 30 12:53:18 2013 by
125
125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
- 0.8.7.3 (ruby-2.0.0).
126
+ 0.8.7.3 (ruby-2.1.0).
127
127
  </div>
128
128
 
129
129
  </body>
@@ -118,9 +118,9 @@
118
118
  </div>
119
119
 
120
120
  <div id="footer">
121
- Generated on Wed Dec 25 15:52:53 2013 by
121
+ Generated on Mon Dec 30 12:53:18 2013 by
122
122
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
123
- 0.8.7.3 (ruby-2.0.0).
123
+ 0.8.7.3 (ruby-2.1.0).
124
124
  </div>
125
125
 
126
126
  </body>
@@ -797,9 +797,9 @@
797
797
  </div>
798
798
 
799
799
  <div id="footer">
800
- Generated on Wed Dec 25 15:52:53 2013 by
800
+ Generated on Mon Dec 30 12:53:19 2013 by
801
801
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
802
- 0.8.7.3 (ruby-2.0.0).
802
+ 0.8.7.3 (ruby-2.1.0).
803
803
  </div>
804
804
 
805
805
  </body>
@@ -887,9 +887,9 @@ and <code>%:Z</code> for the zone name considering also DST.</p>
887
887
  </div>
888
888
 
889
889
  <div id="footer">
890
- Generated on Wed Dec 25 15:52:53 2013 by
890
+ Generated on Mon Dec 30 12:53:19 2013 by
891
891
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
892
- 0.8.7.3 (ruby-2.0.0).
892
+ 0.8.7.3 (ruby-2.1.0).
893
893
  </div>
894
894
 
895
895
  </body>
@@ -274,9 +274,9 @@
274
274
  </div>
275
275
 
276
276
  <div id="footer">
277
- Generated on Wed Dec 25 15:52:53 2013 by
277
+ Generated on Mon Dec 30 12:53:19 2013 by
278
278
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
279
- 0.8.7.3 (ruby-2.0.0).
279
+ 0.8.7.3 (ruby-2.1.0).
280
280
  </div>
281
281
 
282
282
  </body>
@@ -638,9 +638,9 @@
638
638
  </div>
639
639
 
640
640
  <div id="footer">
641
- Generated on Wed Dec 25 15:52:53 2013 by
641
+ Generated on Mon Dec 30 12:53:18 2013 by
642
642
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
643
- 0.8.7.3 (ruby-2.0.0).
643
+ 0.8.7.3 (ruby-2.1.0).
644
644
  </div>
645
645
 
646
646
  </body>
@@ -0,0 +1,282 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: Ballast::Configuration
8
+
9
+ &mdash; Documentation by YARD 0.8.7.3
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (C)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Ballast.html" title="Ballast (module)">Ballast</a></span></span>
36
+ &raquo;
37
+ <span class="title">Configuration</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: Ballast::Configuration
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">HashWithIndifferentAccess</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">HashWithIndifferentAccess</li>
82
+
83
+ <li class="next">Ballast::Configuration</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <dt class="r2 last">Defined in:</dt>
99
+ <dd class="r2 last">lib/ballast/configuration.rb</dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+ <p>A class which loads a list of YAML files in a folder and expose them in a dotted notation.
107
+ For each file, only the subsection for the current environment is loaded, so each YAML document should be an hash.</p>
108
+
109
+
110
+ </div>
111
+ </div>
112
+ <div class="tags">
113
+
114
+
115
+ </div>
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ <h2>
124
+ Instance Method Summary
125
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
126
+ </h2>
127
+
128
+ <ul class="summary">
129
+
130
+ <li class="public ">
131
+ <span class="summary_signature">
132
+
133
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Configuration) <strong>initialize</strong>(sections: [], root: nil, environment: nil) </a>
134
+
135
+
136
+
137
+ </span>
138
+
139
+
140
+ <span class="note title constructor">constructor</span>
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ <span class="summary_desc"><div class='inline'><p>Creates a new configuration.</p>
150
+ </div></span>
151
+
152
+ </li>
153
+
154
+
155
+ </ul>
156
+
157
+
158
+
159
+ <div id="constructor_details" class="method_details_list">
160
+ <h2>Constructor Details</h2>
161
+
162
+ <div class="method_details first">
163
+ <h3 class="signature first" id="initialize-instance_method">
164
+
165
+ - (<tt><span class='object_link'><a href="" title="Ballast::Configuration (class)">Configuration</a></span></tt>) <strong>initialize</strong>(sections: [], root: nil, environment: nil)
166
+
167
+
168
+
169
+
170
+
171
+ </h3><div class="docstring">
172
+ <div class="discussion">
173
+ <p>Creates a new configuration.</p>
174
+
175
+
176
+ </div>
177
+ </div>
178
+ <div class="tags">
179
+ <p class="tag_title">Parameters:</p>
180
+ <ul class="param">
181
+
182
+ <li>
183
+
184
+ <span class='name'>sections</span>
185
+
186
+
187
+ <span class='type'>(<tt>Array</tt>)</span>
188
+
189
+
190
+
191
+ &mdash;
192
+ <div class='inline'><p>A list of sections to load. Each section name should be the basename (without extension) of a file in the root folder.
193
+ Subfolders are not supported.</p>
194
+ </div>
195
+
196
+ </li>
197
+
198
+ <li>
199
+
200
+ <span class='name'>root</span>
201
+
202
+
203
+ <span class='type'>(<tt>String</tt>)</span>
204
+
205
+
206
+
207
+ &mdash;
208
+ <div class='inline'><p>The root folder where look for file. Default is the Rails root.</p>
209
+ </div>
210
+
211
+ </li>
212
+
213
+ <li>
214
+
215
+ <span class='name'>environment</span>
216
+
217
+
218
+ <span class='type'>(<tt>String</tt>)</span>
219
+
220
+
221
+
222
+ &mdash;
223
+ <div class='inline'><p>The environment to load. Default is the Rails environment.</p>
224
+ </div>
225
+
226
+ </li>
227
+
228
+ </ul>
229
+
230
+
231
+ </div><table class="source_code">
232
+ <tr>
233
+ <td>
234
+ <pre class="lines">
235
+
236
+
237
+ 16
238
+ 17
239
+ 18
240
+ 19
241
+ 20
242
+ 21
243
+ 22
244
+ 23
245
+ 24
246
+ 25
247
+ 26
248
+ 27</pre>
249
+ </td>
250
+ <td>
251
+ <pre class="code"><span class="info file"># File 'lib/ballast/configuration.rb', line 16</span>
252
+
253
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>sections:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>environment:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
254
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='rparen'>)</span>
255
+ <span class='id identifier rubyid_root'>root</span> <span class='op'>||=</span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
256
+ <span class='id identifier rubyid_environment'>environment</span> <span class='op'>||=</span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span>
257
+
258
+ <span class='id identifier rubyid_sections'>sections</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_section'>section</span><span class='op'>|</span>
259
+ <span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load_file'>load_file</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_root'>root</span><span class='embexpr_end'>}</span><span class='tstring_content'>/config/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_section'>section</span><span class='embexpr_end'>}</span><span class='tstring_content'>.yml</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with_indifferent_access'>with_indifferent_access</span>
260
+ <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_section'>section</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_content'>content</span><span class='lbracket'>[</span><span class='id identifier rubyid_environment'>environment</span><span class='rbracket'>]</span>
261
+ <span class='kw'>end</span>
262
+
263
+ <span class='id identifier rubyid_enable_dotted_access'>enable_dotted_access</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
264
+ <span class='kw'>end</span></pre>
265
+ </td>
266
+ </tr>
267
+ </table>
268
+ </div>
269
+
270
+ </div>
271
+
272
+
273
+ </div>
274
+
275
+ <div id="footer">
276
+ Generated on Mon Dec 30 12:53:19 2013 by
277
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
278
+ 0.8.7.3 (ruby-2.1.0).
279
+ </div>
280
+
281
+ </body>
282
+ </html>
@@ -408,9 +408,9 @@
408
408
  </div>
409
409
 
410
410
  <div id="footer">
411
- Generated on Wed Dec 25 15:52:53 2013 by
411
+ Generated on Mon Dec 30 12:53:19 2013 by
412
412
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
413
- 0.8.7.3 (ruby-2.0.0).
413
+ 0.8.7.3 (ruby-2.1.0).
414
414
  </div>
415
415
 
416
416
  </body>
@@ -116,9 +116,9 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Wed Dec 25 15:52:53 2013 by
119
+ Generated on Mon Dec 30 12:53:18 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
- 0.8.7.3 (ruby-2.0.0).
121
+ 0.8.7.3 (ruby-2.1.0).
122
122
  </div>
123
123
 
124
124
  </body>
@@ -317,9 +317,9 @@
317
317
  </div>
318
318
 
319
319
  <div id="footer">
320
- Generated on Wed Dec 25 15:52:53 2013 by
320
+ Generated on Mon Dec 30 12:53:19 2013 by
321
321
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
322
- 0.8.7.3 (ruby-2.0.0).
322
+ 0.8.7.3 (ruby-2.1.0).
323
323
  </div>
324
324
 
325
325
  </body>
@@ -148,9 +148,9 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Wed Dec 25 15:52:53 2013 by
151
+ Generated on Mon Dec 30 12:53:19 2013 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
- 0.8.7.3 (ruby-2.0.0).
153
+ 0.8.7.3 (ruby-2.1.0).
154
154
  </div>
155
155
 
156
156
  </body>
@@ -148,9 +148,9 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Wed Dec 25 15:52:53 2013 by
151
+ Generated on Mon Dec 30 12:53:19 2013 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
- 0.8.7.3 (ruby-2.0.0).
153
+ 0.8.7.3 (ruby-2.1.0).
154
154
  </div>
155
155
 
156
156
  </body>
@@ -148,9 +148,9 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Wed Dec 25 15:52:53 2013 by
151
+ Generated on Mon Dec 30 12:53:19 2013 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
- 0.8.7.3 (ruby-2.0.0).
153
+ 0.8.7.3 (ruby-2.1.0).
154
154
  </div>
155
155
 
156
156
  </body>
@@ -116,9 +116,9 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Wed Dec 25 15:52:53 2013 by
119
+ Generated on Mon Dec 30 12:53:19 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
- 0.8.7.3 (ruby-2.0.0).
121
+ 0.8.7.3 (ruby-2.1.0).
122
122
  </div>
123
123
 
124
124
  </body>
@@ -345,9 +345,9 @@
345
345
  </div>
346
346
 
347
347
  <div id="footer">
348
- Generated on Wed Dec 25 15:52:54 2013 by
348
+ Generated on Mon Dec 30 12:53:19 2013 by
349
349
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
350
- 0.8.7.3 (ruby-2.0.0).
350
+ 0.8.7.3 (ruby-2.1.0).
351
351
  </div>
352
352
 
353
353
  </body>
@@ -1295,9 +1295,9 @@ as owner will be created.</p>
1295
1295
  </div>
1296
1296
 
1297
1297
  <div id="footer">
1298
- Generated on Wed Dec 25 15:52:54 2013 by
1298
+ Generated on Mon Dec 30 12:53:19 2013 by
1299
1299
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1300
- 0.8.7.3 (ruby-2.0.0).
1300
+ 0.8.7.3 (ruby-2.1.0).
1301
1301
  </div>
1302
1302
 
1303
1303
  </body>
@@ -576,9 +576,9 @@ as owner will be created.</p>
576
576
  </div>
577
577
 
578
578
  <div id="footer">
579
- Generated on Wed Dec 25 15:52:54 2013 by
579
+ Generated on Mon Dec 30 12:53:19 2013 by
580
580
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
581
- 0.8.7.3 (ruby-2.0.0).
581
+ 0.8.7.3 (ruby-2.1.0).
582
582
  </div>
583
583
 
584
584
  </body>
@@ -908,9 +908,9 @@
908
908
  </div>
909
909
 
910
910
  <div id="footer">
911
- Generated on Wed Dec 25 15:52:54 2013 by
911
+ Generated on Mon Dec 30 12:53:19 2013 by
912
912
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
913
- 0.8.7.3 (ruby-2.0.0).
913
+ 0.8.7.3 (ruby-2.1.0).
914
914
  </div>
915
915
 
916
916
  </body>
@@ -134,7 +134,7 @@
134
134
 
135
135
  </div>
136
136
  </dt>
137
- <dd><pre class="code"><span class='int'>2</span></pre></dd>
137
+ <dd><pre class="code"><span class='int'>3</span></pre></dd>
138
138
 
139
139
  <dt id="PATCH-constant" class="">PATCH =
140
140
  <div class="docstring">
@@ -180,9 +180,9 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Wed Dec 25 15:52:53 2013 by
183
+ Generated on Mon Dec 30 12:53:18 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
- 0.8.7.3 (ruby-2.0.0).
185
+ 0.8.7.3 (ruby-2.1.0).
186
186
  </div>
187
187
 
188
188
  </body>
@@ -133,6 +133,13 @@
133
133
 
134
134
  </li>
135
135
 
136
+ <li>
137
+ <span class='object_link'><a href="Ballast/Configuration.html" title="Ballast::Configuration (class)">Configuration</a></span>
138
+
139
+ <small>(Ballast)</small>
140
+
141
+ </li>
142
+
136
143
  <li>
137
144
  <span class='object_link'><a href="Ballast/Context.html" title="Ballast::Context (class)">Context</a></span>
138
145
 
@@ -303,9 +310,9 @@
303
310
  </div>
304
311
 
305
312
  <div id="footer">
306
- Generated on Wed Dec 25 15:52:52 2013 by
313
+ Generated on Mon Dec 30 12:53:17 2013 by
307
314
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
308
- 0.8.7.3 (ruby-2.0.0).
315
+ 0.8.7.3 (ruby-2.1.0).
309
316
  </div>
310
317
 
311
318
  </body>
@@ -46,7 +46,7 @@
46
46
 
47
47
  <ul id="full_list" class="class">
48
48
  <li><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></li>
49
- <li><a class='toggle'></a> <span class='object_link'><a href="Ballast.html" title="Ballast (module)">Ballast</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><a class='toggle'></a> <span class='object_link'><a href="Ballast/Concerns.html" title="Ballast::Concerns (module)">Concerns</a></span><small class='search_info'>Ballast</small></li><ul><li><span class='object_link'><a href="Ballast/Concerns/Ajax.html" title="Ballast::Concerns::Ajax (module)">Ajax</a></span><small class='search_info'>Ballast::Concerns</small></li><li><span class='object_link'><a href="Ballast/Concerns/Common.html" title="Ballast::Concerns::Common (module)">Common</a></span><small class='search_info'>Ballast::Concerns</small></li><li><span class='object_link'><a href="Ballast/Concerns/ErrorsHandling.html" title="Ballast::Concerns::ErrorsHandling (module)">ErrorsHandling</a></span><small class='search_info'>Ballast::Concerns</small></li><li><span class='object_link'><a href="Ballast/Concerns/View.html" title="Ballast::Concerns::View (module)">View</a></span><small class='search_info'>Ballast::Concerns</small></li></ul><li><span class='object_link'><a href="Ballast/Context.html" title="Ballast::Context (class)">Context</a></span> &lt; Context<small class='search_info'>Ballast</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Ballast/Errors.html" title="Ballast::Errors (module)">Errors</a></span><small class='search_info'>Ballast</small></li><ul><li><span class='object_link'><a href="Ballast/Errors/BaseError.html" title="Ballast::Errors::BaseError (class)">BaseError</a></span> &lt; RuntimeError<small class='search_info'>Ballast::Errors</small></li><li><span class='object_link'><a href="Ballast/Errors/InvalidDomain.html" title="Ballast::Errors::InvalidDomain (class)">InvalidDomain</a></span> &lt; BaseError<small class='search_info'>Ballast::Errors</small></li><li><span class='object_link'><a href="Ballast/Errors/PerformError.html" title="Ballast::Errors::PerformError (class)">PerformError</a></span> &lt; BaseError<small class='search_info'>Ballast::Errors</small></li><li><span class='object_link'><a href="Ballast/Errors/ValidationError.html" title="Ballast::Errors::ValidationError (class)">ValidationError</a></span> &lt; BaseError<small class='search_info'>Ballast::Errors</small></li></ul><li><a class='toggle'></a> <span class='object_link'><a href="Ballast/Middlewares.html" title="Ballast::Middlewares (module)">Middlewares</a></span><small class='search_info'>Ballast</small></li><ul><li><span class='object_link'><a href="Ballast/Middlewares/DefaultHost.html" title="Ballast::Middlewares::DefaultHost (class)">DefaultHost</a></span> &lt; Object<small class='search_info'>Ballast::Middlewares</small></li></ul><li><span class='object_link'><a href="Ballast/Operation.html" title="Ballast::Operation (class)">Operation</a></span> &lt; Object<small class='search_info'>Ballast</small></li><li><span class='object_link'><a href="Ballast/OperationsChain.html" title="Ballast::OperationsChain (class)">OperationsChain</a></span> &lt; Operation<small class='search_info'>Ballast</small></li><li><span class='object_link'><a href="Ballast/RequestDomainMatcher.html" title="Ballast::RequestDomainMatcher (class)">RequestDomainMatcher</a></span> &lt; Object<small class='search_info'>Ballast</small></li><li><span class='object_link'><a href="Ballast/Version.html" title="Ballast::Version (module)">Version</a></span><small class='search_info'>Ballast</small></li></ul>
49
+ <li><a class='toggle'></a> <span class='object_link'><a href="Ballast.html" title="Ballast (module)">Ballast</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><a class='toggle'></a> <span class='object_link'><a href="Ballast/Concerns.html" title="Ballast::Concerns (module)">Concerns</a></span><small class='search_info'>Ballast</small></li><ul><li><span class='object_link'><a href="Ballast/Concerns/Ajax.html" title="Ballast::Concerns::Ajax (module)">Ajax</a></span><small class='search_info'>Ballast::Concerns</small></li><li><span class='object_link'><a href="Ballast/Concerns/Common.html" title="Ballast::Concerns::Common (module)">Common</a></span><small class='search_info'>Ballast::Concerns</small></li><li><span class='object_link'><a href="Ballast/Concerns/ErrorsHandling.html" title="Ballast::Concerns::ErrorsHandling (module)">ErrorsHandling</a></span><small class='search_info'>Ballast::Concerns</small></li><li><span class='object_link'><a href="Ballast/Concerns/View.html" title="Ballast::Concerns::View (module)">View</a></span><small class='search_info'>Ballast::Concerns</small></li></ul><li><span class='object_link'><a href="Ballast/Configuration.html" title="Ballast::Configuration (class)">Configuration</a></span> &lt; HashWithIndifferentAccess<small class='search_info'>Ballast</small></li><li><span class='object_link'><a href="Ballast/Context.html" title="Ballast::Context (class)">Context</a></span> &lt; Context<small class='search_info'>Ballast</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Ballast/Errors.html" title="Ballast::Errors (module)">Errors</a></span><small class='search_info'>Ballast</small></li><ul><li><span class='object_link'><a href="Ballast/Errors/BaseError.html" title="Ballast::Errors::BaseError (class)">BaseError</a></span> &lt; RuntimeError<small class='search_info'>Ballast::Errors</small></li><li><span class='object_link'><a href="Ballast/Errors/InvalidDomain.html" title="Ballast::Errors::InvalidDomain (class)">InvalidDomain</a></span> &lt; BaseError<small class='search_info'>Ballast::Errors</small></li><li><span class='object_link'><a href="Ballast/Errors/PerformError.html" title="Ballast::Errors::PerformError (class)">PerformError</a></span> &lt; BaseError<small class='search_info'>Ballast::Errors</small></li><li><span class='object_link'><a href="Ballast/Errors/ValidationError.html" title="Ballast::Errors::ValidationError (class)">ValidationError</a></span> &lt; BaseError<small class='search_info'>Ballast::Errors</small></li></ul><li><a class='toggle'></a> <span class='object_link'><a href="Ballast/Middlewares.html" title="Ballast::Middlewares (module)">Middlewares</a></span><small class='search_info'>Ballast</small></li><ul><li><span class='object_link'><a href="Ballast/Middlewares/DefaultHost.html" title="Ballast::Middlewares::DefaultHost (class)">DefaultHost</a></span> &lt; Object<small class='search_info'>Ballast::Middlewares</small></li></ul><li><span class='object_link'><a href="Ballast/Operation.html" title="Ballast::Operation (class)">Operation</a></span> &lt; Object<small class='search_info'>Ballast</small></li><li><span class='object_link'><a href="Ballast/OperationsChain.html" title="Ballast::OperationsChain (class)">OperationsChain</a></span> &lt; Operation<small class='search_info'>Ballast</small></li><li><span class='object_link'><a href="Ballast/RequestDomainMatcher.html" title="Ballast::RequestDomainMatcher (class)">RequestDomainMatcher</a></span> &lt; Object<small class='search_info'>Ballast</small></li><li><span class='object_link'><a href="Ballast/Version.html" title="Ballast::Version (module)">Version</a></span><small class='search_info'>Ballast</small></li></ul>
50
50
 
51
51
  </ul>
52
52
  </div>
@@ -106,9 +106,9 @@
106
106
  </div></div>
107
107
 
108
108
  <div id="footer">
109
- Generated on Wed Dec 25 15:52:53 2013 by
109
+ Generated on Mon Dec 30 12:53:18 2013 by
110
110
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
111
- 0.8.7.3 (ruby-2.0.0).
111
+ 0.8.7.3 (ruby-2.1.0).
112
112
  </div>
113
113
 
114
114
  </body>
@@ -106,9 +106,9 @@
106
106
  </div></div>
107
107
 
108
108
  <div id="footer">
109
- Generated on Wed Dec 25 15:52:53 2013 by
109
+ Generated on Mon Dec 30 12:53:18 2013 by
110
110
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
111
- 0.8.7.3 (ruby-2.0.0).
111
+ 0.8.7.3 (ruby-2.1.0).
112
112
  </div>
113
113
 
114
114
  </body>
@@ -150,77 +150,77 @@
150
150
 
151
151
 
152
152
  <li class="r2 ">
153
- <span class='object_link'><a href="Ballast/Errors/BaseError.html#initialize-instance_method" title="Ballast::Errors::BaseError#initialize (method)">#initialize</a></span>
154
- <small>Ballast::Errors::BaseError</small>
153
+ <span class='object_link'><a href="Ballast/Operation.html#initialize-instance_method" title="Ballast::Operation#initialize (method)">#initialize</a></span>
154
+ <small>Ballast::Operation</small>
155
155
  </li>
156
156
 
157
157
 
158
158
  <li class="r1 ">
159
- <span class='object_link'><a href="Ballast/Middlewares/DefaultHost.html#initialize-instance_method" title="Ballast::Middlewares::DefaultHost#initialize (method)">#initialize</a></span>
160
- <small>Ballast::Middlewares::DefaultHost</small>
159
+ <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#initialize-instance_method" title="Ballast::RequestDomainMatcher#initialize (method)">#initialize</a></span>
160
+ <small>Ballast::RequestDomainMatcher</small>
161
161
  </li>
162
162
 
163
163
 
164
164
  <li class="r2 ">
165
- <span class='object_link'><a href="Ballast/OperationsChain.html#initialize-instance_method" title="Ballast::OperationsChain#initialize (method)">#initialize</a></span>
166
- <small>Ballast::OperationsChain</small>
165
+ <span class='object_link'><a href="Ballast/Errors/BaseError.html#initialize-instance_method" title="Ballast::Errors::BaseError#initialize (method)">#initialize</a></span>
166
+ <small>Ballast::Errors::BaseError</small>
167
167
  </li>
168
168
 
169
169
 
170
170
  <li class="r1 ">
171
- <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#initialize-instance_method" title="Ballast::RequestDomainMatcher#initialize (method)">#initialize</a></span>
172
- <small>Ballast::RequestDomainMatcher</small>
171
+ <span class='object_link'><a href="Ballast/Middlewares/DefaultHost.html#initialize-instance_method" title="Ballast::Middlewares::DefaultHost#initialize (method)">#initialize</a></span>
172
+ <small>Ballast::Middlewares::DefaultHost</small>
173
173
  </li>
174
174
 
175
175
 
176
176
  <li class="r2 ">
177
- <span class='object_link'><a href="Ballast/Operation.html#initialize-instance_method" title="Ballast::Operation#initialize (method)">#initialize</a></span>
178
- <small>Ballast::Operation</small>
177
+ <span class='object_link'><a href="Ballast/Configuration.html#initialize-instance_method" title="Ballast::Configuration#initialize (method)">#initialize</a></span>
178
+ <small>Ballast::Configuration</small>
179
179
  </li>
180
180
 
181
181
 
182
182
  <li class="r1 ">
183
+ <span class='object_link'><a href="Ballast/OperationsChain.html#initialize-instance_method" title="Ballast::OperationsChain#initialize (method)">#initialize</a></span>
184
+ <small>Ballast::OperationsChain</small>
185
+ </li>
186
+
187
+
188
+ <li class="r2 ">
183
189
  <span class='object_link'><a href="Ballast/Concerns/Ajax.html#is_ajax%3F-instance_method" title="Ballast::Concerns::Ajax#is_ajax? (method)">#is_ajax?</a></span>
184
190
  <small>Ballast::Concerns::Ajax</small>
185
191
  </li>
186
192
 
187
193
 
188
- <li class="r2 ">
194
+ <li class="r1 ">
189
195
  <span class='object_link'><a href="Ballast/Concerns/View.html#javascript_params-instance_method" title="Ballast::Concerns::View#javascript_params (method)">#javascript_params</a></span>
190
196
  <small>Ballast::Concerns::View</small>
191
197
  </li>
192
198
 
193
199
 
194
- <li class="r1 ">
200
+ <li class="r2 ">
195
201
  <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#matches%3F-instance_method" title="Ballast::RequestDomainMatcher#matches? (method)">#matches?</a></span>
196
202
  <small>Ballast::RequestDomainMatcher</small>
197
203
  </li>
198
204
 
199
205
 
200
- <li class="r2 ">
206
+ <li class="r1 ">
201
207
  <span class='object_link'><a href="Ballast/Context.html#method_missing-instance_method" title="Ballast::Context#method_missing (method)">#method_missing</a></span>
202
208
  <small>Ballast::Context</small>
203
209
  </li>
204
210
 
205
211
 
206
- <li class="r1 ">
212
+ <li class="r2 ">
207
213
  <span class='object_link'><a href="Ballast/Operation.html#method_missing-instance_method" title="Ballast::Operation#method_missing (method)">#method_missing</a></span>
208
214
  <small>Ballast::Operation</small>
209
215
  </li>
210
216
 
211
217
 
212
- <li class="r2 ">
218
+ <li class="r1 ">
213
219
  <span class='object_link'><a href="Ballast/OperationsChain.html#operations-instance_method" title="Ballast::OperationsChain#operations (method)">#operations</a></span>
214
220
  <small>Ballast::OperationsChain</small>
215
221
  </li>
216
222
 
217
223
 
218
- <li class="r1 ">
219
- <span class='object_link'><a href="Ballast/Operation.html#perform-class_method" title="Ballast::Operation.perform (method)">perform</a></span>
220
- <small>Ballast::Operation</small>
221
- </li>
222
-
223
-
224
224
  <li class="r2 ">
225
225
  <span class='object_link'><a href="Ballast/OperationsChain.html#perform-class_method" title="Ballast::OperationsChain.perform (method)">perform</a></span>
226
226
  <small>Ballast::OperationsChain</small>
@@ -228,84 +228,90 @@
228
228
 
229
229
 
230
230
  <li class="r1 ">
231
+ <span class='object_link'><a href="Ballast/Operation.html#perform-class_method" title="Ballast::Operation.perform (method)">perform</a></span>
232
+ <small>Ballast::Operation</small>
233
+ </li>
234
+
235
+
236
+ <li class="r2 ">
231
237
  <span class='object_link'><a href="Ballast/Concerns/Common.html#perform_operation-instance_method" title="Ballast::Concerns::Common#perform_operation (method)">#perform_operation</a></span>
232
238
  <small>Ballast::Concerns::Common</small>
233
239
  </li>
234
240
 
235
241
 
236
- <li class="r2 ">
242
+ <li class="r1 ">
237
243
  <span class='object_link'><a href="Ballast/Operation.html#perform_with_handling-instance_method" title="Ballast::Operation#perform_with_handling (method)">#perform_with_handling</a></span>
238
244
  <small>Ballast::Operation</small>
239
245
  </li>
240
246
 
241
247
 
242
- <li class="r1 ">
248
+ <li class="r2 ">
243
249
  <span class='object_link'><a href="Ballast/Concerns/Ajax.html#prepare_ajax-instance_method" title="Ballast::Concerns::Ajax#prepare_ajax (method)">#prepare_ajax</a></span>
244
250
  <small>Ballast::Concerns::Ajax</small>
245
251
  </li>
246
252
 
247
253
 
248
- <li class="r2 ">
254
+ <li class="r1 ">
249
255
  <span class='object_link'><a href="Ballast/Concerns/Ajax.html#prevent_caching-instance_method" title="Ballast::Concerns::Ajax#prevent_caching (method)">#prevent_caching</a></span>
250
256
  <small>Ballast::Concerns::Ajax</small>
251
257
  </li>
252
258
 
253
259
 
254
- <li class="r1 ">
260
+ <li class="r2 ">
255
261
  <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_block-instance_method" title="Ballast::RequestDomainMatcher#replace_block (method)">#replace_block</a></span>
256
262
  <small>Ballast::RequestDomainMatcher</small>
257
263
  </li>
258
264
 
259
265
 
260
- <li class="r2 ">
266
+ <li class="r1 ">
261
267
  <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_pattern-instance_method" title="Ballast::RequestDomainMatcher#replace_pattern (method)">#replace_pattern</a></span>
262
268
  <small>Ballast::RequestDomainMatcher</small>
263
269
  </li>
264
270
 
265
271
 
266
- <li class="r1 ">
272
+ <li class="r2 ">
267
273
  <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_string-instance_method" title="Ballast::RequestDomainMatcher#replace_string (method)">#replace_string</a></span>
268
274
  <small>Ballast::RequestDomainMatcher</small>
269
275
  </li>
270
276
 
271
277
 
272
- <li class="r2 ">
278
+ <li class="r1 ">
273
279
  <span class='object_link'><a href="Ballast/Operation.html#resolve_error-instance_method" title="Ballast::Operation#resolve_error (method)">#resolve_error</a></span>
274
280
  <small>Ballast::Operation</small>
275
281
  </li>
276
282
 
277
283
 
278
- <li class="r1 ">
284
+ <li class="r2 ">
279
285
  <span class='object_link'><a href="Ballast/Errors/BaseError.html#response-instance_method" title="Ballast::Errors::BaseError#response (method)">#response</a></span>
280
286
  <small>Ballast::Errors::BaseError</small>
281
287
  </li>
282
288
 
283
289
 
284
- <li class="r2 ">
290
+ <li class="r1 ">
285
291
  <span class='object_link'><a href="Ballast/Concerns/View.html#scope_css-instance_method" title="Ballast::Concerns::View#scope_css (method)">#scope_css</a></span>
286
292
  <small>Ballast::Concerns::View</small>
287
293
  </li>
288
294
 
289
295
 
290
- <li class="r1 ">
296
+ <li class="r2 ">
291
297
  <span class='object_link'><a href="Ballast/Concerns/Ajax.html#send_ajax-instance_method" title="Ballast::Concerns::Ajax#send_ajax (method)">#send_ajax</a></span>
292
298
  <small>Ballast::Concerns::Ajax</small>
293
299
  </li>
294
300
 
295
301
 
296
- <li class="r2 ">
302
+ <li class="r1 ">
297
303
  <span class='object_link'><a href="Ballast/Concerns/Common.html#sending_data%3F-instance_method" title="Ballast::Concerns::Common#sending_data? (method)">#sending_data?</a></span>
298
304
  <small>Ballast::Concerns::Common</small>
299
305
  </li>
300
306
 
301
307
 
302
- <li class="r1 ">
308
+ <li class="r2 ">
303
309
  <span class='object_link'><a href="Ballast/Operation.html#setup_response-instance_method" title="Ballast::Operation#setup_response (method)">#setup_response</a></span>
304
310
  <small>Ballast::Operation</small>
305
311
  </li>
306
312
 
307
313
 
308
- <li class="r2 ">
314
+ <li class="r1 ">
309
315
  <span class='object_link'><a href="Ballast/Concerns/Ajax.html#update_ajax-instance_method" title="Ballast::Concerns::Ajax#update_ajax (method)">#update_ajax</a></span>
310
316
  <small>Ballast::Concerns::Ajax</small>
311
317
  </li>
@@ -103,9 +103,9 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Wed Dec 25 15:52:53 2013 by
106
+ Generated on Mon Dec 30 12:53:18 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
- 0.8.7.3 (ruby-2.0.0).
108
+ 0.8.7.3 (ruby-2.1.0).
109
109
  </div>
110
110
 
111
111
  </body>
@@ -19,6 +19,7 @@ require "ballast/context"
19
19
  require "ballast/operation"
20
20
  require "ballast/operations_chain"
21
21
  require "ballast/request_domain_matcher"
22
+ require "ballast/configuration"
22
23
  require "ballast/concerns/ajax"
23
24
  require "ballast/concerns/common"
24
25
  require "ballast/concerns/view"
@@ -0,0 +1,42 @@
1
+ #
2
+ # This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
3
+ # Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
4
+ #
5
+
6
+ module Ballast
7
+ # A class which loads a list of YAML files in a folder and expose them in a dotted notation.
8
+ # For each file, only the subsection for the current environment is loaded, so each YAML document should be an hash.
9
+ class Configuration < HashWithIndifferentAccess
10
+ # Creates a new configuration.
11
+ #
12
+ # @param sections [Array] A list of sections to load. Each section name should be the basename (without extension) of a file in the root folder.
13
+ # Subfolders are not supported.
14
+ # @param root [String] The root folder where look for file. Default is the Rails root.
15
+ # @param environment [String] The environment to load. Default is the Rails environment.
16
+ def initialize(sections: [], root: nil, environment: nil)
17
+ super()
18
+ root ||= Rails.root.to_s
19
+ environment ||= Rails.env
20
+
21
+ sections.each do |section|
22
+ content = (YAML.load_file("#{root}/config/#{section}.yml") rescue {}).with_indifferent_access
23
+ self[section] = content[environment]
24
+ end
25
+
26
+ enable_dotted_access(self)
27
+ end
28
+
29
+ private
30
+ # Enables dotted access on a root object and its nested hashes.
31
+ #
32
+ # @param root [Hash] The hash to manage.
33
+ def enable_dotted_access(root)
34
+ root.extend(Hashie::Extensions::MethodReader)
35
+ root.extend(Hashie::Extensions::MethodQuery)
36
+
37
+ root.each do |_, node|
38
+ enable_dotted_access(node) if node.is_a?(Hash)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -13,7 +13,7 @@ module Ballast
13
13
  MAJOR = 1
14
14
 
15
15
  # The minor version.
16
- MINOR = 2
16
+ MINOR = 3
17
17
 
18
18
  # The patch version.
19
19
  PATCH = 0
@@ -0,0 +1,34 @@
1
+ #
2
+ # This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
3
+ # Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
4
+ #
5
+
6
+ require "spec_helper"
7
+
8
+ describe Ballast::Configuration do
9
+ describe "#initialize" do
10
+ before(:each) do
11
+ expect(YAML).to receive(:load_file).with("ROOT/config/section_a.yml").and_return({"ENV" => {a: {b: 1}}, "OTHER" => {aa: 3}})
12
+ expect(YAML).to receive(:load_file).with("ROOT/config/section_b.yml").and_return({"ENV" => {c: {d: 2}}, "OTHER" => {cc: 4}})
13
+ end
14
+
15
+ it "should load a list of sections" do
16
+ Ballast::Configuration.new(sections: ["section_a", "section_b"], root: "ROOT", environment: "ENV")
17
+ end
18
+
19
+ it "should only load specific environment" do
20
+ subject = Ballast::Configuration.new(sections: ["section_a", "section_b"], root: "ROOT", environment: "ENV")
21
+ expect(subject["section_a"].keys).to eq(["a"])
22
+ expect(subject["section_b"].keys).to eq(["c"])
23
+ end
24
+
25
+ it "should enable dotted access" do
26
+ subject = Ballast::Configuration.new(sections: ["section_a", "section_b"], root: "ROOT", environment: "ENV")
27
+
28
+ expect(subject.section_a.a.b).to eq(1)
29
+ expect(subject.section_b.c).to eq({"d" => 2})
30
+ expect { subject.section_a.e }.to raise_error(NoMethodError)
31
+ expect { subject.e }.to raise_error(NoMethodError)
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ballast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shogun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-25 00:00:00.000000000 Z
11
+ date: 2013-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.5.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.5.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: lazier
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 3.3.10
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.3.10
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: brauser
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 3.2.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.2.4
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: interactor
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 2.1.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 2.1.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: addressable
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 2.3.5
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 2.3.5
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rack-fiber_pool
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.9.3
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.9.3
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: em-synchrony
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: 1.0.3
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 1.0.3
125
125
  description: A collection of base utilities for Ruby on Rails.
@@ -129,10 +129,10 @@ executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
- - .gitignore
133
- - .travis-gemfile
134
- - .travis.yml
135
- - .yardopts
132
+ - ".gitignore"
133
+ - ".travis-gemfile"
134
+ - ".travis.yml"
135
+ - ".yardopts"
136
136
  - CHANGELOG.md
137
137
  - Gemfile
138
138
  - README.md
@@ -144,6 +144,7 @@ files:
144
144
  - doc/Ballast/Concerns/Common.html
145
145
  - doc/Ballast/Concerns/ErrorsHandling.html
146
146
  - doc/Ballast/Concerns/View.html
147
+ - doc/Ballast/Configuration.html
147
148
  - doc/Ballast/Context.html
148
149
  - doc/Ballast/Errors.html
149
150
  - doc/Ballast/Errors/BaseError.html
@@ -175,6 +176,7 @@ files:
175
176
  - lib/ballast/concerns/common.rb
176
177
  - lib/ballast/concerns/errors_handling.rb
177
178
  - lib/ballast/concerns/view.rb
179
+ - lib/ballast/configuration.rb
178
180
  - lib/ballast/context.rb
179
181
  - lib/ballast/errors.rb
180
182
  - lib/ballast/middlewares/default_host.rb
@@ -186,6 +188,7 @@ files:
186
188
  - spec/ballast/concerns/common_spec.rb
187
189
  - spec/ballast/concerns/errors_handling_spec.rb
188
190
  - spec/ballast/concerns/view_spec.rb
191
+ - spec/ballast/configuration_spec.rb
189
192
  - spec/ballast/context_spec.rb
190
193
  - spec/ballast/errors_spec.rb
191
194
  - spec/ballast/middlewares/default_host_spec.rb
@@ -204,17 +207,17 @@ require_paths:
204
207
  - lib
205
208
  required_ruby_version: !ruby/object:Gem::Requirement
206
209
  requirements:
207
- - - '>='
210
+ - - ">="
208
211
  - !ruby/object:Gem::Version
209
212
  version: '2.0'
210
213
  required_rubygems_version: !ruby/object:Gem::Requirement
211
214
  requirements:
212
- - - '>='
215
+ - - ">="
213
216
  - !ruby/object:Gem::Version
214
217
  version: '0'
215
218
  requirements: []
216
219
  rubyforge_project: ballast
217
- rubygems_version: 2.0.6
220
+ rubygems_version: 2.2.0
218
221
  signing_key:
219
222
  specification_version: 4
220
223
  summary: A collection of base utilities for Ruby on Rails.
@@ -223,6 +226,7 @@ test_files:
223
226
  - spec/ballast/concerns/common_spec.rb
224
227
  - spec/ballast/concerns/errors_handling_spec.rb
225
228
  - spec/ballast/concerns/view_spec.rb
229
+ - spec/ballast/configuration_spec.rb
226
230
  - spec/ballast/context_spec.rb
227
231
  - spec/ballast/errors_spec.rb
228
232
  - spec/ballast/middlewares/default_host_spec.rb