tizen 2.3.1 release
[external/device-mapper.git] / report-generators / title_page.rb
1 # Copyright (C) 2010 Red Hat, Inc. All rights reserved.
2 #
3 # This copyrighted material is made available to anyone wishing to use,
4 # modify, copy, or redistribute it subject to the terms and conditions
5 # of the GNU General Public License v.2.
6 #
7 # You should have received a copy of the GNU General Public License
8 # along with this program; if not, write to the Free Software Foundation,
9 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
10
11 # This generates the index for the reports, including generation
12 # times.
13
14 require 'log'
15 require 'string-store'
16 require 'reports'
17 require 'erb'
18 require 'report_templates'
19
20 include Reports
21
22 reports = ReportRegister.new
23
24 def safe_mtime(r)
25   r.path.file? ? r.path.mtime.to_s : "not generated"
26 end
27
28 template_store = TemplateStringStore.new
29
30 # FIXME: use generate_report() method
31 erb = ERB.new(template_store.lookup("index.rhtml"))
32 body = erb.result(binding)
33 title = "Generation times"
34
35 erb = ERB.new(template_store.lookup("boiler_plate.rhtml"))
36 txt = erb.result(binding)
37
38 Pathname.new("reports/index.html").open("w") do |f|
39   f.puts txt
40 end
41
42