无法安装metric_fu,如何切换到simplecov?

Jun*_*Ito 10 ruby gem metric-fu

我试图在我的Ruby 1.9环境中安装metric_fu,但由于下面的问题它失败了:

$ gem install metric_fu

...

Fetching: rcov-1.0.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing metric_fu:
        ERROR: Failed to build gem native extension.

        /Users/xxx/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
**** Ruby 1.9 is not supported. Please switch to simplecov ****
Run Code Online (Sandbox Code Playgroud)

它说"切换到simplecov",但该怎么做?

更新:安装rcov 0.9.11后恢复.我在这里发现了同样的问题:

https://github.com/iain/metrical/issues/12

Ric*_*dan 2

您可以通过添加来使用 SimpleCov

gem 'simplecov', :require => false 
Run Code Online (Sandbox Code Playgroud)

到测试组中的 gem 文件,然后添加到你的 spec_helper.rb 中:

require 'simplecov'
SimpleCov.start
Run Code Online (Sandbox Code Playgroud)

然后只需打开coverage/index.html,您就可以在浏览器中看到SimpleCov。真是太棒了。