genosaurus 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/doc/classes/Genosaurus.html +112 -111
- data/doc/created.rid +1 -1
- data/doc/files/lib/genosaurus_rb.html +1 -1
- data/lib/genosaurus.rb +3 -2
- data/test/test_helper.rb +1 -0
- metadata +8 -2
data/doc/classes/Genosaurus.html
CHANGED
@@ -165,12 +165,13 @@ initialization.
|
|
165
165
|
35: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">match</span>(<span class="ruby-node">/#{@generator_name_underscore}\.rb$/</span>)
|
166
166
|
36: <span class="ruby-ivar">@templates_directory_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">f</span>), <span class="ruby-value str">"templates"</span>)
|
167
167
|
37: <span class="ruby-ivar">@manifest_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">f</span>), <span class="ruby-value str">"manifest.yml"</span>)
|
168
|
-
38: <span class="ruby-keyword kw">
|
169
|
-
39:
|
170
|
-
40:
|
171
|
-
41:
|
172
|
-
42: <span class="ruby-
|
173
|
-
43:
|
168
|
+
38: <span class="ruby-keyword kw">end</span>
|
169
|
+
39: <span class="ruby-keyword kw">end</span>
|
170
|
+
40: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@templates_directory_path</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@manifest_path</span>.<span class="ruby-identifier">nil?</span>
|
171
|
+
41: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Unable to dynamically figure out your templates_directory_path and manifest_path! Please implement these methods and let Genosaurus know where to find these things. Thanks."</span>
|
172
|
+
42: <span class="ruby-keyword kw">end</span>
|
173
|
+
43: <span class="ruby-identifier">setup</span>
|
174
|
+
44: <span class="ruby-keyword kw">end</span>
|
174
175
|
</pre>
|
175
176
|
</div>
|
176
177
|
</div>
|
@@ -193,11 +194,11 @@ Used to define arguments that are required by the generator.
|
|
193
194
|
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
194
195
|
<div class="method-source-code" id="M000009-source">
|
195
196
|
<pre>
|
196
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
197
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 106</span>
|
198
|
+
106: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
199
|
+
107: <span class="ruby-identifier">required_params</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">args</span>
|
200
|
+
108: <span class="ruby-identifier">required_params</span>.<span class="ruby-identifier">flatten!</span>
|
201
|
+
109: <span class="ruby-keyword kw">end</span>
|
201
202
|
</pre>
|
202
203
|
</div>
|
203
204
|
</div>
|
@@ -220,10 +221,10 @@ Returns the <a href="Genosaurus.html#M000010">required_params</a> array.
|
|
220
221
|
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
221
222
|
<div class="method-source-code" id="M000010-source">
|
222
223
|
<pre>
|
223
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
224
|
-
|
225
|
-
|
226
|
-
|
224
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 112</span>
|
225
|
+
112: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">required_params</span>
|
226
|
+
113: <span class="ruby-ivar">@required_params</span> <span class="ruby-operator">||=</span> []
|
227
|
+
114: <span class="ruby-keyword kw">end</span>
|
227
228
|
</pre>
|
228
229
|
</div>
|
229
230
|
</div>
|
@@ -282,9 +283,9 @@ generators.
|
|
282
283
|
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
283
284
|
<div class="method-source-code" id="M000007-source">
|
284
285
|
<pre>
|
285
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
286
|
-
|
287
|
-
|
286
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 73</span>
|
287
|
+
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_generate</span>
|
288
|
+
74: <span class="ruby-keyword kw">end</span>
|
288
289
|
</pre>
|
289
290
|
</div>
|
290
291
|
</div>
|
@@ -309,9 +310,9 @@ href="Genosaurus.html#M000001">run</a>.
|
|
309
310
|
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
310
311
|
<div class="method-source-code" id="M000006-source">
|
311
312
|
<pre>
|
312
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
313
|
-
|
314
|
-
|
313
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 68</span>
|
314
|
+
68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before_generate</span>
|
315
|
+
69: <span class="ruby-keyword kw">end</span>
|
315
316
|
</pre>
|
316
317
|
</div>
|
317
318
|
</div>
|
@@ -331,12 +332,12 @@ href="Genosaurus.html#M000001">run</a>.
|
|
331
332
|
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
332
333
|
<div class="method-source-code" id="M000014-source">
|
333
334
|
<pre>
|
334
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
335
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 146</span>
|
336
|
+
146: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">copy</span>(<span class="ruby-identifier">input_file</span>, <span class="ruby-identifier">output_file</span>, <span class="ruby-identifier">options</span> = <span class="ruby-ivar">@options</span>)
|
337
|
+
147: <span class="ruby-identifier">output_file</span> = <span class="ruby-identifier">template_copy_common</span>(<span class="ruby-identifier">output_file</span>, <span class="ruby-identifier">options</span>)
|
338
|
+
148: <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">cp</span>(<span class="ruby-identifier">input_file</span>, <span class="ruby-identifier">output_file</span>)
|
339
|
+
149: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Copied: #{output_file}"</span>
|
340
|
+
150: <span class="ruby-keyword kw">end</span>
|
340
341
|
</pre>
|
341
342
|
</div>
|
342
343
|
</div>
|
@@ -359,18 +360,18 @@ Creates the specified <a href="Genosaurus.html#M000013">directory</a>.
|
|
359
360
|
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
360
361
|
<div class="method-source-code" id="M000013-source">
|
361
362
|
<pre>
|
362
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
363
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 134</span>
|
364
|
+
134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">directory</span>(<span class="ruby-identifier">output_dir</span>, <span class="ruby-identifier">options</span> = <span class="ruby-ivar">@options</span>)
|
365
|
+
135: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$genosaurus_output_directory</span>
|
366
|
+
136: <span class="ruby-identifier">output_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">$genosaurus_output_directory</span>, <span class="ruby-identifier">output_dir</span>)
|
367
|
+
137: <span class="ruby-keyword kw">end</span>
|
368
|
+
138: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">output_dir</span>)
|
369
|
+
139: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Exists: #{output_dir}"</span>
|
370
|
+
140: <span class="ruby-keyword kw">return</span>
|
371
|
+
141: <span class="ruby-keyword kw">end</span>
|
372
|
+
142: <span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">output_dir</span>)
|
373
|
+
143: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Created: #{output_dir}"</span>
|
374
|
+
144: <span class="ruby-keyword kw">end</span>
|
374
375
|
</pre>
|
375
376
|
</div>
|
376
377
|
</div>
|
@@ -393,23 +394,23 @@ This does the dirty work of generation.
|
|
393
394
|
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
394
395
|
<div class="method-source-code" id="M000015-source">
|
395
396
|
<pre>
|
396
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
397
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 153</span>
|
398
|
+
153: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generate</span>
|
399
|
+
154: <span class="ruby-identifier">generate_callbacks</span> <span class="ruby-keyword kw">do</span>
|
400
|
+
155: <span class="ruby-identifier">manifest</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">info</span><span class="ruby-operator">|</span>
|
401
|
+
156: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">info</span>[<span class="ruby-value str">"type"</span>]
|
402
|
+
157: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"file"</span>
|
403
|
+
158: <span class="ruby-identifier">template</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value str">"template_path"</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value str">"output_path"</span>])
|
404
|
+
159: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"directory"</span>
|
405
|
+
160: <span class="ruby-identifier">directory</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value str">"output_path"</span>])
|
406
|
+
161: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"copy"</span>
|
407
|
+
162: <span class="ruby-identifier">copy</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value str">"template_path"</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value str">"output_path"</span>])
|
408
|
+
163: <span class="ruby-keyword kw">else</span>
|
409
|
+
164: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown 'type': #{info["type"]}!"</span>
|
410
|
+
165: <span class="ruby-keyword kw">end</span>
|
411
|
+
166: <span class="ruby-keyword kw">end</span>
|
412
|
+
167: <span class="ruby-keyword kw">end</span>
|
413
|
+
168: <span class="ruby-keyword kw">end</span>
|
413
414
|
</pre>
|
414
415
|
</div>
|
415
416
|
</div>
|
@@ -440,31 +441,31 @@ href="Genosaurus.html#M000003">templates_directory_path</a>.
|
|
440
441
|
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
441
442
|
<div class="method-source-code" id="M000008-source">
|
442
443
|
<pre>
|
443
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
444
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 80</span>
|
445
|
+
80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">manifest</span>
|
446
|
+
81: <span class="ruby-identifier">ivar_cache</span> <span class="ruby-keyword kw">do</span>
|
447
|
+
82: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">manifest_path</span>)
|
448
|
+
83: <span class="ruby-comment cmt"># run using the yml file</span>
|
449
|
+
84: <span class="ruby-identifier">template</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">manifest_path</span>).<span class="ruby-identifier">read</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">"->"</span>)
|
450
|
+
85: <span class="ruby-identifier">man</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">template</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>))
|
451
|
+
86: <span class="ruby-keyword kw">else</span>
|
452
|
+
87: <span class="ruby-identifier">files</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">templates_directory_path</span>, <span class="ruby-value str">"**/*.template"</span>))
|
453
|
+
88: <span class="ruby-identifier">man</span> = {}
|
454
|
+
89: <span class="ruby-identifier">files</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">f</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
455
|
+
90: <span class="ruby-identifier">output_path</span> = <span class="ruby-identifier">f</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">templates_directory_path</span>, <span class="ruby-value str">""</span>)
|
456
|
+
91: <span class="ruby-identifier">output_path</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-value str">".template"</span>, <span class="ruby-value str">""</span>)
|
457
|
+
92: <span class="ruby-identifier">output_path</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^\//</span>, <span class="ruby-value str">""</span>)
|
458
|
+
93: <span class="ruby-identifier">man</span>[<span class="ruby-node">"template_#{i+1}"</span>] = {
|
459
|
+
94: <span class="ruby-value str">"type"</span> =<span class="ruby-operator">></span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">f</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">"directory"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">"file"</span>,
|
460
|
+
95: <span class="ruby-value str">"template_path"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">f</span>,
|
461
|
+
96: <span class="ruby-value str">"output_path"</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Erubis</span><span class="ruby-operator">::</span><span class="ruby-constant">Eruby</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">output_path</span>, <span class="ruby-identifier">:pattern</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'% %'</span>).<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)
|
462
|
+
97: }
|
463
|
+
98: <span class="ruby-keyword kw">end</span>
|
464
|
+
99: <span class="ruby-keyword kw">end</span>
|
465
|
+
100: <span class="ruby-comment cmt"># puts man.inspect</span>
|
466
|
+
101: <span class="ruby-identifier">man</span>
|
467
|
+
102: <span class="ruby-keyword kw">end</span>
|
468
|
+
103: <span class="ruby-keyword kw">end</span>
|
468
469
|
</pre>
|
469
470
|
</div>
|
470
471
|
</div>
|
@@ -494,10 +495,10 @@ return the correct path.
|
|
494
495
|
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
495
496
|
<div class="method-source-code" id="M000004-source">
|
496
497
|
<pre>
|
497
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
498
|
-
|
499
|
-
|
500
|
-
|
498
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 58</span>
|
499
|
+
58: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">manifest_path</span>
|
500
|
+
59: <span class="ruby-ivar">@manifest_path</span>
|
501
|
+
60: <span class="ruby-keyword kw">end</span>
|
501
502
|
</pre>
|
502
503
|
</div>
|
503
504
|
</div>
|
@@ -517,12 +518,12 @@ return the correct path.
|
|
517
518
|
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
518
519
|
<div class="method-source-code" id="M000016-source">
|
519
520
|
<pre>
|
520
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
521
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 170</span>
|
522
|
+
170: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
523
|
+
171: <span class="ruby-identifier">p</span> = <span class="ruby-identifier">param</span>(<span class="ruby-identifier">sym</span>)
|
524
|
+
172: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">p</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">p</span>
|
525
|
+
173: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">sym</span>)
|
526
|
+
174: <span class="ruby-keyword kw">end</span>
|
526
527
|
</pre>
|
527
528
|
</div>
|
528
529
|
</div>
|
@@ -545,10 +546,10 @@ Returns a parameter from the initial Hash of parameters.
|
|
545
546
|
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
546
547
|
<div class="method-source-code" id="M000011-source">
|
547
548
|
<pre>
|
548
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
549
|
-
|
550
|
-
|
551
|
-
|
549
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 117</span>
|
550
|
+
117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">param</span>(<span class="ruby-identifier">key</span>)
|
551
|
+
118: (<span class="ruby-ivar">@options</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>] <span class="ruby-operator">||=</span> <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>])
|
552
|
+
119: <span class="ruby-keyword kw">end</span>
|
552
553
|
</pre>
|
553
554
|
</div>
|
554
555
|
</div>
|
@@ -572,10 +573,10 @@ href="Genosaurus.html#M000005">setup</a> work needed by the generator.
|
|
572
573
|
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
573
574
|
<div class="method-source-code" id="M000005-source">
|
574
575
|
<pre>
|
575
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
576
|
-
|
577
|
-
|
578
|
-
|
576
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 63</span>
|
577
|
+
63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
|
578
|
+
64: <span class="ruby-comment cmt"># does nothing, unless overridden in subclass.</span>
|
579
|
+
65: <span class="ruby-keyword kw">end</span>
|
579
580
|
</pre>
|
580
581
|
</div>
|
581
582
|
</div>
|
@@ -600,14 +601,14 @@ like to force the writing of the file, use the :force => true option.
|
|
600
601
|
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
601
602
|
<div class="method-source-code" id="M000012-source">
|
602
603
|
<pre>
|
603
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
604
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 125</span>
|
605
|
+
125: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">template</span>(<span class="ruby-identifier">input_file</span>, <span class="ruby-identifier">output_file</span>, <span class="ruby-identifier">options</span> = <span class="ruby-ivar">@options</span>)
|
606
|
+
126: <span class="ruby-identifier">output_file</span> = <span class="ruby-identifier">template_copy_common</span>(<span class="ruby-identifier">output_file</span>, <span class="ruby-identifier">options</span>)
|
607
|
+
127: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">output_file</span>.<span class="ruby-identifier">nil?</span>
|
608
|
+
128: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">output_file</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">puts</span> <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">input_file</span>).<span class="ruby-identifier">read</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">"->"</span>).<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)}
|
609
|
+
129: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Wrote: #{output_file}"</span>
|
610
|
+
130: <span class="ruby-keyword kw">end</span>
|
611
|
+
131: <span class="ruby-keyword kw">end</span>
|
611
612
|
</pre>
|
612
613
|
</div>
|
613
614
|
</div>
|
@@ -636,10 +637,10 @@ return the correct path.
|
|
636
637
|
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
637
638
|
<div class="method-source-code" id="M000003-source">
|
638
639
|
<pre>
|
639
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
640
|
-
|
641
|
-
|
642
|
-
|
640
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 50</span>
|
641
|
+
50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">templates_directory_path</span>
|
642
|
+
51: <span class="ruby-ivar">@templates_directory_path</span>
|
643
|
+
52: <span class="ruby-keyword kw">end</span>
|
643
644
|
</pre>
|
644
645
|
</div>
|
645
646
|
</div>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Thu, 15 May 2008 00:07:39 -0400
|
data/lib/genosaurus.rb
CHANGED
@@ -35,10 +35,11 @@ class Genosaurus
|
|
35
35
|
if f.match(/#{@generator_name_underscore}\.rb$/)
|
36
36
|
@templates_directory_path = File.join(File.dirname(f), "templates")
|
37
37
|
@manifest_path = File.join(File.dirname(f), "manifest.yml")
|
38
|
-
else
|
39
|
-
raise "Unable to dynamically figure out your templates_directory_path and manifest_path! Please implement these methods and let Genosaurus know where to find these things. Thanks."
|
40
38
|
end
|
41
39
|
end
|
40
|
+
if @templates_directory_path.nil? || @manifest_path.nil?
|
41
|
+
raise "Unable to dynamically figure out your templates_directory_path and manifest_path! Please implement these methods and let Genosaurus know where to find these things. Thanks."
|
42
|
+
end
|
42
43
|
setup
|
43
44
|
end
|
44
45
|
|
data/test/test_helper.rb
CHANGED
@@ -6,6 +6,7 @@ require File.join(File.dirname(__FILE__), "..", "lib", "genosaurus")
|
|
6
6
|
|
7
7
|
if $genosaurus_output_directory.nil?
|
8
8
|
$genosaurus_output_directory = File.join(FileUtils.pwd, "tmp")
|
9
|
+
FileUtils.mkdir_p($genosaurus_output_directory)
|
9
10
|
end
|
10
11
|
|
11
12
|
puts "$genosaurus_output_directory: #{$genosaurus_output_directory}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genosaurus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markbates
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-15 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -87,6 +87,11 @@ test_files:
|
|
87
87
|
- test/lib/copy_machine_generator/templates/hello_world.txt
|
88
88
|
- test/lib/directory_generator
|
89
89
|
- test/lib/directory_generator/directory_generator.rb
|
90
|
+
- test/lib/directory_generator/templates
|
91
|
+
- test/lib/directory_generator/templates/months
|
92
|
+
- test/lib/directory_generator/templates/months/february.template
|
93
|
+
- test/lib/directory_generator/templates/months/january.template
|
94
|
+
- test/lib/directory_generator/templates/months/march.template
|
90
95
|
- test/lib/hello_goodbye_generator
|
91
96
|
- test/lib/hello_goodbye_generator/hello_goodbye_generator.rb
|
92
97
|
- test/lib/hello_goodbye_generator/templates
|
@@ -96,6 +101,7 @@ test_files:
|
|
96
101
|
- test/lib/i_am_the_walrus_generator/i_am_the_walrus_generator.rb
|
97
102
|
- test/lib/i_am_the_walrus_generator/templates
|
98
103
|
- test/lib/i_am_the_walrus_generator/templates/beatles
|
104
|
+
- test/lib/i_am_the_walrus_generator/templates/beatles/albums.template
|
99
105
|
- test/lib/i_am_the_walrus_generator/templates/beatles/lyrics
|
100
106
|
- test/lib/i_am_the_walrus_generator/templates/beatles/lyrics/%=name%.txt.template
|
101
107
|
- test/lib/strawberry_fields_generator
|