rook 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LGPL +504 -0
- data/README.txt +15 -6
- data/bin/rook +1 -1
- data/doc-api/classes/BZ2/Reader.html +24 -24
- data/doc-api/classes/Digest/Base.html +18 -18
- data/doc-api/classes/Enumerable.html +55 -55
- data/doc-api/classes/File.html +53 -6
- data/doc-api/classes/FileUtils.html +90 -90
- data/doc-api/classes/Kernel.html +48 -48
- data/doc-api/classes/Rook.html +18 -5
- data/doc-api/classes/Rook/Assertion.html +29 -14
- data/doc-api/classes/Rook/Commands.html +296 -364
- data/doc-api/classes/Rook/Cookbook.html +165 -60
- data/doc-api/classes/Rook/CookbookError.html +7 -7
- data/doc-api/classes/Rook/CookbookValidator.html +24 -24
- data/doc-api/classes/Rook/Kitchen.html +379 -224
- data/doc-api/classes/Rook/KitchenHelper.html +69 -69
- data/doc-api/classes/Rook/Main.html +47 -30
- data/doc-api/classes/Rook/Recipe.html +63 -35
- data/doc-api/classes/Rook/Util.html +72 -68
- data/doc-api/classes/Rook/Util/UndefinedPropertyError.html +6 -6
- data/doc-api/classes/Rook/{Parameters.html → ValueTable.html} +129 -123
- data/doc-api/created.rid +1 -1
- data/doc-api/files/rook/commands_rb.html +2 -2
- data/doc-api/files/rook/cookbook_rb.html +2 -2
- data/doc-api/files/rook/helper/bz2_rb.html +1 -1
- data/doc-api/files/rook/helper/digest_rb.html +1 -1
- data/doc-api/files/rook/helper/enumerable_rb.html +1 -1
- data/doc-api/files/rook/helper/file_rb.html +2 -2
- data/doc-api/files/rook/helper/fileutils_rb.html +1 -1
- data/doc-api/files/rook/helper/kernel_rb.html +1 -1
- data/doc-api/files/rook/kitchen_rb.html +2 -2
- data/doc-api/files/rook/main_rb.html +2 -2
- data/doc-api/files/rook/recipe_rb.html +2 -2
- data/doc-api/files/rook/util_rb.html +2 -2
- data/doc-api/files/rook_rb.html +2 -2
- data/doc-api/fr_class_index.html +1 -1
- data/doc-api/fr_file_index.html +0 -1
- data/doc-api/fr_method_index.html +148 -140
- data/doc-api/index.html +1 -1
- data/examples/hello_c/Rookbook.rb +1 -1
- data/examples/hello_c/Rookbook.yaml +8 -8
- data/examples/project/README.txt +2 -2
- data/examples/project/Rookbook.rb +20 -19
- data/examples/project/Rookbook.yaml +30 -28
- data/examples/project/bin/example +2 -2
- data/examples/project/example.gemspec +1 -1
- data/examples/project/lib/example.rb +2 -2
- data/examples/project/test/test.rb +2 -2
- data/lib/rook.rb +5 -2
- data/lib/rook/commands.rb +28 -17
- data/lib/rook/cookbook.rb +107 -92
- data/lib/rook/helper/bz2.rb +1 -1
- data/lib/rook/helper/digest.rb +1 -1
- data/lib/rook/helper/enumerable.rb +1 -1
- data/lib/rook/helper/file.rb +28 -3
- data/lib/rook/helper/fileutils.rb +1 -1
- data/lib/rook/helper/kernel.rb +1 -1
- data/lib/rook/kitchen.rb +138 -100
- data/lib/rook/main.rb +72 -47
- data/lib/rook/recipe.rb +51 -35
- data/lib/rook/rookbook.schema.yaml +34 -54
- data/lib/rook/util.rb +22 -8
- data/rook.gemspec +5 -5
- metadata +5 -7
- data/COPYING +0 -340
- data/doc-api/files/__/README_txt.html +0 -313
@@ -101,11 +101,13 @@ ex.
|
|
101
101
|
<h3 class="section-bar">Methods</h3>
|
102
102
|
|
103
103
|
<div class="name-list">
|
104
|
-
<a href="#
|
105
|
-
<a href="#
|
106
|
-
<a href="#
|
107
|
-
<a href="#
|
108
|
-
<a href="#
|
104
|
+
<a href="#M000139">_add_code</a>
|
105
|
+
<a href="#M000135">load_yamlfile</a>
|
106
|
+
<a href="#M000136">load_yamlstr</a>
|
107
|
+
<a href="#M000137">load_ydoc</a>
|
108
|
+
<a href="#M000133">new</a>
|
109
|
+
<a href="#M000134">preparation</a>
|
110
|
+
<a href="#M000138">validate_rubycode</a>
|
109
111
|
</div>
|
110
112
|
</div>
|
111
113
|
|
@@ -143,22 +145,22 @@ ex.
|
|
143
145
|
<td class="context-item-desc"></td>
|
144
146
|
</tr>
|
145
147
|
<tr class="top-aligned-row context-row">
|
146
|
-
<td class="context-item-name">
|
148
|
+
<td class="context-item-name">parameters</td>
|
147
149
|
<td class="context-item-value"> [R] </td>
|
148
150
|
<td class="context-item-desc"></td>
|
149
151
|
</tr>
|
150
152
|
<tr class="top-aligned-row context-row">
|
151
|
-
<td class="context-item-name">
|
153
|
+
<td class="context-item-name">preparations</td>
|
152
154
|
<td class="context-item-value"> [R] </td>
|
153
155
|
<td class="context-item-desc"></td>
|
154
156
|
</tr>
|
155
157
|
<tr class="top-aligned-row context-row">
|
156
|
-
<td class="context-item-name">
|
158
|
+
<td class="context-item-name">properties</td>
|
157
159
|
<td class="context-item-value"> [R] </td>
|
158
160
|
<td class="context-item-desc"></td>
|
159
161
|
</tr>
|
160
162
|
<tr class="top-aligned-row context-row">
|
161
|
-
<td class="context-item-name">
|
163
|
+
<td class="context-item-name">recipes</td>
|
162
164
|
<td class="context-item-value"> [R] </td>
|
163
165
|
<td class="context-item-desc"></td>
|
164
166
|
</tr>
|
@@ -172,25 +174,25 @@ ex.
|
|
172
174
|
<div id="methods">
|
173
175
|
<h3 class="section-bar">Public Class methods</h3>
|
174
176
|
|
175
|
-
<div id="method-
|
176
|
-
<a name="
|
177
|
+
<div id="method-M000133" class="method-detail">
|
178
|
+
<a name="M000133"></a>
|
177
179
|
|
178
180
|
<div class="method-heading">
|
179
|
-
<a href="#
|
181
|
+
<a href="#M000133" class="method-signature">
|
180
182
|
<span class="method-name">new</span><span class="method-args">(bookname=nil, load_yaml=true, expand_tab=true)</span>
|
181
183
|
</a>
|
182
184
|
</div>
|
183
185
|
|
184
186
|
<div class="method-description">
|
185
187
|
<p><a class="source-toggle" href="#"
|
186
|
-
onclick="toggleCode('
|
187
|
-
<div class="method-source-code" id="
|
188
|
+
onclick="toggleCode('M000133-source');return false;">[Source]</a></p>
|
189
|
+
<div class="method-source-code" id="M000133-source">
|
188
190
|
<pre>
|
189
191
|
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 101</span>
|
190
192
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">bookname</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">load_yaml</span>=<span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">expand_tab</span>=<span class="ruby-keyword kw">true</span>)
|
191
|
-
<span class="ruby-ivar">@
|
193
|
+
<span class="ruby-ivar">@preparations</span> = []
|
192
194
|
<span class="ruby-ivar">@properties</span> = []
|
193
|
-
<span class="ruby-ivar">@
|
195
|
+
<span class="ruby-ivar">@parameters</span> = []
|
194
196
|
<span class="ruby-ivar">@materials</span> = []
|
195
197
|
<span class="ruby-ivar">@recipes</span> = []
|
196
198
|
<span class="ruby-ivar">@bookname</span> = <span class="ruby-identifier">bookname</span>
|
@@ -203,19 +205,47 @@ ex.
|
|
203
205
|
|
204
206
|
<h3 class="section-bar">Public Instance methods</h3>
|
205
207
|
|
206
|
-
<div id="method-
|
207
|
-
<a name="
|
208
|
+
<div id="method-M000139" class="method-detail">
|
209
|
+
<a name="M000139"></a>
|
210
|
+
|
211
|
+
<div class="method-heading">
|
212
|
+
<a href="#M000139" class="method-signature">
|
213
|
+
<span class="method-name">_add_code</span><span class="method-args">(lines, hash, key)</span>
|
214
|
+
</a>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div class="method-description">
|
218
|
+
<p><a class="source-toggle" href="#"
|
219
|
+
onclick="toggleCode('M000139-source');return false;">[Source]</a></p>
|
220
|
+
<div class="method-source-code" id="M000139-source">
|
221
|
+
<pre>
|
222
|
+
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 238</span>
|
223
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_add_code</span>(<span class="ruby-identifier">lines</span>, <span class="ruby-identifier">hash</span>, <span class="ruby-identifier">key</span>)
|
224
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">key</span>)
|
225
|
+
<span class="ruby-identifier">code</span> = <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>]
|
226
|
+
<span class="ruby-identifier">n</span> = <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'linenum'</span>] <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
227
|
+
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">each_line</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">n</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>] = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp</span> }
|
228
|
+
<span class="ruby-identifier">lines</span>[<span class="ruby-identifier">n</span>] = <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">n</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">';'</span>
|
229
|
+
<span class="ruby-keyword kw">end</span>
|
230
|
+
<span class="ruby-keyword kw">end</span>
|
231
|
+
</pre>
|
232
|
+
</div>
|
233
|
+
</div>
|
234
|
+
</div>
|
235
|
+
|
236
|
+
<div id="method-M000135" class="method-detail">
|
237
|
+
<a name="M000135"></a>
|
208
238
|
|
209
239
|
<div class="method-heading">
|
210
|
-
<a href="#
|
240
|
+
<a href="#M000135" class="method-signature">
|
211
241
|
<span class="method-name">load_yamlfile</span><span class="method-args">(bookname, tab_expand=true)</span>
|
212
242
|
</a>
|
213
243
|
</div>
|
214
244
|
|
215
245
|
<div class="method-description">
|
216
246
|
<p><a class="source-toggle" href="#"
|
217
|
-
onclick="toggleCode('
|
218
|
-
<div class="method-source-code" id="
|
247
|
+
onclick="toggleCode('M000135-source');return false;">[Source]</a></p>
|
248
|
+
<div class="method-source-code" id="M000135-source">
|
219
249
|
<pre>
|
220
250
|
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 119</span>
|
221
251
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_yamlfile</span>(<span class="ruby-identifier">bookname</span>, <span class="ruby-identifier">tab_expand</span>=<span class="ruby-keyword kw">true</span>)
|
@@ -228,19 +258,19 @@ ex.
|
|
228
258
|
</div>
|
229
259
|
</div>
|
230
260
|
|
231
|
-
<div id="method-
|
232
|
-
<a name="
|
261
|
+
<div id="method-M000136" class="method-detail">
|
262
|
+
<a name="M000136"></a>
|
233
263
|
|
234
264
|
<div class="method-heading">
|
235
|
-
<a href="#
|
265
|
+
<a href="#M000136" class="method-signature">
|
236
266
|
<span class="method-name">load_yamlstr</span><span class="method-args">(yaml_str)</span>
|
237
267
|
</a>
|
238
268
|
</div>
|
239
269
|
|
240
270
|
<div class="method-description">
|
241
271
|
<p><a class="source-toggle" href="#"
|
242
|
-
onclick="toggleCode('
|
243
|
-
<div class="method-source-code" id="
|
272
|
+
onclick="toggleCode('M000136-source');return false;">[Source]</a></p>
|
273
|
+
<div class="method-source-code" id="M000136-source">
|
244
274
|
<pre>
|
245
275
|
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 126</span>
|
246
276
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_yamlstr</span>(<span class="ruby-identifier">yaml_str</span>)
|
@@ -264,78 +294,153 @@ ex.
|
|
264
294
|
</div>
|
265
295
|
</div>
|
266
296
|
|
267
|
-
<div id="method-
|
268
|
-
<a name="
|
297
|
+
<div id="method-M000137" class="method-detail">
|
298
|
+
<a name="M000137"></a>
|
269
299
|
|
270
300
|
<div class="method-heading">
|
271
|
-
<a href="#
|
301
|
+
<a href="#M000137" class="method-signature">
|
272
302
|
<span class="method-name">load_ydoc</span><span class="method-args">(ydoc, parser=nil)</span>
|
273
303
|
</a>
|
274
304
|
</div>
|
275
305
|
|
276
306
|
<div class="method-description">
|
277
307
|
<p><a class="source-toggle" href="#"
|
278
|
-
onclick="toggleCode('
|
279
|
-
<div class="method-source-code" id="
|
308
|
+
onclick="toggleCode('M000137-source');return false;">[Source]</a></p>
|
309
|
+
<div class="method-source-code" id="M000137-source">
|
280
310
|
<pre>
|
281
311
|
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 144</span>
|
282
312
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_ydoc</span>(<span class="ruby-identifier">ydoc</span>, <span class="ruby-identifier">parser</span>=<span class="ruby-keyword kw">nil</span>)
|
283
313
|
<span class="ruby-identifier">ydoc</span> = <span class="ruby-identifier">ydoc</span>.<span class="ruby-identifier">dup</span>
|
284
|
-
<span class="ruby-comment cmt"
|
285
|
-
<span class="ruby-identifier">code</span> = <span class="ruby-identifier">ydoc</span>[<span class="ruby-value str">'
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
<span class="ruby-
|
314
|
+
<span class="ruby-comment cmt"># preparation</span>
|
315
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">code</span> = <span class="ruby-identifier">ydoc</span>[<span class="ruby-value str">'preparation*'</span>]
|
316
|
+
<span class="ruby-identifier">linenum</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">path_linenum</span>(<span class="ruby-value str">'/preparation*'</span>)
|
317
|
+
<span class="ruby-ivar">@preparations</span> <span class="ruby-operator"><<</span> { <span class="ruby-value str">'code'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">code</span>, <span class="ruby-value str">'linenum'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">linenum</span><span class="ruby-operator">+</span><span class="ruby-value">1</span> }
|
318
|
+
<span class="ruby-keyword kw">end</span>
|
319
|
+
<span class="ruby-comment cmt"># properties, parameters</span>
|
320
|
+
[ <span class="ruby-value str">'properties'</span>, <span class="ruby-value str">'parameters'</span> ].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
|
321
|
+
<span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ydoc</span>[<span class="ruby-identifier">part</span>]
|
322
|
+
<span class="ruby-identifier">list</span> = <span class="ruby-identifier">part</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'properties'</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@properties</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@parameters</span>
|
323
|
+
<span class="ruby-identifier">ydoc</span>[<span class="ruby-identifier">part</span>].<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">prop</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
292
324
|
<span class="ruby-identifier">opts</span> = {}
|
293
325
|
<span class="ruby-identifier">prop</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">prop</span>[<span class="ruby-identifier">k</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-keyword kw">end</span>
|
294
326
|
<span class="ruby-identifier">prop</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
|
295
327
|
<span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
296
|
-
<span class="ruby-identifier">
|
328
|
+
<span class="ruby-identifier">linenum</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">path_linenum</span>(<span class="ruby-node">"/#{part}/#{i}/#{name}"</span>)
|
329
|
+
<span class="ruby-identifier">vkey</span> = <span class="ruby-identifier">name</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?*</span> <span class="ruby-operator">?</span> <span class="ruby-value str">'value*'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'value'</span>
|
297
330
|
<span class="ruby-comment cmt">#name[-1,1] = '' if name[-1] == ?* # TypeError: can't modify frozen string</span>
|
298
331
|
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">name</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?*</span>
|
299
|
-
<span class="ruby-identifier">h</span> = { <span class="ruby-value str">'name'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">vkey</span>=<span class="ruby-operator">></span><span class="ruby-identifier">val</span> }
|
332
|
+
<span class="ruby-identifier">h</span> = { <span class="ruby-value str">'name'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">vkey</span>=<span class="ruby-operator">></span><span class="ruby-identifier">val</span>, <span class="ruby-value str">'linenum'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">linenum</span> }
|
300
333
|
<span class="ruby-identifier">h</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">opts</span>)
|
301
334
|
<span class="ruby-identifier">list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">h</span>
|
302
335
|
<span class="ruby-keyword kw">end</span>
|
303
336
|
<span class="ruby-keyword kw">end</span>
|
304
|
-
<span class="ruby-identifier">ydoc</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">list</span>
|
305
337
|
<span class="ruby-keyword kw">end</span>
|
306
|
-
<span class="ruby-comment cmt"
|
307
|
-
<span class="ruby-
|
308
|
-
|
309
|
-
<span class="ruby-
|
310
|
-
<span class="ruby-
|
311
|
-
<span class="ruby-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
338
|
+
<span class="ruby-comment cmt"># materials</span>
|
339
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">list</span> = <span class="ruby-identifier">ydoc</span>[<span class="ruby-value str">'materials'</span>]
|
340
|
+
<span class="ruby-ivar">@materials</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">list</span>
|
341
|
+
<span class="ruby-keyword kw">end</span>
|
342
|
+
<span class="ruby-comment cmt"># recipes</span>
|
343
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">list</span> = <span class="ruby-identifier">ydoc</span>[<span class="ruby-value str">'recipes'</span>]
|
344
|
+
<span class="ruby-identifier">list</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
345
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'method*'</span>]
|
346
|
+
<span class="ruby-identifier">linenum</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">path_linenum</span>(<span class="ruby-node">"/recipes/#{i}/method*"</span>)
|
347
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'linenum'</span>] = <span class="ruby-identifier">linenum</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>
|
348
|
+
<span class="ruby-keyword kw">end</span>
|
349
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'params'</span>]
|
350
|
+
<span class="ruby-identifier">list</span> = []
|
351
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'params'</span>].<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">params</span>, <span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
|
352
|
+
<span class="ruby-identifier">params</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
|
353
|
+
<span class="ruby-identifier">linenum</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">path_linenum</span>(<span class="ruby-node">"/recipes/#{i}/params/#{n}/#{name}"</span>)
|
354
|
+
<span class="ruby-identifier">list</span> <span class="ruby-operator"><<</span> { <span class="ruby-value str">'name'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">name</span>, <span class="ruby-value str">'value'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">val</span>, <span class="ruby-value str">'linenum'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">linenum</span> }
|
355
|
+
<span class="ruby-keyword kw">end</span>
|
356
|
+
<span class="ruby-keyword kw">end</span>
|
357
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'params'</span>] = <span class="ruby-identifier">list</span>
|
358
|
+
<span class="ruby-keyword kw">end</span>
|
359
|
+
<span class="ruby-ivar">@recipes</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">hash</span>
|
360
|
+
<span class="ruby-keyword kw">end</span>
|
361
|
+
<span class="ruby-keyword kw">end</span>
|
316
362
|
<span class="ruby-keyword kw">end</span>
|
317
363
|
</pre>
|
318
364
|
</div>
|
319
365
|
</div>
|
320
366
|
</div>
|
321
367
|
|
322
|
-
<div id="method-
|
323
|
-
<a name="
|
368
|
+
<div id="method-M000134" class="method-detail">
|
369
|
+
<a name="M000134"></a>
|
324
370
|
|
325
371
|
<div class="method-heading">
|
326
|
-
<a href="#
|
327
|
-
<span class="method-name">
|
372
|
+
<a href="#M000134" class="method-signature">
|
373
|
+
<span class="method-name">preparation</span><span class="method-args">()</span>
|
328
374
|
</a>
|
329
375
|
</div>
|
330
376
|
|
331
377
|
<div class="method-description">
|
332
378
|
<p><a class="source-toggle" href="#"
|
333
|
-
onclick="toggleCode('
|
334
|
-
<div class="method-source-code" id="
|
379
|
+
onclick="toggleCode('M000134-source');return false;">[Source]</a></p>
|
380
|
+
<div class="method-source-code" id="M000134-source">
|
335
381
|
<pre>
|
336
382
|
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 114</span>
|
337
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
338
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@
|
383
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">preparation</span>
|
384
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@preparations</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'code'</span>] }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>)
|
385
|
+
<span class="ruby-keyword kw">end</span>
|
386
|
+
</pre>
|
387
|
+
</div>
|
388
|
+
</div>
|
389
|
+
</div>
|
390
|
+
|
391
|
+
<div id="method-M000138" class="method-detail">
|
392
|
+
<a name="M000138"></a>
|
393
|
+
|
394
|
+
<div class="method-heading">
|
395
|
+
<a href="#M000138" class="method-signature">
|
396
|
+
<span class="method-name">validate_rubycode</span><span class="method-args">()</span>
|
397
|
+
</a>
|
398
|
+
</div>
|
399
|
+
|
400
|
+
<div class="method-description">
|
401
|
+
<p><a class="source-toggle" href="#"
|
402
|
+
onclick="toggleCode('M000138-source');return false;">[Source]</a></p>
|
403
|
+
<div class="method-source-code" id="M000138-source">
|
404
|
+
<pre>
|
405
|
+
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 197</span>
|
406
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">validate_rubycode</span>
|
407
|
+
<span class="ruby-identifier">lines</span> = []
|
408
|
+
<span class="ruby-ivar">@preparations</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
|
409
|
+
<span class="ruby-identifier">_add_code</span>(<span class="ruby-identifier">lines</span>, <span class="ruby-identifier">hash</span>, <span class="ruby-value str">'code'</span>)
|
410
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@preparations</span>
|
411
|
+
<span class="ruby-ivar">@properties</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
|
412
|
+
<span class="ruby-identifier">_add_code</span>(<span class="ruby-identifier">lines</span>, <span class="ruby-identifier">hash</span>, <span class="ruby-value str">'value*'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'value*'</span>)
|
413
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@properties</span>
|
414
|
+
<span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
|
415
|
+
<span class="ruby-identifier">_add_code</span>(<span class="ruby-identifier">lines</span>, <span class="ruby-identifier">hash</span>, <span class="ruby-value str">'value*'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'value*'</span>)
|
416
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@parameters</span>
|
417
|
+
<span class="ruby-ivar">@recipes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
|
418
|
+
<span class="ruby-identifier">_add_code</span>(<span class="ruby-identifier">lines</span>, <span class="ruby-identifier">hash</span>, <span class="ruby-value str">'method*'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'method*'</span>)
|
419
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'params'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span>
|
420
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">h</span>[<span class="ruby-value str">'name'</span>]
|
421
|
+
<span class="ruby-identifier">_add_code</span>(<span class="ruby-identifier">lines</span>, <span class="ruby-identifier">h</span>, <span class="ruby-value str">'value'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?*</span>
|
422
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'params'</span>)
|
423
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@recipes</span>
|
424
|
+
<span class="ruby-comment cmt">#</span>
|
425
|
+
<span class="ruby-identifier">lines</span>.<span class="ruby-identifier">shift</span> <span class="ruby-comment cmt"># ignore first item</span>
|
426
|
+
<span class="ruby-identifier">code</span> = <span class="ruby-value str">''</span>
|
427
|
+
<span class="ruby-identifier">lines</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
428
|
+
<span class="ruby-identifier">code</span> <span class="ruby-operator"><<</span> (<span class="ruby-identifier">line</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>) <span class="ruby-operator"><<</span> <span class="ruby-value str">"\n"</span>
|
429
|
+
<span class="ruby-keyword kw">end</span>
|
430
|
+
<span class="ruby-identifier">tmpfilename</span> = <span class="ruby-node">"#{@bookname}."</span> <span class="ruby-comment cmt"># or user tmpfile library</span>
|
431
|
+
<span class="ruby-keyword kw">begin</span>
|
432
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">tmpfilename</span>, <span class="ruby-value str">'w'</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">code</span>) }
|
433
|
+
<span class="ruby-comment cmt">#case RUBY_PLATFORM</span>
|
434
|
+
<span class="ruby-comment cmt">#when /linux/, /bsd/, /darwin/, /cygwin/</span>
|
435
|
+
<span class="ruby-identifier">out</span> = <span class="ruby-node">`ruby -wc #{tmpfilename} 2>&1`</span>
|
436
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">out</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/^#{tmpfilename}/</span>, <span class="ruby-identifier">bookname</span>)
|
437
|
+
<span class="ruby-comment cmt">#else</span>
|
438
|
+
<span class="ruby-comment cmt"># system "ruby -wc #{tmpfilename}"</span>
|
439
|
+
<span class="ruby-comment cmt">#end</span>
|
440
|
+
<span class="ruby-keyword kw">ensure</span>
|
441
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">unlink</span>(<span class="ruby-identifier">tmpfilename</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">test</span>(<span class="ruby-value">?f</span>, <span class="ruby-identifier">tmpfilename</span>)
|
442
|
+
<span class="ruby-keyword kw">end</span>
|
443
|
+
|
339
444
|
<span class="ruby-keyword kw">end</span>
|
340
445
|
</pre>
|
341
446
|
</div>
|
@@ -88,7 +88,7 @@
|
|
88
88
|
<h3 class="section-bar">Methods</h3>
|
89
89
|
|
90
90
|
<div class="name-list">
|
91
|
-
<a href="#
|
91
|
+
<a href="#M000094">new</a>
|
92
92
|
</div>
|
93
93
|
</div>
|
94
94
|
|
@@ -123,21 +123,21 @@
|
|
123
123
|
<div id="methods">
|
124
124
|
<h3 class="section-bar">Public Class methods</h3>
|
125
125
|
|
126
|
-
<div id="method-
|
127
|
-
<a name="
|
126
|
+
<div id="method-M000094" class="method-detail">
|
127
|
+
<a name="M000094"></a>
|
128
128
|
|
129
129
|
<div class="method-heading">
|
130
|
-
<a href="#
|
130
|
+
<a href="#M000094" class="method-signature">
|
131
131
|
<span class="method-name">new</span><span class="method-args">(message, validation_errors)</span>
|
132
132
|
</a>
|
133
133
|
</div>
|
134
134
|
|
135
135
|
<div class="method-description">
|
136
136
|
<p><a class="source-toggle" href="#"
|
137
|
-
onclick="toggleCode('
|
138
|
-
<div class="method-source-code" id="
|
137
|
+
onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
|
138
|
+
<div class="method-source-code" id="M000094-source">
|
139
139
|
<pre>
|
140
|
-
<span class="ruby-comment cmt"># File rook/cookbook.rb, line
|
140
|
+
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 21</span>
|
141
141
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">validation_errors</span>)
|
142
142
|
<span class="ruby-ivar">@errors</span> = <span class="ruby-identifier">validation_errors</span>
|
143
143
|
<span class="ruby-keyword kw">end</span>
|
@@ -86,9 +86,9 @@
|
|
86
86
|
<h3 class="section-bar">Methods</h3>
|
87
87
|
|
88
88
|
<div class="name-list">
|
89
|
-
<a href="#
|
90
|
-
<a href="#
|
91
|
-
<a href="#
|
89
|
+
<a href="#M000078">create_error</a>
|
90
|
+
<a href="#M000077">new</a>
|
91
|
+
<a href="#M000079">validate_hook</a>
|
92
92
|
</div>
|
93
93
|
</div>
|
94
94
|
|
@@ -110,21 +110,21 @@
|
|
110
110
|
<div id="methods">
|
111
111
|
<h3 class="section-bar">Public Class methods</h3>
|
112
112
|
|
113
|
-
<div id="method-
|
114
|
-
<a name="
|
113
|
+
<div id="method-M000077" class="method-detail">
|
114
|
+
<a name="M000077"></a>
|
115
115
|
|
116
116
|
<div class="method-heading">
|
117
|
-
<a href="#
|
117
|
+
<a href="#M000077" class="method-signature">
|
118
118
|
<span class="method-name">new</span><span class="method-args">()</span>
|
119
119
|
</a>
|
120
120
|
</div>
|
121
121
|
|
122
122
|
<div class="method-description">
|
123
123
|
<p><a class="source-toggle" href="#"
|
124
|
-
onclick="toggleCode('
|
125
|
-
<div class="method-source-code" id="
|
124
|
+
onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
|
125
|
+
<div class="method-source-code" id="M000077-source">
|
126
126
|
<pre>
|
127
|
-
<span class="ruby-comment cmt"># File rook/cookbook.rb, line
|
127
|
+
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 41</span>
|
128
128
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>()
|
129
129
|
<span class="ruby-keyword kw">super</span>(<span class="ruby-ivar">@@schema</span>)
|
130
130
|
<span class="ruby-keyword kw">end</span>
|
@@ -135,21 +135,21 @@
|
|
135
135
|
|
136
136
|
<h3 class="section-bar">Public Instance methods</h3>
|
137
137
|
|
138
|
-
<div id="method-
|
139
|
-
<a name="
|
138
|
+
<div id="method-M000078" class="method-detail">
|
139
|
+
<a name="M000078"></a>
|
140
140
|
|
141
141
|
<div class="method-heading">
|
142
|
-
<a href="#
|
142
|
+
<a href="#M000078" class="method-signature">
|
143
143
|
<span class="method-name">create_error</span><span class="method-args">(path, message)</span>
|
144
144
|
</a>
|
145
145
|
</div>
|
146
146
|
|
147
147
|
<div class="method-description">
|
148
148
|
<p><a class="source-toggle" href="#"
|
149
|
-
onclick="toggleCode('
|
150
|
-
<div class="method-source-code" id="
|
149
|
+
onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
|
150
|
+
<div class="method-source-code" id="M000078-source">
|
151
151
|
<pre>
|
152
|
-
<span class="ruby-comment cmt"># File rook/cookbook.rb, line
|
152
|
+
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 46</span>
|
153
153
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_error</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">message</span>)
|
154
154
|
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">Kwalify</span><span class="ruby-operator">::</span><span class="ruby-constant">ValidationError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">path</span>)
|
155
155
|
<span class="ruby-keyword kw">end</span>
|
@@ -158,21 +158,21 @@
|
|
158
158
|
</div>
|
159
159
|
</div>
|
160
160
|
|
161
|
-
<div id="method-
|
162
|
-
<a name="
|
161
|
+
<div id="method-M000079" class="method-detail">
|
162
|
+
<a name="M000079"></a>
|
163
163
|
|
164
164
|
<div class="method-heading">
|
165
|
-
<a href="#
|
165
|
+
<a href="#M000079" class="method-signature">
|
166
166
|
<span class="method-name">validate_hook</span><span class="method-args">(value, rule, path, errors)</span>
|
167
167
|
</a>
|
168
168
|
</div>
|
169
169
|
|
170
170
|
<div class="method-description">
|
171
171
|
<p><a class="source-toggle" href="#"
|
172
|
-
onclick="toggleCode('
|
173
|
-
<div class="method-source-code" id="
|
172
|
+
onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
|
173
|
+
<div class="method-source-code" id="M000079-source">
|
174
174
|
<pre>
|
175
|
-
<span class="ruby-comment cmt"># File rook/cookbook.rb, line
|
175
|
+
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 55</span>
|
176
176
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">validate_hook</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">errors</span>)
|
177
177
|
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">name</span>
|
178
178
|
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'MATERIAL'</span>
|
@@ -186,9 +186,9 @@
|
|
186
186
|
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'PROP'</span>
|
187
187
|
<span class="ruby-identifier">value</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
188
188
|
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">k</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
189
|
-
<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">
|
190
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/\A[a-zA-Z_]
|
191
|
-
<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">
|
189
|
+
<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">create_error</span>(<span class="ruby-node">"#{path}/#{k}"</span>, <span class="ruby-value str">"property name is not a string."</span>)
|
190
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/\A[a-zA-Z_]\w*\*?\z/</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'.desc'</span>
|
191
|
+
<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">create_error</span>(<span class="ruby-node">"#{path}/#{k}"</span>, <span class="ruby-value str">"invlaid property name."</span>)
|
192
192
|
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">k</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?*</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
193
193
|
<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">create_error</span>(<span class="ruby-node">"#{path}/#{k}"</span>, <span class="ruby-value str">"expr is not a string."</span>)
|
194
194
|
<span class="ruby-keyword kw">end</span>
|