app_stack 1.1.4 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/Gemfile.lock +43 -0
  2. data/README.md +49 -38
  3. data/doc/coverage/.last_run.json +1 -0
  4. data/doc/coverage/.resultset.json +1 -0
  5. data/doc/coverage/assets/0.7.1/application.css +1110 -0
  6. data/doc/coverage/assets/0.7.1/application.js +626 -0
  7. data/doc/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
  8. data/doc/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
  9. data/doc/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
  10. data/doc/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
  11. data/doc/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
  12. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
  13. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
  14. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
  15. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
  16. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
  17. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
  18. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
  19. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
  20. data/doc/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
  21. data/doc/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
  22. data/doc/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
  23. data/doc/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
  24. data/doc/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
  25. data/doc/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
  26. data/doc/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
  27. data/doc/coverage/assets/0.7.1/favicon_green.png +0 -0
  28. data/doc/coverage/assets/0.7.1/favicon_red.png +0 -0
  29. data/doc/coverage/assets/0.7.1/favicon_yellow.png +0 -0
  30. data/doc/coverage/assets/0.7.1/loading.gif +0 -0
  31. data/doc/coverage/assets/0.7.1/magnify.png +0 -0
  32. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  33. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  34. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  35. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  36. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  37. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  38. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  39. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  40. data/doc/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
  41. data/doc/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  42. data/doc/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
  43. data/doc/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
  44. data/doc/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  45. data/doc/coverage/index.html +2420 -0
  46. data/lib/app_stack/config.rb +132 -0
  47. data/lib/app_stack/merger.rb +127 -0
  48. data/lib/app_stack/version.rb +1 -1
  49. data/lib/app_stack.rb +15 -246
  50. data/spec/config_spec.rb +82 -0
  51. data/spec/fixtures/config_sample/sample.yml +19 -0
  52. data/spec/fixtures/config_sample/wrong_key.yml +2 -0
  53. data/spec/fixtures/config_sample/wrong_type.yml +1 -0
  54. data/spec/fixtures/sample_files/module_1/Gemfile.erb +1 -0
  55. data/spec/fixtures/sample_files/module_1/app_stack.yml +10 -0
  56. data/spec/fixtures/sample_files/module_1/doc/excluding.txt +1 -0
  57. data/spec/fixtures/sample_files/module_1/lib/mixins/b_lib.rb +0 -0
  58. data/spec/fixtures/sample_files/module_1/lib/mixins/s_lib.rb +0 -0
  59. data/spec/fixtures/sample_files/module_1/lib/samples/a_lib.rb +0 -0
  60. data/spec/fixtures/sample_files/module_1/spec/config_spec.rb +0 -0
  61. data/spec/fixtures/sample_files/module_2/Gemfile +0 -0
  62. data/spec/fixtures/sample_files/module_2/Gemfile.liquid +1 -0
  63. data/spec/fixtures/sample_files/module_2/app/lib/sequence.rb +0 -0
  64. data/spec/fixtures/sample_files/module_2/app_stack.yml +3 -0
  65. data/spec/fixtures/sample_files/module_3/app_stack.yml +3 -0
  66. data/spec/fixtures/sample_files/module_3/bin/del +0 -0
  67. data/spec/fixtures/sample_files/module_3/bin/rm +0 -0
  68. data/spec/fixtures/sample_files/module_3/config/application.yml +0 -0
  69. data/spec/fixtures/sample_files/module_3/config/database_development.yml +0 -0
  70. data/spec/fixtures/sample_files/module_3/config/database_production.yml +0 -0
  71. data/spec/fixtures/sample_files/module_3/lib/libfile_1.rb +0 -0
  72. data/spec/fixtures/sample_files/module_3/lib/libfile_2.rb +0 -0
  73. data/spec/fixtures/sample_files/my_app/app_stack.yml +15 -0
  74. data/spec/fixtures/sample_files/my_app/doc/excluding.txt +1 -0
  75. data/spec/fixtures/sample_files/my_app/spec/config_spec.rb +0 -0
  76. data/spec/fixtures/sample_files/my_app_back/app_stack.yml +15 -0
  77. data/spec/fixtures/sample_files/my_app_back/doc/excluding.txt +1 -0
  78. data/spec/fixtures/sample_files/my_app_back/spec/config_spec.rb +0 -0
  79. data/spec/merger_spec.rb +43 -0
  80. data/spec/spec_helper.rb +6 -8
  81. data/spec/stackup_spec.rb +11 -50
  82. metadata +94 -47
  83. data/spec/app_as_hash_spec.rb +0 -15
  84. data/spec/export_list_spec.rb +0 -66
  85. data/spec/fixtures/.app_stack.yml +0 -21
  86. data/spec/fixtures/app-sample.yml +0 -25
  87. data/spec/fixtures/incexc/.gitignore +0 -27
  88. data/spec/fixtures/incexc/incexc-config.yml +0 -24
  89. data/spec/fixtures/incexc/lib/anyway.rb +0 -1
  90. data/spec/fixtures/incexc/lib/extra/excludes.rb +0 -1
  91. data/spec/fixtures/incexc/lib/mixin/otherlib.rb +0 -1
  92. data/spec/fixtures/incexc/spec/spec_helper.rb +0 -1
  93. data/spec/fixtures/incexc/spec/support/api_test.rb +0 -1
  94. data/spec/fixtures/incexc-config.yml +0 -23
  95. data/spec/fixtures/my_app/.app_stack.yml +0 -31
  96. data/spec/fixtures/my_app/.gitignore +0 -27
  97. data/spec/fixtures/my_app/config/self_render.conf.erb +0 -1
  98. data/spec/fixtures/sample_config.yml +0 -21
  99. data/spec/fixtures/stack_apps/module-1/.app_stack.yml +0 -17
  100. data/spec/fixtures/stack_apps/module-1/Gemfile +0 -3
  101. data/spec/fixtures/stack_apps/module-1/lib/auth_util.rb +0 -5
  102. data/spec/fixtures/stack_apps/module-1/lib/libonly1.rb +0 -6
  103. data/spec/fixtures/stack_apps/module-2/.app_stack.yml +0 -22
  104. data/spec/fixtures/stack_apps/module-2/Gemfile.erb +0 -11
  105. data/spec/fixtures/stack_apps/module-2/lib/auth_util.rb +0 -6
  106. data/spec/fixtures/stack_apps/module-2/lib/libonly2.rb +0 -6
  107. data/spec/gitignore_list_spec.rb +0 -21
  108. data/spec/load_configuration_spec.rb +0 -16
  109. data/spec/register_self_spec.rb +0 -13
  110. /data/spec/fixtures/{stack_apps/module-2 → sample_files/module_1}/Gemfile +0 -0
  111. /data/spec/fixtures/{incexc → sample_files/module_1}/Rakefile +0 -0
  112. /data/spec/fixtures/{incexc/.rspec → sample_files/module_1/config/boot_sample.rb} +0 -0
  113. /data/spec/fixtures/{incexc/Rakefile.erb → sample_files/module_1/doc/including.txt} +0 -0
@@ -0,0 +1,2420 @@
1
+ <!DOCTYPE html>
2
+ <html xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <title>Code coverage for App stack-gem</title>
5
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
+ <script src='./assets/0.7.1/application.js' type='text/javascript'></script>
7
+ <link href='./assets/0.7.1/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
8
+ <link rel="shortcut icon" type="image/png" href="./assets/0.7.1/favicon_green.png" />
9
+ <link rel="icon" type="image/png" href="./assets/0.7.1/favicon.png" />
10
+ </head>
11
+
12
+ <body>
13
+ <div id="loading">
14
+ <img src="./assets/0.7.1/loading.gif" alt="loading"/>
15
+ </div>
16
+ <div id="wrapper" style="display:none;">
17
+ <div class="timestamp">Generated <abbr class="timeago" title="2013-10-02T16:23:59+08:00">2013-10-02T16:23:59+08:00</abbr></div>
18
+ <ul class="group_tabs"></ul>
19
+
20
+ <div id="content">
21
+ <div class="file_list_container" id="AllFiles">
22
+ <h2>
23
+ <span class="group_name">All Files</span>
24
+ (<span class="covered_percent"><span class="green">94.33%</span></span>
25
+ covered at
26
+ <span class="covered_strength">
27
+ <span class="green">
28
+ 7.44
29
+ </span>
30
+ </span> hits/line)
31
+ </h2>
32
+ <a name="AllFiles"></a>
33
+ <div>
34
+ <b>8</b> files in total.
35
+ <b>194</b> relevant lines.
36
+ <span class="green"><b>183</b> lines covered</span> and
37
+ <span class="red"><b>11</b> lines missed </span>
38
+ </div>
39
+ <table class="file_list">
40
+ <thead>
41
+ <tr>
42
+ <th>File</th>
43
+ <th>% covered</th>
44
+ <th>Lines</th>
45
+ <th>Relevant Lines</th>
46
+ <th>Lines covered</th>
47
+ <th>Lines missed</th>
48
+ <th>Avg. Hits / Line</th>
49
+ </tr>
50
+ </thead>
51
+ <tbody>
52
+
53
+ <tr>
54
+ <td class="strong"><a href="#0c9f2e63d4801e7f4faff46ee097b6a9705601fe" class="src_link" title="lib/app_stack.rb">lib/app_stack.rb</a></td>
55
+ <td class="green strong">100.0 %</td>
56
+ <td>35</td>
57
+ <td>18</td>
58
+ <td>18</td>
59
+ <td>0</td>
60
+ <td>1.1</td>
61
+ </tr>
62
+
63
+ <tr>
64
+ <td class="strong"><a href="#b188836d957fa0ad1989c995fbd2a7fb4f285bfb" class="src_link" title="lib/app_stack/config.rb">lib/app_stack/config.rb</a></td>
65
+ <td class="green strong">100.0 %</td>
66
+ <td>132</td>
67
+ <td>62</td>
68
+ <td>62</td>
69
+ <td>0</td>
70
+ <td>43.7</td>
71
+ </tr>
72
+
73
+ <tr>
74
+ <td class="strong"><a href="#6efd526042569fe4b2332978c90171abe4fc0f64" class="src_link" title="lib/app_stack/merger.rb">lib/app_stack/merger.rb</a></td>
75
+ <td class="yellow strong">85.53 %</td>
76
+ <td>127</td>
77
+ <td>76</td>
78
+ <td>65</td>
79
+ <td>11</td>
80
+ <td>12.5</td>
81
+ </tr>
82
+
83
+ <tr>
84
+ <td class="strong"><a href="#7f610dcfea9eb3bfc05696df6babc3086014b112" class="src_link" title="spec/fixtures/sample_files/module_1/spec/config_spec.rb">spec/fixtures/sample_files/module_1/spec/config_spec.rb</a></td>
85
+ <td class="green strong">100.0 %</td>
86
+ <td>0</td>
87
+ <td>0</td>
88
+ <td>0</td>
89
+ <td>0</td>
90
+ <td>0</td>
91
+ </tr>
92
+
93
+ <tr>
94
+ <td class="strong"><a href="#ee5b5b721d21a4b9f829724043ebca2c488df3f8" class="src_link" title="spec/fixtures/sample_files/my_app/spec/config_spec.rb">spec/fixtures/sample_files/my_app/spec/config_spec.rb</a></td>
95
+ <td class="green strong">100.0 %</td>
96
+ <td>0</td>
97
+ <td>0</td>
98
+ <td>0</td>
99
+ <td>0</td>
100
+ <td>0</td>
101
+ </tr>
102
+
103
+ <tr>
104
+ <td class="strong"><a href="#69008267ecc76d7096c507f87f0105551e06e319" class="src_link" title="spec/fixtures/sample_files/my_app_back/spec/config_spec.rb">spec/fixtures/sample_files/my_app_back/spec/config_spec.rb</a></td>
105
+ <td class="green strong">100.0 %</td>
106
+ <td>0</td>
107
+ <td>0</td>
108
+ <td>0</td>
109
+ <td>0</td>
110
+ <td>0</td>
111
+ </tr>
112
+
113
+ <tr>
114
+ <td class="strong"><a href="#da69bc65ab23290dcbba0841418d0f64bec9f389" class="src_link" title="spec/merger_spec.rb">spec/merger_spec.rb</a></td>
115
+ <td class="green strong">100.0 %</td>
116
+ <td>43</td>
117
+ <td>26</td>
118
+ <td>26</td>
119
+ <td>0</td>
120
+ <td>1.2</td>
121
+ </tr>
122
+
123
+ <tr>
124
+ <td class="strong"><a href="#36cf8ee74ad0aed8b9e2c51cc062f25c3bcf5f51" class="src_link" title="spec/stackup_spec.rb">spec/stackup_spec.rb</a></td>
125
+ <td class="green strong">100.0 %</td>
126
+ <td>17</td>
127
+ <td>12</td>
128
+ <td>12</td>
129
+ <td>0</td>
130
+ <td>1.0</td>
131
+ </tr>
132
+
133
+ </tbody>
134
+ </table>
135
+ </div>
136
+
137
+
138
+
139
+ </div>
140
+
141
+ <div id="footer">
142
+ Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.7.1
143
+ and simplecov-html v0.7.1<br/>
144
+ using RSpec
145
+ </div>
146
+
147
+ <div class="source_files">
148
+
149
+ <div class="source_table" id="0c9f2e63d4801e7f4faff46ee097b6a9705601fe">
150
+ <div class="header">
151
+ <h3>lib/app_stack.rb</h3>
152
+ <h4><span class="green">100.0 %</span> covered</h4>
153
+ <div>
154
+ <b>18</b> relevant lines.
155
+ <span class="green"><b>18</b> lines covered</span> and
156
+ <span class="red"><b>0</b> lines missed.</span>
157
+ </div>
158
+ </div>
159
+
160
+ <pre>
161
+ <ol>
162
+
163
+ <li class="never" data-hits="" data-linenumber="1">
164
+
165
+
166
+ <code class="ruby"># encoding: utf-8</code>
167
+ </li>
168
+
169
+ <li class="never" data-hits="" data-linenumber="2">
170
+
171
+
172
+ <code class="ruby"></code>
173
+ </li>
174
+
175
+ <li class="covered" data-hits="1" data-linenumber="3">
176
+ <span class="hits">1</span>
177
+
178
+ <code class="ruby">require 'yaml'</code>
179
+ </li>
180
+
181
+ <li class="covered" data-hits="1" data-linenumber="4">
182
+ <span class="hits">1</span>
183
+
184
+ <code class="ruby">require 'find'</code>
185
+ </li>
186
+
187
+ <li class="covered" data-hits="1" data-linenumber="5">
188
+ <span class="hits">1</span>
189
+
190
+ <code class="ruby">require 'fileutils'</code>
191
+ </li>
192
+
193
+ <li class="covered" data-hits="1" data-linenumber="6">
194
+ <span class="hits">1</span>
195
+
196
+ <code class="ruby">require 'ostruct'</code>
197
+ </li>
198
+
199
+ <li class="covered" data-hits="1" data-linenumber="7">
200
+ <span class="hits">1</span>
201
+
202
+ <code class="ruby">require 'tilt'</code>
203
+ </li>
204
+
205
+ <li class="covered" data-hits="1" data-linenumber="8">
206
+ <span class="hits">1</span>
207
+
208
+ <code class="ruby">require 'pathname'</code>
209
+ </li>
210
+
211
+ <li class="covered" data-hits="1" data-linenumber="9">
212
+ <span class="hits">1</span>
213
+
214
+ <code class="ruby">require 'active_support/core_ext/hash/deep_merge'</code>
215
+ </li>
216
+
217
+ <li class="never" data-hits="" data-linenumber="10">
218
+
219
+
220
+ <code class="ruby"></code>
221
+ </li>
222
+
223
+ <li class="covered" data-hits="1" data-linenumber="11">
224
+ <span class="hits">1</span>
225
+
226
+ <code class="ruby">require 'term/ansicolor'</code>
227
+ </li>
228
+
229
+ <li class="never" data-hits="" data-linenumber="12">
230
+
231
+
232
+ <code class="ruby"># mixin String class for term-color methods</code>
233
+ </li>
234
+
235
+ <li class="covered" data-hits="2" data-linenumber="13">
236
+ <span class="hits">2</span>
237
+
238
+ <code class="ruby">class String; include Term::ANSIColor end</code>
239
+ </li>
240
+
241
+ <li class="never" data-hits="" data-linenumber="14">
242
+
243
+
244
+ <code class="ruby"></code>
245
+ </li>
246
+
247
+ <li class="covered" data-hits="1" data-linenumber="15">
248
+ <span class="hits">1</span>
249
+
250
+ <code class="ruby">require 'app_stack/config'</code>
251
+ </li>
252
+
253
+ <li class="never" data-hits="" data-linenumber="16">
254
+
255
+
256
+ <code class="ruby"># require 'app_stack/copier'</code>
257
+ </li>
258
+
259
+ <li class="covered" data-hits="1" data-linenumber="17">
260
+ <span class="hits">1</span>
261
+
262
+ <code class="ruby">require 'app_stack/merger'</code>
263
+ </li>
264
+
265
+ <li class="never" data-hits="" data-linenumber="18">
266
+
267
+
268
+ <code class="ruby"></code>
269
+ </li>
270
+
271
+ <li class="never" data-hits="" data-linenumber="19">
272
+
273
+
274
+ <code class="ruby">## A namespace for app-stack based modules</code>
275
+ </li>
276
+
277
+ <li class="covered" data-hits="1" data-linenumber="20">
278
+ <span class="hits">1</span>
279
+
280
+ <code class="ruby">module AppStack</code>
281
+ </li>
282
+
283
+ <li class="covered" data-hits="1" data-linenumber="21">
284
+ <span class="hits">1</span>
285
+
286
+ <code class="ruby"> CONF_FILE = './.app_stack.yml'</code>
287
+ </li>
288
+
289
+ <li class="never" data-hits="" data-linenumber="22">
290
+
291
+
292
+ <code class="ruby"></code>
293
+ </li>
294
+
295
+ <li class="never" data-hits="" data-linenumber="23">
296
+
297
+
298
+ <code class="ruby"></code>
299
+ </li>
300
+
301
+ <li class="never" data-hits="" data-linenumber="24">
302
+
303
+
304
+ <code class="ruby"> # based on conf_file, merge up from stack of applications</code>
305
+ </li>
306
+
307
+ <li class="covered" data-hits="1" data-linenumber="25">
308
+ <span class="hits">1</span>
309
+
310
+ <code class="ruby"> def stackup!(conf_file)</code>
311
+ </li>
312
+
313
+ <li class="never" data-hits="" data-linenumber="26">
314
+
315
+
316
+ <code class="ruby"> # merge files from stacks</code>
317
+ </li>
318
+
319
+ <li class="covered" data-hits="1" data-linenumber="27">
320
+ <span class="hits">1</span>
321
+
322
+ <code class="ruby"> conf_file ||= CONF_FILE</code>
323
+ </li>
324
+
325
+ <li class="covered" data-hits="1" data-linenumber="28">
326
+ <span class="hits">1</span>
327
+
328
+ <code class="ruby"> mger = Merger.new(conf_file)</code>
329
+ </li>
330
+
331
+ <li class="never" data-hits="" data-linenumber="29">
332
+
333
+
334
+ <code class="ruby"></code>
335
+ </li>
336
+
337
+ <li class="never" data-hits="" data-linenumber="30">
338
+
339
+
340
+ <code class="ruby"> # not run, just prepare in vobose mode</code>
341
+ </li>
342
+
343
+ <li class="covered" data-hits="1" data-linenumber="31">
344
+ <span class="hits">1</span>
345
+
346
+ <code class="ruby"> ENV['NR'] ? mger.prepare(true) : mger.merge!</code>
347
+ </li>
348
+
349
+ <li class="never" data-hits="" data-linenumber="32">
350
+
351
+
352
+ <code class="ruby"> end</code>
353
+ </li>
354
+
355
+ <li class="never" data-hits="" data-linenumber="33">
356
+
357
+
358
+ <code class="ruby"></code>
359
+ </li>
360
+
361
+ <li class="covered" data-hits="1" data-linenumber="34">
362
+ <span class="hits">1</span>
363
+
364
+ <code class="ruby"> module_function :stackup!</code>
365
+ </li>
366
+
367
+ <li class="never" data-hits="" data-linenumber="35">
368
+
369
+
370
+ <code class="ruby">end</code>
371
+ </li>
372
+
373
+ </ol>
374
+ </pre>
375
+ </div>
376
+
377
+ <div class="source_table" id="b188836d957fa0ad1989c995fbd2a7fb4f285bfb">
378
+ <div class="header">
379
+ <h3>lib/app_stack/config.rb</h3>
380
+ <h4><span class="green">100.0 %</span> covered</h4>
381
+ <div>
382
+ <b>62</b> relevant lines.
383
+ <span class="green"><b>62</b> lines covered</span> and
384
+ <span class="red"><b>0</b> lines missed.</span>
385
+ </div>
386
+ </div>
387
+
388
+ <pre>
389
+ <ol>
390
+
391
+ <li class="never" data-hits="" data-linenumber="1">
392
+
393
+
394
+ <code class="ruby"># encoding: utf-8</code>
395
+ </li>
396
+
397
+ <li class="covered" data-hits="1" data-linenumber="2">
398
+ <span class="hits">1</span>
399
+
400
+ <code class="ruby">require 'yaml'</code>
401
+ </li>
402
+
403
+ <li class="never" data-hits="" data-linenumber="3">
404
+
405
+
406
+ <code class="ruby"></code>
407
+ </li>
408
+
409
+ <li class="covered" data-hits="1" data-linenumber="4">
410
+ <span class="hits">1</span>
411
+
412
+ <code class="ruby">module AppStack</code>
413
+ </li>
414
+
415
+ <li class="covered" data-hits="1" data-linenumber="5">
416
+ <span class="hits">1</span>
417
+
418
+ <code class="ruby"> class ParseError &lt; RuntimeError; end</code>
419
+ </li>
420
+
421
+ <li class="never" data-hits="" data-linenumber="6">
422
+
423
+
424
+ <code class="ruby"></code>
425
+ </li>
426
+
427
+ <li class="never" data-hits="" data-linenumber="7">
428
+
429
+
430
+ <code class="ruby"> # an object represent information from .app_stack.yml file</code>
431
+ </li>
432
+
433
+ <li class="covered" data-hits="1" data-linenumber="8">
434
+ <span class="hits">1</span>
435
+
436
+ <code class="ruby"> class Config</code>
437
+ </li>
438
+
439
+ <li class="covered" data-hits="1" data-linenumber="9">
440
+ <span class="hits">1</span>
441
+
442
+ <code class="ruby"> attr_reader :filename, :copy_list</code>
443
+ </li>
444
+
445
+ <li class="never" data-hits="" data-linenumber="10">
446
+
447
+
448
+ <code class="ruby"></code>
449
+ </li>
450
+
451
+ <li class="covered" data-hits="1" data-linenumber="11">
452
+ <span class="hits">1</span>
453
+
454
+ <code class="ruby"> def initialize(file)</code>
455
+ </li>
456
+
457
+ <li class="covered" data-hits="39" data-linenumber="12">
458
+ <span class="hits">39</span>
459
+
460
+ <code class="ruby"> @filename = File.expand_path(file)</code>
461
+ </li>
462
+
463
+ <li class="covered" data-hits="39" data-linenumber="13">
464
+ <span class="hits">39</span>
465
+
466
+ <code class="ruby"> yml = YAML.load(File.open(@filename, 'r:utf-8').read)</code>
467
+ </li>
468
+
469
+ <li class="never" data-hits="" data-linenumber="14">
470
+
471
+
472
+ <code class="ruby"></code>
473
+ </li>
474
+
475
+ <li class="never" data-hits="" data-linenumber="15">
476
+
477
+
478
+ <code class="ruby"> # default configuration, also restrict known keys and data type</code>
479
+ </li>
480
+
481
+ <li class="covered" data-hits="39" data-linenumber="16">
482
+ <span class="hits">39</span>
483
+
484
+ <code class="ruby"> @config = {</code>
485
+ </li>
486
+
487
+ <li class="never" data-hits="" data-linenumber="17">
488
+
489
+
490
+ <code class="ruby"> stack: [],</code>
491
+ </li>
492
+
493
+ <li class="never" data-hits="" data-linenumber="18">
494
+
495
+
496
+ <code class="ruby"> export: [],</code>
497
+ </li>
498
+
499
+ <li class="never" data-hits="" data-linenumber="19">
500
+
501
+
502
+ <code class="ruby"> exclude: [],</code>
503
+ </li>
504
+
505
+ <li class="never" data-hits="" data-linenumber="20">
506
+
507
+
508
+ <code class="ruby"> attrs: {},</code>
509
+ </li>
510
+
511
+ <li class="never" data-hits="" data-linenumber="21">
512
+
513
+
514
+ <code class="ruby"> stack_dir: '../',</code>
515
+ </li>
516
+
517
+ <li class="never" data-hits="" data-linenumber="22">
518
+
519
+
520
+ <code class="ruby"> tpl_ext: %w[.erb .haml .liquid]</code>
521
+ </li>
522
+
523
+ <li class="never" data-hits="" data-linenumber="23">
524
+
525
+
526
+ <code class="ruby"> }</code>
527
+ </li>
528
+
529
+ <li class="never" data-hits="" data-linenumber="24">
530
+
531
+
532
+ <code class="ruby"></code>
533
+ </li>
534
+
535
+ <li class="never" data-hits="" data-linenumber="25">
536
+
537
+
538
+ <code class="ruby"> # use yaml file to set configuration</code>
539
+ </li>
540
+
541
+ <li class="covered" data-hits="39" data-linenumber="26">
542
+ <span class="hits">39</span>
543
+
544
+ <code class="ruby"> yml.each do |k, v|</code>
545
+ </li>
546
+
547
+ <li class="never" data-hits="" data-linenumber="27">
548
+
549
+
550
+ <code class="ruby"> raise ParseError,</code>
551
+ </li>
552
+
553
+ <li class="covered" data-hits="68" data-linenumber="28">
554
+ <span class="hits">68</span>
555
+
556
+ <code class="ruby"> &quot;unkown option `#{k}` in #{@filename}&quot; unless @config[k.to_sym]</code>
557
+ </li>
558
+
559
+ <li class="never" data-hits="" data-linenumber="29">
560
+
561
+
562
+ <code class="ruby"> raise ParseError,</code>
563
+ </li>
564
+
565
+ <li class="never" data-hits="" data-linenumber="30">
566
+
567
+
568
+ <code class="ruby"> &quot;'#{k}' must be a #{@config[k.to_sym].class.to_s}&quot; unless</code>
569
+ </li>
570
+
571
+ <li class="covered" data-hits="67" data-linenumber="31">
572
+ <span class="hits">67</span>
573
+
574
+ <code class="ruby"> v.is_a?(@config[k.to_sym].class)</code>
575
+ </li>
576
+
577
+ <li class="covered" data-hits="66" data-linenumber="32">
578
+ <span class="hits">66</span>
579
+
580
+ <code class="ruby"> @config[k.to_sym] = v</code>
581
+ </li>
582
+
583
+ <li class="never" data-hits="" data-linenumber="33">
584
+
585
+
586
+ <code class="ruby"> end</code>
587
+ </li>
588
+
589
+ <li class="never" data-hits="" data-linenumber="34">
590
+
591
+
592
+ <code class="ruby"></code>
593
+ </li>
594
+
595
+ <li class="never" data-hits="" data-linenumber="35">
596
+
597
+
598
+ <code class="ruby"> # convert stack dir to relative path:</code>
599
+ </li>
600
+
601
+ <li class="covered" data-hits="37" data-linenumber="36">
602
+ <span class="hits">37</span>
603
+
604
+ <code class="ruby"> @config[:stack_dir] = File.expand_path(@config[:stack_dir],</code>
605
+ </li>
606
+
607
+ <li class="never" data-hits="" data-linenumber="37">
608
+
609
+
610
+ <code class="ruby"> File.dirname(@filename))</code>
611
+ </li>
612
+
613
+ <li class="never" data-hits="" data-linenumber="38">
614
+
615
+
616
+ <code class="ruby"></code>
617
+ </li>
618
+
619
+ <li class="never" data-hits="" data-linenumber="39">
620
+
621
+
622
+ <code class="ruby"> # define reader accessors:</code>
623
+ </li>
624
+
625
+ <li class="covered" data-hits="37" data-linenumber="40">
626
+ <span class="hits">37</span>
627
+
628
+ <code class="ruby"> @config.each do |k, v|</code>
629
+ </li>
630
+
631
+ <li class="covered" data-hits="315" data-linenumber="41">
632
+ <span class="hits">315</span>
633
+
634
+ <code class="ruby"> self.class.send(:define_method, k.to_sym) { v }</code>
635
+ </li>
636
+
637
+ <li class="never" data-hits="" data-linenumber="42">
638
+
639
+
640
+ <code class="ruby"> end</code>
641
+ </li>
642
+
643
+ <li class="never" data-hits="" data-linenumber="43">
644
+
645
+
646
+ <code class="ruby"></code>
647
+ </li>
648
+
649
+ <li class="never" data-hits="" data-linenumber="44">
650
+
651
+
652
+ <code class="ruby"> # copy list from merge's view point</code>
653
+ </li>
654
+
655
+ <li class="covered" data-hits="37" data-linenumber="45">
656
+ <span class="hits">37</span>
657
+
658
+ <code class="ruby"> @copy_list = {}</code>
659
+ </li>
660
+
661
+ <li class="never" data-hits="" data-linenumber="46">
662
+
663
+
664
+ <code class="ruby"> end</code>
665
+ </li>
666
+
667
+ <li class="never" data-hits="" data-linenumber="47">
668
+
669
+
670
+ <code class="ruby"></code>
671
+ </li>
672
+
673
+ <li class="covered" data-hits="1" data-linenumber="48">
674
+ <span class="hits">1</span>
675
+
676
+ <code class="ruby"> def directory</code>
677
+ </li>
678
+
679
+ <li class="covered" data-hits="244" data-linenumber="49">
680
+ <span class="hits">244</span>
681
+
682
+ <code class="ruby"> File.expand_path('../', filename)</code>
683
+ </li>
684
+
685
+ <li class="never" data-hits="" data-linenumber="50">
686
+
687
+
688
+ <code class="ruby"> end</code>
689
+ </li>
690
+
691
+ <li class="never" data-hits="" data-linenumber="51">
692
+
693
+
694
+ <code class="ruby"></code>
695
+ </li>
696
+
697
+ <li class="never" data-hits="" data-linenumber="52">
698
+
699
+
700
+ <code class="ruby"> # use the direct name of the config file as app name</code>
701
+ </li>
702
+
703
+ <li class="covered" data-hits="1" data-linenumber="53">
704
+ <span class="hits">1</span>
705
+
706
+ <code class="ruby"> def app_name</code>
707
+ </li>
708
+
709
+ <li class="covered" data-hits="2" data-linenumber="54">
710
+ <span class="hits">2</span>
711
+
712
+ <code class="ruby"> File.basename(File.dirname(File.expand_path(filename)))</code>
713
+ </li>
714
+
715
+ <li class="never" data-hits="" data-linenumber="55">
716
+
717
+
718
+ <code class="ruby"> end</code>
719
+ </li>
720
+
721
+ <li class="never" data-hits="" data-linenumber="56">
722
+
723
+
724
+ <code class="ruby"></code>
725
+ </li>
726
+
727
+ <li class="covered" data-hits="1" data-linenumber="57">
728
+ <span class="hits">1</span>
729
+
730
+ <code class="ruby"> def attr_vars</code>
731
+ </li>
732
+
733
+ <li class="covered" data-hits="22" data-linenumber="58">
734
+ <span class="hits">22</span>
735
+
736
+ <code class="ruby"> @config[:attrs]</code>
737
+ </li>
738
+
739
+ <li class="never" data-hits="" data-linenumber="59">
740
+
741
+
742
+ <code class="ruby"> end</code>
743
+ </li>
744
+
745
+ <li class="never" data-hits="" data-linenumber="60">
746
+
747
+
748
+ <code class="ruby"></code>
749
+ </li>
750
+
751
+ <li class="never" data-hits="" data-linenumber="61">
752
+
753
+
754
+ <code class="ruby"> # get export files list (copy_from =&gt; copy_to hash) for a specific group</code>
755
+ </li>
756
+
757
+ <li class="covered" data-hits="1" data-linenumber="62">
758
+ <span class="hits">1</span>
759
+
760
+ <code class="ruby"> def export_files(group = 'default')</code>
761
+ </li>
762
+
763
+ <li class="covered" data-hits="34" data-linenumber="63">
764
+ <span class="hits">34</span>
765
+
766
+ <code class="ruby"> @export_files ||= parse_export_files</code>
767
+ </li>
768
+
769
+ <li class="covered" data-hits="34" data-linenumber="64">
770
+ <span class="hits">34</span>
771
+
772
+ <code class="ruby"> group = 'default' if group.to_s == 'defaults' # back-compatibility</code>
773
+ </li>
774
+
775
+ <li class="covered" data-hits="34" data-linenumber="65">
776
+ <span class="hits">34</span>
777
+
778
+ <code class="ruby"> @export_files[group.to_s]</code>
779
+ </li>
780
+
781
+ <li class="never" data-hits="" data-linenumber="66">
782
+
783
+
784
+ <code class="ruby"> end</code>
785
+ </li>
786
+
787
+ <li class="never" data-hits="" data-linenumber="67">
788
+
789
+
790
+ <code class="ruby"></code>
791
+ </li>
792
+
793
+ <li class="covered" data-hits="1" data-linenumber="68">
794
+ <span class="hits">1</span>
795
+
796
+ <code class="ruby"> def exclude_files</code>
797
+ </li>
798
+
799
+ <li class="covered" data-hits="49" data-linenumber="69">
800
+ <span class="hits">49</span>
801
+
802
+ <code class="ruby"> @export_files ||= find_files(@config[:exclude], false)</code>
803
+ </li>
804
+
805
+ <li class="never" data-hits="" data-linenumber="70">
806
+
807
+
808
+ <code class="ruby"> end</code>
809
+ </li>
810
+
811
+ <li class="never" data-hits="" data-linenumber="71">
812
+
813
+
814
+ <code class="ruby"></code>
815
+ </li>
816
+
817
+ <li class="covered" data-hits="1" data-linenumber="72">
818
+ <span class="hits">1</span>
819
+
820
+ <code class="ruby"> def add_copy_list(fhsh)</code>
821
+ </li>
822
+
823
+ <li class="covered" data-hits="42" data-linenumber="73">
824
+ <span class="hits">42</span>
825
+
826
+ <code class="ruby"> if fhsh.is_a?(Hash)</code>
827
+ </li>
828
+
829
+ <li class="covered" data-hits="14" data-linenumber="74">
830
+ <span class="hits">14</span>
831
+
832
+ <code class="ruby"> fhsh.each do |fr, to|</code>
833
+ </li>
834
+
835
+ <li class="covered" data-hits="14" data-linenumber="75">
836
+ <span class="hits">14</span>
837
+
838
+ <code class="ruby"> fr = File.expand_path(fr, directory)</code>
839
+ </li>
840
+
841
+ <li class="covered" data-hits="14" data-linenumber="76">
842
+ <span class="hits">14</span>
843
+
844
+ <code class="ruby"> @copy_list[fr] = to</code>
845
+ </li>
846
+
847
+ <li class="never" data-hits="" data-linenumber="77">
848
+
849
+
850
+ <code class="ruby"> end</code>
851
+ </li>
852
+
853
+ <li class="never" data-hits="" data-linenumber="78">
854
+
855
+
856
+ <code class="ruby"> else</code>
857
+ </li>
858
+
859
+ <li class="covered" data-hits="28" data-linenumber="79">
860
+ <span class="hits">28</span>
861
+
862
+ <code class="ruby"> @copy_list.merge! export_files(fhsh) # the group's name</code>
863
+ </li>
864
+
865
+ <li class="never" data-hits="" data-linenumber="80">
866
+
867
+
868
+ <code class="ruby"> end</code>
869
+ </li>
870
+
871
+ <li class="never" data-hits="" data-linenumber="81">
872
+
873
+
874
+ <code class="ruby"> end</code>
875
+ </li>
876
+
877
+ <li class="never" data-hits="" data-linenumber="82">
878
+
879
+
880
+ <code class="ruby"></code>
881
+ </li>
882
+
883
+ <li class="covered" data-hits="1" data-linenumber="83">
884
+ <span class="hits">1</span>
885
+
886
+ <code class="ruby"> private</code>
887
+ </li>
888
+
889
+ <li class="never" data-hits="" data-linenumber="84">
890
+
891
+
892
+ <code class="ruby"></code>
893
+ </li>
894
+
895
+ <li class="never" data-hits="" data-linenumber="85">
896
+
897
+
898
+ <code class="ruby"> # get all exported files in groups</code>
899
+ </li>
900
+
901
+ <li class="covered" data-hits="1" data-linenumber="86">
902
+ <span class="hits">1</span>
903
+
904
+ <code class="ruby"> def parse_export_files</code>
905
+ </li>
906
+
907
+ <li class="never" data-hits="" data-linenumber="87">
908
+
909
+
910
+ <code class="ruby"> # 'file_group_name' =&gt; { copy_from =&gt; copy_to_base_name }</code>
911
+ </li>
912
+
913
+ <li class="covered" data-hits="24" data-linenumber="88">
914
+ <span class="hits">24</span>
915
+
916
+ <code class="ruby"> @export_files ||= {}</code>
917
+ </li>
918
+
919
+ <li class="covered" data-hits="24" data-linenumber="89">
920
+ <span class="hits">24</span>
921
+
922
+ <code class="ruby"> export.each do |p_list| # pattern list</code>
923
+ </li>
924
+
925
+ <li class="covered" data-hits="88" data-linenumber="90">
926
+ <span class="hits">88</span>
927
+
928
+ <code class="ruby"> if p_list.is_a?(Hash) # group, file list</code>
929
+ </li>
930
+
931
+ <li class="covered" data-hits="20" data-linenumber="91">
932
+ <span class="hits">20</span>
933
+
934
+ <code class="ruby"> p_list.each do |n, p|</code>
935
+ </li>
936
+
937
+ <li class="covered" data-hits="20" data-linenumber="92">
938
+ <span class="hits">20</span>
939
+
940
+ <code class="ruby"> @export_files[n] ||= {}</code>
941
+ </li>
942
+
943
+ <li class="covered" data-hits="20" data-linenumber="93">
944
+ <span class="hits">20</span>
945
+
946
+ <code class="ruby"> @export_files[n].merge! find_files(p)</code>
947
+ </li>
948
+
949
+ <li class="never" data-hits="" data-linenumber="94">
950
+
951
+
952
+ <code class="ruby"> end</code>
953
+ </li>
954
+
955
+ <li class="never" data-hits="" data-linenumber="95">
956
+
957
+
958
+ <code class="ruby"> else</code>
959
+ </li>
960
+
961
+ <li class="covered" data-hits="68" data-linenumber="96">
962
+ <span class="hits">68</span>
963
+
964
+ <code class="ruby"> @export_files['default'] ||= {}</code>
965
+ </li>
966
+
967
+ <li class="covered" data-hits="68" data-linenumber="97">
968
+ <span class="hits">68</span>
969
+
970
+ <code class="ruby"> @export_files['default'].merge! find_files(p_list)</code>
971
+ </li>
972
+
973
+ <li class="never" data-hits="" data-linenumber="98">
974
+
975
+
976
+ <code class="ruby"> end</code>
977
+ </li>
978
+
979
+ <li class="never" data-hits="" data-linenumber="99">
980
+
981
+
982
+ <code class="ruby"> end</code>
983
+ </li>
984
+
985
+ <li class="covered" data-hits="24" data-linenumber="100">
986
+ <span class="hits">24</span>
987
+
988
+ <code class="ruby"> @export_files</code>
989
+ </li>
990
+
991
+ <li class="never" data-hits="" data-linenumber="101">
992
+
993
+
994
+ <code class="ruby"> end</code>
995
+ </li>
996
+
997
+ <li class="never" data-hits="" data-linenumber="102">
998
+
999
+
1000
+ <code class="ruby"></code>
1001
+ </li>
1002
+
1003
+ <li class="never" data-hits="" data-linenumber="103">
1004
+
1005
+
1006
+ <code class="ruby"> # from file pattern to copy_from =&gt; copy_to (remove directory header) hash</code>
1007
+ </li>
1008
+
1009
+ <li class="covered" data-hits="1" data-linenumber="104">
1010
+ <span class="hits">1</span>
1011
+
1012
+ <code class="ruby"> def glob_files(dir, allow_hash)</code>
1013
+ </li>
1014
+
1015
+ <li class="covered" data-hits="100" data-linenumber="105">
1016
+ <span class="hits">100</span>
1017
+
1018
+ <code class="ruby"> fhsh = {}</code>
1019
+ </li>
1020
+
1021
+ <li class="covered" data-hits="100" data-linenumber="106">
1022
+ <span class="hits">100</span>
1023
+
1024
+ <code class="ruby"> if dir.is_a?(Hash)</code>
1025
+ </li>
1026
+
1027
+ <li class="never" data-hits="" data-linenumber="107">
1028
+
1029
+
1030
+ <code class="ruby"> raise 'Can not use hash here for ' + dir.keys.join.to_s + ' in file ' +</code>
1031
+ </li>
1032
+
1033
+ <li class="covered" data-hits="10" data-linenumber="108">
1034
+ <span class="hits">10</span>
1035
+
1036
+ <code class="ruby"> filename unless allow_hash</code>
1037
+ </li>
1038
+
1039
+ <li class="covered" data-hits="10" data-linenumber="109">
1040
+ <span class="hits">10</span>
1041
+
1042
+ <code class="ruby"> dir.each do |f, t|</code>
1043
+ </li>
1044
+
1045
+ <li class="covered" data-hits="10" data-linenumber="110">
1046
+ <span class="hits">10</span>
1047
+
1048
+ <code class="ruby"> t = '/' + t.gsub(/^\//, '')</code>
1049
+ </li>
1050
+
1051
+ <li class="covered" data-hits="10" data-linenumber="111">
1052
+ <span class="hits">10</span>
1053
+
1054
+ <code class="ruby"> fhsh[File.expand_path(f, directory)] = t</code>
1055
+ </li>
1056
+
1057
+ <li class="never" data-hits="" data-linenumber="112">
1058
+
1059
+
1060
+ <code class="ruby"> end</code>
1061
+ </li>
1062
+
1063
+ <li class="never" data-hits="" data-linenumber="113">
1064
+
1065
+
1066
+ <code class="ruby"> else</code>
1067
+ </li>
1068
+
1069
+ <li class="covered" data-hits="90" data-linenumber="114">
1070
+ <span class="hits">90</span>
1071
+
1072
+ <code class="ruby"> Dir[File.expand_path(dir, directory)].each do |f|</code>
1073
+ </li>
1074
+
1075
+ <li class="covered" data-hits="126" data-linenumber="115">
1076
+ <span class="hits">126</span>
1077
+
1078
+ <code class="ruby"> fhsh[f] = f.gsub(/^#{directory}/, '')</code>
1079
+ </li>
1080
+
1081
+ <li class="never" data-hits="" data-linenumber="116">
1082
+
1083
+
1084
+ <code class="ruby"> end</code>
1085
+ </li>
1086
+
1087
+ <li class="never" data-hits="" data-linenumber="117">
1088
+
1089
+
1090
+ <code class="ruby"> end</code>
1091
+ </li>
1092
+
1093
+ <li class="covered" data-hits="100" data-linenumber="118">
1094
+ <span class="hits">100</span>
1095
+
1096
+ <code class="ruby"> fhsh</code>
1097
+ </li>
1098
+
1099
+ <li class="never" data-hits="" data-linenumber="119">
1100
+
1101
+
1102
+ <code class="ruby"> end</code>
1103
+ </li>
1104
+
1105
+ <li class="never" data-hits="" data-linenumber="120">
1106
+
1107
+
1108
+ <code class="ruby"></code>
1109
+ </li>
1110
+
1111
+ <li class="never" data-hits="" data-linenumber="121">
1112
+
1113
+
1114
+ <code class="ruby"> # from array (or string) of file patterns, glob files and build a</code>
1115
+ </li>
1116
+
1117
+ <li class="never" data-hits="" data-linenumber="122">
1118
+
1119
+
1120
+ <code class="ruby"> # large array</code>
1121
+ </li>
1122
+
1123
+ <li class="covered" data-hits="1" data-linenumber="123">
1124
+ <span class="hits">1</span>
1125
+
1126
+ <code class="ruby"> def find_files(group, allow_hash = true)</code>
1127
+ </li>
1128
+
1129
+ <li class="covered" data-hits="92" data-linenumber="124">
1130
+ <span class="hits">92</span>
1131
+
1132
+ <code class="ruby"> group = [ group ] unless group.is_a?(Array)</code>
1133
+ </li>
1134
+
1135
+ <li class="covered" data-hits="92" data-linenumber="125">
1136
+ <span class="hits">92</span>
1137
+
1138
+ <code class="ruby"> fhsh = {}</code>
1139
+ </li>
1140
+
1141
+ <li class="covered" data-hits="92" data-linenumber="126">
1142
+ <span class="hits">92</span>
1143
+
1144
+ <code class="ruby"> group.each do |file_pattern|</code>
1145
+ </li>
1146
+
1147
+ <li class="covered" data-hits="100" data-linenumber="127">
1148
+ <span class="hits">100</span>
1149
+
1150
+ <code class="ruby"> fhsh.merge! glob_files(file_pattern, allow_hash)</code>
1151
+ </li>
1152
+
1153
+ <li class="never" data-hits="" data-linenumber="128">
1154
+
1155
+
1156
+ <code class="ruby"> end</code>
1157
+ </li>
1158
+
1159
+ <li class="covered" data-hits="92" data-linenumber="129">
1160
+ <span class="hits">92</span>
1161
+
1162
+ <code class="ruby"> fhsh</code>
1163
+ </li>
1164
+
1165
+ <li class="never" data-hits="" data-linenumber="130">
1166
+
1167
+
1168
+ <code class="ruby"> end</code>
1169
+ </li>
1170
+
1171
+ <li class="never" data-hits="" data-linenumber="131">
1172
+
1173
+
1174
+ <code class="ruby"> end</code>
1175
+ </li>
1176
+
1177
+ <li class="never" data-hits="" data-linenumber="132">
1178
+
1179
+
1180
+ <code class="ruby">end</code>
1181
+ </li>
1182
+
1183
+ </ol>
1184
+ </pre>
1185
+ </div>
1186
+
1187
+ <div class="source_table" id="6efd526042569fe4b2332978c90171abe4fc0f64">
1188
+ <div class="header">
1189
+ <h3>lib/app_stack/merger.rb</h3>
1190
+ <h4><span class="yellow">85.53 %</span> covered</h4>
1191
+ <div>
1192
+ <b>76</b> relevant lines.
1193
+ <span class="green"><b>65</b> lines covered</span> and
1194
+ <span class="red"><b>11</b> lines missed.</span>
1195
+ </div>
1196
+ </div>
1197
+
1198
+ <pre>
1199
+ <ol>
1200
+
1201
+ <li class="never" data-hits="" data-linenumber="1">
1202
+
1203
+
1204
+ <code class="ruby"># encoding: utf-8</code>
1205
+ </li>
1206
+
1207
+ <li class="never" data-hits="" data-linenumber="2">
1208
+
1209
+
1210
+ <code class="ruby"></code>
1211
+ </li>
1212
+
1213
+ <li class="covered" data-hits="1" data-linenumber="3">
1214
+ <span class="hits">1</span>
1215
+
1216
+ <code class="ruby">module AppStack</code>
1217
+ </li>
1218
+
1219
+ <li class="never" data-hits="" data-linenumber="4">
1220
+
1221
+
1222
+ <code class="ruby"> # runner for merge files from stack of apps</code>
1223
+ </li>
1224
+
1225
+ <li class="covered" data-hits="1" data-linenumber="5">
1226
+ <span class="hits">1</span>
1227
+
1228
+ <code class="ruby"> class Merger</code>
1229
+ </li>
1230
+
1231
+ <li class="covered" data-hits="1" data-linenumber="6">
1232
+ <span class="hits">1</span>
1233
+
1234
+ <code class="ruby"> attr_reader :stacks, :copy_list, :render_list</code>
1235
+ </li>
1236
+
1237
+ <li class="never" data-hits="" data-linenumber="7">
1238
+
1239
+
1240
+ <code class="ruby"></code>
1241
+ </li>
1242
+
1243
+ <li class="covered" data-hits="1" data-linenumber="8">
1244
+ <span class="hits">1</span>
1245
+
1246
+ <code class="ruby"> def initialize(conf_file, verbose = false)</code>
1247
+ </li>
1248
+
1249
+ <li class="never" data-hits="" data-linenumber="9">
1250
+
1251
+
1252
+ <code class="ruby"> # load configuration</code>
1253
+ </li>
1254
+
1255
+ <li class="covered" data-hits="7" data-linenumber="10">
1256
+ <span class="hits">7</span>
1257
+
1258
+ <code class="ruby"> @conf_file = conf_file</code>
1259
+ </li>
1260
+
1261
+ <li class="covered" data-hits="7" data-linenumber="11">
1262
+ <span class="hits">7</span>
1263
+
1264
+ <code class="ruby"> @config = Config.new(@conf_file)</code>
1265
+ </li>
1266
+
1267
+ <li class="covered" data-hits="7" data-linenumber="12">
1268
+ <span class="hits">7</span>
1269
+
1270
+ <code class="ruby"> @verbose = verbose</code>
1271
+ </li>
1272
+
1273
+ <li class="never" data-hits="" data-linenumber="13">
1274
+
1275
+
1276
+ <code class="ruby"></code>
1277
+ </li>
1278
+
1279
+ <li class="covered" data-hits="7" data-linenumber="14">
1280
+ <span class="hits">7</span>
1281
+
1282
+ <code class="ruby"> @stacks = []</code>
1283
+ </li>
1284
+
1285
+ <li class="covered" data-hits="7" data-linenumber="15">
1286
+ <span class="hits">7</span>
1287
+
1288
+ <code class="ruby"> @attr_vars = {}</code>
1289
+ </li>
1290
+
1291
+ <li class="covered" data-hits="7" data-linenumber="16">
1292
+ <span class="hits">7</span>
1293
+
1294
+ <code class="ruby"> @attr_last_mod = File.mtime(@conf_file)</code>
1295
+ </li>
1296
+
1297
+ <li class="covered" data-hits="7" data-linenumber="17">
1298
+ <span class="hits">7</span>
1299
+
1300
+ <code class="ruby"> parse_stacks</code>
1301
+ </li>
1302
+
1303
+ <li class="never" data-hits="" data-linenumber="18">
1304
+
1305
+
1306
+ <code class="ruby"></code>
1307
+ </li>
1308
+
1309
+ <li class="covered" data-hits="7" data-linenumber="19">
1310
+ <span class="hits">7</span>
1311
+
1312
+ <code class="ruby"> @copy_list = {}</code>
1313
+ </li>
1314
+
1315
+ <li class="covered" data-hits="7" data-linenumber="20">
1316
+ <span class="hits">7</span>
1317
+
1318
+ <code class="ruby"> @render_list = {}</code>
1319
+ </li>
1320
+
1321
+ <li class="covered" data-hits="7" data-linenumber="21">
1322
+ <span class="hits">7</span>
1323
+
1324
+ <code class="ruby"> @prepared = false</code>
1325
+ </li>
1326
+
1327
+ <li class="never" data-hits="" data-linenumber="22">
1328
+
1329
+
1330
+ <code class="ruby"> end</code>
1331
+ </li>
1332
+
1333
+ <li class="never" data-hits="" data-linenumber="23">
1334
+
1335
+
1336
+ <code class="ruby"></code>
1337
+ </li>
1338
+
1339
+ <li class="covered" data-hits="1" data-linenumber="24">
1340
+ <span class="hits">1</span>
1341
+
1342
+ <code class="ruby"> def prepare(verbose = false)</code>
1343
+ </li>
1344
+
1345
+ <li class="covered" data-hits="3" data-linenumber="25">
1346
+ <span class="hits">3</span>
1347
+
1348
+ <code class="ruby"> local_dir = Pathname.new(@config.directory)</code>
1349
+ </li>
1350
+
1351
+ <li class="covered" data-hits="3" data-linenumber="26">
1352
+ <span class="hits">3</span>
1353
+
1354
+ <code class="ruby"> @stacks.each do |stack|</code>
1355
+ </li>
1356
+
1357
+ <li class="covered" data-hits="9" data-linenumber="27">
1358
+ <span class="hits">9</span>
1359
+
1360
+ <code class="ruby"> stack.copy_list.each do |fr, to| # copy from, copy to</code>
1361
+ </li>
1362
+
1363
+ <li class="covered" data-hits="48" data-linenumber="28">
1364
+ <span class="hits">48</span>
1365
+
1366
+ <code class="ruby"> to = local_dir + to.gsub(/^\//, '')</code>
1367
+ </li>
1368
+
1369
+ <li class="covered" data-hits="48" data-linenumber="29">
1370
+ <span class="hits">48</span>
1371
+
1372
+ <code class="ruby"> if @config.exclude_files[to.to_s]</code>
1373
+ </li>
1374
+
1375
+ <li class="covered" data-hits="3" data-linenumber="30">
1376
+ <span class="hits">3</span>
1377
+
1378
+ <code class="ruby"> puts 'keep '.green.bold + to.to_s.gsub(@config.stack_dir, '') if verbose</code>
1379
+ </li>
1380
+
1381
+ <li class="never" data-hits="" data-linenumber="31">
1382
+
1383
+
1384
+ <code class="ruby"> elsif newer?(to, fr)</code>
1385
+ </li>
1386
+
1387
+ <li class="covered" data-hits="6" data-linenumber="32">
1388
+ <span class="hits">6</span>
1389
+
1390
+ <code class="ruby"> puts 'skip '.white.bold + to.to_s.gsub(@config.stack_dir, '') if verbose</code>
1391
+ </li>
1392
+
1393
+ <li class="never" data-hits="" data-linenumber="33">
1394
+
1395
+
1396
+ <code class="ruby"> else</code>
1397
+ </li>
1398
+
1399
+ <li class="never" data-hits="" data-linenumber="34">
1400
+
1401
+
1402
+ <code class="ruby"> # render list</code>
1403
+ </li>
1404
+
1405
+ <li class="covered" data-hits="39" data-linenumber="35">
1406
+ <span class="hits">39</span>
1407
+
1408
+ <code class="ruby"> tpl_file = nil</code>
1409
+ </li>
1410
+
1411
+ <li class="covered" data-hits="39" data-linenumber="36">
1412
+ <span class="hits">39</span>
1413
+
1414
+ <code class="ruby"> @config.tpl_ext.each do |ext|</code>
1415
+ </li>
1416
+
1417
+ <li class="covered" data-hits="117" data-linenumber="37">
1418
+ <span class="hits">117</span>
1419
+
1420
+ <code class="ruby"> tpl_file = fr + ext if File.exists?(fr + ext)</code>
1421
+ </li>
1422
+
1423
+ <li class="never" data-hits="" data-linenumber="38">
1424
+
1425
+
1426
+ <code class="ruby"> end</code>
1427
+ </li>
1428
+
1429
+ <li class="never" data-hits="" data-linenumber="39">
1430
+
1431
+
1432
+ <code class="ruby"></code>
1433
+ </li>
1434
+
1435
+ <li class="covered" data-hits="39" data-linenumber="40">
1436
+ <span class="hits">39</span>
1437
+
1438
+ <code class="ruby"> if tpl_file</code>
1439
+ </li>
1440
+
1441
+ <li class="covered" data-hits="6" data-linenumber="41">
1442
+ <span class="hits">6</span>
1443
+
1444
+ <code class="ruby"> @render_list[to.to_s] = tpl_file if newer?(tpl_file, to) || attr_mod?(to)</code>
1445
+ </li>
1446
+
1447
+ <li class="never" data-hits="" data-linenumber="42">
1448
+
1449
+
1450
+ <code class="ruby"> else</code>
1451
+ </li>
1452
+
1453
+ <li class="covered" data-hits="33" data-linenumber="43">
1454
+ <span class="hits">33</span>
1455
+
1456
+ <code class="ruby"> @copy_list[to.to_s] = fr if newer?(fr, to)</code>
1457
+ </li>
1458
+
1459
+ <li class="never" data-hits="" data-linenumber="44">
1460
+
1461
+
1462
+ <code class="ruby"> end</code>
1463
+ </li>
1464
+
1465
+ <li class="never" data-hits="" data-linenumber="45">
1466
+
1467
+
1468
+ <code class="ruby"> end</code>
1469
+ </li>
1470
+
1471
+ <li class="never" data-hits="" data-linenumber="46">
1472
+
1473
+
1474
+ <code class="ruby"> end</code>
1475
+ </li>
1476
+
1477
+ <li class="covered" data-hits="9" data-linenumber="47">
1478
+ <span class="hits">9</span>
1479
+
1480
+ <code class="ruby"> @prepared = true</code>
1481
+ </li>
1482
+
1483
+ <li class="never" data-hits="" data-linenumber="48">
1484
+
1485
+
1486
+ <code class="ruby"> end</code>
1487
+ </li>
1488
+
1489
+ <li class="never" data-hits="" data-linenumber="49">
1490
+
1491
+
1492
+ <code class="ruby"></code>
1493
+ </li>
1494
+
1495
+ <li class="covered" data-hits="3" data-linenumber="50">
1496
+ <span class="hits">3</span>
1497
+
1498
+ <code class="ruby"> if verbose</code>
1499
+ </li>
1500
+
1501
+ <li class="missed" data-hits="0" data-linenumber="51">
1502
+
1503
+
1504
+ <code class="ruby"> @copy_list.each do |to, fr|</code>
1505
+ </li>
1506
+
1507
+ <li class="missed" data-hits="0" data-linenumber="52">
1508
+
1509
+
1510
+ <code class="ruby"> puts 'copy '.bold + fr.gsub(@config.stack_dir, '')</code>
1511
+ </li>
1512
+
1513
+ <li class="missed" data-hits="0" data-linenumber="53">
1514
+
1515
+
1516
+ <code class="ruby"> puts ' to '.bold + to.to_s.gsub(@config.stack_dir, '')</code>
1517
+ </li>
1518
+
1519
+ <li class="never" data-hits="" data-linenumber="54">
1520
+
1521
+
1522
+ <code class="ruby"> end</code>
1523
+ </li>
1524
+
1525
+ <li class="never" data-hits="" data-linenumber="55">
1526
+
1527
+
1528
+ <code class="ruby"></code>
1529
+ </li>
1530
+
1531
+ <li class="missed" data-hits="0" data-linenumber="56">
1532
+
1533
+
1534
+ <code class="ruby"> @render_list.each do |to, fr|</code>
1535
+ </li>
1536
+
1537
+ <li class="missed" data-hits="0" data-linenumber="57">
1538
+
1539
+
1540
+ <code class="ruby"> puts 'render '.bold + fr.gsub(@config.stack_dir, '')</code>
1541
+ </li>
1542
+
1543
+ <li class="missed" data-hits="0" data-linenumber="58">
1544
+
1545
+
1546
+ <code class="ruby"> puts ' to '.bold + to.to_s.gsub(@config.stack_dir, '')</code>
1547
+ </li>
1548
+
1549
+ <li class="never" data-hits="" data-linenumber="59">
1550
+
1551
+
1552
+ <code class="ruby"> end</code>
1553
+ </li>
1554
+
1555
+ <li class="never" data-hits="" data-linenumber="60">
1556
+
1557
+
1558
+ <code class="ruby"> end</code>
1559
+ </li>
1560
+
1561
+ <li class="never" data-hits="" data-linenumber="61">
1562
+
1563
+
1564
+ <code class="ruby"> end</code>
1565
+ </li>
1566
+
1567
+ <li class="never" data-hits="" data-linenumber="62">
1568
+
1569
+
1570
+ <code class="ruby"></code>
1571
+ </li>
1572
+
1573
+ <li class="covered" data-hits="1" data-linenumber="63">
1574
+ <span class="hits">1</span>
1575
+
1576
+ <code class="ruby"> def merge!</code>
1577
+ </li>
1578
+
1579
+ <li class="covered" data-hits="1" data-linenumber="64">
1580
+ <span class="hits">1</span>
1581
+
1582
+ <code class="ruby"> @prepared || prepare(@verbose)</code>
1583
+ </li>
1584
+
1585
+ <li class="covered" data-hits="12" data-linenumber="65">
1586
+ <span class="hits">12</span>
1587
+
1588
+ <code class="ruby"> @copy_list.each { |to, fr| copy_file!(fr, to) }</code>
1589
+ </li>
1590
+
1591
+ <li class="covered" data-hits="2" data-linenumber="66">
1592
+ <span class="hits">2</span>
1593
+
1594
+ <code class="ruby"> @render_list.each { |to, fr| render_file!(fr, to) }</code>
1595
+ </li>
1596
+
1597
+ <li class="never" data-hits="" data-linenumber="67">
1598
+
1599
+
1600
+ <code class="ruby"> end</code>
1601
+ </li>
1602
+
1603
+ <li class="never" data-hits="" data-linenumber="68">
1604
+
1605
+
1606
+ <code class="ruby"></code>
1607
+ </li>
1608
+
1609
+ <li class="covered" data-hits="1" data-linenumber="69">
1610
+ <span class="hits">1</span>
1611
+
1612
+ <code class="ruby"> private</code>
1613
+ </li>
1614
+
1615
+ <li class="never" data-hits="" data-linenumber="70">
1616
+
1617
+
1618
+ <code class="ruby"></code>
1619
+ </li>
1620
+
1621
+ <li class="covered" data-hits="1" data-linenumber="71">
1622
+ <span class="hits">1</span>
1623
+
1624
+ <code class="ruby"> def copy_file!(fr, to)</code>
1625
+ </li>
1626
+
1627
+ <li class="covered" data-hits="11" data-linenumber="72">
1628
+ <span class="hits">11</span>
1629
+
1630
+ <code class="ruby"> target_dir = File.dirname(to)</code>
1631
+ </li>
1632
+
1633
+ <li class="covered" data-hits="11" data-linenumber="73">
1634
+ <span class="hits">11</span>
1635
+
1636
+ <code class="ruby"> FileUtils.mkdir_p target_dir unless File.directory?(target_dir)</code>
1637
+ </li>
1638
+
1639
+ <li class="covered" data-hits="11" data-linenumber="74">
1640
+ <span class="hits">11</span>
1641
+
1642
+ <code class="ruby"> FileUtils.copy fr, to</code>
1643
+ </li>
1644
+
1645
+ <li class="never" data-hits="" data-linenumber="75">
1646
+
1647
+
1648
+ <code class="ruby"> end</code>
1649
+ </li>
1650
+
1651
+ <li class="never" data-hits="" data-linenumber="76">
1652
+
1653
+
1654
+ <code class="ruby"></code>
1655
+ </li>
1656
+
1657
+ <li class="covered" data-hits="1" data-linenumber="77">
1658
+ <span class="hits">1</span>
1659
+
1660
+ <code class="ruby"> def render_file!(fr, to)</code>
1661
+ </li>
1662
+
1663
+ <li class="covered" data-hits="1" data-linenumber="78">
1664
+ <span class="hits">1</span>
1665
+
1666
+ <code class="ruby"> var = @attr_vars.deep_merge(@config.attr_vars)</code>
1667
+ </li>
1668
+
1669
+ <li class="covered" data-hits="1" data-linenumber="79">
1670
+ <span class="hits">1</span>
1671
+
1672
+ <code class="ruby"> oh = File.open(to, 'wb')</code>
1673
+ </li>
1674
+
1675
+ <li class="covered" data-hits="1" data-linenumber="80">
1676
+ <span class="hits">1</span>
1677
+
1678
+ <code class="ruby"> if fr.match(/\.liquid$/)</code>
1679
+ </li>
1680
+
1681
+ <li class="covered" data-hits="1" data-linenumber="81">
1682
+ <span class="hits">1</span>
1683
+
1684
+ <code class="ruby"> require 'liquid'</code>
1685
+ </li>
1686
+
1687
+ <li class="covered" data-hits="1" data-linenumber="82">
1688
+ <span class="hits">1</span>
1689
+
1690
+ <code class="ruby"> oh.write Liquid::Template.parse(File.open(fr, 'r:utf-8').read).render(var)</code>
1691
+ </li>
1692
+
1693
+ <li class="never" data-hits="" data-linenumber="83">
1694
+
1695
+
1696
+ <code class="ruby"> else</code>
1697
+ </li>
1698
+
1699
+ <li class="missed" data-hits="0" data-linenumber="84">
1700
+
1701
+
1702
+ <code class="ruby"> tilt = Tilt.new(fr)</code>
1703
+ </li>
1704
+
1705
+ <li class="missed" data-hits="0" data-linenumber="85">
1706
+
1707
+
1708
+ <code class="ruby"> oh.write tilt.render(OpenStruct.new(var))</code>
1709
+ </li>
1710
+
1711
+ <li class="never" data-hits="" data-linenumber="86">
1712
+
1713
+
1714
+ <code class="ruby"> end</code>
1715
+ </li>
1716
+
1717
+ <li class="covered" data-hits="1" data-linenumber="87">
1718
+ <span class="hits">1</span>
1719
+
1720
+ <code class="ruby"> oh.close</code>
1721
+ </li>
1722
+
1723
+ <li class="never" data-hits="" data-linenumber="88">
1724
+
1725
+
1726
+ <code class="ruby"> end</code>
1727
+ </li>
1728
+
1729
+ <li class="never" data-hits="" data-linenumber="89">
1730
+
1731
+
1732
+ <code class="ruby"></code>
1733
+ </li>
1734
+
1735
+ <li class="never" data-hits="" data-linenumber="90">
1736
+
1737
+
1738
+ <code class="ruby"> # get a list of stacked app object</code>
1739
+ </li>
1740
+
1741
+ <li class="covered" data-hits="1" data-linenumber="91">
1742
+ <span class="hits">1</span>
1743
+
1744
+ <code class="ruby"> def parse_stacks</code>
1745
+ </li>
1746
+
1747
+ <li class="covered" data-hits="7" data-linenumber="92">
1748
+ <span class="hits">7</span>
1749
+
1750
+ <code class="ruby"> @config.stack.each do |stk|</code>
1751
+ </li>
1752
+
1753
+ <li class="never" data-hits="" data-linenumber="93">
1754
+
1755
+
1756
+ <code class="ruby"> case</code>
1757
+ </li>
1758
+
1759
+ <li class="covered" data-hits="7" data-linenumber="94">
1760
+ <span class="hits">7</span>
1761
+
1762
+ <code class="ruby"> when stk.is_a?(String) then @stacks &lt;&lt; load_stack(stk, ['default'])</code>
1763
+ </li>
1764
+
1765
+ <li class="never" data-hits="" data-linenumber="95">
1766
+
1767
+
1768
+ <code class="ruby"> when stk.is_a?(Hash)</code>
1769
+ </li>
1770
+
1771
+ <li class="covered" data-hits="28" data-linenumber="96">
1772
+ <span class="hits">28</span>
1773
+
1774
+ <code class="ruby"> stk.each { |key, groups| @stacks &lt;&lt; load_stack(key, groups) }</code>
1775
+ </li>
1776
+
1777
+ <li class="never" data-hits="" data-linenumber="97">
1778
+
1779
+
1780
+ <code class="ruby"> else</code>
1781
+ </li>
1782
+
1783
+ <li class="missed" data-hits="0" data-linenumber="98">
1784
+
1785
+
1786
+ <code class="ruby"> raise 'stack must be a string or a hash, in ' + @conf_file</code>
1787
+ </li>
1788
+
1789
+ <li class="covered" data-hits="21" data-linenumber="99">
1790
+ <span class="hits">21</span>
1791
+
1792
+ <code class="ruby"> end</code>
1793
+ </li>
1794
+
1795
+ <li class="never" data-hits="" data-linenumber="100">
1796
+
1797
+
1798
+ <code class="ruby"> end</code>
1799
+ </li>
1800
+
1801
+ <li class="never" data-hits="" data-linenumber="101">
1802
+
1803
+
1804
+ <code class="ruby"> end</code>
1805
+ </li>
1806
+
1807
+ <li class="never" data-hits="" data-linenumber="102">
1808
+
1809
+
1810
+ <code class="ruby"></code>
1811
+ </li>
1812
+
1813
+ <li class="never" data-hits="" data-linenumber="103">
1814
+
1815
+
1816
+ <code class="ruby"> # read stack from list, set copy_list</code>
1817
+ </li>
1818
+
1819
+ <li class="covered" data-hits="1" data-linenumber="104">
1820
+ <span class="hits">1</span>
1821
+
1822
+ <code class="ruby"> def load_stack(stack_name, groups)</code>
1823
+ </li>
1824
+
1825
+ <li class="covered" data-hits="21" data-linenumber="105">
1826
+ <span class="hits">21</span>
1827
+
1828
+ <code class="ruby"> conf_base_name = File.basename(@conf_file)</code>
1829
+ </li>
1830
+
1831
+ <li class="covered" data-hits="21" data-linenumber="106">
1832
+ <span class="hits">21</span>
1833
+
1834
+ <code class="ruby"> stack_dir = Pathname.new(@config.stack_dir) + stack_name</code>
1835
+ </li>
1836
+
1837
+ <li class="covered" data-hits="21" data-linenumber="107">
1838
+ <span class="hits">21</span>
1839
+
1840
+ <code class="ruby"> stack = Config.new(stack_dir + conf_base_name)</code>
1841
+ </li>
1842
+
1843
+ <li class="covered" data-hits="21" data-linenumber="108">
1844
+ <span class="hits">21</span>
1845
+
1846
+ <code class="ruby"> fmodtime = File.mtime(stack_dir + conf_base_name)</code>
1847
+ </li>
1848
+
1849
+ <li class="covered" data-hits="21" data-linenumber="109">
1850
+ <span class="hits">21</span>
1851
+
1852
+ <code class="ruby"> @attr_last_mod = fmodtime if fmodtime &gt; @attr_last_mod # update file mod time</code>
1853
+ </li>
1854
+
1855
+ <li class="covered" data-hits="21" data-linenumber="110">
1856
+ <span class="hits">21</span>
1857
+
1858
+ <code class="ruby"> @attr_vars = @attr_vars.deep_merge stack.attr_vars</code>
1859
+ </li>
1860
+
1861
+ <li class="covered" data-hits="63" data-linenumber="111">
1862
+ <span class="hits">63</span>
1863
+
1864
+ <code class="ruby"> groups.each { |grp| stack.add_copy_list(grp) }</code>
1865
+ </li>
1866
+
1867
+ <li class="covered" data-hits="21" data-linenumber="112">
1868
+ <span class="hits">21</span>
1869
+
1870
+ <code class="ruby"> stack</code>
1871
+ </li>
1872
+
1873
+ <li class="never" data-hits="" data-linenumber="113">
1874
+
1875
+
1876
+ <code class="ruby"> end</code>
1877
+ </li>
1878
+
1879
+ <li class="never" data-hits="" data-linenumber="114">
1880
+
1881
+
1882
+ <code class="ruby"></code>
1883
+ </li>
1884
+
1885
+ <li class="never" data-hits="" data-linenumber="115">
1886
+
1887
+
1888
+ <code class="ruby"> # if f1 newer than f2, or f2 not exits but f1 does.</code>
1889
+ </li>
1890
+
1891
+ <li class="covered" data-hits="1" data-linenumber="116">
1892
+ <span class="hits">1</span>
1893
+
1894
+ <code class="ruby"> def newer?(f1, f2)</code>
1895
+ </li>
1896
+
1897
+ <li class="covered" data-hits="84" data-linenumber="117">
1898
+ <span class="hits">84</span>
1899
+
1900
+ <code class="ruby"> return false unless File.exists?(f1)</code>
1901
+ </li>
1902
+
1903
+ <li class="covered" data-hits="45" data-linenumber="118">
1904
+ <span class="hits">45</span>
1905
+
1906
+ <code class="ruby"> return true unless File.exists?(f2)</code>
1907
+ </li>
1908
+
1909
+ <li class="covered" data-hits="6" data-linenumber="119">
1910
+ <span class="hits">6</span>
1911
+
1912
+ <code class="ruby"> File.mtime(f1) &gt; File.mtime(f2)</code>
1913
+ </li>
1914
+
1915
+ <li class="never" data-hits="" data-linenumber="120">
1916
+
1917
+
1918
+ <code class="ruby"> end</code>
1919
+ </li>
1920
+
1921
+ <li class="never" data-hits="" data-linenumber="121">
1922
+
1923
+
1924
+ <code class="ruby"></code>
1925
+ </li>
1926
+
1927
+ <li class="covered" data-hits="1" data-linenumber="122">
1928
+ <span class="hits">1</span>
1929
+
1930
+ <code class="ruby"> def attr_mod?(to)</code>
1931
+ </li>
1932
+
1933
+ <li class="missed" data-hits="0" data-linenumber="123">
1934
+
1935
+
1936
+ <code class="ruby"> return true unless File.exists?(to)</code>
1937
+ </li>
1938
+
1939
+ <li class="missed" data-hits="0" data-linenumber="124">
1940
+
1941
+
1942
+ <code class="ruby"> @attr_last_mod &gt; File.mtime(to)</code>
1943
+ </li>
1944
+
1945
+ <li class="never" data-hits="" data-linenumber="125">
1946
+
1947
+
1948
+ <code class="ruby"> end</code>
1949
+ </li>
1950
+
1951
+ <li class="never" data-hits="" data-linenumber="126">
1952
+
1953
+
1954
+ <code class="ruby"> end</code>
1955
+ </li>
1956
+
1957
+ <li class="never" data-hits="" data-linenumber="127">
1958
+
1959
+
1960
+ <code class="ruby">end</code>
1961
+ </li>
1962
+
1963
+ </ol>
1964
+ </pre>
1965
+ </div>
1966
+
1967
+ <div class="source_table" id="7f610dcfea9eb3bfc05696df6babc3086014b112">
1968
+ <div class="header">
1969
+ <h3>spec/fixtures/sample_files/module_1/spec/config_spec.rb</h3>
1970
+ <h4><span class="green">100.0 %</span> covered</h4>
1971
+ <div>
1972
+ <b>0</b> relevant lines.
1973
+ <span class="green"><b>0</b> lines covered</span> and
1974
+ <span class="red"><b>0</b> lines missed.</span>
1975
+ </div>
1976
+ </div>
1977
+
1978
+ <pre>
1979
+ <ol>
1980
+
1981
+ </ol>
1982
+ </pre>
1983
+ </div>
1984
+
1985
+ <div class="source_table" id="ee5b5b721d21a4b9f829724043ebca2c488df3f8">
1986
+ <div class="header">
1987
+ <h3>spec/fixtures/sample_files/my_app/spec/config_spec.rb</h3>
1988
+ <h4><span class="green">100.0 %</span> covered</h4>
1989
+ <div>
1990
+ <b>0</b> relevant lines.
1991
+ <span class="green"><b>0</b> lines covered</span> and
1992
+ <span class="red"><b>0</b> lines missed.</span>
1993
+ </div>
1994
+ </div>
1995
+
1996
+ <pre>
1997
+ <ol>
1998
+
1999
+ </ol>
2000
+ </pre>
2001
+ </div>
2002
+
2003
+ <div class="source_table" id="69008267ecc76d7096c507f87f0105551e06e319">
2004
+ <div class="header">
2005
+ <h3>spec/fixtures/sample_files/my_app_back/spec/config_spec.rb</h3>
2006
+ <h4><span class="green">100.0 %</span> covered</h4>
2007
+ <div>
2008
+ <b>0</b> relevant lines.
2009
+ <span class="green"><b>0</b> lines covered</span> and
2010
+ <span class="red"><b>0</b> lines missed.</span>
2011
+ </div>
2012
+ </div>
2013
+
2014
+ <pre>
2015
+ <ol>
2016
+
2017
+ </ol>
2018
+ </pre>
2019
+ </div>
2020
+
2021
+ <div class="source_table" id="da69bc65ab23290dcbba0841418d0f64bec9f389">
2022
+ <div class="header">
2023
+ <h3>spec/merger_spec.rb</h3>
2024
+ <h4><span class="green">100.0 %</span> covered</h4>
2025
+ <div>
2026
+ <b>26</b> relevant lines.
2027
+ <span class="green"><b>26</b> lines covered</span> and
2028
+ <span class="red"><b>0</b> lines missed.</span>
2029
+ </div>
2030
+ </div>
2031
+
2032
+ <pre>
2033
+ <ol>
2034
+
2035
+ <li class="never" data-hits="" data-linenumber="1">
2036
+
2037
+
2038
+ <code class="ruby"># encoding: utf-8</code>
2039
+ </li>
2040
+
2041
+ <li class="never" data-hits="" data-linenumber="2">
2042
+
2043
+
2044
+ <code class="ruby"></code>
2045
+ </li>
2046
+
2047
+ <li class="covered" data-hits="1" data-linenumber="3">
2048
+ <span class="hits">1</span>
2049
+
2050
+ <code class="ruby">require 'spec_helper'</code>
2051
+ </li>
2052
+
2053
+ <li class="never" data-hits="" data-linenumber="4">
2054
+
2055
+
2056
+ <code class="ruby"></code>
2057
+ </li>
2058
+
2059
+ <li class="covered" data-hits="1" data-linenumber="5">
2060
+ <span class="hits">1</span>
2061
+
2062
+ <code class="ruby">describe AppStack::Merger do</code>
2063
+ </li>
2064
+
2065
+ <li class="covered" data-hits="7" data-linenumber="6">
2066
+ <span class="hits">7</span>
2067
+
2068
+ <code class="ruby"> subject (:mg) { AppStack::Merger.new('spec/fixtures/sample_files/my_app/app_stack.yml') }</code>
2069
+ </li>
2070
+
2071
+ <li class="covered" data-hits="1" data-linenumber="7">
2072
+ <span class="hits">1</span>
2073
+
2074
+ <code class="ruby"> describe '#parse_stacks' do</code>
2075
+ </li>
2076
+
2077
+ <li class="covered" data-hits="1" data-linenumber="8">
2078
+ <span class="hits">1</span>
2079
+
2080
+ <code class="ruby"> it 'get a stacked app list' do</code>
2081
+ </li>
2082
+
2083
+ <li class="covered" data-hits="1" data-linenumber="9">
2084
+ <span class="hits">1</span>
2085
+
2086
+ <code class="ruby"> mg.stacks[0].app_name.should eq('module_1')</code>
2087
+ </li>
2088
+
2089
+ <li class="never" data-hits="" data-linenumber="10">
2090
+
2091
+
2092
+ <code class="ruby"> end</code>
2093
+ </li>
2094
+
2095
+ <li class="never" data-hits="" data-linenumber="11">
2096
+
2097
+
2098
+ <code class="ruby"></code>
2099
+ </li>
2100
+
2101
+ <li class="covered" data-hits="1" data-linenumber="12">
2102
+ <span class="hits">1</span>
2103
+
2104
+ <code class="ruby"> it 'get a group of files' do</code>
2105
+ </li>
2106
+
2107
+ <li class="covered" data-hits="1" data-linenumber="13">
2108
+ <span class="hits">1</span>
2109
+
2110
+ <code class="ruby"> file = File.expand_path('spec/fixtures/sample_files/module_1/spec/config_spec.rb')</code>
2111
+ </li>
2112
+
2113
+ <li class="covered" data-hits="1" data-linenumber="14">
2114
+ <span class="hits">1</span>
2115
+
2116
+ <code class="ruby"> mg.stacks[0].copy_list[file].should eq('/spec/config_spec.rb')</code>
2117
+ </li>
2118
+
2119
+ <li class="never" data-hits="" data-linenumber="15">
2120
+
2121
+
2122
+ <code class="ruby"> end</code>
2123
+ </li>
2124
+
2125
+ <li class="never" data-hits="" data-linenumber="16">
2126
+
2127
+
2128
+ <code class="ruby"></code>
2129
+ </li>
2130
+
2131
+ <li class="covered" data-hits="1" data-linenumber="17">
2132
+ <span class="hits">1</span>
2133
+
2134
+ <code class="ruby"> it 'get the default files' do</code>
2135
+ </li>
2136
+
2137
+ <li class="covered" data-hits="1" data-linenumber="18">
2138
+ <span class="hits">1</span>
2139
+
2140
+ <code class="ruby"> file = File.expand_path('spec/fixtures/sample_files/module_2/app/lib/sequence.rb')</code>
2141
+ </li>
2142
+
2143
+ <li class="covered" data-hits="1" data-linenumber="19">
2144
+ <span class="hits">1</span>
2145
+
2146
+ <code class="ruby"> mg.stacks[1].copy_list[file].should eq('/app/lib/sequence.rb')</code>
2147
+ </li>
2148
+
2149
+ <li class="never" data-hits="" data-linenumber="20">
2150
+
2151
+
2152
+ <code class="ruby"> end</code>
2153
+ </li>
2154
+
2155
+ <li class="never" data-hits="" data-linenumber="21">
2156
+
2157
+
2158
+ <code class="ruby"></code>
2159
+ </li>
2160
+
2161
+ <li class="covered" data-hits="1" data-linenumber="22">
2162
+ <span class="hits">1</span>
2163
+
2164
+ <code class="ruby"> it 'get file with specified target name' do</code>
2165
+ </li>
2166
+
2167
+ <li class="covered" data-hits="1" data-linenumber="23">
2168
+ <span class="hits">1</span>
2169
+
2170
+ <code class="ruby"> file = File.expand_path('spec/fixtures/sample_files/module_3/config/database_production.yml')</code>
2171
+ </li>
2172
+
2173
+ <li class="covered" data-hits="1" data-linenumber="24">
2174
+ <span class="hits">1</span>
2175
+
2176
+ <code class="ruby"> mg.stacks[2].copy_list[file].should eq('config/database.yml')</code>
2177
+ </li>
2178
+
2179
+ <li class="never" data-hits="" data-linenumber="25">
2180
+
2181
+
2182
+ <code class="ruby"> end</code>
2183
+ </li>
2184
+
2185
+ <li class="never" data-hits="" data-linenumber="26">
2186
+
2187
+
2188
+ <code class="ruby"> end</code>
2189
+ </li>
2190
+
2191
+ <li class="never" data-hits="" data-linenumber="27">
2192
+
2193
+
2194
+ <code class="ruby"></code>
2195
+ </li>
2196
+
2197
+ <li class="covered" data-hits="1" data-linenumber="28">
2198
+ <span class="hits">1</span>
2199
+
2200
+ <code class="ruby"> describe '#prepare' do</code>
2201
+ </li>
2202
+
2203
+ <li class="covered" data-hits="1" data-linenumber="29">
2204
+ <span class="hits">1</span>
2205
+
2206
+ <code class="ruby"> it 'get copy list' do</code>
2207
+ </li>
2208
+
2209
+ <li class="covered" data-hits="1" data-linenumber="30">
2210
+ <span class="hits">1</span>
2211
+
2212
+ <code class="ruby"> mg.prepare</code>
2213
+ </li>
2214
+
2215
+ <li class="covered" data-hits="1" data-linenumber="31">
2216
+ <span class="hits">1</span>
2217
+
2218
+ <code class="ruby"> file = File.expand_path('spec/fixtures/sample_files/module_3/config/database_production.yml')</code>
2219
+ </li>
2220
+
2221
+ <li class="covered" data-hits="1" data-linenumber="32">
2222
+ <span class="hits">1</span>
2223
+
2224
+ <code class="ruby"> target = File.expand_path('spec/fixtures/sample_files/my_app/config/database.yml')</code>
2225
+ </li>
2226
+
2227
+ <li class="covered" data-hits="1" data-linenumber="33">
2228
+ <span class="hits">1</span>
2229
+
2230
+ <code class="ruby"> mg.copy_list[target].should eq(file)</code>
2231
+ </li>
2232
+
2233
+ <li class="never" data-hits="" data-linenumber="34">
2234
+
2235
+
2236
+ <code class="ruby"> end</code>
2237
+ </li>
2238
+
2239
+ <li class="never" data-hits="" data-linenumber="35">
2240
+
2241
+
2242
+ <code class="ruby"></code>
2243
+ </li>
2244
+
2245
+ <li class="covered" data-hits="1" data-linenumber="36">
2246
+ <span class="hits">1</span>
2247
+
2248
+ <code class="ruby"> it 'get render list' do</code>
2249
+ </li>
2250
+
2251
+ <li class="covered" data-hits="1" data-linenumber="37">
2252
+ <span class="hits">1</span>
2253
+
2254
+ <code class="ruby"> mg.prepare</code>
2255
+ </li>
2256
+
2257
+ <li class="covered" data-hits="1" data-linenumber="38">
2258
+ <span class="hits">1</span>
2259
+
2260
+ <code class="ruby"> file = File.expand_path('spec/fixtures/sample_files/module_2/Gemfile.liquid')</code>
2261
+ </li>
2262
+
2263
+ <li class="covered" data-hits="1" data-linenumber="39">
2264
+ <span class="hits">1</span>
2265
+
2266
+ <code class="ruby"> target = File.expand_path('spec/fixtures/sample_files/my_app/Gemfile')</code>
2267
+ </li>
2268
+
2269
+ <li class="covered" data-hits="1" data-linenumber="40">
2270
+ <span class="hits">1</span>
2271
+
2272
+ <code class="ruby"> mg.render_list[target].should eq(file)</code>
2273
+ </li>
2274
+
2275
+ <li class="never" data-hits="" data-linenumber="41">
2276
+
2277
+
2278
+ <code class="ruby"> end</code>
2279
+ </li>
2280
+
2281
+ <li class="never" data-hits="" data-linenumber="42">
2282
+
2283
+
2284
+ <code class="ruby"> end</code>
2285
+ </li>
2286
+
2287
+ <li class="never" data-hits="" data-linenumber="43">
2288
+
2289
+
2290
+ <code class="ruby">end</code>
2291
+ </li>
2292
+
2293
+ </ol>
2294
+ </pre>
2295
+ </div>
2296
+
2297
+ <div class="source_table" id="36cf8ee74ad0aed8b9e2c51cc062f25c3bcf5f51">
2298
+ <div class="header">
2299
+ <h3>spec/stackup_spec.rb</h3>
2300
+ <h4><span class="green">100.0 %</span> covered</h4>
2301
+ <div>
2302
+ <b>12</b> relevant lines.
2303
+ <span class="green"><b>12</b> lines covered</span> and
2304
+ <span class="red"><b>0</b> lines missed.</span>
2305
+ </div>
2306
+ </div>
2307
+
2308
+ <pre>
2309
+ <ol>
2310
+
2311
+ <li class="never" data-hits="" data-linenumber="1">
2312
+
2313
+
2314
+ <code class="ruby"># encoding: utf-8</code>
2315
+ </li>
2316
+
2317
+ <li class="covered" data-hits="1" data-linenumber="2">
2318
+ <span class="hits">1</span>
2319
+
2320
+ <code class="ruby">require 'spec_helper'</code>
2321
+ </li>
2322
+
2323
+ <li class="never" data-hits="" data-linenumber="3">
2324
+
2325
+
2326
+ <code class="ruby"></code>
2327
+ </li>
2328
+
2329
+ <li class="covered" data-hits="1" data-linenumber="4">
2330
+ <span class="hits">1</span>
2331
+
2332
+ <code class="ruby">describe AppStack do</code>
2333
+ </li>
2334
+
2335
+ <li class="covered" data-hits="1" data-linenumber="5">
2336
+ <span class="hits">1</span>
2337
+
2338
+ <code class="ruby"> describe '.stackup!' do</code>
2339
+ </li>
2340
+
2341
+ <li class="covered" data-hits="1" data-linenumber="6">
2342
+ <span class="hits">1</span>
2343
+
2344
+ <code class="ruby"> it 'copy proper files' do</code>
2345
+ </li>
2346
+
2347
+ <li class="covered" data-hits="1" data-linenumber="7">
2348
+ <span class="hits">1</span>
2349
+
2350
+ <code class="ruby"> AppStack.stackup!('spec/fixtures/sample_files/my_app/app_stack.yml')</code>
2351
+ </li>
2352
+
2353
+ <li class="covered" data-hits="1" data-linenumber="8">
2354
+ <span class="hits">1</span>
2355
+
2356
+ <code class="ruby"> File.exists?('spec/fixtures/sample_files/my_app/config/boot_sample.rb').should be_false</code>
2357
+ </li>
2358
+
2359
+ <li class="covered" data-hits="1" data-linenumber="9">
2360
+ <span class="hits">1</span>
2361
+
2362
+ <code class="ruby"> File.exists?('spec/fixtures/sample_files/my_app/doc/including.txt').should be_true</code>
2363
+ </li>
2364
+
2365
+ <li class="covered" data-hits="1" data-linenumber="10">
2366
+ <span class="hits">1</span>
2367
+
2368
+ <code class="ruby"> File.exists?('spec/fixtures/sample_files/my_app/app/lib/sequence.rb').should be_true</code>
2369
+ </li>
2370
+
2371
+ <li class="covered" data-hits="1" data-linenumber="11">
2372
+ <span class="hits">1</span>
2373
+
2374
+ <code class="ruby"> File.read('spec/fixtures/sample_files/my_app/Gemfile').should eq(&quot;Mod2: my_app\n&quot;)</code>
2375
+ </li>
2376
+
2377
+ <li class="covered" data-hits="1" data-linenumber="12">
2378
+ <span class="hits">1</span>
2379
+
2380
+ <code class="ruby"> File.read('spec/fixtures/sample_files/my_app/doc/excluding.txt').should eq(&quot;from my_app\n&quot;)</code>
2381
+ </li>
2382
+
2383
+ <li class="covered" data-hits="1" data-linenumber="13">
2384
+ <span class="hits">1</span>
2385
+
2386
+ <code class="ruby"> FileUtils.rm_rf 'spec/fixtures/sample_files/my_app'</code>
2387
+ </li>
2388
+
2389
+ <li class="covered" data-hits="1" data-linenumber="14">
2390
+ <span class="hits">1</span>
2391
+
2392
+ <code class="ruby"> FileUtils.cp_r 'spec/fixtures/sample_files/my_app_back', 'spec/fixtures/sample_files/my_app'</code>
2393
+ </li>
2394
+
2395
+ <li class="never" data-hits="" data-linenumber="15">
2396
+
2397
+
2398
+ <code class="ruby"> end</code>
2399
+ </li>
2400
+
2401
+ <li class="never" data-hits="" data-linenumber="16">
2402
+
2403
+
2404
+ <code class="ruby"> end</code>
2405
+ </li>
2406
+
2407
+ <li class="never" data-hits="" data-linenumber="17">
2408
+
2409
+
2410
+ <code class="ruby">end</code>
2411
+ </li>
2412
+
2413
+ </ol>
2414
+ </pre>
2415
+ </div>
2416
+
2417
+ </div>
2418
+ </div>
2419
+ </body>
2420
+ </html>