summaryrefslogtreecommitdiff
path: root/lib/chef/audit/runner.rb
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-11-06 07:33:35 -0800
committertyler-ball <tyleraball@gmail.com>2014-12-17 18:47:26 -0800
commit2bb912157470f55975f2e50e3792132478639a78 (patch)
tree717d21be119adb2e072146d6f7c2183a11d013d9 /lib/chef/audit/runner.rb
parentb9b4d3bfd6ec6196cb78094e589c094edb61b501 (diff)
downloadchef-2bb912157470f55975f2e50e3792132478639a78.tar.gz
Preparing for demo - using rspec documentation formatter for output instead of the proxy
Diffstat (limited to 'lib/chef/audit/runner.rb')
-rw-r--r--lib/chef/audit/runner.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/chef/audit/runner.rb b/lib/chef/audit/runner.rb
index 1408c67327..4a76b7e65b 100644
--- a/lib/chef/audit/runner.rb
+++ b/lib/chef/audit/runner.rb
@@ -18,6 +18,7 @@
require 'chef/audit'
require 'chef/audit/audit_event_proxy'
+require 'chef/audit/chef_json_formatter'
require 'chef/config'
class Chef
@@ -25,6 +26,7 @@ class Chef
class Runner
attr_reader :run_context
+ private :run_context
def initialize(run_context)
@run_context = run_context
@@ -48,11 +50,11 @@ class Chef
# RSpec configuration and world objects are heavy, so let's wait until
# we actually need them.
def configuration
- @configuration ||= RSpec::Core::Configuration.new
+ RSpec.configuration
end
def world
- @world ||= RSpec::Core::World.new(configuration)
+ RSpec.world
end
# Configure audits before run.
@@ -62,8 +64,14 @@ class Chef
def setup
# We're setting the output stream, but that will only be used for error situations
# Our formatter forwards events to the Chef event message bus
+ # TODO so some testing to see if these output to a log file - we probably need
+ # to register these before any formatters are added.
configuration.output_stream = Chef::Config[:log_location]
configuration.error_stream = Chef::Config[:log_location]
+ # TODO im pretty sure I only need this because im running locally in rvmsudo
+ configuration.backtrace_exclusion_patterns.push(Regexp.new("/Users".gsub("/", File::SEPARATOR)))
+ configuration.backtrace_exclusion_patterns.push(Regexp.new("(eval)"))
+ configuration.color = Chef::Config[:color]
add_formatters
disable_should_syntax
@@ -71,8 +79,10 @@ class Chef
end
def add_formatters
- configuration.add_formatter(Chef::Audit::AuditEventProxy)
- Chef::Audit::AuditEventProxy.events = run_context.events
+ configuration.add_formatter(RSpec::Core::Formatters::DocumentationFormatter)
+ configuration.add_formatter(Chef::Audit::ChefJsonFormatter)
+ #configuration.add_formatter(Chef::Audit::AuditEventProxy)
+ #Chef::Audit::AuditEventProxy.events = run_context.events
end
# Explicitly disable :should syntax.