Class: InspecPlugins::Html2Reporter::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run_data_schema_constraintsObject



20
21
22
# File 'lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb', line 20

def self.run_data_schema_constraints
  "~> 0.0"
end

Instance Method Details

#renderObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# 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