Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more files for firstbase mode #77

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
oddb2xml (2.8.1)
oddb2xml (2.8.2)
htmlentities
httpi
mechanize
Expand Down
10 changes: 6 additions & 4 deletions lib/oddb2xml/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def run
start_time = Time.now
files2rm = Dir.glob(File.join(DOWNLOADS, "*"))
FileUtils.rm_f(files2rm, verbose: true) if (files2rm.size > 0) && !Oddb2xml.skip_download?
if @options[:calc] && !(@options[:extended])
if @options[:calc] && !(@options[:extended] || @options[:firstbase])
threads << download(:package) # swissmedic
elsif @options[:address]
[:company, :person].each do |type|
Expand Down Expand Up @@ -106,9 +106,9 @@ def run
private

def build
@the_files = {"calc" => "oddb_calc.xml"} if @options[:calc] && !(@options[:extended] || @options[:artikelstamm])
@the_files = {"calc" => "oddb_calc.xml"} if @options[:calc] && !(@options[:extended] || @options[:artikelstamm] || @options[:firstbase])
builder = Builder.new(@options) do |builder|
if @options[:calc] && !(@options[:extended] || @options[:artikelstamm])
if @options[:calc] && !(@options[:extended] || @options[:artikelstamm] || @options[:firstbase])
builder.packs = @packs
elsif @options[:address]
builder.companies = @companies
Expand Down Expand Up @@ -343,7 +343,9 @@ def compress
def files
unless @the_files
@the_files = {}
@the_files[:calc] = "oddb_calc.xml" if @options[:calc]
if @options[:calc]
@the_files[:calc] = "oddb_calc.xml"
end
if @options[:artikelstamm]
@the_files[:artikelstamm] = "artikelstamm_#{Date.today.strftime("%d%m%Y")}_v5.xml"
elsif @options[:address]
Expand Down
9 changes: 5 additions & 4 deletions lib/oddb2xml/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ def self.parse(args = ARGV)
@opts.delete(:increment)
@opts[:nonpharma] = @opts[:append]
@opts.delete(:append)
if @opts[:firstbase]
@opts[:nonpharma] = true
# https://github.com/zdavatz/oddb2xml/issues/76
@opts[:calc] = true
end
if @opts[:extended]
@opts[:nonpharma] = true
@opts[:price] = :zurrose
Expand All @@ -64,10 +69,6 @@ def self.parse(args = ARGV)
@opts[:extended] = true
@opts[:price] = :zurrose
end
if @opts[:firstbase]
@opts[:nonpharma] = true
@opts[:calc] = true
end
@opts[:price] = :zurrose if @opts[:price].is_a?(TrueClass)
@opts[:price] = @opts[:price].to_sym if @opts[:price]
@opts[:ean14] = @opts[:include]
Expand Down
Loading