oddb2xml 2.0.2 → 2.0.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
  SHA1:
3
- metadata.gz: 91e209f6f384705d053e56609465c69349b2f09b
4
- data.tar.gz: fee149a15fe84a106f74aa3b9c5018ea9a641951
3
+ metadata.gz: e34415925083cd7afcbb59f160b901d355f22faf
4
+ data.tar.gz: 8f3ba8afe9838a9595a4018323ad6ac0719c90ce
5
5
  SHA512:
6
- metadata.gz: 13362a32f7f7c3f3bcf63826a7ead70e03678cd219439e2c88f87a3d2ac082ade71093790b2d6a2c59f86094e1c91152cf88fddbee5e3407f98f93be40e1f1e1
7
- data.tar.gz: 3afe7a0686b90a0c1c33cde46fdd82f8f057d3ea2cb2decadcd2e07f0a796ee984b9fbdb2ce95d424c639d0bcc8e0c388adef0626c4e55e2dfd3916294b1c56c
6
+ metadata.gz: 65db04ccb0593a0eac016ed2c7ea9ec5ebaf9131315ef2d95acdc2d8af58223aa21f5f95c4c787ccd4a6c3642cbd5e6659d412936e95a67221fcc4cea64361bf
7
+ data.tar.gz: 1c5f35d25a0fe3032df867d891cd3d019071b5a069b7515c272c05a2af166a1edcc48169f28b11591dcf024b26a107e41e940ddb90a6bb9407a458545cc84891
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oddb2xml (2.0.2)
4
+ oddb2xml (2.0.3)
5
5
  archive-tar-minitar (~> 0.5.2)
6
6
  mechanize (~> 2.5.1)
7
7
  nokogiri (~> 1.5.10)
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 2.0.3 / 25.03.2015
2
+
3
+ * Option -e implies --calc, too.
4
+
1
5
  === 2.0.2 / 24.03.2015
2
6
 
3
7
  * Fixed handling of chemicals and units with '%'
data/lib/oddb2xml/cli.rb CHANGED
@@ -43,7 +43,7 @@ module Oddb2xml
43
43
  end
44
44
  def run
45
45
  threads = []
46
- if @options[:calc]
46
+ if @options[:calc] and not @options[:extended]
47
47
  threads << download(:package) # swissmedic
48
48
  elsif @options[:address]
49
49
  [:company, :person].each do |type|
@@ -94,10 +94,11 @@ module Oddb2xml
94
94
  def build
95
95
  Oddb2xml.log("Start build")
96
96
  begin
97
- @_files = {"calc"=>"oddb_calc.xml"} if @options[:calc]
97
+ # require 'pry'; binding.pry
98
+ @_files = {"calc"=>"oddb_calc.xml"} if @options[:calc] and not @options[:extended]
98
99
  files.each_pair do |sbj, file|
99
100
  builder = Builder.new(@options) do |builder|
100
- if @options[:calc]
101
+ if @options[:calc] and not @options[:extended]
101
102
  builder.packs = @packs
102
103
  builder.subject = sbj
103
104
  elsif @options[:address]
@@ -222,7 +223,7 @@ module Oddb2xml
222
223
  @packs = SwissmedicExtractor.new(bin, :package).to_hash
223
224
  Oddb2xml.log("SwissmedicExtractor added #{@packs.size} packs from #{bin}")
224
225
  @packs
225
- end unless @options[:calc]
226
+ end
226
227
  end
227
228
  when :bm_update
228
229
  Thread.new do
@@ -296,6 +297,7 @@ module Oddb2xml
296
297
  def files
297
298
  unless @_files
298
299
  @_files = {}
300
+ @_files[:calc] = "oddb_calc.xml" if @options[:calc]
299
301
  if @options[:address]
300
302
  @_files[:company] = "#{prefix}_betrieb.xml"
301
303
  @_files[:person] = "#{prefix}_medizinalperson.xml"
@@ -31,7 +31,9 @@ Usage:
31
31
  produced files are found under data
32
32
  -a, --append Additional target nonpharma
33
33
  -c F, --compress=F Compress format F. {tar.gz|zip}
34
- -e --extended pharma, non-pharma plus prices and non-pharma from zurrose. Products without EAN-Code will also be listed.
34
+ -e --extended pharma, non-pharma plus prices and non-pharma from zurrose.
35
+ Products without EAN-Code will also be listed.
36
+ File oddb_calc.xml will also be generated
35
37
  -f F, --format=F File format F, default is xml. {xml|dat}
36
38
  If F is given, -o option is ignored.
37
39
  -I x, --increment=x Increment price by x percent. Forces -f dat -p zurrose.
@@ -63,6 +65,7 @@ EOS
63
65
  @parser.on('-e', '--extended') {|v| @opts[:extended] = true
64
66
  @opts[:nonpharma] = true
65
67
  @opts[:price] = :zurrose
68
+ @opts[:calc] = true
66
69
  }
67
70
  @parser.on('-f v', '--format v', /^xml|dat$/) {|v| @opts[:format] = v.intern }
68
71
  @parser.on('--calc') {|v| @opts[:calc] = true }
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
data/spec/options_spec.rb CHANGED
@@ -92,16 +92,7 @@ describe Oddb2xml::Options do
92
92
  expected = Default_opts.clone
93
93
  expected[:extended] = true
94
94
  expected[:nonpharma] = true
95
- expected[:price] = :zurrose
96
- specify { expect(options.opts).to eq expected }
97
- end
98
-
99
- context 'when -e is given' do
100
- options = Oddb2xml::Options.new
101
- options.parser.parse!('-e'.split(' '))
102
- expected = Default_opts.clone
103
- expected[:extended] = true
104
- expected[:nonpharma] = true
95
+ expected[:calc] = true
105
96
  expected[:price] = :zurrose
106
97
  specify { expect(options.opts).to eq expected }
107
98
  end
@@ -112,6 +103,7 @@ describe Oddb2xml::Options do
112
103
  expected = Default_opts.clone
113
104
  expected[:extended] = true
114
105
  expected[:nonpharma] = true
106
+ expected[:calc] = true
115
107
  expected[:price] = :zurrose
116
108
  expected[:percent] = 80
117
109
  specify { expect(options.opts).to eq expected }
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.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhiro Asaka, Zeno R.R. Davatz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip