teodoro 0.16.0 → 0.17.0
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/lib/teodoro/empresa.rb +29 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95be697f0016ccf25571d0a21540d704c84f67166b8326e3e1ec4098ca3459be
|
4
|
+
data.tar.gz: 89eac7b3fc2876ac75b4753fa471dfcb9d9e67ec87ae0a521139d8bbb6440d30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22a6e36c97a6c4c31e81e24f963a02823c3c9e02c794787d036f89e131f88867d1673c9f32d57827192bdceefc05c031c8af894388544be116f3970d0728f91a
|
7
|
+
data.tar.gz: fcd47ad109f0a9f7802712b8bdc0a1900576cf444874976d3c8c0cd02758f77f14b241d152b006098d1fee6e074596f88f55ddce9f044cad59247750784ec7de
|
data/lib/teodoro/empresa.rb
CHANGED
@@ -21,7 +21,7 @@ module Teodoro
|
|
21
21
|
impl.processar
|
22
22
|
end
|
23
23
|
|
24
|
-
class Impl
|
24
|
+
class Impl # rubocop:disable Metrics/ClassLength
|
25
25
|
private
|
26
26
|
|
27
27
|
def initialize(caminho:, destino:)
|
@@ -39,15 +39,14 @@ module Teodoro
|
|
39
39
|
|
40
40
|
def processar
|
41
41
|
dar_feedback_para_o_usuario
|
42
|
-
|
43
|
-
criar_diretorio_dos_arquivos_xml
|
42
|
+
criar_diretorios_destino
|
44
43
|
descompactar_arquivos_de_origem
|
45
|
-
criar_diretorio_dos_arquivos_data
|
46
44
|
carregar_arquivos_xml
|
47
45
|
classificar_arquivos_xml
|
48
46
|
ordenar_arquivos_xml
|
49
47
|
processar_arquivos_xml
|
50
48
|
processar_cargos_gerados
|
49
|
+
ajustar_nome_do_ultimo_arquivo_emp_data
|
51
50
|
end
|
52
51
|
|
53
52
|
def destino_dos_arquivos_data
|
@@ -80,6 +79,12 @@ module Teodoro
|
|
80
79
|
@nome_do_diretorio ||= File.basename(caminho)
|
81
80
|
end
|
82
81
|
|
82
|
+
def criar_diretorios_destino
|
83
|
+
criar_diretorio_destino
|
84
|
+
criar_diretorio_dos_arquivos_xml
|
85
|
+
criar_diretorio_dos_arquivos_data
|
86
|
+
end
|
87
|
+
|
83
88
|
def criar_diretorio_destino
|
84
89
|
Dir.mkdir(destino)
|
85
90
|
end
|
@@ -92,6 +97,10 @@ module Teodoro
|
|
92
97
|
@destino_dos_arquivos_xml ||= File.join(destino, 'xmls')
|
93
98
|
end
|
94
99
|
|
100
|
+
def criar_diretorio_dos_arquivos_data
|
101
|
+
Dir.mkdir(destino_dos_arquivos_data)
|
102
|
+
end
|
103
|
+
|
95
104
|
def descompactar_arquivos_de_origem
|
96
105
|
# otimizacao do gerenciamento de memoria
|
97
106
|
arquivos_de_origem.shift.descompactar while arquivos_de_origem.any?
|
@@ -103,10 +112,6 @@ module Teodoro
|
|
103
112
|
.map { |caminho| ArquivoDeOrigem.new(caminho: caminho, destino_dos_arquivos_xml: destino_dos_arquivos_xml) }
|
104
113
|
end
|
105
114
|
|
106
|
-
def criar_diretorio_dos_arquivos_data
|
107
|
-
Dir.mkdir(destino_dos_arquivos_data)
|
108
|
-
end
|
109
|
-
|
110
115
|
def carregar_arquivos_xml
|
111
116
|
arquivos_xml.each(&:carregar)
|
112
117
|
end
|
@@ -143,6 +148,22 @@ module Teodoro
|
|
143
148
|
def processar_cargos_gerados
|
144
149
|
cargos_gerados.each(&:processar)
|
145
150
|
end
|
151
|
+
|
152
|
+
def ajustar_nome_do_ultimo_arquivo_emp_data
|
153
|
+
File.rename(caminho_do_ultimo_arquivo_emp_data, novo_caminho_do_ultimo_arquivo_emp_data)
|
154
|
+
end
|
155
|
+
|
156
|
+
def caminho_do_ultimo_arquivo_emp_data
|
157
|
+
@caminho_do_ultimo_arquivo_emp_data ||= caminhos_dos_arquivos_emp_data.last
|
158
|
+
end
|
159
|
+
|
160
|
+
def caminhos_dos_arquivos_emp_data
|
161
|
+
Dir[File.join(destino_dos_arquivos_data, 'EMP*.data')]
|
162
|
+
end
|
163
|
+
|
164
|
+
def novo_caminho_do_ultimo_arquivo_emp_data
|
165
|
+
caminho_do_ultimo_arquivo_emp_data.sub(/\[[^\]]*\]\.data$/, '.data')
|
166
|
+
end
|
146
167
|
end
|
147
168
|
end
|
148
169
|
end
|
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.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clavius Tales
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|