humidifier-reservoir 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5f85405b3ffe729d470851826a69df6b15d44f2
4
- data.tar.gz: c6e4936a707be0f47cc9d7c27eedebc71737fcae
3
+ metadata.gz: d7d20aa3a279e1a06147c7d6a1f7bcdce6b64817
4
+ data.tar.gz: b53f34b255a333ed55426654b0395268e9925bc1
5
5
  SHA512:
6
- metadata.gz: fef30451ce5594b6c710a5c157284718b87beba2c9553e9086c1c538fbff0aab9ac4495a740d125b1bee77b36b2cc9c6190c7d83e76568bdadbd68db26d8b8d4
7
- data.tar.gz: 9ca01c48c83975c056cd9a9bdb8d04e831fde8a31adf3b5b788b9a2cb43f5e4b9339ef549f3202ddd0814f0d21cb3ac748d4e073e4ed86c594cdba5f3aa2581e
6
+ metadata.gz: 7000ae7f9d8768d1fa793ab62585937bfc6e93c432bd2b4a0dd0d11ef4797af65f87a4382e4921877a7ab407897a791794c1608d2d1f6a0d5fd8b3abe13c45ee
7
+ data.tar.gz: bfc1e3fac90140b7e1fd2b50831242307bbd5e991ebbaf39205497da00842e8f3ad4752565a845712b451e1aeb2aff5d59e8539472fdec8af7721d8264c66327
data/.rubocop.yml CHANGED
@@ -1,14 +1,17 @@
1
1
  AllCops:
2
2
  DisplayCopNames: true
3
3
  DisplayStyleGuide: true
4
- TargetRubyVersion: 2.0
4
+ TargetRubyVersion: 2.1
5
5
  Exclude:
6
6
  - 'vendor/**/*'
7
7
 
8
8
  Metrics/LineLength:
9
9
  Max: 100
10
10
 
11
+ Style/IndentHeredoc:
12
+ Enabled: false
13
+
11
14
  Style/PercentLiteralDelimiters:
12
15
  PreferredDelimiters:
13
- '%i': '[]'
14
- '%w': '[]'
16
+ default: '[]'
17
+ '%r': '{}'
data/.yardopts ADDED
@@ -0,0 +1,7 @@
1
+ --title 'Humidifier::Reservoir'
2
+ --no-private
3
+ --markup markdown
4
+ --quiet
5
+ --output-dir docs
6
+ -
7
+ LICENSE
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/localytics/humidifier-reservoir.svg?branch=master)](https://travis-ci.org/localytics/humidifier-reservoir)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/localytics/humidifier-reservoir/badge.svg?branch=master&t=GKTl7x)](https://coveralls.io/github/localytics/humidifier-reservoir?branch=master)
5
+ [![Gem](https://img.shields.io/gem/v/humidifier-reservoir.svg)](https://rubygems.org/gems/humidifier-reservoir)
5
6
 
6
7
  `Reservoir` is a plugin for the [`humidifier`](https://github.com/localytics/humidifier) gem that allows you to specify CloudFormation resources in [yaml](http://yaml.org/) syntax, while still allowing you to take advantage of the flexibility of `humidifier`.
7
8
 
data/Rakefile CHANGED
@@ -2,6 +2,7 @@ require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
3
 
4
4
  Rake::TestTask.new(:test) do |t|
5
+ t.warning = false
5
6
  t.libs << 'test'
6
7
  t.libs << 'lib'
7
8
  t.test_files = FileList['test/**/*_test.rb']
@@ -0,0 +1,457 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Humidifier::Reservoir::BaseMapper
8
+
9
+ &mdash; Humidifier::Reservoir
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
+ pathId = "Humidifier::Reservoir::BaseMapper";
19
+ relpath = '../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../_index.html">Index (B)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../Humidifier.html" title="Humidifier (module)">Humidifier</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Reservoir.html" title="Humidifier::Reservoir (module)">Reservoir</a></span></span>
41
+ &raquo;
42
+ <span class="title">BaseMapper</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Humidifier::Reservoir::BaseMapper
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Humidifier::Reservoir::BaseMapper</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/humidifier/reservoir/base_mapper.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>The parent class for mapper classes. These classes are used to transform
106
+ arbitrary attributes coming from the user-provided YAML files into valid
107
+ CloudFormation attributes that can then be used in the template. This class
108
+ provides an easy-to-extend DSL that allows for default attributes
109
+ specifying custom attributes.</p>
110
+
111
+
112
+ </div>
113
+ </div>
114
+ <div class="tags">
115
+
116
+
117
+ </div>
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+ <h2>
126
+ Class Method Summary
127
+ <small><a href="#" class="summary_toggle">collapse</a></small>
128
+ </h2>
129
+
130
+ <ul class="summary">
131
+
132
+ <li class="public ">
133
+ <span class="summary_signature">
134
+
135
+ <a href="#attribute-class_method" title="attribute (class method)">.<strong>attribute</strong>(name, &amp;block) &#x21d2; Object </a>
136
+
137
+
138
+
139
+ </span>
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ <span class="summary_desc"><div class='inline'>
150
+ <p>Defines a custom attribute.</p>
151
+ </div></span>
152
+
153
+ </li>
154
+
155
+
156
+ <li class="public ">
157
+ <span class="summary_signature">
158
+
159
+ <a href="#attribute_methods-class_method" title="attribute_methods (class method)">.<strong>attribute_methods</strong> &#x21d2; Object </a>
160
+
161
+
162
+
163
+ </span>
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+ <span class="summary_desc"><div class='inline'>
174
+ <p>The names of the custom attribute methods.</p>
175
+ </div></span>
176
+
177
+ </li>
178
+
179
+
180
+ <li class="public ">
181
+ <span class="summary_signature">
182
+
183
+ <a href="#defaults-class_method" title="defaults (class method)">.<strong>defaults</strong>(&amp;block) &#x21d2; Object </a>
184
+
185
+
186
+
187
+ </span>
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+ <span class="summary_desc"><div class='inline'>
198
+ <p>Defines the default attributes that should be applied to all resources of
199
+ this type.</p>
200
+ </div></span>
201
+
202
+ </li>
203
+
204
+
205
+ </ul>
206
+
207
+ <h2>
208
+ Instance Method Summary
209
+ <small><a href="#" class="summary_toggle">collapse</a></small>
210
+ </h2>
211
+
212
+ <ul class="summary">
213
+
214
+ <li class="public ">
215
+ <span class="summary_signature">
216
+
217
+ <a href="#resource_for-instance_method" title="#resource_for (instance method)">#<strong>resource_for</strong>(clazz, name, attributes) &#x21d2; Object </a>
218
+
219
+
220
+
221
+ </span>
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+ <span class="summary_desc"><div class='inline'>
232
+ <p>Builds a humidifier resource using the given humidifier resource class, the
233
+ logical name for the resource, and the user-specified attributes.</p>
234
+ </div></span>
235
+
236
+ </li>
237
+
238
+
239
+ </ul>
240
+
241
+
242
+
243
+
244
+ <div id="class_method_details" class="method_details_list">
245
+ <h2>Class Method Details</h2>
246
+
247
+
248
+ <div class="method_details first">
249
+ <h3 class="signature first" id="attribute-class_method">
250
+
251
+ .<strong>attribute</strong>(name, &amp;block) &#x21d2; <tt>Object</tt>
252
+
253
+
254
+
255
+
256
+
257
+ </h3><div class="docstring">
258
+ <div class="discussion">
259
+
260
+ <p>Defines a custom attribute. The given block will receive the user-provided
261
+ value for the attribute. The block should return a hash where the keys are
262
+ valid humidifier properties and the values are valid values for those
263
+ properties. In the below example, we specify the group attribute which maps
264
+ to the groups attribute after some transformation.</p>
265
+
266
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:group</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_group'>group</span><span class='op'>|</span>
267
+ <span class='id identifier rubyid_groups'>groups</span> <span class='op'>=</span> <span class='const'>GROUPS</span><span class='lbracket'>[</span><span class='id identifier rubyid_group'>group</span><span class='rbracket'>]</span>
268
+ <span class='id identifier rubyid_groups'>groups</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='op'>?</span> <span class='lbrace'>{</span> <span class='label'>groups:</span> <span class='const'>GROUPS</span><span class='lbracket'>[</span><span class='id identifier rubyid_group'>group</span><span class='rbracket'>]</span> <span class='rbrace'>}</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
269
+ <span class='kw'>end</span>
270
+ </code></pre>
271
+
272
+
273
+ </div>
274
+ </div>
275
+ <div class="tags">
276
+
277
+
278
+ </div><table class="source_code">
279
+ <tr>
280
+ <td>
281
+ <pre class="lines">
282
+
283
+
284
+ 21
285
+ 22
286
+ 23
287
+ 24</pre>
288
+ </td>
289
+ <td>
290
+ <pre class="code"><span class="info file"># File 'lib/humidifier/reservoir/base_mapper.rb', line 21</span>
291
+
292
+ <span class='kw'>def</span> <span class='id identifier rubyid_attribute'>attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
293
+ <span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='symbol'>:attribute_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
294
+ <span class='id identifier rubyid_attribute_methods'>attribute_methods</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_name'>name</span>
295
+ <span class='kw'>end</span></pre>
296
+ </td>
297
+ </tr>
298
+ </table>
299
+ </div>
300
+
301
+ <div class="method_details ">
302
+ <h3 class="signature " id="attribute_methods-class_method">
303
+
304
+ .<strong>attribute_methods</strong> &#x21d2; <tt>Object</tt>
305
+
306
+
307
+
308
+
309
+
310
+ </h3><div class="docstring">
311
+ <div class="discussion">
312
+
313
+ <p>The names of the custom attribute methods.</p>
314
+
315
+
316
+ </div>
317
+ </div>
318
+ <div class="tags">
319
+
320
+
321
+ </div><table class="source_code">
322
+ <tr>
323
+ <td>
324
+ <pre class="lines">
325
+
326
+
327
+ 27
328
+ 28
329
+ 29</pre>
330
+ </td>
331
+ <td>
332
+ <pre class="code"><span class="info file"># File 'lib/humidifier/reservoir/base_mapper.rb', line 27</span>
333
+
334
+ <span class='kw'>def</span> <span class='id identifier rubyid_attribute_methods'>attribute_methods</span>
335
+ <span class='ivar'>@attribute_methods</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
336
+ <span class='kw'>end</span></pre>
337
+ </td>
338
+ </tr>
339
+ </table>
340
+ </div>
341
+
342
+ <div class="method_details ">
343
+ <h3 class="signature " id="defaults-class_method">
344
+
345
+ .<strong>defaults</strong>(&amp;block) &#x21d2; <tt>Object</tt>
346
+
347
+
348
+
349
+
350
+
351
+ </h3><div class="docstring">
352
+ <div class="discussion">
353
+
354
+ <p>Defines the default attributes that should be applied to all resources of
355
+ this type. The given block will be passed the logical resource name that
356
+ the user specified for the resource. The block should return a hash where
357
+ the keys are valid humidifier properties and the values are valid values
358
+ for those properties. In the example below, the user_name property is set
359
+ based on the logical name.</p>
360
+
361
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_defaults'>defaults</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='op'>|</span>
362
+ <span class='lbrace'>{</span> <span class='label'>user_name:</span> <span class='id identifier rubyid_name'>name</span> <span class='rbrace'>}</span>
363
+ <span class='kw'>end</span>
364
+ </code></pre>
365
+
366
+
367
+ </div>
368
+ </div>
369
+ <div class="tags">
370
+
371
+
372
+ </div><table class="source_code">
373
+ <tr>
374
+ <td>
375
+ <pre class="lines">
376
+
377
+
378
+ 41
379
+ 42
380
+ 43</pre>
381
+ </td>
382
+ <td>
383
+ <pre class="code"><span class="info file"># File 'lib/humidifier/reservoir/base_mapper.rb', line 41</span>
384
+
385
+ <span class='kw'>def</span> <span class='id identifier rubyid_defaults'>defaults</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
386
+ <span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='symbol'>:attribute_defaults</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
387
+ <span class='kw'>end</span></pre>
388
+ </td>
389
+ </tr>
390
+ </table>
391
+ </div>
392
+
393
+ </div>
394
+
395
+ <div id="instance_method_details" class="method_details_list">
396
+ <h2>Instance Method Details</h2>
397
+
398
+
399
+ <div class="method_details first">
400
+ <h3 class="signature first" id="resource_for-instance_method">
401
+
402
+ #<strong>resource_for</strong>(clazz, name, attributes) &#x21d2; <tt>Object</tt>
403
+
404
+
405
+
406
+
407
+
408
+ </h3><div class="docstring">
409
+ <div class="discussion">
410
+
411
+ <p>Builds a humidifier resource using the given humidifier resource class, the
412
+ logical name for the resource, and the user-specified attributes.</p>
413
+
414
+
415
+ </div>
416
+ </div>
417
+ <div class="tags">
418
+
419
+
420
+ </div><table class="source_code">
421
+ <tr>
422
+ <td>
423
+ <pre class="lines">
424
+
425
+
426
+ 48
427
+ 49
428
+ 50
429
+ 51
430
+ 52</pre>
431
+ </td>
432
+ <td>
433
+ <pre class="code"><span class="info file"># File 'lib/humidifier/reservoir/base_mapper.rb', line 48</span>
434
+
435
+ <span class='kw'>def</span> <span class='id identifier rubyid_resource_for'>resource_for</span><span class='lparen'>(</span><span class='id identifier rubyid_clazz'>clazz</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_attributes'>attributes</span><span class='rparen'>)</span>
436
+ <span class='id identifier rubyid_mapped'>mapped</span> <span class='op'>=</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:attribute_defaults</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_attribute_defaults'>attribute_defaults</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
437
+ <span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_mapped'>mapped</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_mapped_from'>mapped_from</span><span class='lparen'>(</span><span class='id identifier rubyid_clazz'>clazz</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
438
+ <span class='id identifier rubyid_clazz'>clazz</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_mapped'>mapped</span><span class='rparen'>)</span>
439
+ <span class='kw'>end</span></pre>
440
+ </td>
441
+ </tr>
442
+ </table>
443
+ </div>
444
+
445
+ </div>
446
+
447
+ </div>
448
+
449
+ <div id="footer">
450
+ Generated on Sun Oct 1 09:25:22 2017 by
451
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
452
+ 0.9.9 (ruby-2.4.1).
453
+ </div>
454
+
455
+ </div>
456
+ </body>
457
+ </html>