lib/puppet-check/output_results.rb in puppet-check-2.0.1 vs lib/puppet-check/output_results.rb in puppet-check-2.1.0

- old
+ new

@@ -1,6 +1,6 @@ -require_relative '../puppet-check' +require_relative '../puppet_check' # class to handle outputting diagnostic results in desired format class OutputResults # output the results as text def self.text @@ -20,26 +20,26 @@ print "\n\033[36mThe following files have unrecognized formats and therefore were not processed:\033[0m\n-- " puts PuppetCheck.settings[:ignored_files].join("\n-- ") end # output the results as yaml or json - def self.markup(settings) + def self.markup(format) # generate output hash hash = {} hash['errors'] = PuppetCheck.settings[:error_files] unless PuppetCheck.settings[:error_files].empty? hash['warnings'] = PuppetCheck.settings[:warning_files] unless PuppetCheck.settings[:warning_files].empty? hash['clean'] = PuppetCheck.settings[:clean_files] unless PuppetCheck.settings[:clean_files].empty? hash['ignored'] = PuppetCheck.settings[:ignored_files] unless PuppetCheck.settings[:ignored_files].empty? # convert hash to markup language - case settings[:output_format] + case format when 'yaml' require 'yaml' puts Psych.dump(hash, indentation: 2) when 'json' require 'json' puts JSON.pretty_generate(hash) else - raise "puppet-check: Unsupported output format '#{settings[:output_format]}' was specified." + raise "puppet-check: Unsupported output format '#{format}' was specified." end end end