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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35e8e21b724442b0cb35cda26d862a4aa3a1eccbfd1bdb050dba306c1606600e
4
- data.tar.gz: 540d3c814c5621fb7184261c4f070b4f30fa7c0ea351028b6205739556864bc9
3
+ metadata.gz: b9a93bafcbda4d21a1cc0b340565b6dbf269fe635fddbb69ead9c9154ebfef95
4
+ data.tar.gz: 48421b76147e864c97b4a6e024173ca1f587c23778166ae29f69ac3290aac194
5
5
  SHA512:
6
- metadata.gz: 6942cf6d50f8f4f4a1ddd69f05a294f066907798f3b3dcfaac0cbc4bb04844267488bad866c65eef47c1bc9596efca105b366102d6eff3305025afbb70b8565e
7
- data.tar.gz: ed96a04fa5b37f17f768f3f015eaed93e5a944ae9d041425743610b97b3dc1bbf58caef555c692d6cf732b1229d373a3f3b0fae6ebe02c719514eaa6f253b839
6
+ metadata.gz: 98853eae51856f72cc90a007f5949c94e3b9151aaf7e18c0b6163f2f6397685159ef8fbf8c6fe6c37ded30b275cbfc4c5499ef18e0cb06fc5a61d9d9aac32a9c
7
+ data.tar.gz: 1979c869cbb720f13d498f658986a9eecf3b79e85ac82bd45d0ee52415f70b533925e9a0a601af139ce5855b10f90322d7b9aaadef1f19649593ca906a897a2e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.5
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
- # Extrai todas as linhas de exemplo de um array de strings.
28
- #
29
- # @param raw [Array<String>] Array com linhas do grupo de passos
30
- # @return [Array<String>] Somente as linhas que contêm exemplos (começam com '|')
31
- def self.dividir_examples(raw)
32
- raw.select { |l| l.strip.start_with?('|') }
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
- idioma = historia[:idioma] || 'pt'
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 "✅ Arquivo .feature gerado: #{caminho}"
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 deepseek].include?(modo)
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
 
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: 2.4.5
4
+ version: 2.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Nascimento