Sha256: 45eec68c5b520480d6cd442b5474bcd47e49a86114ffc8ec69371260b89098d4

Contents?: true

Size: 937 Bytes

Versions: 48

Compression:

Stored size: 937 Bytes

Contents

require "erb" unless defined?(Erb)
require "inspec/config"

module InspecPlugins::Html2Reporter
  class Reporter < Inspec.plugin(2, :reporter)
    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

    def self.run_data_schema_constraints
      "~> 0.0"
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
inspec-core-6.8.11 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.22.58 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.22.55 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-6.8.1 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.22.40 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-6.6.0 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.22.36 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.22.29 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-4.56.58 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.22.3 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.21.29 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.18.14 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.17.4 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.14.0 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-4.56.20 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.12.2 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.10.5 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-4.56.19 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-5.7.9 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
inspec-core-4.56.17 lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb