From e7dd149ee60120400f3ffd40d6479db31bb63a2b Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood Date: Wed, 18 Nov 2009 15:33:36 +0100 Subject: [PATCH] build the command we execute from an array, provide option to output in pretty format --- lib/generators/project/bin/cucumber-nagios | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/generators/project/bin/cucumber-nagios b/lib/generators/project/bin/cucumber-nagios index 9d0a3ac..6a6f9f1 100755 --- a/lib/generators/project/bin/cucumber-nagios +++ b/lib/generators/project/bin/cucumber-nagios @@ -17,13 +17,21 @@ unless File.exist?(feature) exit 98 end -command = "#{__DIR__}/cucumber" -command += " --require features/" -command += " --format Cucumber::Formatter::Nagios" -command += " #{feature}" +command_parts = [] +command_parts << "#{__DIR__}/cucumber" +command_parts << "--require features/" + +if ARGV.grep(/^\-\-pretty$/).size > 0 + command_parts << "--format pretty" +else + command_parts << "--format Cucumber::Formatter::Nagios" +end + +command_parts << feature +command = command_parts.join(' ') -if ARGV[1] == "--debug" - puts command +if ARGV.grep(/^\-\-debug$/).size > 0 + puts command puts end