lib/relaton_itu/data_fetcher.rb in relaton-itu-1.18.1 vs lib/relaton_itu/data_fetcher.rb in relaton-itu-1.19.0
- old
+ new
@@ -34,12 +34,11 @@
def parse_page(url, type)
doc = agent.get url
bib = DataParserR.parse doc, url, type
write_file bib
rescue => e # rubocop:disable Style/RescueStandardError
- warn e.message
- warn e.backtrace
+ Util.error "#{e.message}\n#{e.backtrace}"
end
def self.fetch(output: "data", format: "yaml")
t1 = Time.now
puts "Started at: #{t1}"
@@ -126,10 +125,10 @@
# @param bib [RelatonItu::ItuBibliographicItem]
def write_file(bib) # rubocop:disable Metrics/AbcSize
id = bib.docidentifier[0].id.gsub(/[\s.]/, "_")
file = "#{@output}/#{id}.#{@ext}"
if files.include? file
- warn "File #{file} exists."
+ Util.warn "File #{file} exists."
else
files << file
end
index.add_or_update bib.docidentifier[0].id, file
File.write file, content(bib), encoding: "UTF-8"