oddb2xml 2.7.1 → 2.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -2
  3. data/.standard.yml +2 -0
  4. data/Gemfile +3 -3
  5. data/History.txt +24 -0
  6. data/README.md +3 -3
  7. data/Rakefile +24 -23
  8. data/bin/check_artikelstamm +11 -11
  9. data/bin/compare_v5 +23 -23
  10. data/bin/oddb2xml +14 -13
  11. data/lib/oddb2xml/builder.rb +1070 -1038
  12. data/lib/oddb2xml/calc.rb +232 -233
  13. data/lib/oddb2xml/chapter_70_hack.rb +38 -32
  14. data/lib/oddb2xml/cli.rb +252 -236
  15. data/lib/oddb2xml/compare.rb +70 -59
  16. data/lib/oddb2xml/compositions_syntax.rb +451 -430
  17. data/lib/oddb2xml/compressor.rb +20 -20
  18. data/lib/oddb2xml/downloader.rb +157 -129
  19. data/lib/oddb2xml/extractor.rb +295 -295
  20. data/lib/oddb2xml/options.rb +34 -35
  21. data/lib/oddb2xml/parslet_compositions.rb +265 -269
  22. data/lib/oddb2xml/semantic_check.rb +39 -33
  23. data/lib/oddb2xml/util.rb +163 -163
  24. data/lib/oddb2xml/version.rb +1 -1
  25. data/lib/oddb2xml/xml_definitions.rb +32 -33
  26. data/lib/oddb2xml.rb +1 -1
  27. data/oddb2xml.gemspec +34 -34
  28. data/shell.nix +17 -0
  29. data/spec/artikelstamm_spec.rb +111 -110
  30. data/spec/builder_spec.rb +490 -505
  31. data/spec/calc_spec.rb +552 -593
  32. data/spec/check_artikelstamm_spec.rb +26 -26
  33. data/spec/cli_spec.rb +173 -174
  34. data/spec/compare_spec.rb +9 -11
  35. data/spec/composition_syntax_spec.rb +390 -409
  36. data/spec/compressor_spec.rb +48 -48
  37. data/spec/data/transfer.dat +1 -0
  38. data/spec/data_helper.rb +47 -49
  39. data/spec/downloader_spec.rb +251 -260
  40. data/spec/extractor_spec.rb +171 -159
  41. data/spec/fixtures/vcr_cassettes/oddb2xml.json +1 -1
  42. data/spec/galenic_spec.rb +233 -256
  43. data/spec/options_spec.rb +116 -119
  44. data/spec/parslet_spec.rb +896 -863
  45. data/spec/spec_helper.rb +153 -153
  46. data/test_options.rb +39 -42
  47. data/tools/win_fetch_cacerts.rb +2 -3
  48. metadata +42 -12
@@ -1,61 +1,60 @@
1
- # encoding: utf-8
2
- require 'optimist'
3
- require 'oddb2xml/version'
1
+ require "optimist"
2
+ require "oddb2xml/version"
4
3
 
5
4
  module Oddb2xml
6
5
  module Options
7
- def self.parse(args =ARGV)
6
+ def self.parse(args = ARGV)
8
7
  if args.is_a?(String)
9
- args = args.split(' ')
8
+ args = args.split(" ")
10
9
  end
11
10
 
12
- @opts = Optimist::options(args) do
13
- version "#$0 ver.#{Oddb2xml::VERSION}"
11
+ @opts = Optimist.options(args) do
12
+ version "#{$0} ver.#{Oddb2xml::VERSION}"
14
13
  banner <<-EOS
15
14
  #{File.expand_path($0)} version #{Oddb2xml::VERSION}
16
15
  Usage:
17
16
  oddb2xml [option]
18
17
  produced files are found under data
19
- EOS
20
- opt :append, "Additional target nonpharma", :default => false
18
+ EOS
19
+ opt :append, "Additional target nonpharma", default: false
21
20
  opt :artikelstamm, "Create Artikelstamm Version 3 and 5 for Elexis >= 3.1"
22
- opt :compress_ext, "format F. {tar.gz|zip}", :type => :string, :default => nil, :short => 'c'
23
- opt :extended, "pharma, non-pharma plus prices and non-pharma from zurrose.
21
+ opt :compress_ext, "format F. {tar.gz|zip}", type: :string, default: nil, short: "c"
22
+ opt :extended, "pharma, non-pharma plus prices and non-pharma from zurrose.
24
23
  Products without EAN-Code will also be listed.
25
24
  File oddb_calc.xml will also be generated"
26
- opt :format, "File format F, default is xml. {xml|dat}
27
- If F is given, -o option is ignored.", :type => :string, :default => 'xml'
28
- opt :include, "Include target option for ean14 for 'dat' format.
29
- 'xml' format includes always ean14 records.", :short => 'i'
30
- opt :increment, "Increment price by x percent. Forces -f dat -p zurrose.
25
+ opt :format, "File format F, default is xml. {xml|dat}
26
+ If F is given, -o option is ignored.", type: :string, default: "xml"
27
+ opt :include, "Include target option for ean14 for 'dat' format.
28
+ 'xml' format includes always ean14 records.", short: "i"
29
+ opt :increment, "Increment price by x percent. Forces -f dat -p zurrose.
31
30
  create additional field price_resellerpub as
32
31
  price_extfactory incremented by x percent (rounded to the next 0.05 francs)
33
32
  in oddb_article.xml. In generated zurrose_transfer.dat PRPU is set to this price
34
- Forces -f dat -p zurrose.", :type => :int, :default => nil, :short => 'I'
35
- opt :fi, "Optional fachinfo output.", :short => 'o'
36
- opt :price, "Price source (transfer.dat) from ZurRose", :default => nil
37
- opt :tag_suffix, "XML tag suffix S. Default is none. [A-z0-9]
38
- If S is given, it is also used as prefix of filename.", :type => :string, :short => 't'
39
- opt :context, "{product|address}. product is default.", :default => 'product', :type => :string, :short => 'x'
40
- opt :calc, "create only oddb_calc.xml with GTIN, name and galenic information"
33
+ Forces -f dat -p zurrose.", type: :int, default: nil, short: "I"
34
+ opt :fi, "Optional fachinfo output.", short: "o"
35
+ opt :price, "Price source (transfer.dat) from ZurRose", default: nil
36
+ opt :tag_suffix, "XML tag suffix S. Default is none. [A-z0-9]
37
+ If S is given, it is also used as prefix of filename.", type: :string, short: "t"
38
+ opt :context, "{product|address}. product is default.", default: "product", type: :string, short: "x"
39
+ opt :calc, "create only oddb_calc.xml with GTIN, name and galenic information"
41
40
 
42
41
  opt :skip_download, "skips downloading files it the file is already under downloads.
43
42
  Downloaded files are saved under downloads"
44
- opt :log, "log important actions", :short => :none
45
- opt :use_ra11zip, "Use the ra11.zip (a zipped transfer.dat from Galexis)",
46
- :default => File.exist?('ra11.zip') ? 'ra11.zip' : nil, :type => :string
43
+ opt :log, "log important actions", short: :none
44
+ opt :use_ra11zip, "Use the ra11.zip (a zipped transfer.dat from Galexis)",
45
+ default: File.exist?("ra11.zip") ? "ra11.zip" : nil, type: :string
47
46
  end
48
-
47
+
49
48
  @opts[:percent] = @opts[:increment]
50
- if @opts[:increment]
49
+ if @opts[:increment]
51
50
  @opts[:nonpharma] = true
52
51
  @opts[:price] = :zurrose
53
52
  end
54
- @opts[:ean14] = @opts[:increment]
53
+ @opts[:ean14] = @opts[:increment]
55
54
  @opts.delete(:increment)
56
55
  @opts[:nonpharma] = @opts[:append]
57
56
  @opts.delete(:append)
58
- if @opts[:extended]
57
+ if @opts[:extended]
59
58
  @opts[:nonpharma] = true
60
59
  @opts[:price] = :zurrose
61
60
  @opts[:calc] = true
@@ -63,22 +62,22 @@ EOS
63
62
  if @opts[:artikelstamm]
64
63
  @opts[:extended] = true
65
64
  @opts[:price] = :zurrose
66
- end
65
+ end
67
66
  @opts[:price] = :zurrose if @opts[:price].is_a?(TrueClass)
68
- @opts[:price] = @opts[:price].to_sym if @opts[:price]
67
+ @opts[:price] = @opts[:price].to_sym if @opts[:price]
69
68
  @opts[:ean14] = @opts[:include]
70
69
  @opts[:format] = @opts[:format].to_sym if @opts[:format]
71
70
  @opts.delete(:include)
72
71
  @opts.delete(:help)
73
72
  @opts.delete(:version)
74
73
 
75
- @opts[:address] = false
76
- @opts[:address] = true if /^addr(ess)*$/i.match(@opts[:context])
74
+ @opts[:address] = false
75
+ @opts[:address] = true if /^addr(ess)*$/i.match?(@opts[:context])
77
76
  @opts.delete(:context)
78
77
 
79
78
  @opts.delete(:price) unless @opts[:price]
80
79
 
81
- @opts.each{|k,v| @opts.delete(k) if /_given$/.match(k.to_s)}
80
+ @opts.each { |k, v| @opts.delete(k) if /_given$/.match?(k.to_s) }
82
81
  end
83
82
  end
84
83
  end