oddb2xml 2.7.2 → 2.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8da655dd712cff69591fb63c97ad9f0e61d1bf085fd03b4cc1af409c140fe31
4
- data.tar.gz: ff287b7a4104e8a446a33d12d0f4a64e0741d390329a2fb2446647fb1b99014b
3
+ metadata.gz: 5dc59cd0f8ed09f2416f4ba77030ab3549618c3cbe90b3e0496e91808e51fa95
4
+ data.tar.gz: 3fdbf0803a5b92b4b3af6950c0021db33ade825de3bb768ca34c54c90e0e659a
5
5
  SHA512:
6
- metadata.gz: 13a5bf2653004efe4365ac0f869b329a0d23e94ef11c5501f03bab1253fa69170a7df0bb78f976dc9c946a4a5f2b5bad21e38f3b5bc24d1e566f5a303eb0bb2f
7
- data.tar.gz: 5483ac6d5eaeaddf7800e7c1bad5245155b61c7025a2d1325790ebf3ed76e70b8b5b1bd262d35e81011109ccb59d304740d7954ee1bef06b61711012eb1f703c
6
+ metadata.gz: b742461c737d8409d8a6f79eba36d4a3d87458e6f211086ff8c828264d76b5c6b3216cdb9b8ce216c3bbb3caa3a38dae2a430e9dd97faa624e8c3b15ceb0a749
7
+ data.tar.gz: 1b825d705594c244f34a9ff4df06e158f8fd63ebabd1bdf7c760ea52a50b816d8781eacd5b0627df394a39de62dc3572afd07261358df66e6d6f0b7cfa0846bf
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 2.7.3 / 29.03.2021
2
+ * Do not delete swissmedic_package.xlsx and swissmedic_orphan.xlsx
3
+ * Save swissmedic_package.xlsx and swissmedic_orphan.xlsx under downloads
4
+ * Log removing files
5
+
1
6
  === 2.7.2 / 18.03.2021
2
7
  * Added https://github.com/testdouble/standard and fixed all useful warnings
3
8
  * Added standard to rake tasks
data/README.md CHANGED
@@ -106,8 +106,8 @@ FR
106
106
 
107
107
  ## Supported ruby version
108
108
 
109
- We run tests on travis-ci.org for the Ruby versions mentioned in the .travis.yml file. You will need ruby > 2.4 to work correctly.
110
- Ruby 2.2/2.3 have problems with i18n encoding and fail a spec test for Naropin
109
+ We run tests on travis-ci.org for the Ruby versions mentioned in the .travis.yml file. You will need ruby > 2.5 to work correctly.
110
+ Look at the github actions to see the spec test results. We ignore errors against ruby head, as it is sometimes unstable.
111
111
 
112
112
 
113
113
  ## XSD files
@@ -709,7 +709,7 @@ module Oddb2xml
709
709
 
710
710
  def prepare_calc_items(suppress_composition_parsing: false)
711
711
  @calc_items = {}
712
- packungen_xlsx = File.join(Oddb2xml::WORK_DIR, "swissmedic_package.xlsx")
712
+ packungen_xlsx = File.join(Oddb2xml::DOWNLOADS, "swissmedic_package.xlsx")
713
713
  return unless File.exist?(packungen_xlsx)
714
714
  workbook = RubyXL::Parser.parse(packungen_xlsx)
715
715
  row_nr = 0
data/lib/oddb2xml/cli.rb CHANGED
@@ -38,7 +38,7 @@ module Oddb2xml
38
38
  threads = []
39
39
  start_time = Time.now
40
40
  files2rm = Dir.glob(File.join(DOWNLOADS, "*"))
41
- FileUtils.rm_f(files2rm, verbose: @options[:log]) if (files2rm.size > 0) && !Oddb2xml.skip_download?
41
+ FileUtils.rm_f(files2rm, verbose: true) if (files2rm.size > 0) && !Oddb2xml.skip_download?
42
42
  if @options[:calc] && !(@options[:extended])
43
43
  threads << download(:package) # swissmedic
44
44
  elsif @options[:address]
@@ -211,7 +211,7 @@ module Oddb2xml
211
211
  "@#{var}",
212
212
  items = SwissmedicExtractor.new(bin, what).to_arry
213
213
  )
214
- Oddb2xml.log("SwissmedicExtractor added #{items.size}")
214
+ Oddb2xml.log("SwissmedicExtractor added #{items.size} from #{bin}")
215
215
  items
216
216
 
217
217
  when :interaction
@@ -39,7 +39,7 @@ module Oddb2xml
39
39
  @contents.each do |file|
40
40
  @tmpfile = file
41
41
  puts "#{__LINE__}: @tmpfile"
42
- FileUtils.rm(file) if file && File.exist?(file)
42
+ FileUtils.rm(file, verbose: true) if file && File.exist?(file)
43
43
  end
44
44
  end
45
45
  rescue Errno::ENOENT
@@ -151,7 +151,7 @@ module Oddb2xml
151
151
  @url ||= "https://raw.githubusercontent.com/zdavatz/oddb2xml_files/master/interactions_de_utf8.csv"
152
152
  file = "epha_interactions.csv"
153
153
  content = download_as(file, "w+")
154
- FileUtils.rm_f(file, verbose: false)
154
+ FileUtils.rm_f(file, verbose: true)
155
155
  content
156
156
  end
157
157
  end
@@ -181,7 +181,7 @@ module Oddb2xml
181
181
  # read file and convert it to utf-8
182
182
  File.open(dest, "r:iso-8859-1:utf-8").read
183
183
  ensure
184
- FileUtils.rm(zipfile) if File.exist?(dest) && File.exist?(zipfile)
184
+ FileUtils.rm(zipfile, verbose: true) if File.exist?(dest) && File.exist?(zipfile)
185
185
  end
186
186
  end
187
187
 
@@ -205,7 +205,7 @@ module Oddb2xml
205
205
  file = "medregbm_#{@type}.txt"
206
206
  download_as(file, "w+:iso-8859-1:utf-8")
207
207
  report_download(@url, file)
208
- FileUtils.rm_f(file, verbose: false) # we need it only in the download
208
+ FileUtils.rm_f(file, verbose: true) # we need it only in the download
209
209
  file
210
210
  end
211
211
  end
@@ -233,7 +233,7 @@ module Oddb2xml
233
233
  Oddb2xml.log(cmd)
234
234
  system(cmd)
235
235
  end
236
- FileUtils.rm_f(file, verbose: false) unless defined?(RSpec)
236
+ FileUtils.rm_f(file, verbose: true) unless defined?(RSpec)
237
237
  content
238
238
  end
239
239
  end
@@ -270,7 +270,7 @@ module Oddb2xml
270
270
  )
271
271
  report_download(@url, @file2save)
272
272
  return IO.read(@file2save) if Oddb2xml.skip_download? && File.exist?(@file2save)
273
- FileUtils.rm_f(@file2save, verbose: false)
273
+ FileUtils.rm_f(@file2save, verbose: true)
274
274
  response = @client.call(:download, xml: soap)
275
275
  if response.success?
276
276
  if (xml = response.to_xml)
@@ -316,17 +316,17 @@ module Oddb2xml
316
316
  end
317
317
 
318
318
  def download
319
- @file2save = File.join(Oddb2xml::WORK_DIR, "swissmedic_#{@type}.xlsx")
319
+ @file2save = File.join(DOWNLOADS, "swissmedic_#{@type}.xlsx")
320
320
  report_download(@url, @file2save)
321
321
  if @options[:calc] && @options[:skip_download] && File.exist?(@file2save) && ((Time.now - File.ctime(@file2save)).to_i < 24 * 60 * 60)
322
322
  Oddb2xml.log "SwissmedicDownloader #{__LINE__}: Skip downloading #{@file2save} #{File.size(@file2save)} bytes"
323
323
  return File.expand_path(@file2save)
324
324
  end
325
325
  begin
326
- FileUtils.rm(File.expand_path(@file2save), verbose: !defined?(RSpec)) if File.exist?(File.expand_path(@file2save))
327
326
  @url = @direct_url_link
328
327
  download_as(@file2save, "w+")
329
328
  if @options[:artikelstamm]
329
+ # ssconvert is in the package gnumeric (Debian)
330
330
  cmd = "ssconvert '#{@file2save}' '#{File.join(DOWNLOADS, File.basename(@file2save).sub(/\.xls.*/, ".csv"))}' 2> /dev/null"
331
331
  Oddb2xml.log(cmd)
332
332
  system(cmd)
@@ -351,7 +351,7 @@ module Oddb2xml
351
351
  def download
352
352
  file = File.join(DOWNLOADS, "swissmedic_info.zip")
353
353
  report_download(@url, file)
354
- FileUtils.rm_f(file, verbose: false) unless Oddb2xml.skip_download?
354
+ FileUtils.rm_f(file, verbose: true) unless Oddb2xml.skip_download?
355
355
  unless File.exist?(file)
356
356
  begin
357
357
  response = nil
@@ -257,7 +257,6 @@ module Oddb2xml
257
257
  end
258
258
  end
259
259
  end
260
- cleanup_file
261
260
  # puts "found #{data.uniq.size} entities for type #{@type}"
262
261
  data.uniq
263
262
  end
@@ -339,20 +338,8 @@ module Oddb2xml
339
338
  end
340
339
  end
341
340
  end
342
- cleanup_file
343
341
  data
344
342
  end
345
-
346
- private
347
-
348
- def cleanup_file
349
- unless defined?(RSpec)
350
- begin
351
- File.unlink(@filename) if File.exist?(@filename)
352
- rescue Errno::EACCES # Permission Denied on Windows
353
- end
354
- end
355
- end
356
343
  end
357
344
 
358
345
  class MigelExtractor < Extractor
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "2.7.2"
2
+ VERSION = "2.7.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oddb2xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.2
4
+ version: 2.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhiro Asaka, Zeno R.R. Davatz, Niklaus Giger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-18 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip