lib/aipim-rails/parser.rb in aipim-rails-0.0.23 vs lib/aipim-rails/parser.rb in aipim-rails-0.0.40
- old
+ new
@@ -13,12 +13,13 @@
line
end
def self.read_links(filename)
cenario_counter = 1
- output = File.new("aipim/markdown.md", "w")
- file = File.new(filename, "r")
+ system("mkdir -p aipim/markdown")
+ output = File.new("aipim/markdown/#{filename}.md", "w")
+ file = File.new("features/#{filename}", "r")
while(line = read_line(file))
if ParserHelper.is_cenario?(line)
output.puts "[#{cenario_counter}. #{ParserHelper.get_cenario(line)}](#) "
cenario_counter = cenario_counter+1
end
@@ -27,16 +28,16 @@
output.close
end
def self.read_content(filename)
- file = File.new(filename, "r")
- output = File.new("aipim/markdown.md", "a")
+ file = File.new("features/#{filename}", "r")
+ output = File.new("aipim/markdown/#{filename}.md", "a")
screenshot = false
cenario_counter = 1
- result = %x[ls aipim/screenshots/].split("\n")
+ result = %x[ls aipim/screenshots/#{filename}].split("\n")
counter_screenshot = 0
output.puts ""
line = read_line(file)
while (line)
@@ -60,10 +61,10 @@
if !(line.gsub(" ", "") == "")
output.puts "> #{line} "
end
end
if screenshot
- output.puts '> [![Alt text](screenshots/'+result[counter_screenshot].to_s+')](screenshots/'+result[counter_screenshot].to_s+') '
+ output.puts '> [![Alt text](../screenshots/'+filename+'/'+result[counter_screenshot].to_s+')](../screenshots/'+filename+'/'+result[counter_screenshot].to_s+') '
counter_screenshot = counter_screenshot+1
screenshot = false
end
output.puts ''
output.puts '<!-- -->'