catalogos_sat 0.0.5 → 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/catalogos_sat.rb +16 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8feed585a4d3f2dd0355ecf35169f272de7f303
4
- data.tar.gz: 4df32cfb8f261ea7953b1f2d4dd056f8d01f989a
3
+ metadata.gz: ecbcf5c7089cf433adfd4a89a7305a06cef4e99d
4
+ data.tar.gz: 5e9770b3339c21eeed0391b3f5e24be54f2e0cd1
5
5
  SHA512:
6
- metadata.gz: 96c3aecc7a165e37b9e8879334a9443ed78e6bf142b828092a2a50dc0ac711e5ae88f211c011f51d13112fccb4146c1b92c4b902f0e6a6deb02bdbfae049e5d4
7
- data.tar.gz: ffd8fab1d06f8199afe7d2c5f47bec88489dda34ad2997668d4529ff7982fd8f8c4fe81b14cb0ff6192c2e7c16f82e19e97291b5a2c3eb245f9c91b92252ffd1
6
+ metadata.gz: 34021706826580eb6538c0599efcb15543f7495d6dab8a47f9c85d6c565bab51a72fc5e2287d7ab2908e81692b6f170420647a54dc85f7911f03bbd9fa71581b
7
+ data.tar.gz: ec98129fa3a9fe7ee746d68f9b06c2da60542510cfeb869c8ad4dbfc269b86227b21a372c0277e5ab2701e759ce687649aeabc2a011b03461530a98b3cd51faa
data/lib/catalogos_sat.rb CHANGED
@@ -55,7 +55,7 @@ class Catalogos
55
55
  response = http.request_head(url_excel.path)
56
56
  totalSize = response['content-length'].to_i
57
57
  @local_eTag = response['etag'].split(",")[0]
58
- pbar = ProgressBar.create(:title => "Progreso:", :format => "%t %B %p%% %E")
58
+ pbar = ProgressBar.create(:title => "Descargando:", :format => "%t %B %p%% %E")
59
59
 
60
60
  tempdir = Dir.tmpdir()
61
61
 
@@ -107,13 +107,20 @@ class Catalogos
107
107
  ultima_parte = false
108
108
  encabezados = Array.new
109
109
  renglones_json = nil
110
-
110
+
111
+ total_hojas = book.worksheets.count
112
+
113
+ pbar = ProgressBar.create(:title => "Procesando:", :format => "%t %B %p%%")
114
+
115
+
111
116
  # Recorremos todas las hojas/catálogos
112
- for i in 0..book.worksheets.count - 1 do
117
+ for i in 0..book.worksheets.count - 1
118
+ relation = (i+1) * 100 / total_hojas
119
+ pbar.progress = relation
113
120
  hoja = book.worksheet i
114
121
 
115
- puts "\n\n----------------------------------------------"
116
- puts "Conviertiendo a JSON hoja #{hoja.name}..."
122
+ #puts "\n\n----------------------------------------------"
123
+ #puts "Conviertiendo a JSON hoja #{hoja.name}..."
117
124
 
118
125
  # Manejamos la lectura de dos hojas separadas en partes, como la de Codigo Postal
119
126
  if hoja.name.index("_Parte_") != nil
@@ -137,7 +144,7 @@ class Catalogos
137
144
 
138
145
  if row.formats[0].pattern_fg_color == :silver then
139
146
  if renglones_json.nil? then
140
- puts "Ignorando: #{row}"
147
+ #puts "Ignorando: #{row}"
141
148
  renglones_json = Array.new
142
149
  encabezados = Array.new
143
150
  else
@@ -204,7 +211,7 @@ class Catalogos
204
211
 
205
212
  # Guardamos el contenido JSON
206
213
  if !en_partes || ultima_parte then
207
- puts "Escribiendo archivo JSON..."
214
+ #puts "Escribiendo archivo JSON..."
208
215
  hoja.name.sub!(/(_Parte_\d+)$/, '') if ultima_parte
209
216
  File.open("#{tempdir}/#{final_dir}/#{hoja.name}.json","w") do |f|
210
217
  f.write(JSON.pretty_generate(renglones_json))
@@ -215,6 +222,8 @@ class Catalogos
215
222
  encabezados = Array.new
216
223
  end
217
224
  end
225
+ pbar.finish()
226
+
218
227
 
219
228
 
220
229
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catalogos_sat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - BambuCode