genosaurus 1.1.3 → 1.1.4
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 +46 -44
- data/doc/created.rid +1 -1
- data/doc/files/README.html +1 -1
- data/doc/files/lib/genosaurus_rb.html +1 -1
- data/lib/genosaurus.rb +5 -3
- metadata +2 -2
data/doc/classes/Genosaurus.html
CHANGED
@@ -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
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
332
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 143</span>
|
333
|
+
143: <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
|
+
144: <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
|
+
145: <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
|
+
146: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Copied: #{output_file}"</span>
|
337
|
+
147: <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
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
360
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 131</span>
|
361
|
+
131: <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
|
+
132: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$genosaurus_output_directory</span>
|
363
|
+
133: <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
|
+
134: <span class="ruby-keyword kw">end</span>
|
365
|
+
135: <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
|
+
136: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Exists: #{output_dir}"</span>
|
367
|
+
137: <span class="ruby-keyword kw">return</span>
|
368
|
+
138: <span class="ruby-keyword kw">end</span>
|
369
|
+
139: <span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">output_dir</span>)
|
370
|
+
140: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Created: #{output_dir}"</span>
|
371
|
+
141: <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
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
394
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 150</span>
|
395
|
+
150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generate</span>
|
396
|
+
151: <span class="ruby-identifier">generate_callbacks</span> <span class="ruby-keyword kw">do</span>
|
397
|
+
152: <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
|
+
153: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">info</span>[<span class="ruby-value str">"type"</span>]
|
399
|
+
154: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"file"</span>
|
400
|
+
155: <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>])
|
401
|
+
156: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"directory"</span>
|
402
|
+
157: <span class="ruby-identifier">directory</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value str">"output_path"</span>])
|
403
|
+
158: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"copy"</span>
|
404
|
+
159: <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>])
|
405
|
+
160: <span class="ruby-keyword kw">else</span>
|
406
|
+
161: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown 'type': #{info["type"]}!"</span>
|
407
|
+
162: <span class="ruby-keyword kw">end</span>
|
408
|
+
163: <span class="ruby-keyword kw">end</span>
|
409
|
+
164: <span class="ruby-keyword kw">end</span>
|
410
|
+
165: <span class="ruby-keyword kw">end</span>
|
411
411
|
</pre>
|
412
412
|
</div>
|
413
413
|
</div>
|
@@ -515,12 +515,12 @@ return the correct path.
|
|
515
515
|
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
516
516
|
<div class="method-source-code" id="M000016-source">
|
517
517
|
<pre>
|
518
|
-
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
518
|
+
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 167</span>
|
519
|
+
167: <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>)
|
520
|
+
168: <span class="ruby-identifier">p</span> = <span class="ruby-identifier">param</span>(<span class="ruby-identifier">sym</span>)
|
521
|
+
169: <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>
|
522
|
+
170: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">sym</span>)
|
523
|
+
171: <span class="ruby-keyword kw">end</span>
|
524
524
|
</pre>
|
525
525
|
</div>
|
526
526
|
</div>
|
@@ -601,9 +601,11 @@ like to force the writing of the file, use the :force => true option.
|
|
601
601
|
<span class="ruby-comment cmt"># File lib/genosaurus.rb, line 122</span>
|
602
602
|
122: <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>)
|
603
603
|
123: <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>)
|
604
|
-
124: <span class="ruby-
|
605
|
-
125:
|
606
|
-
126:
|
604
|
+
124: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">output_file</span>.<span class="ruby-identifier">nil?</span>
|
605
|
+
125: <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>)}
|
606
|
+
126: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Wrote: #{output_file}"</span>
|
607
|
+
127: <span class="ruby-keyword kw">end</span>
|
608
|
+
128: <span class="ruby-keyword kw">end</span>
|
607
609
|
</pre>
|
608
610
|
</div>
|
609
611
|
</div>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Mon,
|
1
|
+
Mon, 05 May 2008 15:30:32 -0400
|
data/doc/files/README.html
CHANGED
data/lib/genosaurus.rb
CHANGED
@@ -121,8 +121,10 @@ class Genosaurus
|
|
121
121
|
# :force => true option.
|
122
122
|
def template(input_file, output_file, options = @options)
|
123
123
|
output_file = template_copy_common(output_file, options)
|
124
|
-
|
125
|
-
|
124
|
+
unless output_file.nil?
|
125
|
+
File.open(output_file, "w") {|f| f.puts ERB.new(File.open(input_file).read, nil, "->").result(binding)}
|
126
|
+
puts "Wrote: #{output_file}"
|
127
|
+
end
|
126
128
|
end
|
127
129
|
|
128
130
|
# Creates the specified directory.
|
@@ -179,7 +181,7 @@ class Genosaurus
|
|
179
181
|
if File.exists?(output_file)
|
180
182
|
unless options[:force]
|
181
183
|
puts "Skipped: #{output_file}"
|
182
|
-
return
|
184
|
+
return nil
|
183
185
|
end
|
184
186
|
end
|
185
187
|
# incase the directory doesn't exist, let's create it.
|
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.4
|
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-
|
12
|
+
date: 2008-05-05 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|