Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
/home/masa/ywesee/oddb.org/src/plugin/oddbdat_export.rb | 90 | 70 | 100.00%
|
100.00%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 #/usr/bin/env ruby |
2 # OddbDatExport -- oddb -- 23.06.2003 -- aschrafl@ywesee.com |
3 |
4 require 'plugin/plugin' |
5 require 'drb' |
6 require 'util/oddbconfig' |
7 require 'util/persistence' |
8 require 'custom/lookandfeelbase' |
9 require 'date' |
10 require 'iconv' |
11 require 'archive/tarsimple' |
12 require 'zip/zip' |
13 |
14 module ODDB |
15 module OdbaExporter |
16 class AcTable; end |
17 class AccompTable; end |
18 class AcLimTable; end |
19 class AcmedTable; end |
20 class AcnamTable; end |
21 class AcOddbTable; end |
22 class AcpricealgTable; end |
23 class AcscTable; end |
24 class LimitationTable; end |
25 class LimTxtTable; end |
26 class MCMTable; end |
27 class CodesTable; end |
28 class EanTable; end |
29 class ScTable; end |
30 class CompTable; end |
31 class Readme; end |
32 class OddbDatExport < ODDB::Plugin |
33 EXPORT_SERVER = DRbObject.new(nil, EXPORT_URI) |
34 EXPORT_DIR = File.expand_path('../../data/downloads', |
35 File.dirname(__FILE__)) |
36 def initialize(app) |
37 @date = @@today |
38 super |
39 end |
40 def export |
41 files = [] |
42 |
43 # package tables |
44 package_tables = [ |
45 AcTable, AccompTable, AcLimTable, AcmedTable, AcnamTable, |
46 AcOddbTable, AcpricealgTable, AcscTable, LimitationTable, |
47 LimTxtTable, EanTable |
48 ] |
49 ids = [] |
50 dose_missing_list = [] |
51 @app.each_package { |pac| |
52 ids.push(pac.odba_id) |
53 if pac.parts.empty? |
54 dose_missing_list.push([pac.basename, pac.iksnr, pac.sequence.seqnr, pac.ikscd]) |
55 end |
56 } |
57 |
58 files += EXPORT_SERVER.export_oddbdat(ids, EXPORT_DIR, package_tables) |
59 |
60 # codes table |
61 ids = @app.atc_classes.values.collect { |atc| atc.odba_id } |
62 @app.each_galenic_form { |galform| ids.push(galform.odba_id) } |
63 files += EXPORT_SERVER.export_oddbdat(ids, EXPORT_DIR, [CodesTable]) |
64 |
65 # substances table |
66 ids = @app.substances.collect { |subs| subs.odba_id } |
67 files += EXPORT_SERVER.export_oddbdat(ids, EXPORT_DIR, [ScTable]) |
68 |
69 # companies table |
70 ids = @app.companies.collect { |oid, comp| comp.odba_id } |
71 files += EXPORT_SERVER.export_oddbdat(ids, EXPORT_DIR, [CompTable]) |
72 |
73 # readme |
74 files += EXPORT_SERVER.export_oddbdat(nil, EXPORT_DIR, [Readme]) |
75 |
76 # compress |
77 EXPORT_SERVER.compress_many(EXPORT_DIR, 'oddbdat', files) |
78 |
79 # warning |
80 return dose_missing_list |
81 end |
82 def export_fachinfos |
83 # fachinfo table |
84 ids = @app.fachinfos.collect { |oid, fachinfo| fachinfo.odba_id } |
85 files = EXPORT_SERVER.export_oddbdat(ids, EXPORT_DIR, [MCMTable]) |
86 EXPORT_SERVER.compress(EXPORT_DIR, files.first) |
87 end |
88 end |
89 end |
90 end |
Generated on Mon Feb 07 09:23:52 +0100 2011 with rcov 0.9.8