web/rdoc/classes/Reap/TestExt.src/M000073.html in reap-4.0 vs web/rdoc/classes/Reap/TestExt.src/M000073.html in reap-4.0.0

- old
+ new

@@ -3,16 +3,47 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <title>task_desc (Reap::TestExt)</title> + <title>run (Reap::TestExt)</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/testext.rb, line 14</span> - <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">task_desc</span> - <span class="ruby-value str">&quot;Extract unit-tests from lib scripts.&quot;</span> + <pre><span class="ruby-comment cmt"># File lib/reap/task/testext.rb, line 26</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span> + <span class="ruby-comment cmt">#test_libs = @libs.join(':')</span> + <span class="ruby-identifier">files</span> = <span class="ruby-constant">FileList</span>.<span class="ruby-identifier">new</span> + <span class="ruby-identifier">files</span>.<span class="ruby-identifier">include</span>(<span class="ruby-operator">*</span><span class="ruby-ivar">@files</span>) + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">files</span>.<span class="ruby-identifier">empty?</span> + <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;No script files found.&quot;</span> + <span class="ruby-keyword kw">return</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">print</span> <span class="ruby-value str">&quot;Reap is scanning and copying embedded tests...&quot;</span> + + <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@dir</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">empty?</span> + <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Test directory must be specified.&quot;</span> + <span class="ruby-keyword kw">return</span> + <span class="ruby-keyword kw">end</span> + + <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-ivar">@dir</span>) + <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Test directory doesn't exist: #{File.expand_path( @dir )}&quot;</span> + <span class="ruby-keyword kw">return</span> + <span class="ruby-keyword kw">end</span> + + <span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">$stdout</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'.'</span>; <span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">flush</span> + <span class="ruby-identifier">testing</span> = <span class="ruby-identifier">extract</span>( <span class="ruby-identifier">file</span> ) + <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">testing</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">empty?</span> + <span class="ruby-identifier">complete_test</span> = <span class="ruby-identifier">create</span>( <span class="ruby-identifier">testing</span>, <span class="ruby-identifier">file</span> ) + <span class="ruby-identifier">fp</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@dir</span>,<span class="ruby-identifier">file</span>) + <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>( <span class="ruby-identifier">fp</span> ) ) + <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">fp</span>) ) + <span class="ruby-keyword kw">end</span> + <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>( <span class="ruby-identifier">fp</span>, <span class="ruby-value str">&quot;w&quot;</span> ) { <span class="ruby-operator">|</span><span class="ruby-identifier">fw</span><span class="ruby-operator">|</span> <span class="ruby-identifier">fw</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">complete_test</span> } + <span class="ruby-keyword kw">end</span> + } + <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;done.&quot;</span> <span class="ruby-keyword kw">end</span></pre> </body> </html> \ No newline at end of file