lib/aipim-rails/parser.rb in aipim-rails-0.0.17 vs lib/aipim-rails/parser.rb in aipim-rails-0.0.18
- old
+ new
@@ -13,69 +13,74 @@
line
end
def self.read_links(filename)
cenario_counter = 1
+ output = File.new("aipim/markdown.md", "w")
file = File.new(filename, "r")
while(line = read_line(file))
if ParserHelper.is_cenario?(line)
- puts "[#{cenario_counter}. #{ParserHelper.get_cenario(line)}](#) "
+ output.puts "[#{cenario_counter}. #{ParserHelper.get_cenario(line)}](#) "
cenario_counter = cenario_counter+1
end
end
file.close
+ output.close
end
def self.read_content(filename)
file = File.new(filename, "r")
+ output = File.new("aipim/markdown.md", "a")
screenshot = false
cenario_counter = 1
result = %x[ls aipim/screenshots/].split("\n")
counter_screenshot = 0
+ output.puts ""
line = read_line(file)
while (line)
if !ParserHelper.is_comando?(line) && !(line.gsub(" ", "") == "")
- puts "#{line} "
+ output.puts "#{line} "
line = read_line(file)
elsif ParserHelper.is_marcacao?(line)
screenshot = true
line = read_line(file)
elsif ParserHelper.is_funcionalidade?(line)
- puts "# #{ParserHelper.get_funcionalidade(line)} #"
+ output.puts "# #{ParserHelper.get_funcionalidade(line)} #"
line = read_line(file)
elsif ParserHelper.is_cenario?(line)
- puts "> ## #{cenario_counter}. #{ParserHelper.get_cenario(line)} ##"
+ output.puts "> ## #{cenario_counter}. #{ParserHelper.get_cenario(line)} ##"
cenario_counter = cenario_counter+1
while ((line = read_line(file)) && !ParserHelper.is_comando?(line))
if !(line.gsub(" ", "") == "")
- puts "> #{line} "
+ output.puts "> #{line} "
end
end
if screenshot
- puts '> [![Alt text](screenshots/'+result[counter_screenshot].to_s+')](screenshots/'+result[counter_screenshot].to_s+') '
+ output.puts '> [![Alt text](screenshots/'+result[counter_screenshot].to_s+')](screenshots/'+result[counter_screenshot].to_s+') '
counter_screenshot = counter_screenshot+1
screenshot = false
end
- puts ''
- puts '<!-- -->'
- puts ''
+ output.puts ''
+ output.puts '<!-- -->'
+ output.puts ''
elsif ParserHelper.is_contexto?(line)
- puts "## Contexto : #{ParserHelper.get_contexto(line)} ##"
+ output.puts "## Contexto : #{ParserHelper.get_contexto(line)} ##"
line = read_line(file)
else
line = read_line(file)
end
end
file.close
+ output.close
end
end