aipim 0.0.3 → 0.0.8

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: 5d6186ef4e0f1a887c323cc07220be779cc63366
4
- data.tar.gz: 71aac484f19c6742eeaa70a8eaa6a89286fec192
3
+ metadata.gz: c7e0086c8c0f5675c2ded1cbc34351036631027c
4
+ data.tar.gz: 3b4edad5e28a33ccdefedaa304fde891ea37b8f9
5
5
  SHA512:
6
- metadata.gz: ce477b2472bb36287bd3be6ad9287b21524297a7df372623d40e1c5f4d981d4988f4e55e24e45b3c137fe4b45503e95c9a99aff3297b5f79f574467682167b48
7
- data.tar.gz: 99854dbd8a38d8db217c830ffd25138f22e8d99535297ea4ed6c9c21c81b46ddbc23296b6a0c3d049d868e5c7b25fe53c1047f9f98fe312ad5871de0f15b2e2f
6
+ metadata.gz: 564b3fb38a9aed2da65dcd3ef6609fcb6cc8d0ddc3ea56fd3b7d48e4d03c57197669640b9e2e225ef1bfee598c6942c09a4aaf7880260ba601e3877bfc48b206
7
+ data.tar.gz: 65dfb2b51622b0bc5cd98afd4d2c17c5e5516f36ad3d3e8792f20ac44bd0a6e4311a33eda160d12b61729e610a0d781ffbb202b0524fd9af77c05c30c8355bec
@@ -1 +1,3 @@
1
- puts "ola, eu sou o aipim"
1
+ require 'aipim/parser'
2
+
3
+ Parser.init("features/usuario.feature")
@@ -0,0 +1,82 @@
1
+ require 'aipim/parser_helper'
2
+
3
+ module Parser
4
+
5
+ def self.init(filename)
6
+ read_links(filename)
7
+ read_content(filename)
8
+ end
9
+
10
+ def self.read_line(file)
11
+ line = file.gets
12
+ line = line.gsub("\n", "") unless line.nil?
13
+ line
14
+ end
15
+
16
+ def self.read_links(filename)
17
+ cenario_counter = 1
18
+ file = File.new(filename, "r")
19
+ while(line = read_line(file))
20
+ if ParserHelper.is_cenario?(line)
21
+ puts "[#{cenario_counter}. #{ParserHelper.get_cenario(line)}](#) "
22
+ cenario_counter = cenario_counter+1
23
+ end
24
+ end
25
+ file.close
26
+ end
27
+
28
+ def self.read_content(filename)
29
+
30
+ file = File.new(filename, "r")
31
+
32
+ screenshot = false
33
+ cenario_counter = 1
34
+ result = %x[ls screenshots/].split("\n")
35
+ counter_screenshot = 0
36
+
37
+ line = read_line(file)
38
+ while (line)
39
+
40
+ if !ParserHelper.is_comando?(line) && !(line.gsub(" ", "") == "")
41
+ puts "#{line} "
42
+ line = read_line(file)
43
+
44
+ elsif ParserHelper.is_marcacao?(line)
45
+ screenshot = true
46
+ line = read_line(file)
47
+
48
+ elsif ParserHelper.is_funcionalidade?(line)
49
+ puts "# #{ParserHelper.get_funcionalidade(line)} #"
50
+ line = read_line(file)
51
+
52
+ elsif ParserHelper.is_cenario?(line)
53
+ puts "> ## #{cenario_counter}. #{ParserHelper.get_cenario(line)} ##"
54
+ cenario_counter = cenario_counter+1
55
+ while ((line = read_line(file)) && !ParserHelper.is_comando?(line))
56
+ if !(line.gsub(" ", "") == "")
57
+ puts "> #{line} "
58
+ end
59
+ end
60
+ if screenshot
61
+ puts '> [![Alt text](screenshots/'+result[counter_screenshot].to_s+')](screenshots/'+result[counter_screenshot].to_s+') '
62
+ counter_screenshot = counter_screenshot+1
63
+ screenshot = false
64
+ end
65
+ puts ''
66
+ puts '<!-- -->'
67
+ puts ''
68
+
69
+ elsif ParserHelper.is_contexto?(line)
70
+ puts "## Contexto : #{ParserHelper.get_contexto(line)} ##"
71
+ line = read_line(file)
72
+
73
+ else
74
+ line = read_line(file)
75
+ end
76
+ end
77
+ file.close
78
+
79
+
80
+ end
81
+
82
+ end
@@ -0,0 +1,40 @@
1
+ module ParserHelper
2
+
3
+ def self.is_comando?(line)
4
+ is_funcionalidade?(line) || is_cenario?(line) || is_contexto?(line) || is_marcacao?(line) || is_comentario?(line)
5
+ end
6
+
7
+ def self.is_funcionalidade?(line)
8
+ return line =~ /Funcionalidade:.*/
9
+ end
10
+
11
+ def self.get_funcionalidade(line)
12
+ line.gsub("Funcionalidade: ", '').split(' ').join(' ')
13
+ end
14
+
15
+ def self.is_cenario?(line)
16
+ return line =~ /Cenário:.*/
17
+ end
18
+
19
+ def self.get_cenario(line)
20
+ line.gsub("Cenário:", '').split(' ').join(' ')
21
+ end
22
+
23
+ def self.is_contexto?(line)
24
+ return true if line =~ /Contexto:.*/
25
+ end
26
+
27
+ def self.get_contexto(line)
28
+ line.gsub("Contexto:", '').split(' ').join(' ')
29
+ end
30
+
31
+ def self.is_marcacao?(line)
32
+ return true if line =~ /@.*/
33
+ end
34
+
35
+ def self.is_comentario?(line)
36
+ return true if line =~ /#.*/
37
+ end
38
+
39
+
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aipim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Facta TI
@@ -18,6 +18,8 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - lib/aipim.rb
21
+ - lib/aipim/parser.rb
22
+ - lib/aipim/parser_helper.rb
21
23
  - bin/aipim
22
24
  homepage: http://rubygems.org/gems/aipim
23
25
  licenses: