aipim-rails 0.0.0 → 0.0.9

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: a60b1cdd49fc90b1e2dd8085ba12a30f060cc386
4
- data.tar.gz: b5d627612be298a2d7aafc09beaad5b860ddd694
3
+ metadata.gz: abb9eca2892fe3c0c8f8badba37a288922d2fad6
4
+ data.tar.gz: a0bad9fd6cb8bd743a2fc2d1b9cbec38d47ef924
5
5
  SHA512:
6
- metadata.gz: 756f2b6f19aa542b706526d2dc431e61b4b4ab3a5c42a98f24c257ecef94fff5aaed5d2b34e25954bc3d561c0a8607e0505c9645d793a8046abf0824840366b9
7
- data.tar.gz: 289f7e9d8bad7a2617ac6e6a57e7acfeafce0caf3d80a462226924307da44ff15f525f9600a3aa784072aa6aed83aa48203e142114b6c030168c783fef76fed1
6
+ metadata.gz: 61375972fdcf90e1ce8820d8b93d9aa36de6e58a168cd1eb0cbd08f40a0d1841001e705ad90d62d973c59154dcbf1357b4494259e0c527ace2565f14c72f05cb
7
+ data.tar.gz: 98b61a790e1c2b470f6bafb511f8df2c7cfccfcf4bc7645059d384f384a6948fe849773b67c8b2445bd2385835820aa1336dc41581eb08417492798d7f9e08e0
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'aipim'
@@ -1 +1,3 @@
1
- puts "aipim-rails"
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,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.0
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
- - Factati
7
+ - Facta TI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-13 00:00:00.000000000 Z
11
+ date: 2014-11-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: test.
14
- email: marcus@factati.com
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
- homepage: ''
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: test gem.
47
+ summary: Teste aipim
44
48
  test_files: []