bddgenx 0.1.33 → 0.1.35

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/bddgenx/runner.rb +24 -32
  4. metadata +1 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 051fe63425b07f1d16462519caf52f72241117de91e89e7b168df58d2c1c36db
4
- data.tar.gz: 22bf2b4478fbb808d01f165baced950bdaddfacf5c4cb4adf9ed4f36711ddc88
3
+ metadata.gz: 3e1ce97aed08d81bc55bb1dc4c3c1c66f0b19b8a934e8bfdc4a87cc57c536a77
4
+ data.tar.gz: 2138c9fc8fbc3e6db3ce599f8d83cf2e24420a9b6591cd20aa301831e8f39f3f
5
5
  SHA512:
6
- metadata.gz: 6ca1dfab87003578859507f6d5b95ce3ddf9fedb19d6aa64e037841c6519cf874095889f8771dd8e47391e4ffd7f0e5631123c4e9b52a596f10b11fdc0b21079
7
- data.tar.gz: 42d083f9d7673beb1b5d3a6256d9b8beeba6fa2d170499fa70a0f040fa79451d822e4d37db41d1899050012e4b26f69723014558453f8493e27a4a25e6dd26fb
6
+ metadata.gz: 7ad9a63c9d93a7a61f72b0fa38e741d6075c5311665c73edc8753c580e90b8de056758484f5499a7d00f0a8cae01abee2b468e7bf91e561cb46b8d532c162054
7
+ data.tar.gz: 8447a0d1f8d12ac255fd4813cc6dc8cfe4c8e52e2ae28523fa705d28b46345279a39423e0b53f97291469b38671404a225f09865f7522ab525e4ed077e54a2c9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.33
1
+ 0.1.35
@@ -9,7 +9,16 @@ require_relative 'pdf_exporter'
9
9
 
10
10
  module Bddgenx
11
11
  class Runner
12
- # Retorna lista de arquivos .txt em input/ ou aqueles baseados em ARGV
12
+ # Retorna arquivos a processar: usa ARGV ou prompt interativo
13
+ def self.choose_files(input_dir)
14
+ if ARGV.any?
15
+ selecionar_arquivos_txt(input_dir)
16
+ else
17
+ choose_input(input_dir)
18
+ end
19
+ end
20
+
21
+ # Seleciona arquivos .txt via argumentos
13
22
  def self.selecionar_arquivos_txt(input_dir)
14
23
  ARGV.map do |arg|
15
24
  nome = arg.end_with?('.txt') ? arg : "#{arg}.txt"
@@ -22,7 +31,7 @@ module Bddgenx
22
31
  end.compact
23
32
  end
24
33
 
25
- # Interativo: permite ao usuário escolher entre os .txt em input/
34
+ # Prompt interativo único
26
35
  def self.choose_input(input_dir)
27
36
  files = Dir.glob(File.join(input_dir, '*.txt'))
28
37
  if files.empty?
@@ -31,39 +40,26 @@ module Bddgenx
31
40
  end
32
41
 
33
42
  puts "Selecione o arquivo de história para processar:"
34
- files.each_with_index do |f, i|
35
- puts "#{i+1}. #{File.basename(f)}"
36
- end
43
+ files.each_with_index { |f,i| puts "#{i+1}. #{File.basename(f)}" }
37
44
  print "Digite o número correspondente (ou ENTER para todos): "
38
45
  choice = STDIN.gets.chomp
39
-
40
46
  return files if choice.empty?
41
-
42
47
  idx = choice.to_i - 1
43
- unless idx.between?(0, files.size - 1)
44
- warn "❌ Escolha inválida."
45
- exit 1
48
+ unless idx.between?(0, files.size-1)
49
+ warn "❌ Escolha inválida."; exit 1
46
50
  end
47
51
  [files[idx]]
48
52
  end
49
53
 
50
54
  def self.execute
51
- history_dir = 'input'
52
- Dir.mkdir(history_dir) unless Dir.exist?(history_dir)
53
-
54
- # Determina quais arquivos processar
55
- arquivos = if ARGV.any?
56
- selecionar_arquivos_txt(history_dir)
57
- else
58
- choose_input(history_dir)
59
- end
55
+ input_dir = 'input'
56
+ Dir.mkdir(input_dir) unless Dir.exist?(input_dir)
60
57
 
58
+ arquivos = choose_files(input_dir)
61
59
  if arquivos.empty?
62
- warn "❌ Nenhum arquivo de história para processar."
63
- exit 1
60
+ warn "❌ Nenhum arquivo de história para processar."; exit 1
64
61
  end
65
62
 
66
- # Contadores e coleções
67
63
  total = features = steps = ignored = 0
68
64
  skipped_steps = []
69
65
  generated_pdfs = []
@@ -75,26 +71,22 @@ module Bddgenx
75
71
 
76
72
  historia = Parser.ler_historia(arquivo)
77
73
  unless Validator.validar(historia)
78
- ignored += 1
79
- puts "❌ Arquivo inválido: #{arquivo}"
80
- next
74
+ ignored += 1; puts "❌ Arquivo inválido: #{arquivo}"; next
81
75
  end
82
76
 
83
- # Geração de feature
84
- feature_path, feature_content = Bddgenx::Generator.gerar_feature(historia)
77
+ # Gera feature
78
+ feature_path, feature_content = Generator.gerar_feature(historia)
85
79
  Backup.salvar_versao_antiga(feature_path)
86
- if Bddgenx::Generator.salvar_feature(feature_path, feature_content)
87
- features += 1
88
- end
80
+ features += 1 if Generator.salvar_feature(feature_path, feature_content)
89
81
 
90
- # Geração de steps
82
+ # Gera steps
91
83
  if StepsGenerator.gerar_passos(feature_path)
92
84
  steps += 1
93
85
  else
94
86
  skipped_steps << feature_path
95
87
  end
96
88
 
97
- # Exportação de PDFs
89
+ # Exporta PDFs
98
90
  FileUtils.mkdir_p('reports')
99
91
  results = PDFExporter.exportar_todos(only_new: true)
100
92
  generated_pdfs.concat(results[:generated])
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.33
4
+ version: 0.1.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Nascimento
@@ -24,20 +24,6 @@ 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'
41
27
  description: Transforma arquivos .txt com histórias em arquivos .feature, com steps,
42
28
  rastreabilidade e integração com CI/CD.
43
29
  email: