Module: Inspec::Reporters
- Defined in:
- lib/inspec/reporters.rb,
lib/inspec/reporters/cli.rb,
lib/inspec/reporters/base.rb,
lib/inspec/reporters/json.rb,
lib/inspec/reporters/junit.rb,
lib/inspec/reporters/json_min.rb
Defined Under Namespace
Classes: Base, CLI, Json, JsonMin, Junit
Class Method Summary collapse
Class Method Details
.render(reporter, run_data) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/inspec/reporters.rb', line 8 def self.render(reporter, run_data) name, config = reporter config[:run_data] = run_data case name when 'cli' reporter = Inspec::Reporters::CLI.new(config) when 'json' reporter = Inspec::Reporters::Json.new(config) when 'json-min' reporter = Inspec::Reporters::JsonMin.new(config) when 'junit' reporter = Inspec::Reporters::Junit.new(config) else raise NotImplementedError, "'#{name}' is not a valid reporter type." end reporter.render output = reporter.rendered_output if config['file'] File.write(config['file'], output) elsif config['stdout'] == true puts output end end |