Class: SodaReportSummery
- Inherits:
-
Object
- Object
- SodaReportSummery
- Defined in:
- lib/SodaReportSummery.rb
Instance Method Summary collapse
-
#initialize(dir = "", outfile = "", create_links = false) ⇒ SodaReportSummery
constructor
initialize – constructor This is the class constructor.
Constructor Details
#initialize(dir = "", outfile = "", create_links = false) ⇒ SodaReportSummery
initialize – constructor
This is the class constructor. Really this does all the needed work.
Params:
dir: This is the dorectory with raw soda logs in it.
outfile: This is the new summery html file to create.
create_links: This will create links to the soda report files in the
summery.
Results:
Creates a new class and html summery file. Will raise and exception on
any errors.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/SodaReportSummery.rb', line 51 def initialize(dir ="", outfile = "", create_links = false) log_files = nil report_data = nil result = 0 html_tmp_file = "" timout = true if (dir.empty?) raise "Empty 'dir' param!\n" elsif (outfile.empty?) raise "Empty 'outfile param!" end html_tmp_file = File.dirname(outfile) html_tmp_file += "/summery.tmp" for i in 0..120 if (!File.exist?(html_tmp_file)) timeout = false break end timeout = true sleep(1) end # if (timeout != false) # raise "Timed out waiting for lock to be released on file:"+ # " \"#{html_tmp_file}\"!\n" # end log_files = GetLogFiles(dir) if ( (log_files == nil) || (log_files.length < 1) ) raise "Failed calling: GetLogFiles(#{dir})!" end report_data = GenerateReportData(log_files) if (report_data.length < 1) raise "No report data found when calling: GenerateReportData()!" end result = GenHtmlReport(report_data, html_tmp_file, create_links) if (result != 0) raise "Failed calling: GenHtmlReport()!" end File.rename(html_tmp_file, outfile) end |