Rake (Ruby) 在构建结束时捕获错误
我目前正在使用 Ruby 和 Rake 来构建 .Net 项目。
我调用一些命令行工具(例如 NCover)来检查覆盖率是否足够高。当 NCover 返回并退出(失败)代码时,Rake 退出立即停止。
有没有一个钩子,比如 on_exit,我可以使用。我基本上想用漂亮的红色字体输出“Build FAILED”,如果可能的话,输出失败的步骤,甚至更好地说明原因的消息。这样对于开发人员来说就更清楚了。
NAnt 中也有类似的东西,而且非常方便。想知道 Rake/Ruby 是否有类似的东西。
有人有过此类事情的经验吗?
干杯。
I'm using Ruby and Rake to do our builds at the moment for .Net projects.
I call a few commandline tools, such as NCover to check the coverage is high enough. When NCover returns and exit (fail) code though, Rake exits immediately stops.
Is there a hook, like on_exit, that I can use. I basically want to output "Build FAILED" in nice red writing, and if possible the step it failed on, and even better a message as to why. Just so it's a little clearer to the devs.
There is something similar in NAnt, and it's quite handy. Wondering if Rake/Ruby had anything similar.
Anyone had any experience with this sort of thing?
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Ruby 有
at_exit
。你可以这样使用它:Ruby has
at_exit
. You can use it like this:也许您可以检查该工具返回的错误,如下所示:
Maybe you can check for the error returned by the tool like this: