aipim-rails 0.0.0 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/aipim +3 -0
- data/lib/aipim-rails.rb +3 -1
- data/lib/aipim-rails/parser.rb +82 -0
- data/lib/aipim-rails/parser_helper.rb +40 -0
- metadata +13 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abb9eca2892fe3c0c8f8badba37a288922d2fad6
|
4
|
+
data.tar.gz: a0bad9fd6cb8bd743a2fc2d1b9cbec38d47ef924
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61375972fdcf90e1ce8820d8b93d9aa36de6e58a168cd1eb0cbd08f40a0d1841001e705ad90d62d973c59154dcbf1357b4494259e0c527ace2565f14c72f05cb
|
7
|
+
data.tar.gz: 98b61a790e1c2b470f6bafb511f8df2c7cfccfcf4bc7645059d384f384a6948fe849773b67c8b2445bd2385835820aa1336dc41581eb08417492798d7f9e08e0
|
data/bin/aipim
ADDED
data/lib/aipim-rails.rb
CHANGED
@@ -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,25 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aipim-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Facta TI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
email:
|
15
|
-
executables:
|
13
|
+
description: Teste aipim
|
14
|
+
email: jefferson@factati.com
|
15
|
+
executables:
|
16
|
+
- aipim
|
16
17
|
extensions: []
|
17
18
|
extra_rdoc_files: []
|
18
19
|
files:
|
19
20
|
- lib/aipim-rails.rb
|
20
|
-
|
21
|
+
- lib/aipim-rails/parser.rb
|
22
|
+
- lib/aipim-rails/parser_helper.rb
|
23
|
+
- bin/aipim
|
24
|
+
homepage: http://rubygems.org/gems/aipim
|
21
25
|
licenses:
|
22
|
-
-
|
26
|
+
- FactaTI
|
23
27
|
metadata: {}
|
24
28
|
post_install_message:
|
25
29
|
rdoc_options: []
|
@@ -40,5 +44,5 @@ rubyforge_project:
|
|
40
44
|
rubygems_version: 2.0.7
|
41
45
|
signing_key:
|
42
46
|
specification_version: 4
|
43
|
-
summary:
|
47
|
+
summary: Teste aipim
|
44
48
|
test_files: []
|