genosaurus 1.1.8 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -151,24 +151,24 @@ initialization.
151
151
  onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
152
152
  <div class="method-source-code" id="M000002-source">
153
153
  <pre>
154
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 25</span>
155
- 25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span> = {})
156
- 26: <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
157
- 27: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">required_params</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
158
- 28: <span class="ruby-identifier">raise</span> <span class="ruby-operator">::</span><span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;The required parameter '#{p.to_s.upcase}' is missing for this generator!&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">param</span>(<span class="ruby-identifier">p</span>)
159
- 29: <span class="ruby-keyword kw">end</span>
160
- 30: <span class="ruby-ivar">@generator_name</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>
161
- 31: <span class="ruby-ivar">@generator_name_underscore</span> = <span class="ruby-ivar">@generator_name</span>.<span class="ruby-identifier">underscore</span>
162
- 32: <span class="ruby-ivar">@templates_directory_path</span> = <span class="ruby-keyword kw">nil</span>
163
- 33: <span class="ruby-ivar">@manifest_path</span> = <span class="ruby-keyword kw">nil</span>
164
- 34: <span class="ruby-identifier">$&quot;</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
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
- 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">&quot;templates&quot;</span>)
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">&quot;manifest.yml&quot;</span>)
168
- 38: <span class="ruby-keyword kw">end</span>
154
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 35</span>
155
+ 35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span> = {})
156
+ 36: <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
157
+ 37: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">required_params</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
158
+ 38: <span class="ruby-identifier">raise</span> <span class="ruby-operator">::</span><span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;The required parameter '#{p.to_s.upcase}' is missing for this generator!&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">param</span>(<span class="ruby-identifier">p</span>)
169
159
  39: <span class="ruby-keyword kw">end</span>
170
- 40: <span class="ruby-identifier">setup</span>
171
- 41: <span class="ruby-keyword kw">end</span>
160
+ 40: <span class="ruby-ivar">@generator_name</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>
161
+ 41: <span class="ruby-ivar">@generator_name_underscore</span> = <span class="ruby-ivar">@generator_name</span>.<span class="ruby-identifier">underscore</span> <span class="ruby-comment cmt">#String::Style.underscore(@generator_name)#.underscore</span>
162
+ 42: <span class="ruby-ivar">@templates_directory_path</span> = <span class="ruby-keyword kw">nil</span>
163
+ 43: <span class="ruby-ivar">@manifest_path</span> = <span class="ruby-keyword kw">nil</span>
164
+ 44: <span class="ruby-identifier">$&quot;</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
165
+ 45: <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
+ 46: <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">&quot;templates&quot;</span>)
167
+ 47: <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">&quot;manifest.yml&quot;</span>)
168
+ 48: <span class="ruby-keyword kw">end</span>
169
+ 49: <span class="ruby-keyword kw">end</span>
170
+ 50: <span class="ruby-identifier">setup</span>
171
+ 51: <span class="ruby-keyword kw">end</span>
172
172
  </pre>
173
173
  </div>
174
174
  </div>
@@ -191,11 +191,11 @@ Used to define arguments that are required by the generator.
191
191
  onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
192
192
  <div class="method-source-code" id="M000009-source">
193
193
  <pre>
194
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 106</span>
195
- 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>)
196
- 107: <span class="ruby-identifier">required_params</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">args</span>
197
- 108: <span class="ruby-identifier">required_params</span>.<span class="ruby-identifier">flatten!</span>
198
- 109: <span class="ruby-keyword kw">end</span>
194
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 114</span>
195
+ 114: <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>)
196
+ 115: <span class="ruby-identifier">required_params</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">args</span>
197
+ 116: <span class="ruby-identifier">required_params</span>.<span class="ruby-identifier">flatten!</span>
198
+ 117: <span class="ruby-keyword kw">end</span>
199
199
  </pre>
200
200
  </div>
201
201
  </div>
@@ -218,10 +218,10 @@ Returns the <a href="Genosaurus.html#M000010">required_params</a> array.
218
218
  onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
219
219
  <div class="method-source-code" id="M000010-source">
220
220
  <pre>
221
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 112</span>
222
- 112: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">required_params</span>
223
- 113: <span class="ruby-ivar">@required_params</span> <span class="ruby-operator">||=</span> []
224
- 114: <span class="ruby-keyword kw">end</span>
221
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 120</span>
222
+ 120: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">required_params</span>
223
+ 121: <span class="ruby-ivar">@required_params</span> <span class="ruby-operator">||=</span> []
224
+ 122: <span class="ruby-keyword kw">end</span>
225
225
  </pre>
226
226
  </div>
227
227
  </div>
@@ -247,12 +247,12 @@ returns the <a href="Genosaurus.html">Genosaurus</a> object.
247
247
  onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
248
248
  <div class="method-source-code" id="M000001-source">
249
249
  <pre>
250
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 15</span>
251
- 15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-identifier">options</span> = <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">to_hash</span>)
252
- 16: <span class="ruby-identifier">gen</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>)
253
- 17: <span class="ruby-identifier">gen</span>.<span class="ruby-identifier">generate</span>
254
- 18: <span class="ruby-identifier">gen</span>
255
- 19: <span class="ruby-keyword kw">end</span>
250
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 25</span>
251
+ 25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-identifier">options</span> = <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">to_hash</span>)
252
+ 26: <span class="ruby-identifier">gen</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>)
253
+ 27: <span class="ruby-identifier">gen</span>.<span class="ruby-identifier">generate</span>
254
+ 28: <span class="ruby-identifier">gen</span>
255
+ 29: <span class="ruby-keyword kw">end</span>
256
256
  </pre>
257
257
  </div>
258
258
  </div>
@@ -280,9 +280,9 @@ generators.
280
280
  onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
281
281
  <div class="method-source-code" id="M000007-source">
282
282
  <pre>
283
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 70</span>
284
- 70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_generate</span>
285
- 71: <span class="ruby-keyword kw">end</span>
283
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 80</span>
284
+ 80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_generate</span>
285
+ 81: <span class="ruby-keyword kw">end</span>
286
286
  </pre>
287
287
  </div>
288
288
  </div>
@@ -307,9 +307,9 @@ href="Genosaurus.html#M000001">run</a>.
307
307
  onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
308
308
  <div class="method-source-code" id="M000006-source">
309
309
  <pre>
310
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 65</span>
311
- 65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before_generate</span>
312
- 66: <span class="ruby-keyword kw">end</span>
310
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 75</span>
311
+ 75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before_generate</span>
312
+ 76: <span class="ruby-keyword kw">end</span>
313
313
  </pre>
314
314
  </div>
315
315
  </div>
@@ -329,12 +329,12 @@ href="Genosaurus.html#M000001">run</a>.
329
329
  onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
330
330
  <div class="method-source-code" id="M000014-source">
331
331
  <pre>
332
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 146</span>
333
- 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>)
334
- 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>)
335
- 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>)
336
- 149: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Copied: #{output_file}&quot;</span>
337
- 150: <span class="ruby-keyword kw">end</span>
332
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 154</span>
333
+ 154: <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>)
334
+ 155: <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>)
335
+ 156: <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>)
336
+ 157: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Copied: #{output_file}&quot;</span>
337
+ 158: <span class="ruby-keyword kw">end</span>
338
338
  </pre>
339
339
  </div>
340
340
  </div>
@@ -357,18 +357,18 @@ Creates the specified <a href="Genosaurus.html#M000013">directory</a>.
357
357
  onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
358
358
  <div class="method-source-code" id="M000013-source">
359
359
  <pre>
360
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 134</span>
361
- 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>)
362
- 135: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$genosaurus_output_directory</span>
363
- 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>)
364
- 137: <span class="ruby-keyword kw">end</span>
365
- 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>)
366
- 139: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Exists: #{output_dir}&quot;</span>
367
- 140: <span class="ruby-keyword kw">return</span>
368
- 141: <span class="ruby-keyword kw">end</span>
369
- 142: <span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">output_dir</span>)
370
- 143: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Created: #{output_dir}&quot;</span>
371
- 144: <span class="ruby-keyword kw">end</span>
360
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 142</span>
361
+ 142: <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>)
362
+ 143: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$genosaurus_output_directory</span>
363
+ 144: <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>)
364
+ 145: <span class="ruby-keyword kw">end</span>
365
+ 146: <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>)
366
+ 147: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Exists: #{output_dir}&quot;</span>
367
+ 148: <span class="ruby-keyword kw">return</span>
368
+ 149: <span class="ruby-keyword kw">end</span>
369
+ 150: <span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">output_dir</span>)
370
+ 151: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Created: #{output_dir}&quot;</span>
371
+ 152: <span class="ruby-keyword kw">end</span>
372
372
  </pre>
373
373
  </div>
374
374
  </div>
@@ -391,23 +391,23 @@ This does the dirty work of generation.
391
391
  onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
392
392
  <div class="method-source-code" id="M000015-source">
393
393
  <pre>
394
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 153</span>
395
- 153: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generate</span>
396
- 154: <span class="ruby-identifier">generate_callbacks</span> <span class="ruby-keyword kw">do</span>
397
- 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>
398
- 156: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;type&quot;</span>]
399
- 157: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;file&quot;</span>
400
- 158: <span class="ruby-identifier">template</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;template_path&quot;</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;output_path&quot;</span>])
401
- 159: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;directory&quot;</span>
402
- 160: <span class="ruby-identifier">directory</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;output_path&quot;</span>])
403
- 161: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;copy&quot;</span>
404
- 162: <span class="ruby-identifier">copy</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;template_path&quot;</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;output_path&quot;</span>])
405
- 163: <span class="ruby-keyword kw">else</span>
406
- 164: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown 'type': #{info[&quot;type&quot;]}!&quot;</span>
407
- 165: <span class="ruby-keyword kw">end</span>
408
- 166: <span class="ruby-keyword kw">end</span>
409
- 167: <span class="ruby-keyword kw">end</span>
410
- 168: <span class="ruby-keyword kw">end</span>
394
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 161</span>
395
+ 161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generate</span>
396
+ 162: <span class="ruby-identifier">generate_callbacks</span> <span class="ruby-keyword kw">do</span>
397
+ 163: <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>
398
+ 164: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;type&quot;</span>]
399
+ 165: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;file&quot;</span>
400
+ 166: <span class="ruby-identifier">template</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;template_path&quot;</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;output_path&quot;</span>])
401
+ 167: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;directory&quot;</span>
402
+ 168: <span class="ruby-identifier">directory</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;output_path&quot;</span>])
403
+ 169: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;copy&quot;</span>
404
+ 170: <span class="ruby-identifier">copy</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;template_path&quot;</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value str">&quot;output_path&quot;</span>])
405
+ 171: <span class="ruby-keyword kw">else</span>
406
+ 172: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown 'type': #{info[&quot;type&quot;]}!&quot;</span>
407
+ 173: <span class="ruby-keyword kw">end</span>
408
+ 174: <span class="ruby-keyword kw">end</span>
409
+ 175: <span class="ruby-keyword kw">end</span>
410
+ 176: <span class="ruby-keyword kw">end</span>
411
411
  </pre>
412
412
  </div>
413
413
  </div>
@@ -438,34 +438,32 @@ href="Genosaurus.html#M000003">templates_directory_path</a>.
438
438
  onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
439
439
  <div class="method-source-code" id="M000008-source">
440
440
  <pre>
441
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 77</span>
442
- 77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">manifest</span>
443
- 78: <span class="ruby-identifier">ivar_cache</span> <span class="ruby-keyword kw">do</span>
444
- 79: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">templates_directory_path</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">manifest_path</span>.<span class="ruby-identifier">nil?</span>
445
- 80: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Unable to dynamically figure out your templates_directory_path and manifest_path!\nPlease implement these methods and let Genosaurus know where to find these things. Thanks.&quot;</span>
446
- 81: <span class="ruby-keyword kw">end</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">&quot;-&gt;&quot;</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">&quot;**/*.template&quot;</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">&quot;&quot;</span>)
456
- 91: <span class="ruby-identifier">output_path</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-value str">&quot;.template&quot;</span>, <span class="ruby-value str">&quot;&quot;</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">&quot;&quot;</span>)
458
- 93: <span class="ruby-identifier">man</span>[<span class="ruby-node">&quot;template_#{i+1}&quot;</span>] = {
459
- 94: <span class="ruby-value str">&quot;type&quot;</span> =<span class="ruby-operator">&gt;</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">&quot;directory&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;file&quot;</span>,
460
- 95: <span class="ruby-value str">&quot;template_path&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">f</span>,
461
- 96: <span class="ruby-value str">&quot;output_path&quot;</span> =<span class="ruby-operator">&gt;</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">&gt;</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>
441
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 87</span>
442
+ 87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">manifest</span>
443
+ 88: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">templates_directory_path</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">manifest_path</span>.<span class="ruby-identifier">nil?</span>
444
+ 89: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Unable to dynamically figure out your templates_directory_path and manifest_path!\nPlease implement these methods and let Genosaurus know where to find these things. Thanks.&quot;</span>
445
+ 90: <span class="ruby-keyword kw">end</span>
446
+ 91: <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>)
447
+ 92: <span class="ruby-comment cmt"># run using the yml file</span>
448
+ 93: <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">&quot;-&gt;&quot;</span>)
449
+ 94: <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>))
450
+ 95: <span class="ruby-keyword kw">else</span>
451
+ 96: <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">&quot;**/*.template&quot;</span>))
452
+ 97: <span class="ruby-identifier">man</span> = {}
453
+ 98: <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>
454
+ 99: <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">&quot;&quot;</span>)
455
+ 100: <span class="ruby-identifier">output_path</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-value str">&quot;.template&quot;</span>, <span class="ruby-value str">&quot;&quot;</span>)
456
+ 101: <span class="ruby-identifier">output_path</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^\//</span>, <span class="ruby-value str">&quot;&quot;</span>)
457
+ 102: <span class="ruby-identifier">man</span>[<span class="ruby-node">&quot;template_#{i+1}&quot;</span>] = {
458
+ 103: <span class="ruby-value str">&quot;type&quot;</span> =<span class="ruby-operator">&gt;</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">&quot;directory&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;file&quot;</span>,
459
+ 104: <span class="ruby-value str">&quot;template_path&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">f</span>,
460
+ 105: <span class="ruby-value str">&quot;output_path&quot;</span> =<span class="ruby-operator">&gt;</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">&gt;</span> <span class="ruby-value str">'% %'</span>).<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)
461
+ 106: }
462
+ 107: <span class="ruby-keyword kw">end</span>
463
+ 108: <span class="ruby-keyword kw">end</span>
464
+ 109: <span class="ruby-comment cmt"># puts man.inspect</span>
465
+ 110: <span class="ruby-identifier">man</span>
466
+ 111: <span class="ruby-keyword kw">end</span>
469
467
  </pre>
470
468
  </div>
471
469
  </div>
@@ -495,10 +493,10 @@ return the correct path.
495
493
  onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
496
494
  <div class="method-source-code" id="M000004-source">
497
495
  <pre>
498
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 55</span>
499
- 55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">manifest_path</span>
500
- 56: <span class="ruby-ivar">@manifest_path</span>
501
- 57: <span class="ruby-keyword kw">end</span>
496
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 65</span>
497
+ 65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">manifest_path</span>
498
+ 66: <span class="ruby-ivar">@manifest_path</span>
499
+ 67: <span class="ruby-keyword kw">end</span>
502
500
  </pre>
503
501
  </div>
504
502
  </div>
@@ -518,12 +516,12 @@ return the correct path.
518
516
  onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
519
517
  <div class="method-source-code" id="M000016-source">
520
518
  <pre>
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>
519
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 178</span>
520
+ 178: <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>)
521
+ 179: <span class="ruby-identifier">p</span> = <span class="ruby-identifier">param</span>(<span class="ruby-identifier">sym</span>)
522
+ 180: <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>
523
+ 181: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">sym</span>)
524
+ 182: <span class="ruby-keyword kw">end</span>
527
525
  </pre>
528
526
  </div>
529
527
  </div>
@@ -546,10 +544,10 @@ Returns a parameter from the initial Hash of parameters.
546
544
  onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
547
545
  <div class="method-source-code" id="M000011-source">
548
546
  <pre>
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>
547
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 125</span>
548
+ 125: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">param</span>(<span class="ruby-identifier">key</span>)
549
+ 126: (<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>])
550
+ 127: <span class="ruby-keyword kw">end</span>
553
551
  </pre>
554
552
  </div>
555
553
  </div>
@@ -573,10 +571,10 @@ href="Genosaurus.html#M000005">setup</a> work needed by the generator.
573
571
  onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
574
572
  <div class="method-source-code" id="M000005-source">
575
573
  <pre>
576
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 60</span>
577
- 60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
578
- 61: <span class="ruby-comment cmt"># does nothing, unless overridden in subclass.</span>
579
- 62: <span class="ruby-keyword kw">end</span>
574
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 70</span>
575
+ 70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
576
+ 71: <span class="ruby-comment cmt"># does nothing, unless overridden in subclass.</span>
577
+ 72: <span class="ruby-keyword kw">end</span>
580
578
  </pre>
581
579
  </div>
582
580
  </div>
@@ -601,14 +599,14 @@ like to force the writing of the file, use the :force =&gt; true option.
601
599
  onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
602
600
  <div class="method-source-code" id="M000012-source">
603
601
  <pre>
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">&quot;w&quot;</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">&quot;-&gt;&quot;</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">&quot;Wrote: #{output_file}&quot;</span>
610
- 130: <span class="ruby-keyword kw">end</span>
611
- 131: <span class="ruby-keyword kw">end</span>
602
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 133</span>
603
+ 133: <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>)
604
+ 134: <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>)
605
+ 135: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">output_file</span>.<span class="ruby-identifier">nil?</span>
606
+ 136: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">output_file</span>, <span class="ruby-value str">&quot;w&quot;</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">&quot;-&gt;&quot;</span>).<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)}
607
+ 137: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Wrote: #{output_file}&quot;</span>
608
+ 138: <span class="ruby-keyword kw">end</span>
609
+ 139: <span class="ruby-keyword kw">end</span>
612
610
  </pre>
613
611
  </div>
614
612
  </div>
@@ -637,10 +635,10 @@ return the correct path.
637
635
  onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
638
636
  <div class="method-source-code" id="M000003-source">
639
637
  <pre>
640
- <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 47</span>
641
- 47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">templates_directory_path</span>
642
- 48: <span class="ruby-ivar">@templates_directory_path</span>
643
- 49: <span class="ruby-keyword kw">end</span>
638
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 57</span>
639
+ 57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">templates_directory_path</span>
640
+ 58: <span class="ruby-ivar">@templates_directory_path</span>
641
+ 59: <span class="ruby-keyword kw">end</span>
644
642
  </pre>
645
643
  </div>
646
644
  </div>
@@ -0,0 +1,151 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: String</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">String</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/genosaurus_rb.html">
59
+ lib/genosaurus.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000017">underscore</a>&nbsp;&nbsp;
90
+ </div>
91
+ </div>
92
+
93
+ </div>
94
+
95
+
96
+ <!-- if includes -->
97
+
98
+ <div id="section">
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <!-- if method_list -->
108
+ <div id="methods">
109
+ <h3 class="section-bar">Public Instance methods</h3>
110
+
111
+ <div id="method-M000017" class="method-detail">
112
+ <a name="M000017"></a>
113
+
114
+ <div class="method-heading">
115
+ <a href="#M000017" class="method-signature">
116
+ <span class="method-name">underscore</span><span class="method-args">()</span>
117
+ </a>
118
+ </div>
119
+
120
+ <div class="method-description">
121
+ <p><a class="source-toggle" href="#"
122
+ onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
123
+ <div class="method-source-code" id="M000017-source">
124
+ <pre>
125
+ <span class="ruby-comment cmt"># File lib/genosaurus.rb, line 8</span>
126
+ 8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">underscore</span>
127
+ 9: <span class="ruby-identifier">camel_cased_word</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
128
+ 10: <span class="ruby-identifier">camel_cased_word</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/::/</span>, <span class="ruby-value str">'/'</span>).
129
+ 11: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z]+)([A-Z][a-z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
130
+ 12: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z\d])([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
131
+ 13: <span class="ruby-identifier">tr</span>(<span class="ruby-value str">&quot;-&quot;</span>, <span class="ruby-value str">&quot;_&quot;</span>).
132
+ 14: <span class="ruby-identifier">downcase</span>
133
+ 15: <span class="ruby-keyword kw">end</span>
134
+ </pre>
135
+ </div>
136
+ </div>
137
+ </div>
138
+
139
+
140
+ </div>
141
+
142
+
143
+ </div>
144
+
145
+
146
+ <div id="validator-badges">
147
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
148
+ </div>
149
+
150
+ </body>
151
+ </html>
data/doc/created.rid CHANGED
@@ -1 +1 @@
1
- Thu, 15 May 2008 11:29:21 -0400
1
+ Sun, 29 Jun 2008 21:18:17 +0100
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Thu May 15 10:54:04 -0400 2008</td>
59
+ <td>Thu May 15 04:35:59 +0100 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Thu May 15 11:26:33 -0400 2008</td>
59
+ <td>Sun Jun 29 21:17:08 +0100 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -74,7 +74,6 @@
74
74
 
75
75
  <div class="name-list">
76
76
  rubygems&nbsp;&nbsp;
77
- mack_ruby_core_extensions&nbsp;&nbsp;
78
77
  fileutils&nbsp;&nbsp;
79
78
  erb&nbsp;&nbsp;
80
79
  yaml&nbsp;&nbsp;
@@ -21,6 +21,7 @@
21
21
  <h1 class="section-bar">Classes</h1>
22
22
  <div id="index-entries">
23
23
  <a href="classes/Genosaurus.html">Genosaurus</a><br />
24
+ <a href="classes/String.html">String</a><br />
24
25
  </div>
25
26
  </div>
26
27
  </body>
@@ -36,6 +36,7 @@
36
36
  <a href="classes/Genosaurus.html#M000005">setup (Genosaurus)</a><br />
37
37
  <a href="classes/Genosaurus.html#M000012">template (Genosaurus)</a><br />
38
38
  <a href="classes/Genosaurus.html#M000003">templates_directory_path (Genosaurus)</a><br />
39
+ <a href="classes/String.html#M000017">underscore (String)</a><br />
39
40
  </div>
40
41
  </div>
41
42
  </body>
data/lib/genosaurus.rb CHANGED
@@ -1,10 +1,20 @@
1
1
  require 'rubygems'
2
- require 'mack_ruby_core_extensions'
3
2
  require 'fileutils'
4
3
  require 'erb'
5
4
  require 'yaml'
6
5
  require 'erubis'
7
6
 
7
+ class String
8
+ def underscore
9
+ camel_cased_word = self.dup
10
+ camel_cased_word.to_s.gsub(/::/, '/').
11
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
12
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
13
+ tr("-", "_").
14
+ downcase
15
+ end
16
+ end
17
+
8
18
  class Genosaurus
9
19
 
10
20
  include FileUtils
@@ -28,7 +38,7 @@ class Genosaurus
28
38
  raise ::ArgumentError.new("The required parameter '#{p.to_s.upcase}' is missing for this generator!") unless param(p)
29
39
  end
30
40
  @generator_name = self.class.name
31
- @generator_name_underscore = @generator_name.underscore
41
+ @generator_name_underscore = @generator_name.underscore #String::Style.underscore(@generator_name)#.underscore
32
42
  @templates_directory_path = nil
33
43
  @manifest_path = nil
34
44
  $".each do |f|
@@ -75,31 +85,29 @@ class Genosaurus
75
85
  # with ERB and returned. If there is not manifest.yml then an implied manifest is generated from the contents
76
86
  # of the templates_directory_path.
77
87
  def manifest
78
- ivar_cache do
79
- if templates_directory_path.nil? || manifest_path.nil?
80
- raise "Unable to dynamically figure out your templates_directory_path and manifest_path!\nPlease implement these methods and let Genosaurus know where to find these things. Thanks."
81
- end
82
- if File.exists?(manifest_path)
83
- # run using the yml file
84
- template = ERB.new(File.open(manifest_path).read, nil, "->")
85
- man = YAML.load(template.result(binding))
86
- else
87
- files = Dir.glob(File.join(templates_directory_path, "**/*.template"))
88
- man = {}
89
- files.each_with_index do |f, i|
90
- output_path = f.gsub(templates_directory_path, "")
91
- output_path.gsub!(".template", "")
92
- output_path.gsub!(/^\//, "")
93
- man["template_#{i+1}"] = {
94
- "type" => File.directory?(f) ? "directory" : "file",
95
- "template_path" => f,
96
- "output_path" => Erubis::Eruby.new(output_path, :pattern => '% %').result(binding)
97
- }
98
- end
88
+ if templates_directory_path.nil? || manifest_path.nil?
89
+ raise "Unable to dynamically figure out your templates_directory_path and manifest_path!\nPlease implement these methods and let Genosaurus know where to find these things. Thanks."
90
+ end
91
+ if File.exists?(manifest_path)
92
+ # run using the yml file
93
+ template = ERB.new(File.open(manifest_path).read, nil, "->")
94
+ man = YAML.load(template.result(binding))
95
+ else
96
+ files = Dir.glob(File.join(templates_directory_path, "**/*.template"))
97
+ man = {}
98
+ files.each_with_index do |f, i|
99
+ output_path = f.gsub(templates_directory_path, "")
100
+ output_path.gsub!(".template", "")
101
+ output_path.gsub!(/^\//, "")
102
+ man["template_#{i+1}"] = {
103
+ "type" => File.directory?(f) ? "directory" : "file",
104
+ "template_path" => f,
105
+ "output_path" => Erubis::Eruby.new(output_path, :pattern => '% %').result(binding)
106
+ }
99
107
  end
100
- # puts man.inspect
101
- man
102
108
  end
109
+ # puts man.inspect
110
+ man
103
111
  end
104
112
 
105
113
  # Used to define arguments that are required by the generator.
data/test/test_helper.rb CHANGED
@@ -13,6 +13,12 @@ puts "$genosaurus_output_directory: #{$genosaurus_output_directory}"
13
13
 
14
14
  Dir.glob(File.join(File.dirname(__FILE__), "lib", "**/*.rb")).each {|f| require f}
15
15
 
16
+ class String
17
+ def capitalize_all_words
18
+ self.gsub(/\b\w/) {|s| s.upcase}
19
+ end
20
+ end
21
+
16
22
  class Test::Unit::TestCase
17
23
 
18
24
  end
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.8
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,18 +9,9 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-15 00:00:00 -04:00
12
+ date: 2008-06-29 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: mack_ruby_core_extensions
17
- version_requirement:
18
- version_requirements: !ruby/object:Gem::Requirement
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: "0"
23
- version:
24
15
  - !ruby/object:Gem::Dependency
25
16
  name: erubis
26
17
  version_requirement:
@@ -42,6 +33,7 @@ files:
42
33
  - lib/genosaurus.rb
43
34
  - README
44
35
  - doc/classes/Genosaurus.html
36
+ - doc/classes/String.html
45
37
  - doc/created.rid
46
38
  - doc/files/lib/genosaurus_rb.html
47
39
  - doc/files/README.html
@@ -73,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
65
  requirements: []
74
66
 
75
67
  rubyforge_project: magrathea
76
- rubygems_version: 1.0.1
68
+ rubygems_version: 1.1.1
77
69
  signing_key:
78
70
  specification_version: 2
79
71
  summary: genosaurus