bddgenx 0.1.31 → 0.1.32

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
  SHA256:
3
- metadata.gz: 750091e9fa8dbfbc0456300c190a1e2632c8d562014c8792b61a74d44f5a8343
4
- data.tar.gz: f9ad48899cca0bfa88a6ef3e7ab453b10676d2d1f1fa6d7628c3435837b88e10
3
+ metadata.gz: fda31f4771f3fc150f52a9a6242c1e0fac890009c3cf66281640c9f58152f53c
4
+ data.tar.gz: 60ec20719d98e9f32151f5f4cebeff5123d237d158a8495ce389d7ec65f201bc
5
5
  SHA512:
6
- metadata.gz: 0d6163a1a6dee7883a2bcdc1afc215a1b3d9bf9fe5dd05a2f9cd23cbab4ee6ad04333ce0874e66e12ce6facc0c7703862ca1466a39661228c9ee2cf7f65087b0
7
- data.tar.gz: 33d5218b2f911d40b5898bdb8053b6ba19a91a23df93d37b4910c3699b92f309b3bb5e1de9a973066dc8f9fa8d577f428cb2892bb81a7d5ed72a7ab834fa4ddf
6
+ metadata.gz: c1f92ae05c89f892f8f206535cf3928be7037ca95f71787f01e74a8ecd401cdf7fa7b852f22b2e0d45de5a757b7ae385dd705bfbb53e28b5c3694d2a398608cd
7
+ data.tar.gz: 99964cbae7ef80abb75792c6629932efd9a66d4b9000d0e839c7b8ec94f57b793065a04c17722ec72f508df76185ff3d8a13c69008805c040042b3232316fee1
data/README.md CHANGED
@@ -18,6 +18,8 @@ bddgenx/
18
18
  │ └── pdf/ # relatórios camelCase
19
19
  ├── lib/
20
20
  │ ├── bddgenx/
21
+ │ │ ├── integrations
22
+ │ │ │ └── jira.rb
21
23
  │ │ ├── parser.rb
22
24
  │ │ ├── validator.rb
23
25
  │ │ ├── generator.rb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.31
1
+ 0.1.32
data/lib/bddgenx/cli.rb CHANGED
@@ -1,5 +1,17 @@
1
1
  module Bddgenx
2
2
  class Cli
3
+ def self.confirm(message)
4
+ print "#{message} "
5
+ answer = $stdin.gets.to_s.strip.downcase
6
+ %w[s sim y yes].include?(answer)
7
+ end
8
+
9
+ # Exibe uma mensagem de pergunta e retorna a string digitada pelo usuário
10
+ def self.ask(message)
11
+ print "#{message} "
12
+ $stdin.gets.to_s.strip
13
+ end
14
+
3
15
  def self.selecionar_arquivos_txt(diretorio)
4
16
  arquivos = Dir.glob("#{diretorio}/*.txt")
5
17
 
@@ -3,24 +3,28 @@ require 'fileutils'
3
3
 
4
4
  module Bddgenx
5
5
  class PDFExporter
6
- def self.exportar_todos
6
+ def self.exportar_todos(only_new: false)
7
7
  FileUtils.mkdir_p('reports/pdf')
8
+ generated = []
9
+ skipped = []
8
10
 
9
- Dir.glob('features/*.feature').each do |feature_file|
10
- base = File.basename(feature_file, '.feature')
11
- nome_pdf = camel_case(base)
12
- destino = "reports/pdf/#{nome_pdf}.pdf"
11
+ Dir.glob('features/*.feature').each do |feature|
12
+ nome = File.basename(feature, '.feature')
13
+ destino = "reports/pdf/#{camel_case(nome)}.pdf"
13
14
 
14
15
  if File.exist?(destino)
15
- puts "⚠️ PDF já existe: #{destino}"
16
+ skipped << destino
16
17
  next
17
18
  end
18
19
 
19
- exportar_arquivo(feature_file, destino)
20
- puts "📄 PDF gerado: #{destino}"
20
+ exportar_arquivo(feature, destino)
21
+ generated << destino
21
22
  end
23
+
24
+ return { generated: generated, skipped: skipped }
22
25
  end
23
26
 
27
+
24
28
  # Converte string para camelCase, removendo caracteres especiais
25
29
  def self.camel_case(str)
26
30
  # Remove tudo que não for letra ou número ou espaço
data/lib/bddgenx.rb CHANGED
@@ -8,42 +8,52 @@ require_relative 'bddgenx/cli'
8
8
  require_relative 'bddgenx/pdf_exporter'
9
9
  require_relative 'bddgenx/utils/verificador'
10
10
 
11
-
12
- cont_total = 0
13
- cont_features = 0
14
- cont_steps = 0
11
+ cont_total = 0
12
+ cont_features = 0
13
+ cont_steps = 0
15
14
  cont_ignorados = 0
16
15
 
17
- # Exibe menu inicial e pergunta quais arquivos processar
16
+ # Seleciona arquivos .txt
18
17
  arquivos = Bddgenx::Cli.selecionar_arquivos_txt('input')
19
-
18
+ # Antes do loop
19
+ skipped_steps = []
20
+ skipped_pdfs = []
21
+ generated_pdfs = []
20
22
  arquivos.each do |arquivo_path|
21
- puts "\n🔍 Processando: #{arquivo_path}"
23
+ cont_total += 1
24
+ puts "\n🔍 Processando: #{arquivo_path}"
22
25
 
23
26
  historia = Bddgenx::Parser.ler_historia(arquivo_path)
24
-
25
27
  unless Bddgenx::Validator.validar(historia)
26
28
  cont_ignorados += 1
27
29
  puts "❌ Arquivo inválido: #{arquivo_path}"
28
30
  next
29
31
  end
30
32
 
33
+ # Gera feature e steps
31
34
  nome_feature, conteudo_feature = Bddgenx::Generator.gerar_feature(historia)
32
-
33
- Bddgenx::Backup.salvar_versao_antiga(nome_feature)
35
+ Bddgenx::Backup.salvar_versao_antiga(nome_feature)
34
36
  cont_features += 1 if Bddgenx::Generator.salvar_feature(nome_feature, conteudo_feature)
35
- cont_steps += 1 if Bddgenx::StepsGenerator.gerar_passos(historia, nome_feature)
36
-
37
- # cria pasta reports raiz
38
- FileUtils.mkdir_p('reports')
39
- Bddgenx::Tracer.adicionar_entrada(historia, nome_feature)
40
- Bddgenx::PDFExporter.exportar_todos
37
+ cont_steps += 1 if Bddgenx::StepsGenerator.gerar_passos(historia, nome_feature)
38
+
39
+ # Rastreabilidade, PDF
40
+ FileUtils.mkdir_p('reports')
41
+ # steps
42
+ if Bddgenx::StepsGenerator.gerar_passos(historia, nome_feature)
43
+ cont_steps += 1
44
+ else
45
+ skipped_steps << nome_feature
46
+ end
47
+ # substituir chamada direta por:
48
+ results = Bddgenx::PDFExporter.exportar_todos(only_new: true)
49
+ # exportar_todos agora fornece [:generated, :skipped]
50
+ generated_pdfs.concat(results[:generated])
51
+ skipped_pdfs.concat(results[:skipped])
41
52
  end
42
- puts "\n✅ Processamento finalizado. Arquivos gerados em: features/, steps/, output/"
43
- puts "🔄 Versões antigas salvas em: reports/backup/"
44
53
 
45
- puts "\n✅ Processamento finalizado:"
46
- puts "- Arquivos processados: #{cont_total}"
54
+ puts "\n✅ Processamento finalizado."
47
55
  puts "- Features geradas: #{cont_features}"
48
56
  puts "- Steps gerados: #{cont_steps}"
49
- puts "- Ignorados: #{cont_ignorados}"
57
+ puts "- Steps mantidos: #{skipped_steps.size}"
58
+ puts "- PDFs gerados: #{generated_pdfs.size}"
59
+ puts "- PDFs já existentes: #{skipped_pdfs.size}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bddgenx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.31
4
+ version: 0.1.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Nascimento
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-12 00:00:00.000000000 Z
11
+ date: 2025-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prawn
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: jira-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
27
41
  description: Transforma arquivos .txt com histórias em arquivos .feature, com steps,
28
42
  rastreabilidade e integração com CI/CD.
29
43
  email:
@@ -45,8 +59,6 @@ files:
45
59
  - lib/bddgenx/backup.rb
46
60
  - lib/bddgenx/cli.rb
47
61
  - lib/bddgenx/generator.rb
48
- - lib/bddgenx/integrations/jira.rb
49
- - lib/bddgenx/integrations/testlink.rb
50
62
  - lib/bddgenx/parser.rb
51
63
  - lib/bddgenx/pdf_exporter.rb
52
64
  - lib/bddgenx/steps_generator.rb
@@ -1,32 +0,0 @@
1
- require 'jira-ruby'
2
-
3
- module Bddgenx
4
- module Integrations
5
- class Jira
6
- def initialize(options = {})
7
- @client = JIRA::Client.new(
8
- username: options[:username],
9
- password: options[:api_token],
10
- site: options[:site],
11
- context_path: '',
12
- auth_type: :basic
13
- )
14
- @project_key = options[:project_key]
15
- end
16
-
17
- def enviar_cenario(titulo, descricao)
18
- issue = {
19
- fields: {
20
- project: { key: @project_key },
21
- summary: titulo,
22
- description: descricao,
23
- issuetype: { name: "Task" }
24
- }
25
- }
26
-
27
- @client.Issue.build.save(issue)
28
- puts "✅ Cenário enviado para Jira: #{titulo}"
29
- end
30
- end
31
- end
32
- end
@@ -1,35 +0,0 @@
1
- require 'xmlrpc/client'
2
-
3
- module Bddgenx
4
- class TestLink
5
- def initialize(api_key, url)
6
- @server = XMLRPC::Client.new2(url)
7
- @key = api_key
8
- end
9
-
10
- def criar_caso_teste(plan_id, titulo, passos)
11
- steps_formated = passos.map.with_index(1) do |step, i|
12
- {
13
- step_number: i,
14
- actions: step,
15
- expected_results: '',
16
- execution_type: 1
17
- }
18
- end
19
-
20
- params = {
21
- devKey: @key,
22
- testprojectid: 1,
23
- testsuiteid: plan_id,
24
- testcasename: titulo,
25
- steps: steps_formated
26
- }
27
-
28
- response = @server.call('tl.createTestCase', params)
29
- puts "✅ Teste enviado ao TestLink: #{titulo}"
30
- response
31
- rescue => e
32
- puts "❌ Erro ao criar caso no TestLink: #{e.message}"
33
- end
34
- end
35
- end