aipim-rails 0.0.139 → 0.0.157

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66cc36bbb83ffc547d9b6ac6c823141c6206cec1
4
- data.tar.gz: 7788f2f905779cb197ccd152175430c4b905f8c1
3
+ metadata.gz: bf64999a71e2009004d3fc8e48e3344c63ad9cf8
4
+ data.tar.gz: cbe8865cdca7702473650c3d490ccee8b8f92925
5
5
  SHA512:
6
- metadata.gz: 07df864bea816e58ffb93e426e1d76124f5be9ba8a82ea747fa82ab26351bbcedf1da87cd6e664ebab1e8245dc343447ff5243164594049c95014bb05f92f47c
7
- data.tar.gz: 85be949fbd51bd35be514bdc428a304e5bb7028cfd2eafa5e6030e71a926566c2b58a23a52eac66df64fb4fa14b54012c040c6e47c53a49525fe4a35cfd31591
6
+ metadata.gz: a70fd0ad1fdc491ccfe7c183fe35d7b69d942bf715a31131902be39cc73465be79fdc5affc03dcebbd45d323f24fce5f55a7b4312a3c780f12fdf0414d1ad186
7
+ data.tar.gz: a0c737c7c06962ec2367b6538a081f05c0f5ea2aa4adfc56ca3ba93e18a9d2121a539d873710623a5022ef7931f8cd4839c17e17f7a1417cbb4d2a6ebee16e23
data/bin/aipim CHANGED
@@ -22,8 +22,16 @@ end
22
22
  if ARGV[0] == 'generate'
23
23
  system('mkdir -p aipim')
24
24
  system('mkdir -p aipim/screenshots')
25
+ system('touch aipim/screenshots/empty')
26
+ system('mkdir -p aipim/html')
27
+ system('mkdir -p aipim/html/costum')
28
+ system('cp '+path+'lib/assets/bootstrap.min.css aipim/html')
29
+ system('cp '+path+'lib/assets/jquery-1.9.1.js aipim/html')
30
+ system('cp '+path+'lib/assets/costum.css aipim/html/costum')
31
+ system('cp '+path+'lib/assets/costum.js aipim/html/costum')
32
+
25
33
 
26
- width = "1024"
34
+ width = "1366"
27
35
  height = "768"
28
36
 
29
37
  unless ARGV[1].nil?
@@ -41,16 +49,14 @@ if ARGV[0] == 'generate'
41
49
  f.close
42
50
 
43
51
  elsif ARGV[0] == 'html'
44
- %x[rm -rf aipim/html]
45
- %x[mkdir -p aipim/html]
52
+ %x[rm -f aipim/html/*.feature.html]
46
53
  features = []
47
54
  files = get_files
48
55
  files.each do |f|
49
56
  features << Parser.init(f)
50
57
  end
58
+ ConvertToHtml.index(features)
51
59
  ConvertToHtml.init(features)
52
- system('cp '+path+'lib/assets/bootstrap.min.css aipim/html')
53
- system('cp '+path+'lib/assets/jquery-1.9.1.js aipim/html')
54
60
 
55
61
  elsif ARGV[0] == 'markdown' || ARGV[0] == 'md'
56
62
  %x[rm -rf aipim/markdown]
@@ -23,63 +23,109 @@ module ConvertToHtml
23
23
  str = get_tag_color(str, "E ", "tag-and")
24
24
  end
25
25
 
26
+
27
+ def self.index(features)
28
+
29
+ output = File.open("aipim/html/index.html", "w")
30
+
31
+ output.puts '
32
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
33
+ <html>
34
+ <head>
35
+ <META http-equiv="Content-Type" content="text/html; charset=utf-8">
36
+ <link href="bootstrap.min.css" rel="stylesheet">
37
+ <link href="costum/costum.css" rel="stylesheet">
38
+ <script src="jquery-1.9.1.js"></script>
39
+ <script src="costum/costum.js"></script>
40
+ </head>
41
+ <body>'
42
+ output.puts '
43
+ <div class="panel panel-default scenario-index-panel">
44
+ <div class="panel-body scenario-index-body">
45
+ <ul class="list-unstyled">'
46
+ features.each_with_index do |feature,i|
47
+ output.puts '
48
+ <li><a href="#">'+(i+1).to_s+'. '+feature[:feature_name]+'</a></li>'
49
+ end
50
+ output.puts '
51
+ </ul>
52
+ </div>
53
+ </div>
54
+ </body>
55
+ </html>'
56
+
57
+ output.close
58
+ end
59
+
26
60
  def self.init(features)
27
61
 
28
- features.each do |feature|
62
+ features.each_with_index do |feature, i|
29
63
  output = File.open("aipim/html/"+feature[:filename]+".html", "w")
30
64
 
31
65
  output.puts '
32
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
33
- <html>
34
- <head>
35
- <META http-equiv="Content-Type" content="text/html; charset=utf-8">
36
- <link href="bootstrap.min.css" rel="stylesheet">
37
- <link href="../costum.css" rel="stylesheet">
38
- <script src="jquery-1.9.1.js"></script>
39
- <script src="../costum.js"></script>
40
- </head>
41
- <body>'
42
-
66
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
67
+ <html>
68
+ <head>
69
+ <META http-equiv="Content-Type" content="text/html; charset=utf-8">
70
+ <link href="bootstrap.min.css" rel="stylesheet">
71
+ <link href="costum/costum.css" rel="stylesheet">
72
+ <script src="jquery-1.9.1.js"></script>
73
+ <script src="costum/costum.js"></script>
74
+ </head>
75
+ <body>'
76
+ output.puts '
77
+ <div class="panel panel-default scenario-index-panel">
78
+ <div class="panel-body scenario-index-body">
79
+ <ul class="list-unstyled">'
80
+ features.each_with_index do |t, j|
81
+ output.puts '
82
+ <li><a href="'+t[:filename]+'.html">'+(j+1).to_s+'. '+t[:feature_name]+'</a></li>'
83
+ if i == j
43
84
  output.puts '
44
- <div class="panel panel-default scenario-index-panel">
45
- <div class="panel-body scenario-index-body">
46
- <ul class="list-unstyled">'
47
- feature[:scenarios].each_with_index do |scenario,i|
85
+ <li>
86
+ <ul class="list-unstyled features-link">'
87
+ feature[:scenarios].each_with_index do |scenario,k|
48
88
  output.puts '
49
- <li><a href="#">'+(i+1).to_s+'. '+scenario[:name]+'</a></li>'
89
+ <li><a href="#">'+(j+1).to_s+'.'+(k+1).to_s+'. '+scenario[:name]+'</a></li>'
50
90
  end
51
91
  output.puts '
52
- </ul>
53
- </div>
54
- </div>'
92
+ </ul>
93
+ </li>'
94
+ end
95
+ end
96
+ output.puts '
97
+ </ul>
98
+ </div>
99
+ </div>'
55
100
 
56
- feature[:scenarios].each_with_index do |scenario,i|
101
+ feature[:scenarios].each_with_index do |scenario,j|
57
102
 
58
- output.puts '
59
- <div class="panel panel-default scenario-panel">
60
- <div class="panel-heading scenario-name">
61
- <h3 class="panel-title">'+(i+1).to_s+'. '+scenario[:name]+'<span class="pull-right"><a href="#">[índice]</a></span></h3>
62
- </div>
63
- <div class="panel-body scenario-body">
64
- <ul class="list-unstyled">'
65
-
66
- scenario[:steps].each do |step|
67
- output.puts '<li>'+colorize(step)+'</li>'
68
- end
69
-
70
- output.puts '
71
- </ul>
72
- </div>
73
- <div class="panel-footer scenario-screenshot">
74
- <img src="../screenshots/'+feature[:filename]+'/'+scenario[:screenshot]+'" />
75
- </div>
76
- </div>'
103
+ output.puts '
104
+ <div class="panel panel-default scenario-panel">
105
+ <div class="panel-heading scenario-name">
106
+ <h3 class="panel-title">'+(i+1).to_s+'.'+(j+1).to_s+'. '+scenario[:name]+'<span class="pull-right"><a href="#">[índice]</a></span></h3>
107
+ </div>
108
+ <div class="panel-body scenario-body">
109
+ <ul class="list-unstyled">'
110
+ scenario[:steps].each do |step|
111
+ output.puts '
112
+ <li>'+colorize(step)+'</li>'
113
+ end
77
114
 
78
- end
115
+ output.puts '
116
+ </ul>
117
+ </div>
118
+
119
+ <div class="panel-footer scenario-screenshot">
120
+ <a href="../screenshots/'+feature[:filename]+'/'+scenario[:screenshot]+'"><img src="../screenshots/'+feature[:filename]+'/'+scenario[:screenshot]+'" /></a>
121
+ </div>
122
+ </div>'
123
+
124
+ end
79
125
 
80
126
  output.puts '
81
- </body>
82
- </html>'
127
+ </body>
128
+ </html>'
83
129
 
84
130
  output.close
85
131
  end
@@ -11,12 +11,6 @@ module Markdown
11
11
  #read_content(filename)
12
12
  end
13
13
 
14
- def self.read_line(file)
15
- line = file.gets
16
- line = line.gsub("\n", "").split(' ').join(' ') unless line.nil?
17
- line
18
- end
19
-
20
14
  def self.write_feature(feature, output)
21
15
  feature[:scenarios].each_with_index do |scenario, i|
22
16
  output.puts "[#{i+1}. #{scenario[:name]}](#) "
@@ -35,25 +29,25 @@ module Markdown
35
29
  screenshots = %x[\ls aipim/screenshots/#{filename}].split("\n")
36
30
 
37
31
  output.puts ""
38
- line = read_line(file)
32
+ line = ParserHelper.read_line(file)
39
33
  while (line)
40
34
 
41
35
  if !ParserHelper.is_comando?(line) && !(line.gsub(" ", "") == "")
42
36
  output.puts " #{line} "
43
- line = read_line(file)
37
+ line = ParserHelper.read_line(file)
44
38
 
45
39
  elsif ParserHelper.is_marcacao?(line) && ParserHelper.is_screenshot?(line)
46
40
  is_screenshot = true
47
- line = read_line(file)
41
+ line = ParserHelper.read_line(file)
48
42
 
49
43
  elsif ParserHelper.is_funcionalidade?(line)
50
44
  output.puts "# #{ParserHelper.get_funcionalidade(line)} #"
51
- line = read_line(file)
45
+ line = ParserHelper.read_line(file)
52
46
 
53
47
  elsif ParserHelper.is_cenario?(line)
54
48
  output.puts "> ## #{scenario_counter}. #{ParserHelper.get_cenario(line)} ##"
55
49
  scenario_counter = scenario_counter+1
56
- while ((line = read_line(file)) && !ParserHelper.is_comando?(line))
50
+ while ((line = ParserHelper.read_line(file)) && !ParserHelper.is_comando?(line))
57
51
  output.puts "> #{line} " if !(line.gsub(" ", "") == "")
58
52
  end
59
53
  if is_screenshot
@@ -65,10 +59,10 @@ module Markdown
65
59
 
66
60
  elsif ParserHelper.is_contexto?(line)
67
61
  output.puts "## Contexto : #{ParserHelper.get_contexto(line)} ##"
68
- line = read_line(file)
62
+ line = ParserHelper.read_line(file)
69
63
 
70
64
  else
71
- line = read_line(file)
65
+ line = ParserHelper.read_line(file)
72
66
  end
73
67
  end
74
68
  file.close
@@ -6,71 +6,105 @@ module Parser
6
6
  parser(filename)
7
7
  end
8
8
 
9
- def self.read_line(file)
10
- line = file.gets
11
- line = line.gsub("\n", "").split(' ').join(' ') unless line.nil?
12
- line
9
+
10
+ def self.tag_screenshot(line,file,workset)
11
+ if line && ParserHelper.is_marcacao?(line) && ParserHelper.is_screenshot?(line)
12
+ workset[:screenshot] = true
13
+ line = ParserHelper::read_line(file)
14
+ end
15
+ return line, file, workset
13
16
  end
14
17
 
15
- def self.parser(filename)
18
+ def self.tag_feature(line,file,workset)
19
+ if line && ParserHelper.is_funcionalidade?(line)
20
+ workset[:feature_name] = ParserHelper.get_funcionalidade(line)
21
+ while ((line = ParserHelper::read_line(file)) && !ParserHelper.is_comando?(line))
22
+ workset[:feature_description] << line if !(line.gsub(" ", "") == "")
23
+ end
24
+ end
25
+ return line, file, workset
26
+ end
16
27
 
17
- file = File.new("features/"+filename, "r")
28
+ def self.tag_context(line,file,workset)
29
+ if line && ParserHelper.is_contexto?(line)
30
+ while ((line = ParserHelper::read_line(file)) && !ParserHelper.is_comando?(line))
31
+ workset[:context_description] << line if !(line.gsub(" ", "") == "")
32
+ end
33
+ end
34
+ return line, file, workset
35
+ end
18
36
 
19
- screenshots = %x[\ls aipim/screenshots/#{filename}].split("\n")
37
+ def self.tag_scenario(line,file,workset)
38
+ if line && ParserHelper.is_cenario?(line)
39
+ scenario_name = ParserHelper.get_cenario(line)
40
+ scenario_steps = []
41
+ while ((line = ParserHelper::read_line(file)) && !ParserHelper.is_comando?(line))
42
+ scenario_steps << line if !(line.gsub(" ", "") == "")
43
+ end
44
+ if workset[:screenshot]
45
+ screenshot = workset[:screenshots][workset[:screenshot_counter]].to_s
46
+ workset[:screenshot_counter] += 1
47
+ workset[:screenshot] = false
48
+ end
49
+ workset[:scenarios] << {name: scenario_name, steps: scenario_steps, screenshot: screenshot}
50
+ end
51
+ return line, file, workset
52
+ end
20
53
 
21
- is_screenshot = false; scenario_counter = 1; screenshot_counter = 0
22
- feature = []; feature_name = nil; feature_description = []
23
- context_name = nil; context_description = []
24
- scenarios = []; scenario_name = nil; scenario_steps = []; screenshot = nil
54
+ def self.parser(filename)
55
+
56
+ # Read input
57
+ file = read_file(filename)
58
+
59
+ # Get screenshot files
60
+ screenshots = get_screenshot_files(filename)
61
+
62
+ workset = {
63
+ screenshot: false,
64
+ screenshot_counter: 0,
65
+ screenshots: screenshots,
66
+ feature_name: nil,
67
+ feature_description: [],
68
+ context_name: nil,
69
+ context_description: [],
70
+ scenarios: []
71
+ }
25
72
 
26
- line = read_line(file)
73
+ line = ParserHelper::read_line(file)
27
74
  while (line)
28
75
 
29
- if ParserHelper.is_marcacao?(line) && ParserHelper.is_screenshot?(line)
30
- is_screenshot = true
31
- line = read_line(file)
32
-
33
- elsif ParserHelper.is_funcionalidade?(line)
34
- feature_name = ParserHelper.get_funcionalidade(line)
35
- while ((line = read_line(file)) && !ParserHelper.is_comando?(line))
36
- feature_description << line if !(line.gsub(" ", "") == "")
37
- end
38
-
39
- elsif ParserHelper.is_contexto?(line)
40
- while ((line = read_line(file)) && !ParserHelper.is_comando?(line))
41
- context_description << line if !(line.gsub(" ", "") == "")
42
- end
43
-
44
- elsif ParserHelper.is_cenario?(line)
45
- scenario_name = ParserHelper.get_cenario(line)
46
- while ((line = read_line(file)) && !ParserHelper.is_comando?(line))
47
- scenario_steps << line if !(line.gsub(" ", "") == "")
48
- end
49
- if is_screenshot
50
- screenshot = screenshots[screenshot_counter].to_s
51
- screenshot_counter = screenshot_counter+1
52
- is_screenshot = false
53
- end
54
- scenarios << {name: scenario_name, steps: scenario_steps, screenshot: screenshot}
55
- scenario_steps = []
56
- screenshot = nil
57
-
58
- else
59
- line = read_line(file)
60
- end
76
+ line, file, workset = tag_screenshot(line, file, workset)
77
+
78
+ line, file, workset = tag_feature(line, file, workset)
79
+
80
+ line, file, workset = tag_context(line, file, workset)
81
+
82
+ line, file, workset = tag_scenario(line, file, workset)
83
+
84
+ line = ParserHelper::read_line(file) unless ParserHelper.is_comando?(line)
61
85
  end
62
86
  file.close
63
87
 
64
88
  feature = {
65
- feature_name: feature_name,
66
- feature_description: feature_description,
67
- context_name: context_name,
68
- context_description: context_description,
69
- scenarios: scenarios,
89
+ feature_name: workset[:feature_name],
90
+ feature_description: workset[:feature_description],
91
+ context_name: workset[:context_name],
92
+ context_description: workset[:context_description],
93
+ scenarios: workset[:scenarios],
70
94
  filename: filename
71
95
  }
72
96
 
73
97
 
74
98
  end
75
99
 
100
+ def self.read_file(filename)
101
+ filename = "features/"+filename
102
+ raise "FileNotFound" unless File.exists?(filename)
103
+ File.open(filename, "r")
104
+ end
105
+
106
+ def self.get_screenshot_files(filename)
107
+ %x[\ls aipim/screenshots/#{filename}].split("\n")
108
+ end
109
+
76
110
  end
@@ -1,7 +1,7 @@
1
1
  module ParserHelper
2
2
 
3
3
  def self.is_comando?(line)
4
- is_funcionalidade?(line) || is_cenario?(line) || is_contexto?(line) || is_marcacao?(line) || is_comentario?(line)
4
+ is_funcionalidade?(line) || is_cenario?(line) || is_contexto?(line) || is_marcacao?(line)
5
5
  end
6
6
 
7
7
  def self.is_funcionalidade?(line)
@@ -40,5 +40,10 @@ module ParserHelper
40
40
  return true if line =~ /#.*/
41
41
  end
42
42
 
43
+ def self.read_line(file)
44
+ line = file.gets
45
+ line = line.gsub("\n", "").split(' ').join(' ') unless line.nil?
46
+ line
47
+ end
43
48
 
44
49
  end
@@ -0,0 +1,37 @@
1
+ body{
2
+ padding-left: 20%;
3
+ padding-right: 20%;
4
+ padding-top: 10px;
5
+ }
6
+
7
+ .tag-given{
8
+ color:green;
9
+ font-weight:bold;
10
+ }
11
+
12
+ .tag-then{
13
+ color:red;
14
+ font-weight:bold;
15
+ }
16
+
17
+ .tag-when{
18
+ color:purple;
19
+ font-weight:bold;
20
+ }
21
+
22
+ .tag-and{
23
+ color:yellow;
24
+ font-weight:bold;
25
+ }
26
+
27
+ .tag-quotes{
28
+ font-weight:bold;
29
+ }
30
+
31
+ .scenario-screenshot img{
32
+ width:100%;
33
+ }
34
+
35
+ .features-link{
36
+ text-indent: 25px;
37
+ }
@@ -0,0 +1,14 @@
1
+ $(document).ready(function(){
2
+ $('a').click(function(){
3
+ var titulo = $(this).html();
4
+ if (titulo == "[índice]") {
5
+ $('html, body').animate({
6
+ scrollTop: 0
7
+ }, 1000);
8
+ } else {
9
+ $('html, body').animate({
10
+ scrollTop: $('h3').filter(':contains("'+titulo+'")').offset().top - 30
11
+ }, 1000);
12
+ }
13
+ });
14
+ });
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.139
4
+ version: 0.0.157
5
5
  platform: ruby
6
6
  authors:
7
7
  - Facta TI
@@ -11,7 +11,21 @@ cert_chain: []
11
11
  date: 2014-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: redcarpet
14
+ name: cucumber-rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: selenium-webdriver
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - '>='
@@ -38,6 +52,8 @@ files:
38
52
  - lib/webdriver/screenshot.rb
39
53
  - lib/assets/bootstrap.min.css
40
54
  - lib/assets/jquery-1.9.1.js
55
+ - lib/assets/costum.css
56
+ - lib/assets/costum.js
41
57
  - lib/aipim-rails/convert_to_html.rb
42
58
  - bin/aipim
43
59
  homepage: http://rubygems.org/gems/aipim