oddb2xml 2.7.1 → 2.7.5
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 +4 -4
- data/.github/workflows/ruby.yml +1 -2
- data/.standard.yml +2 -0
- data/Gemfile +3 -3
- data/History.txt +24 -0
- data/README.md +3 -3
- data/Rakefile +24 -23
- data/bin/check_artikelstamm +11 -11
- data/bin/compare_v5 +23 -23
- data/bin/oddb2xml +14 -13
- data/lib/oddb2xml/builder.rb +1070 -1038
- data/lib/oddb2xml/calc.rb +232 -233
- data/lib/oddb2xml/chapter_70_hack.rb +38 -32
- data/lib/oddb2xml/cli.rb +252 -236
- data/lib/oddb2xml/compare.rb +70 -59
- data/lib/oddb2xml/compositions_syntax.rb +451 -430
- data/lib/oddb2xml/compressor.rb +20 -20
- data/lib/oddb2xml/downloader.rb +157 -129
- data/lib/oddb2xml/extractor.rb +295 -295
- data/lib/oddb2xml/options.rb +34 -35
- data/lib/oddb2xml/parslet_compositions.rb +265 -269
- data/lib/oddb2xml/semantic_check.rb +39 -33
- data/lib/oddb2xml/util.rb +163 -163
- data/lib/oddb2xml/version.rb +1 -1
- data/lib/oddb2xml/xml_definitions.rb +32 -33
- data/lib/oddb2xml.rb +1 -1
- data/oddb2xml.gemspec +34 -34
- data/shell.nix +17 -0
- data/spec/artikelstamm_spec.rb +111 -110
- data/spec/builder_spec.rb +490 -505
- data/spec/calc_spec.rb +552 -593
- data/spec/check_artikelstamm_spec.rb +26 -26
- data/spec/cli_spec.rb +173 -174
- data/spec/compare_spec.rb +9 -11
- data/spec/composition_syntax_spec.rb +390 -409
- data/spec/compressor_spec.rb +48 -48
- data/spec/data/transfer.dat +1 -0
- data/spec/data_helper.rb +47 -49
- data/spec/downloader_spec.rb +251 -260
- data/spec/extractor_spec.rb +171 -159
- data/spec/fixtures/vcr_cassettes/oddb2xml.json +1 -1
- data/spec/galenic_spec.rb +233 -256
- data/spec/options_spec.rb +116 -119
- data/spec/parslet_spec.rb +896 -863
- data/spec/spec_helper.rb +153 -153
- data/test_options.rb +39 -42
- data/tools/win_fetch_cacerts.rb +2 -3
- metadata +42 -12
data/lib/oddb2xml/options.rb
CHANGED
@@ -1,61 +1,60 @@
|
|
1
|
-
|
2
|
-
require
|
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
|
13
|
-
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,
|
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,
|
23
|
-
opt :extended,
|
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,
|
27
|
-
If F is given, -o option is ignored.", :
|
28
|
-
opt :include,
|
29
|
-
'xml' format includes always ean14 records.", :
|
30
|
-
opt :increment,
|
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.", :
|
35
|
-
opt :fi,
|
36
|
-
opt :price,
|
37
|
-
opt :tag_suffix,
|
38
|
-
If S is given, it is also used as prefix of filename.", :
|
39
|
-
opt :context,
|
40
|
-
opt :calc,
|
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,
|
45
|
-
opt :use_ra11zip,
|
46
|
-
|
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]
|
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]
|
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]
|
76
|
-
@opts[:address]
|
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
|