从“rake cucumber”中删除有关ansicon的警告 [英] Remove warning about ansicon from "rake cucumber"

查看:449
本文介绍了从“rake cucumber”中删除有关ansicon的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您在没有安装ANSICON的机器上运行任何带有黄瓜的rake任务时,您会收到以下消息:

  ***警告:您必须使用ANSICON 1.31或更高版本(http://adoxa.110mb.com/ansicon)在Windows上获取彩色输出

在本地运行时,我喜欢使用ANSICON,但是当在构建服务器中使用时,我不在乎 - 我不想看到那里的警告。有没有办法摆脱它?

解决方案

你可以删除警告本身。我不喜欢安装一堆垃圾,只是为了一个绿色的词。因此,要移除警告:



1。在gems目录(位于Ruby安装目录)中找到Cucumber安装。对我来说,是:lib \ruby\gems\1.9.1\gems\cucumber-1.2.0



2。在黄瓜安装的cucumber-1.2.0 \lib \cucumber\formatter目录中找到 ansicolor.rb



3。找到以下行:


STDERR.puts%{***警告:您必须使用ANSICON 1.31或更高版本(http://adoxa.110mb.com/ansicon)在Windows上获取彩色输出}


STDERR.puts%{***警告:您必须使用ANSICON 1.31或更高版本(http://adoxa.110mb.com/ansicon)在Windows上获得彩色输出}


行号



4。保存文件并完成操作


When you run any rake task with cucumber installed on a machine that doesn't have ANSICON installed, you get the following message:

*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows

When running locally I like using ANSICON, but when used within the build server I don't care about that - and I don't want to see that warning there. Is there a way to get rid of it?

解决方案

You can actually remove the warning itself. I do not like installing a bunch of garbage just for the sake of having a green word. So, to remove the warning:

1. Locate the Cucumber installation in gems directory (it's in the Ruby installation directory). For me it was: lib\ruby\gems\1.9.1\gems\cucumber-1.2.0

2. In the cucumber-1.2.0\lib\cucumber\formatter directory of the Cucumber installation find the file ansicolor.rb

3. Locate the line:

STDERR.puts %{*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows}

and add # in front of it to comment it out:

# STDERR.puts %{*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows}

The line number was 14 for my version of Cucumber.

4. Save the file and you're done

这篇关于从“rake cucumber”中删除有关ansicon的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆