From ee2ff6a4d351442da0cf35c5c5f9e4d8f0e25e77 Mon Sep 17 00:00:00 2001 From: Yi Wen Date: Tue, 30 Oct 2012 12:03:23 -0500 Subject: [PATCH] A temp checkin for debugging --- bin/spinach | 1 - lib/spinach/cli.rb | 6 +++++- lib/spinach/config.rb | 2 +- lib/spinach/runner.rb | 8 ++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/spinach b/bin/spinach index a08cde8b..64d06115 100755 --- a/bin/spinach +++ b/bin/spinach @@ -12,5 +12,4 @@ rescue LoadError end cli = Spinach::Cli.new(ARGV) -cli.init_reporter exit cli.run diff --git a/lib/spinach/cli.rb b/lib/spinach/cli.rb index 135d5352..eadac569 100644 --- a/lib/spinach/cli.rb +++ b/lib/spinach/cli.rb @@ -11,6 +11,7 @@ class Cli # @api public def initialize(args = ARGV) @args = args + options # make sure options is parsed end # Runs all the features. @@ -52,6 +53,7 @@ def options # # @api private def parse_options + p "enter parse_options" reporter_options = {} reporter_options[:backtrace] = false config = {} @@ -59,6 +61,7 @@ def parse_options begin OptionParser.new do |opts| + p opts opts.on('-c', '--config_path PATH', 'Parse options from file (will get overriden by flags)') do |file| Spinach.config[:config_path] = file @@ -97,7 +100,8 @@ def parse_options opts.on('-r', '--reporter CLASS_NAME', 'Formatter class name') do |class_name| - config[:reporter_class] = Helpers.constantize(class_name) + p class_name + config[:reporter_class] = class_name end end.parse!(@args) diff --git a/lib/spinach/config.rb b/lib/spinach/config.rb index 45250dfa..c6cd9f17 100644 --- a/lib/spinach/config.rb +++ b/lib/spinach/config.rb @@ -52,7 +52,7 @@ def features_path # # @api public def reporter_class - @reporter_class || Spinach::Reporter::Stdout + @reporter_class || "Spinach::Reporter::Stdout" end # The "step definitions path" holds the place where your feature step diff --git a/lib/spinach/runner.rb b/lib/spinach/runner.rb index 9c18306e..0deedd79 100644 --- a/lib/spinach/runner.rb +++ b/lib/spinach/runner.rb @@ -46,6 +46,12 @@ def initialize(filenames, options = {}) # The default path where the support files are located attr_reader :support_path + def init_reporter + p Helpers.constantize(Spinach.config[:reporter_class]) + reporter = Helpers.constantize(Spinach.config[:reporter_class]).new({}) + reporter.bind + end + # Runs this runner and outputs the results in a colorful manner. # # @return [true, false] @@ -55,11 +61,13 @@ def initialize(filenames, options = {}) def run require_dependencies require_frameworks + init_reporter Spinach.hooks.run_before_run successful = true + p filenames filenames.map do |filename| filename.split(':') end.each do |filename, line|