Module: Oddb2xml
- Defined in:
- lib/oddb2xml.rb,
lib/oddb2xml/cli.rb,
lib/oddb2xml/util.rb,
lib/oddb2xml/builder.rb,
lib/oddb2xml/version.rb,
lib/oddb2xml/extractor.rb,
lib/oddb2xml/compressor.rb,
lib/oddb2xml/downloader.rb
Defined Under Namespace
Modules: DownloadMethod, TxtExtractorMethods
Classes: BMUpdateDownloader, BMUpdateExtractor, BagXmlDownloader, BagXmlExtractor, Builder, Cli, Compressor, Downloader, EphaDownloader, EphaExtractor, Extractor, LppvDownloader, LppvExtractor, MedregbmDownloader, MedregbmExtractor, MigelDownloader, MigelExtractor, SwissIndexDownloader, SwissIndexExtractor, SwissmedicDownloader, SwissmedicExtractor, SwissmedicInfoDownloader, SwissmedicInfoExtractor, ZurroseDownloader, ZurroseExtractor
Constant Summary
collapse
- WorkDir =
Dir.pwd
- Downloads =
"#{Dir.pwd}/downloads"
- XML_OPTIONS =
{
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xmlns' => 'http://wiki.oddb.org/wiki.php?pagename=Swissmedic.Datendeklaration',
'CREATION_DATETIME' => Time.new.strftime('%FT%T%z'),
'PROD_DATE' => Time.new.strftime('%FT%T%z'),
'VALID_DATE' => Time.new.strftime('%FT%T%z')
}
- VERSION =
"1.8.9"
- Strip_For_Sax_Machine =
'<?xml version="1.0" encoding="utf-8"?>'+"\n"
Class Method Summary
collapse
Class Method Details
.download_finished(file, remove_file = true) ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/oddb2xml/util.rb', line 31
def Oddb2xml.download_finished(file, remove_file = true)
src = "#{WorkDir}/#{File.basename(file)}"
dest = "#{Downloads}/#{File.basename(file)}"
FileUtils.makedirs(Downloads)
return unless file and File.exists?(file)
return if File.expand_path(file).eql?(dest)
FileUtils.cp(src, dest, :verbose => false)
Oddb2xml.log("download_finished saved as #{dest} #{File.size(dest)} bytes.")
end
|
.log(msg) ⇒ Object
8
9
10
11
12
|
# File 'lib/oddb2xml/util.rb', line 8
def Oddb2xml.log(msg)
return unless @options[:log]
$stdout.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")}: #{msg}"
$stdout.flush
end
|
.save_options(options) ⇒ Object
14
15
16
|
# File 'lib/oddb2xml/util.rb', line 14
def Oddb2xml.save_options(options)
@options = options
end
|
.skip_download(file) ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'lib/oddb2xml/util.rb', line 22
def Oddb2xml.skip_download(file)
dest = "#{Downloads}/#{File.basename(file)}"
if File.exists?(dest)
FileUtils.cp(dest, file, :verbose => false, :preserve => true) unless File.expand_path(file).eql?(dest)
return true
end
false
end
|
.skip_download? ⇒ Boolean
18
19
20
|
# File 'lib/oddb2xml/util.rb', line 18
def Oddb2xml.skip_download?
@options[:skip_download]
end
|