aipim-rails 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d3b7226731d7dfd0e40d27eb049dbca953aa2b7
4
- data.tar.gz: 8c1e6acc29a0e1f3d2d47095c3a4e2d08030742a
3
+ metadata.gz: 0acf37dfa5baa88689a83be414af8ec547116cb3
4
+ data.tar.gz: 299be5b1566d8882efa4940b08644d2f231e6e60
5
5
  SHA512:
6
- metadata.gz: 50ad74d87d0b90b4e87e8c93922f91f776ae2c01564afdc5087782aa9c5040f0ed43ea5d0f5f9f348d0683959c05085cee2b7f94618ceeb6dc69d85d47ad4b3d
7
- data.tar.gz: 8c797ec0d2d97cbef690a79077d512fed30241cbf1e13ad20a610007c7ba36c67e7bbf70020f65400c046adb312d6dfed11f0be13830731694e64f4769f09412
6
+ metadata.gz: 456f3dbddda014730945796fc55e5acf678edd8d0b148cbf419f49d9bb813012481c6efbc8040173503d6dc276e44d6ab659108805579bcead28637c35c8ef92
7
+ data.tar.gz: da6f70f7749f83a73f836ae33a74de7feadab202e5c62cc0be3dc330dec81402d7376ec401aefa9a817ba8413c94c1a89dcce835d9b42f50c5322a09adccb5fe
data/bin/aipim CHANGED
@@ -8,6 +8,8 @@ if ARGV[0] == 'generate'
8
8
  system('mkdir -p aipim')
9
9
  system('mkdir -p aipim/screenshots')
10
10
  system('cp '+path+'lib/screenshot.rb features/support/')
11
+ elsif ARGV[0] == 'html'
12
+ ConvertToHtml('aipim/markdown.md')
11
13
  else
12
14
  Parser.init("features/login.feature")
13
15
  end
@@ -1 +1,2 @@
1
1
  require 'aipim-rails/parser'
2
+ require 'aipim-rails/convert_to_html'
@@ -0,0 +1,50 @@
1
+ require 'redcarpet'
2
+
3
+ module ConvertToHtml
4
+
5
+ def self.md_to_html(filename)
6
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)
7
+ markdown.render(File.read(filename))
8
+ end
9
+
10
+ def self.init(filename)
11
+ output = File.open("aipim/relatorio.html", "w")
12
+ output.puts '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'
13
+ output.puts '<html>'
14
+ output.puts ' <head>'
15
+ output.puts ' <META http-equiv="Content-Type" content="text/html; charset=utf-8">'
16
+ output.puts ' <link href="bootstrap.min.css" rel="stylesheet">'
17
+ output.puts ' <script src="http://code.jquery.com/jquery-1.9.1.js"></script>'
18
+ output.puts ' <script type="text/javascript">'
19
+ output.puts ' $(document).ready(function(){'
20
+ output.puts ' $(\'a\').click(function(){'
21
+ output.puts ' var titulo = $(this).html();'
22
+ output.puts ' $(\'html, body\').animate({'
23
+ output.puts ' scrollTop: $(\'h2\').filter(\':contains("\'+titulo+\'")\').offset().top'
24
+ output.puts ' }, 1000);'
25
+ output.puts ' });'
26
+ output.puts ' });'
27
+ output.puts ' </script>'
28
+ output.puts ' <style>'
29
+ output.puts ' img {'
30
+ output.puts ' width: 100%;'
31
+ output.puts ' }'
32
+ output.puts ' blockquote p {'
33
+ output.puts ' text-align: center;'
34
+ output.puts ' }'
35
+ output.puts ' body {'
36
+ output.puts ' padding-left:25%;'
37
+ output.puts ' padding-right:25%;'
38
+ output.puts ' align:center'
39
+ output.puts ' }'
40
+ output.puts ' </style>'
41
+ output.puts '</head>'
42
+ output.puts '<body>'
43
+ output.puts md_to_html(filename)
44
+ output.puts '</body>'
45
+ output.puts '</html>'
46
+ end
47
+
48
+ end
49
+
50
+ ConvertToHtml.init("aipim/markdown.md")
@@ -15,30 +15,34 @@ module Parser
15
15
 
16
16
  def self.read_links(filename)
17
17
  cenario_counter = 1
18
+ output = File.new("aipim/markdown.md", "w")
18
19
  file = File.new(filename, "r")
19
20
  while(line = read_line(file))
20
21
  if ParserHelper.is_cenario?(line)
21
- puts "[#{cenario_counter}. #{ParserHelper.get_cenario(line)}](#) "
22
+ output.puts "[#{cenario_counter}. #{ParserHelper.get_cenario(line)}](#) "
22
23
  cenario_counter = cenario_counter+1
23
24
  end
24
25
  end
25
26
  file.close
27
+ output.close
26
28
  end
27
29
 
28
30
  def self.read_content(filename)
29
31
 
30
32
  file = File.new(filename, "r")
33
+ output = File.new("aipim/markdown.md", "a")
31
34
 
32
35
  screenshot = false
33
36
  cenario_counter = 1
34
37
  result = %x[ls aipim/screenshots/].split("\n")
35
38
  counter_screenshot = 0
36
39
 
40
+ output.puts ""
37
41
  line = read_line(file)
38
42
  while (line)
39
43
 
40
44
  if !ParserHelper.is_comando?(line) && !(line.gsub(" ", "") == "")
41
- puts "#{line} "
45
+ output.puts "#{line} "
42
46
  line = read_line(file)
43
47
 
44
48
  elsif ParserHelper.is_marcacao?(line)
@@ -46,28 +50,28 @@ module Parser
46
50
  line = read_line(file)
47
51
 
48
52
  elsif ParserHelper.is_funcionalidade?(line)
49
- puts "# #{ParserHelper.get_funcionalidade(line)} #"
53
+ output.puts "# #{ParserHelper.get_funcionalidade(line)} #"
50
54
  line = read_line(file)
51
55
 
52
56
  elsif ParserHelper.is_cenario?(line)
53
- puts "> ## #{cenario_counter}. #{ParserHelper.get_cenario(line)} ##"
57
+ output.puts "> ## #{cenario_counter}. #{ParserHelper.get_cenario(line)} ##"
54
58
  cenario_counter = cenario_counter+1
55
59
  while ((line = read_line(file)) && !ParserHelper.is_comando?(line))
56
60
  if !(line.gsub(" ", "") == "")
57
- puts "> #{line} "
61
+ output.puts "> #{line} "
58
62
  end
59
63
  end
60
64
  if screenshot
61
- puts '> [![Alt text](screenshots/'+result[counter_screenshot].to_s+')](screenshots/'+result[counter_screenshot].to_s+') '
65
+ output.puts '> [![Alt text](screenshots/'+result[counter_screenshot].to_s+')](screenshots/'+result[counter_screenshot].to_s+') '
62
66
  counter_screenshot = counter_screenshot+1
63
67
  screenshot = false
64
68
  end
65
- puts ''
66
- puts '<!-- -->'
67
- puts ''
69
+ output.puts ''
70
+ output.puts '<!-- -->'
71
+ output.puts ''
68
72
 
69
73
  elsif ParserHelper.is_contexto?(line)
70
- puts "## Contexto : #{ParserHelper.get_contexto(line)} ##"
74
+ output.puts "## Contexto : #{ParserHelper.get_contexto(line)} ##"
71
75
  line = read_line(file)
72
76
 
73
77
  else
@@ -75,6 +79,7 @@ module Parser
75
79
  end
76
80
  end
77
81
  file.close
82
+ output.close
78
83
 
79
84
 
80
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aipim-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Facta TI
@@ -21,6 +21,7 @@ files:
21
21
  - lib/aipim-rails/parser.rb
22
22
  - lib/aipim-rails/parser_helper.rb
23
23
  - lib/screenshot.rb
24
+ - lib/aipim-rails/convert_to_html.rb
24
25
  - bin/aipim
25
26
  homepage: http://rubygems.org/gems/aipim
26
27
  licenses: