def run
files = FileList.new
files.include(*@files)
if files.empty?
puts "No script files found."
return
end
print "Reap is scanning and copying embedded tests..."
if @dir.strip.empty?
puts "Test directory must be specified."
return
end
unless File.directory?(@dir)
puts "Test directory doesn't exist: #{File.expand_path( @dir )}"
return
end
files.each { |file|
$stdout << '.'; $stdout.flush
testing = extract( file )
unless testing.strip.empty?
complete_test = create( testing, file )
fp = File.join(@dir,file)
unless File.directory?( File.dirname( fp ) )
FileUtils.mkdir_p( File.dirname(fp) )
end
File.open( fp, "w" ) { |fw| fw << complete_test }
end
}
puts "done."
end