bddgenx 0.1.34 → 0.1.39

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 (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -15
  3. data/VERSION +1 -1
  4. data/bin/bddgenx +2 -2
  5. data/lib/bddgenx/runner.rb +25 -32
  6. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9bf7bc9f9f2860f8e305530e4e445ecdc67a9f45bfc4d6dca751f954bea45931
4
- data.tar.gz: cdff8e55fea97da8d77fce3fde6d01d53de653a2bbaa15ce5af84bb27d58f700
3
+ metadata.gz: 65b3615437c2737a0dae46cde1467f70dba861018c5ffd78a060764a900ea9d8
4
+ data.tar.gz: e792ed698e942072c0f39a81f083448b63cb5a52b0aafefd0d51b9f8d07d1e23
5
5
  SHA512:
6
- metadata.gz: 830ff28e5997763916c6ff02cd51d5c2eb20cdb8933c2f6a695391f39a327a6c1ad330e578855e8048afc00eb5d96006d4435f56e36459ce32d41624a6fa2301
7
- data.tar.gz: e365e0c9f7edbb717538b26bbee7dce27b9621f2fb54b26db8fde1d3996636ec4c408f9b0f50f1b2d5d81b3c8c59b494454d75516b8a0def0f6b198c7b065cba
6
+ metadata.gz: 970819e00b2845ec2f136d4d40fee6a4d044f55573ad7db2ceed90f14c6e56c66d26e4dfeea97564fbb44d5f3d35f8d7cc753111e38e1e2bfd16835bd134329e
7
+ data.tar.gz: cbb6d11dada635ce791201efeb19709b2d30fb204c042771bbe3a9abb1d89acd0c0c3556611a5b5a64ef049b333dc764b914c37b3c94efc1e060e7d32b5ccba4
data/README.md CHANGED
@@ -160,21 +160,7 @@ require "rake"
160
160
  namespace :bddgenx do
161
161
  desc "Gera arquivos .feature e steps a partir de arquivos .txt"
162
162
  task :gerar do
163
- arquivos = Dir.glob("input/*.txt")
164
-
165
- arquivos.each do |arquivo|
166
- historia = Bddgenx::Parser.ler_historia(arquivo)
167
- next unless Bddgenx::Validator.validar(historia)
168
-
169
- nome_feature, conteudo = Bddgenx::Generator.gerar_feature(historia)
170
- Bddgenx::Backup.salvar_versao_antiga(nome_feature)
171
- Bddgenx::Generator.salvar_feature(nome_feature, conteudo)
172
-
173
- Bddgenx::StepsGenerator.gerar_passos(historia, nome_feature)
174
- Bddgenx::Tracer.adicionar_entrada(historia, nome_feature)
175
- end
176
-
177
- puts "✅ Geração BDD concluída com sucesso!"
163
+ Bddgenx::Runner.execute
178
164
  end
179
165
  end
180
166
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.34
1
+ 0.1.39
data/bin/bddgenx CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative "../lib/bddgen/cli"
2
+ require_relative "../lib/bddgenx/runner"
3
3
 
4
- Bddgenx::CLI.start
4
+ Bddgenx::Runner.execute
@@ -2,6 +2,7 @@
2
2
  require 'fileutils'
3
3
  require_relative 'parser'
4
4
  require_relative 'generator'
5
+ require_relative 'pdf_exporter'
5
6
  require_relative 'steps_generator'
6
7
  require_relative 'validator'
7
8
  require_relative 'backup'
@@ -9,7 +10,16 @@ require_relative 'pdf_exporter'
9
10
 
10
11
  module Bddgenx
11
12
  class Runner
12
- # Retorna lista de arquivos .txt em input/ ou aqueles baseados em ARGV
13
+ # Retorna arquivos a processar: usa ARGV ou prompt interativo
14
+ def self.choose_files(input_dir)
15
+ if ARGV.any?
16
+ selecionar_arquivos_txt(input_dir)
17
+ else
18
+ choose_input(input_dir)
19
+ end
20
+ end
21
+
22
+ # Seleciona arquivos .txt via argumentos
13
23
  def self.selecionar_arquivos_txt(input_dir)
14
24
  ARGV.map do |arg|
15
25
  nome = arg.end_with?('.txt') ? arg : "#{arg}.txt"
@@ -22,7 +32,7 @@ module Bddgenx
22
32
  end.compact
23
33
  end
24
34
 
25
- # Interativo: permite ao usuário escolher entre os .txt em input/
35
+ # Prompt interativo único
26
36
  def self.choose_input(input_dir)
27
37
  files = Dir.glob(File.join(input_dir, '*.txt'))
28
38
  if files.empty?
@@ -31,39 +41,26 @@ module Bddgenx
31
41
  end
32
42
 
33
43
  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
44
+ files.each_with_index { |f,i| puts "#{i+1}. #{File.basename(f)}" }
37
45
  print "Digite o número correspondente (ou ENTER para todos): "
38
46
  choice = STDIN.gets.chomp
39
-
40
47
  return files if choice.empty?
41
-
42
48
  idx = choice.to_i - 1
43
- unless idx.between?(0, files.size - 1)
44
- warn "❌ Escolha inválida."
45
- exit 1
49
+ unless idx.between?(0, files.size-1)
50
+ warn "❌ Escolha inválida."; exit 1
46
51
  end
47
52
  [files[idx]]
48
53
  end
49
54
 
50
55
  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
56
+ input_dir = 'input'
57
+ Dir.mkdir(input_dir) unless Dir.exist?(input_dir)
60
58
 
59
+ arquivos = choose_files(input_dir)
61
60
  if arquivos.empty?
62
- warn "❌ Nenhum arquivo de história para processar."
63
- exit 1
61
+ warn "❌ Nenhum arquivo de história para processar."; exit 1
64
62
  end
65
63
 
66
- # Contadores e coleções
67
64
  total = features = steps = ignored = 0
68
65
  skipped_steps = []
69
66
  generated_pdfs = []
@@ -75,26 +72,22 @@ module Bddgenx
75
72
 
76
73
  historia = Parser.ler_historia(arquivo)
77
74
  unless Validator.validar(historia)
78
- ignored += 1
79
- puts "❌ Arquivo inválido: #{arquivo}"
80
- next
75
+ ignored += 1; puts "❌ Arquivo inválido: #{arquivo}"; next
81
76
  end
82
77
 
83
- # Geração de feature
84
- feature_path, feature_content = Bddgenx::Generator.gerar_feature(historia)
78
+ # Gera feature
79
+ feature_path, feature_content = Generator.gerar_feature(historia)
85
80
  Backup.salvar_versao_antiga(feature_path)
86
- if Bddgenx::Generator.salvar_feature(feature_path, feature_content)
87
- features += 1
88
- end
81
+ features += 1 if Generator.salvar_feature(feature_path, feature_content)
89
82
 
90
- # Geração de steps
83
+ # Gera steps
91
84
  if StepsGenerator.gerar_passos(feature_path)
92
85
  steps += 1
93
86
  else
94
87
  skipped_steps << feature_path
95
88
  end
96
89
 
97
- # Exportação de PDFs
90
+ # Exporta PDFs
98
91
  FileUtils.mkdir_p('reports')
99
92
  results = PDFExporter.exportar_todos(only_new: true)
100
93
  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.34
4
+ version: 0.1.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Nascimento