1 # Copyright (C) 2010 Red Hat, Inc. All rights reserved.
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.
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
11 # Policy for the location of report templates
12 require 'string-store'
14 class TemplateStringStore < StringStore
16 super(['report-generators/templates'])
20 module ReportTemplates
21 def generate_report(report, bs, dest_path = nil)
23 reports = ReportRegister.new
24 template_store = TemplateStringStore.new
25 report = reports.get_report(report)
26 erb = ERB.new(template_store.lookup(report.template))
28 title = report.short_desc
30 erb = ERB.new(template_store.lookup("boiler_plate.rhtml"))
31 txt = erb.result(binding)
33 dest_path = dest_path.nil? ? report.path : dest_path
34 dest_path.open("w") do |out|