teodoro 0.67.2 → 0.67.3

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: bd31ac75abdcccfd08625bc2caba6a656f5c2717f5b10f0b7eaa6a3f8068b924
4
- data.tar.gz: 18b8779eeb088c257b12b4fd201222cdc719d922a0af838eae29ee8e0520075c
3
+ metadata.gz: 9bd232ff7396766bbf22931a10bdb93cebb1165d5afea355a49cacffb3f8d981
4
+ data.tar.gz: 288f9b35d3d605d50e537d685442646b57a6d80278ad6be2670eb4e0af10a3c5
5
5
  SHA512:
6
- metadata.gz: 6a3d94552031cd6b0d8c2b37eb58f98e70a590a061237a2a3a2e43a6d9ffbe5e777292b83c03bcbd7f69c96d14ddf8ca60eacfa636219ecfcd204ead55ff5260
7
- data.tar.gz: ca50443b7ddd3f30fce31729001665bcb65e86a354e04df9bcaa40e1fac1046c7c7fffb4846089352ca80a59602c9d048505730ba6418f0acbbee1cdf66b06a8
6
+ metadata.gz: 44c240a32c5c8ead1b19b8378b66069683f8e765113231bc841a43b8bf0c30a1b8988333f6fdfc870f56863f7e3dd567fe1a6848fc2a391b07e9a020a90e664a
7
+ data.tar.gz: 5fb8688f5af27f19127deba394ae08d78b626d0cd50184755ce7a400b180486ecda4bf2800b3f1aa714661990a4b4c004820ac87a35a25322a12cf5827e59d86
@@ -25,8 +25,7 @@ module Teodoro
25
25
  def validar_existencia_do_arquivo_data_original
26
26
  return if File.exist?(caminho_do_arquivo_data_original)
27
27
 
28
- puts '', Rainbow('Erro! Evento de alteração/exclusão sem inclusão anterior.').red
29
- exit
28
+ Teodoro.exit('', Rainbow('Erro! Evento de alteração/exclusão sem inclusão anterior.').red)
30
29
  end
31
30
 
32
31
  def deletar_arquivo_data_original
@@ -28,8 +28,7 @@ module Teodoro
28
28
  def validar_que_nao_eh_diretorio
29
29
  return unless File.directory?(caminho)
30
30
 
31
- puts '', Rainbow("Erro! \"#{p(caminho)}\" é um diretório.").red
32
- exit
31
+ Teodoro.exit('', Rainbow("Erro! \"#{caminho}\" é um diretório.").red)
33
32
  end
34
33
 
35
34
  def percentual
@@ -45,8 +44,7 @@ module Teodoro
45
44
  end
46
45
  end
47
46
  rescue Zip::Error
48
- puts '', Rainbow("Erro! Arquivo \"#{caminho}\" corrompido.").red
49
- exit
47
+ Teodoro.exit('', Rainbow("Erro! Arquivo \"#{caminho}\" corrompido.").red)
50
48
  end
51
49
 
52
50
  def extrair(entrada)
@@ -213,8 +213,7 @@ module Teodoro
213
213
  def validar_que_primeiro_arquivo_xml_eh_s1000
214
214
  return if primeiro_arquivo_xml_eh_s1000?
215
215
 
216
- puts '', Rainbow('Erro! Primeiro arquivo XML (evento) deve ser S-1000.').red
217
- exit
216
+ Teodoro.exit('', Rainbow('Erro! Primeiro arquivo XML (evento) deve ser S-1000.').red)
218
217
  end
219
218
 
220
219
  def primeiro_arquivo_xml_eh_s1000?
@@ -232,14 +231,15 @@ module Teodoro
232
231
  def validar_que_nao_houve_evento_de_retificacao_sem_inclusao_correspondente
233
232
  return if arquivo_xml_por_recibo_de_evento_retificado.empty?
234
233
 
235
- puts ''
236
- puts [
237
- 'Erro! Evento(s) de retificação sem inclusão correspondente:',
238
- *arquivo_xml_por_recibo_de_evento_retificado
239
- .values
240
- .map { "#{_1.nome}.xml" }
241
- ].map { Rainbow(_1).red }
242
- exit
234
+ Teodoro.exit(
235
+ '',
236
+ [
237
+ 'Erro! Evento(s) de retificação sem inclusão correspondente:',
238
+ *arquivo_xml_por_recibo_de_evento_retificado
239
+ .values
240
+ .map { "#{_1.nome}.xml" }
241
+ ].map { Rainbow(_1).red }
242
+ )
243
243
  end
244
244
 
245
245
  def salvar_arquivo_de_dados_gerais
@@ -14,8 +14,7 @@ module Teodoro
14
14
  def validar_existencia_do_contrato_de_trabalho
15
15
  return if empresa.trabalhadores[cpf_do_trabalhador]
16
16
 
17
- puts '', Rainbow('Erro! Evento de início de contrato de trabalho inexistente.').red
18
- exit
17
+ Teodoro.exit('', Rainbow('Erro! Evento de início de contrato de trabalho inexistente.').red)
19
18
  end
20
19
 
21
20
  def salvar_arquivos_data
@@ -134,7 +134,9 @@ module Teodoro
134
134
  end
135
135
 
136
136
  def contrato_de_emprego
137
- @contrato_de_emprego ||= contratos_de_emprego[alteracao_contratual.matricula_do_trabalhador]
137
+ @contrato_de_emprego ||=
138
+ contratos_de_emprego[alteracao_contratual.matricula_do_trabalhador]
139
+ .tap { Teodoro.exit('', Rainbow('Erro! S-2200 correspondente não encontrado.').red) unless _1 }
138
140
  end
139
141
 
140
142
  def contratos_de_emprego
@@ -22,14 +22,13 @@ module Teodoro
22
22
  empresa.contratos_de_trabalho_sem_vinculo
23
23
  end
24
24
 
25
- def inicio_de_contrato # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
25
+ def inicio_de_contrato
26
26
  @inicio_de_contrato ||= Obj.new(
27
27
  trabalhador: trabalhador,
28
28
  matricula_do_trabalhador: evento['infoTSVInicio/matricula'],
29
29
  categoria_do_trabalhador: evento['infoTSVInicio/codCateg'],
30
30
  data_de_inicio: evento['infoTSVInicio/dtInicio'],
31
31
  natureza_da_atividade: evento['infoTSVInicio/natAtividade'],
32
- matricula: evento['infoTSVInicio/matricula'],
33
32
  opcao_pelo_fgts: leiaute.opcao_pelo_fgts,
34
33
  data_de_opcao_pelo_fgts: leiaute.data_de_opcao_pelo_fgts,
35
34
  recibo: numero_do_recibo
@@ -239,7 +238,7 @@ module Teodoro
239
238
  ['localTrabGeral_nrInsc', evento['infoTSVInicio/infoComplementares/localTrabGeral/nrInsc']],
240
239
  ['localTrabGeral_descComp', evento['infoTSVInicio/infoComplementares/localTrabGeral/descComp']],
241
240
  ['EventoAdmissao_InformacoesInicio_CodigoCategoria', inicio_de_contrato.categoria_do_trabalhador],
242
- ['EventoAdmissao_InformacoesInicio_Matricula', inicio_de_contrato.matricula],
241
+ ['EventoAdmissao_InformacoesInicio_Matricula', inicio_de_contrato.matricula_do_trabalhador],
243
242
  ['DescricaoProcEmi', processo_de_emissao_do_evento],
244
243
  ['IdEventoXml', id_do_evento],
245
244
  ['EventoAdmissao_InfoTrabalhador_InfoEndereco_EnderecoResidencialBR_Bairro', trabalhador.endereco.bairro],
@@ -1,3 +1,3 @@
1
1
  module Teodoro
2
- VERSION = '0.67.2'.freeze
2
+ VERSION = '0.67.3'.freeze
3
3
  end
data/lib/teodoro.rb CHANGED
@@ -41,6 +41,11 @@ module Teodoro
41
41
  Execution.new(args).call
42
42
  end
43
43
 
44
+ def self.exit(*args)
45
+ puts(*args)
46
+ Kernel.exit
47
+ end
48
+
44
49
  class Execution
45
50
  NOME_DO_PROGRAMA = 'teodoro'.freeze
46
51
 
@@ -142,8 +147,7 @@ module Teodoro
142
147
  end
143
148
 
144
149
  def erro(erro, saiba_mais: false)
145
- puts [erro, *('Saiba mais em sites.google.com/fortestecnologia.com.br/teodoro.' if saiba_mais)]
146
- exit
150
+ Teodoro.exit([erro, *('Saiba mais em sites.google.com/fortestecnologia.com.br/teodoro.' if saiba_mais)])
147
151
  end
148
152
 
149
153
  def processar_empresas
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teodoro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.67.2
4
+ version: 0.67.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fortes Tecnologia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-29 00:00:00.000000000 Z
11
+ date: 2024-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri