bddgenx 0.1.16 → 0.1.17
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 +4 -4
- data/Rakefile +54 -0
- data/lib/bddgenx/pdf_exporter.rb +10 -10
- data/lib/bddgenx/steps_generator.rb +4 -4
- data/lib/bddgenx/version.rb +1 -1
- metadata +6 -5
- /data/{assets → lib/bddgenx/assets}/fonts/DejaVuSansMono-Bold.ttf +0 -0
- /data/{assets → lib/bddgenx/assets}/fonts/DejaVuSansMono-BoldOblique.ttf +0 -0
- /data/{assets → lib/bddgenx/assets}/fonts/DejaVuSansMono-Oblique.ttf +0 -0
- /data/{assets → lib/bddgenx/assets}/fonts/DejaVuSansMono.ttf +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eae91a2de34a4ea84503ab6015501479f2a2483dafaa3b2a88d1930fc3271c0f
|
4
|
+
data.tar.gz: d14373f08e54d394f993954acc6fff5c2ef275b942b2e0e381f3f65a02b0d986
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1630a5697a6f519bf92ecfd5f895b088fab0d4305f23efd5ea77204d1b292940c1381f9f282483116edb970890f7e6fd399dabc2a7468748fdb69fc552ba89db
|
7
|
+
data.tar.gz: b2528be1f5c6a3ab8ea4555e168e2fbc7ca9677eb0ba76cc64c72c691d7478c69f12018a7ca8230dd57702dbf2c77e4e3bd00572cec3c6430a3f8b3d2e52fdf7
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require_relative 'lib/bddgenx.rb'
|
3
|
+
require_relative 'lib/bddgenx/pdf_exporter'
|
4
|
+
require_relative 'lib/bddgenx/integrations/jira'
|
5
|
+
require_relative 'lib/bddgenx/integrations/testlink'
|
6
|
+
|
7
|
+
namespace :bddgenx do
|
8
|
+
|
9
|
+
desc "Gerar arquivos .feature, steps, rastreabilidade e backups"
|
10
|
+
task :gerar do
|
11
|
+
arquivos = Bddgenx::CLI.todos_arquivos('input')
|
12
|
+
arquivos.each do |arquivo|
|
13
|
+
puts "🔁 Executando: ruby bddgen.rb"
|
14
|
+
system("ruby lib/bddgen.rb")
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Exportar todos os arquivos .feature para PDF"
|
20
|
+
task :pdf do
|
21
|
+
puts "📦 Exportando para PDF..."
|
22
|
+
Bddgenx::PDFExporter.exportar_todos
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Enviar todos os cenários para o Jira"
|
26
|
+
task :jira do
|
27
|
+
jira = Bddgenx::Integrations::Jira.new(
|
28
|
+
username: ENV['JIRA_USER'],
|
29
|
+
api_token: ENV['JIRA_TOKEN'],
|
30
|
+
site: ENV['JIRA_SITE'],
|
31
|
+
project_key: ENV['JIRA_PROJECT']
|
32
|
+
)
|
33
|
+
|
34
|
+
Dir.glob("features/*.feature") do |arquivo|
|
35
|
+
conteudo = File.read(arquivo)
|
36
|
+
titulo = File.basename(arquivo, ".feature").gsub('_', ' ').capitalize
|
37
|
+
jira.enviar_cenario(titulo, conteudo)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "Enviar todos os cenários para o TestLink"
|
42
|
+
task :testlink do
|
43
|
+
testlink = Bddgen::Integrations::TestLink.new(
|
44
|
+
ENV['TESTLINK_TOKEN'],
|
45
|
+
ENV['TESTLINK_URL']
|
46
|
+
)
|
47
|
+
|
48
|
+
Dir.glob("features/*.feature") do |arquivo|
|
49
|
+
conteudo = File.readlines(arquivo).reject { |l| l.strip.start_with?("#") || l.strip.empty? }
|
50
|
+
titulo = File.basename(arquivo, ".feature").gsub('_', ' ').capitalize
|
51
|
+
testlink.criar_caso_teste(ENV['TESTLINK_PLAN_ID'].to_i, titulo, conteudo)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/bddgenx/pdf_exporter.rb
CHANGED
@@ -22,22 +22,22 @@ module Bddgenx
|
|
22
22
|
conteudo = File.read(origem, encoding: 'utf-8')
|
23
23
|
|
24
24
|
Prawn::Document.generate(destino) do |pdf|
|
25
|
-
fonte_existe = File.exist?("fonts/DejaVuSansMono.ttf")
|
26
|
-
|
27
|
-
|
28
|
-
if
|
25
|
+
fonte_existe = File.exist?("assets/fonts/DejaVuSansMono.ttf")
|
26
|
+
font_dir = File.expand_path("assets/fonts", __dir__)
|
27
|
+
|
28
|
+
if File.exist?(File.join(font_dir, "DejaVuSansMono.ttf"))
|
29
29
|
pdf.font_families.update(
|
30
30
|
"DejaVu" => {
|
31
|
-
normal: File.join(
|
32
|
-
bold: File.join(
|
33
|
-
italic: File.join(
|
34
|
-
bold_italic: File.join(
|
31
|
+
normal: File.join(font_dir, "DejaVuSansMono.ttf"),
|
32
|
+
bold: File.join(font_dir, "DejaVuSansMono-Bold.ttf"),
|
33
|
+
italic: File.join(font_dir, "DejaVuSansMono-Oblique.ttf"),
|
34
|
+
bold_italic: File.join(font_dir, "DejaVuSansMono-BoldOblique.ttf")
|
35
35
|
}
|
36
36
|
)
|
37
37
|
pdf.font "DejaVu"
|
38
38
|
else
|
39
|
-
puts "⚠️
|
40
|
-
pdf.font "Courier"
|
39
|
+
puts "⚠️ Fonte não encontrada: #{font_dir}"
|
40
|
+
pdf.font "Courier"
|
41
41
|
end
|
42
42
|
|
43
43
|
pdf.font_size 10
|
@@ -4,14 +4,14 @@ require_relative 'utils/verificador'
|
|
4
4
|
module Bddgenx
|
5
5
|
class StepsGenerator
|
6
6
|
PADROES = {
|
7
|
-
'pt' => %w[Dado Quando Então E],
|
8
|
-
'en' => %w[Given When Then And]
|
7
|
+
'pt' => %w[Dado Quando Então E Mas Regra Contexto],
|
8
|
+
'en' => %w[Given When Then And But Rule Context]
|
9
9
|
}
|
10
10
|
|
11
11
|
TIPOS_BLOCOS = %w[
|
12
12
|
CONTEXT SUCCESS FAILURE ERROR EXCEPTION
|
13
13
|
VALIDATION PERMISSION EDGE_CASE PERFORMANCE
|
14
|
-
EXAMPLES
|
14
|
+
EXAMPLES RULE
|
15
15
|
]
|
16
16
|
|
17
17
|
def self.gerar_passos(historia, nome_arquivo_feature)
|
@@ -22,7 +22,7 @@ module Bddgenx
|
|
22
22
|
grupos_examples = dividir_examples(historia[:blocos]["EXAMPLES"]) if historia[:blocos]["EXAMPLES"]&.any?
|
23
23
|
|
24
24
|
TIPOS_BLOCOS.each do |tipo|
|
25
|
-
blocos = tipo == "
|
25
|
+
blocos = tipo == "RULE" ? historia[:regras] : historia[:blocos][tipo]
|
26
26
|
next unless blocos.is_a?(Array)
|
27
27
|
|
28
28
|
passos = blocos.dup
|
data/lib/bddgenx/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bddgenx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Nascimento
|
@@ -20,12 +20,13 @@ extensions: []
|
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
22
|
- README.md
|
23
|
-
-
|
24
|
-
- assets/fonts/DejaVuSansMono-BoldOblique.ttf
|
25
|
-
- assets/fonts/DejaVuSansMono-Oblique.ttf
|
26
|
-
- assets/fonts/DejaVuSansMono.ttf
|
23
|
+
- Rakefile
|
27
24
|
- bin/bddgenx
|
28
25
|
- lib/bddgenx.rb
|
26
|
+
- lib/bddgenx/assets/fonts/DejaVuSansMono-Bold.ttf
|
27
|
+
- lib/bddgenx/assets/fonts/DejaVuSansMono-BoldOblique.ttf
|
28
|
+
- lib/bddgenx/assets/fonts/DejaVuSansMono-Oblique.ttf
|
29
|
+
- lib/bddgenx/assets/fonts/DejaVuSansMono.ttf
|
29
30
|
- lib/bddgenx/backup.rb
|
30
31
|
- lib/bddgenx/cli.rb
|
31
32
|
- lib/bddgenx/generator.rb
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|