class InspecPlugins::Html2Reporter::Reporter

Public Class Methods

run_data_schema_constraints() click to toggle source
# File lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb, line 20
def self.run_data_schema_constraints
  "~> 0.0"
end

Public Instance Methods

render() click to toggle source
# File lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb, line 6
def render
  template_path = File.expand_path(__FILE__ + "../../../../templates")

  # Read config data from the user's config file. Supports two settings, both of which are absolute filesystem paths:
  #  alternate_css_file - contents will be used instead of default CSS
  #  alternate_js_file - contents will be used instead of default JavaScript
  cfg = Inspec::Config.cached.fetch_plugin_config("inspec-reporter-html2")
  js_path = cfg[:alternate_js_file] || (template_path + "/default.js")
  css_path = cfg[:alternate_css_file] || (template_path + "/default.css")

  template = ERB.new(File.read(template_path + "/body.html.erb"))
  output(template.result(binding))
end