From a1ff3b1c28acea95e63b9ef7687858c219b53541 Mon Sep 17 00:00:00 2001 From: Dmitri Date: Mon, 27 Jul 2015 17:39:31 +0200 Subject: [PATCH] Dropped `fail` call to report a format violation to avoid a RuntimeError message - do a console red print instead. --- Gemfile | 1 + lib/gherkin_format.rb | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 195fe4e..e363678 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,4 @@ gem 'rubocop' gem 'gherkin' gem 'rake' gem 'aruba' +gem 'term/ansicolor' diff --git a/lib/gherkin_format.rb b/lib/gherkin_format.rb index ef4e6c8..bf0ccf1 100644 --- a/lib/gherkin_format.rb +++ b/lib/gherkin_format.rb @@ -1,9 +1,11 @@ require 'gherkin/formatter/json_formatter' require 'gherkin/formatter/pretty_formatter' require 'gherkin/parser/parser' +require 'term/ansicolor' require 'stringio' require 'multi_json' require 'erb' +include Term::ANSIColor # format gherkin files class GherkinFormat @@ -25,8 +27,7 @@ def format(file, options = {}) File.write("#{file}", output) end - puts "File #{file} is not formatted well." - fail "File #{file} is not formatted well." + puts red "File #{file} is not formatted well." end def render(template, files)