oddb2xml 2.6.8 → 2.6.9

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
- SHA256:
3
- metadata.gz: 1e269835cb1d379b6d58dc3acdc2b358a2a562bf2e384335ac8b91f94cc6fe85
4
- data.tar.gz: 31e536028c6664688a65436b7c491c750613f0894eaab3b7e960056755e794e7
2
+ SHA1:
3
+ metadata.gz: 57997dab6b06c6ad0aa8bff72b8fb5050f025255
4
+ data.tar.gz: 57b14760b0448b1cc5a24b4fd7f5f313f3257a19
5
5
  SHA512:
6
- metadata.gz: eca74f7c3b982ddc352476fcf517151e13bf75dc3a6293c9a30784826a341bac3b9364f78b602de6c445f4d59ecf16cef342c1e5666f03d23de1c11af222076e
7
- data.tar.gz: 47e128df187298f95b0c21838ec974c75badaff1b55ce7dbf3583d07d87318999a51ab38fed31306d2b27abed255bce3fe54b94f5243aa4c621a7bc21837893b
6
+ metadata.gz: 4b2e2bd8a4ffa584e74422da0c77cf9755c48908bc3c82210a71848109704a59a918bda7092ba3c056dc9e1423317b8ceb94b715639d08e19ecd8b9e95db4e7c
7
+ data.tar.gz: c277c5c81259a52031f97ce7b346c80e124385efc128f549c97ed4e7f26ab739316ab7dae1b1315842c310c4028dae2db0d1a372a44ea429e3e70382c0acdd4f
@@ -1,3 +1,8 @@
1
+ === 2.6.9 / 29.06.2020
2
+
3
+ * Fix problem when running bin/oddb2xml -a -f dat. Thanks to Lukas Furre for reporting the problem
4
+ * Fix warning with regular expression thas has ']'
5
+
1
6
  === 2.6.8 / 26.06.2020
2
7
 
3
8
  * Re-Add support for Ruby Version 2.4
@@ -1337,7 +1337,7 @@ module Oddb2xml
1337
1337
  else
1338
1338
  ('0' * DAT_LEN[:ITHE])
1339
1339
  end.to_i
1340
- row << "%0#{DAT_LEN[:CEAN]}d" % (sprintf('%013d', ean).match(/^000000/) ? 0 : ean.to_i)
1340
+ row << "%0#{DAT_LEN[:CEAN]}d" % (sprintf('%013d', ean.to_i).match(/^000000/) ? 0 : ean.to_i)
1341
1341
  row << "%#{DAT_LEN[:CMWS]}s" % '2' # pharma
1342
1342
  rows << row
1343
1343
  end
@@ -157,7 +157,9 @@ module Oddb2xml
157
157
  end
158
158
  end
159
159
  if @options[:calc]
160
- FileUtils.cp(File.join(WorkDir, file), File.join(WorkDir, file.sub('.xml', '_'+Time.now.strftime("%d.%m.%Y_%H.%M")+'.xml')), :verbose => false)
160
+ ext = File.extname(file)
161
+ dest = File.join(WorkDir, file.sub(ext, '_'+Time.now.strftime("%d.%m.%Y_%H.%M")+ext))
162
+ FileUtils.cp(File.join(WorkDir, file), dest, :verbose => false)
161
163
  end
162
164
  end
163
165
  rescue Interrupt
@@ -88,7 +88,11 @@ module ParseUtil
88
88
  composition.substances.each do
89
89
  |substance_item|
90
90
  active_substance_name = substance_item.name.downcase.sub(/^cum\s/, '')
91
- substance_item.is_active_agent = (active_agents.find {|x| /#{x.downcase.gsub('(', '\(').gsub(')', '\)')}($|\s)/.match(active_substance_name) } != nil)
91
+ substance_item.is_active_agent = (active_agents.find {|x| /#{x.downcase.
92
+ gsub('(', '\(').
93
+ gsub(')', '\)').
94
+ gsub('[', '\[').
95
+ gsub(']', '\]')}($|\s)/.match(active_substance_name) } != nil)
92
96
  substance_item.is_active_agent = true if substance_item.chemical_substance and active_agents.find {|x| x.downcase.eql?(substance_item.chemical_substance.name.downcase) }
93
97
  end
94
98
  comps << composition
@@ -69,7 +69,7 @@ module Oddb2xml
69
69
  def Oddb2xml.add_epha_changes_for_ATC(iksnr, atc_code, force_run: false)
70
70
  @atc_csv_content = {} if force_run
71
71
  if @atc_csv_content.size == 0
72
- open(@atc_csv_origin).readlines.each{
72
+ Oddb2xml.uri_open(@atc_csv_origin).readlines.each{
73
73
  |line|
74
74
  items = line.split(',')
75
75
  @atc_csv_content[[items[0], items[1]]] = items[2]
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "2.6.8"
2
+ VERSION = "2.6.9"
3
3
  end
@@ -184,6 +184,32 @@ describe Oddb2xml::Cli do
184
184
  }
185
185
  end
186
186
  end
187
+ context 'when -e and -f dat option is given' do
188
+ before(:all) do
189
+ cleanup_directories_before_run
190
+ options = Oddb2xml::Options.parse('-e -f dat')
191
+ @cli = Oddb2xml::Cli.new(options)
192
+ @cli_output = buildr_capture(:stdout) { @cli.run }
193
+ end
194
+ it_behaves_like 'any interface for product'
195
+ it 'should have calc option' do
196
+ expect(@cli).to have_option(:format => :dat)
197
+ expect(@cli).to have_option(:calc => true)
198
+ expect(@cli).to have_option(:extended => true)
199
+ end
200
+ it 'should create xml files' do
201
+ expect(@cli_output).to match(/NonPharma/)
202
+ file_today = "oddb_calc_#{Time.now.strftime("%d.%m.%Y_%H.%M")}.xml"
203
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_calc.xml')).size).to eq 1
204
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, file_today)).size).to eq 1
205
+ end
206
+ it 'should create migel files' do
207
+ expect(@cli_output).to match(/NonPharma/)
208
+ file_today = "oddb_with_migel_#{Time.now.strftime("%d.%m.%Y_%H.%M")}.dat"
209
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_with_migel.dat')).size).to eq 1
210
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, file_today)).size).to eq 1
211
+ end
212
+ end
187
213
 
188
214
  context 'when -a nonpharma option is given' do
189
215
  before(:all) do
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.6.8
4
+ version: 2.6.9
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: 2020-06-26 00:00:00.000000000 Z
11
+ date: 2020-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -486,7 +486,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
486
486
  - !ruby/object:Gem::Version
487
487
  version: '0'
488
488
  requirements: []
489
- rubygems_version: 3.1.2
489
+ rubyforge_project:
490
+ rubygems_version: 2.6.8
490
491
  signing_key:
491
492
  specification_version: 4
492
493
  summary: oddb2xml creates xml files.