web/rdoc/classes/Scaffold.src/M000086.html in reap-4.0 vs web/rdoc/classes/Scaffold.src/M000086.html in reap-4.0.0
- old
+ new
@@ -3,14 +3,30 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
- <title>go (Scaffold)</title>
+ <title>template (Scaffold)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
- <pre><span class="ruby-comment cmt"># File lib/reap/task/scaffold.rb, line 37</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">go</span>(<span class="ruby-identifier">name</span>) ; <span class="ruby-identifier">scaffold</span>(<span class="ruby-identifier">name</span>) ; <span class="ruby-keyword kw">end</span></pre>
+ <pre><span class="ruby-comment cmt"># File lib/reap/task/scaffold.rb, line 57</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">template</span>( <span class="ruby-identifier">filename</span> )
+ <span class="ruby-identifier">dir</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-keyword kw">__FILE__</span>), <span class="ruby-value str">'data'</span> )
+ <span class="ruby-comment cmt">#dir = File.join( ::Config::CONFIG['datadir'], DATA_DIR )</span>
+ <span class="ruby-identifier">f</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>( <span class="ruby-identifier">dir</span>, <span class="ruby-identifier">filename</span> )
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>( <span class="ruby-identifier">f</span> )
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">f</span>
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Tempfile is missing."</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"#{filename} already exists."</span>
+ <span class="ruby-keyword kw">return</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># copy tmpf to Reapfile</span>
+ <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">cp</span>( <span class="ruby-identifier">f</span>, <span class="ruby-identifier">filename</span> )
+ <span class="ruby-comment cmt">#puts "#{filename} created. You'll need to fill it out."</span>
+ <span class="ruby-keyword kw">end</span></pre>
</body>
</html>
\ No newline at end of file