bddgenx 2.4.5 → 2.4.6
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/VERSION +1 -1
- data/lib/bddgenx/generators/generator.rb +18 -9
- data/lib/bddgenx/generators/runner.rb +1 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9a93bafcbda4d21a1cc0b340565b6dbf269fe635fddbb69ead9c9154ebfef95
|
4
|
+
data.tar.gz: 48421b76147e864c97b4a6e024173ca1f587c23778166ae29f69ac3290aac194
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98853eae51856f72cc90a007f5949c94e3b9151aaf7e18c0b6163f2f6397685159ef8fbf8c6fe6c37ded30b275cbfc4c5499ef18e0cb06fc5a61d9d9aac32a9c
|
7
|
+
data.tar.gz: 1979c869cbb720f13d498f658986a9eecf3b79e85ac82bd45d0ee52415f70b533925e9a0a601af139ce5855b10f90322d7b9aaadef1f19649593ca906a897a2e
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.4.
|
1
|
+
2.4.6
|
@@ -24,12 +24,18 @@ module Bddgenx
|
|
24
24
|
ALL_KEYS = GHERKIN_KEYS_PT + GHERKIN_KEYS_EN
|
25
25
|
|
26
26
|
##
|
27
|
-
#
|
28
|
-
#
|
29
|
-
# @
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
# Função para extrair o idioma do arquivo .txt
|
28
|
+
# @param txt_file [String] Caminho do arquivo .txt
|
29
|
+
# @return [String] O idioma extraído ou 'pt' como padrão
|
30
|
+
def self.obter_idioma_do_arquivo(txt_file)
|
31
|
+
idioma = nil
|
32
|
+
File.foreach(txt_file) do |line|
|
33
|
+
if line.strip.start_with?('# language:')
|
34
|
+
idioma = line.strip.split(':').last.strip.downcase
|
35
|
+
break
|
36
|
+
end
|
37
|
+
end
|
38
|
+
idioma || 'pt' # Retorna 'pt' como padrão caso o idioma não seja encontrado
|
33
39
|
end
|
34
40
|
|
35
41
|
##
|
@@ -49,7 +55,7 @@ module Bddgenx
|
|
49
55
|
# Geração com IA
|
50
56
|
raw_txt = File.read(input)
|
51
57
|
historia = {
|
52
|
-
idioma: 'pt',
|
58
|
+
idioma: 'pt', # Idioma inicial, caso não seja detectado no arquivo
|
53
59
|
quero: File.basename(input, '.txt').tr('_', ' ').capitalize,
|
54
60
|
como: '',
|
55
61
|
para: '',
|
@@ -72,7 +78,8 @@ module Bddgenx
|
|
72
78
|
historia = input.is_a?(String) ? Parser.ler_historia(input) : input
|
73
79
|
end
|
74
80
|
|
75
|
-
|
81
|
+
# Atribui o idioma corretamente antes da geração do conteúdo
|
82
|
+
idioma = historia[:idioma] || obter_idioma_do_arquivo(input) # Uso da função para pegar o idioma do arquivo
|
76
83
|
cont = 1
|
77
84
|
|
78
85
|
# Cria nome-base do arquivo .feature
|
@@ -173,7 +180,9 @@ module Bddgenx
|
|
173
180
|
def self.salvar_feature(caminho, conteudo)
|
174
181
|
FileUtils.mkdir_p(File.dirname(caminho))
|
175
182
|
File.write(caminho, conteudo)
|
176
|
-
puts
|
183
|
+
puts I18n.t('messages.feature_created', caminho: caminho)
|
177
184
|
end
|
178
185
|
end
|
179
186
|
end
|
187
|
+
|
188
|
+
|
@@ -108,7 +108,7 @@ module Bddgenx
|
|
108
108
|
end
|
109
109
|
|
110
110
|
# Geração via IA (ChatGPT, Gemini, Deepseek)
|
111
|
-
if %w[gemini chatgpt
|
111
|
+
if %w[gemini chatgpt].include?(modo)
|
112
112
|
puts I18n.t('messages.start_ia', modo: modo.capitalize)
|
113
113
|
idioma = IA::GeminiCliente.detecta_idioma_arquivo(arquivo)
|
114
114
|
|
@@ -118,8 +118,6 @@ module Bddgenx
|
|
118
118
|
IA::GeminiCliente.gerar_cenarios(historia, idioma)
|
119
119
|
when 'chatgpt'
|
120
120
|
IA::ChatGptCliente.gerar_cenarios(historia, idioma)
|
121
|
-
when 'deepseek'
|
122
|
-
IA::DeepseekCliente.gerar_cenarios(historia, idioma)
|
123
121
|
end
|
124
122
|
end
|
125
123
|
|