Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install metric_fu, how to switch to simplecov?

I tried to install metric_fu against my Ruby 1.9 environment, but it failed due to the problem below:

$ 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 ****

It says "switch to simplecov", but how to do that?

UPDATE: Resoved after installing rcov 0.9.11. I found the same issue here:

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

like image 735
Junichi Ito Avatar asked Feb 02 '12 20:02

Junichi Ito


2 Answers

You can use SimpleCov by adding

gem 'simplecov', :require => false 

to your gem file in the test group, and then add into your spec_helper.rb:

require 'simplecov'
SimpleCov.start

then just open coverage/index.html and you get SimpleCov in the browser. It's really excellent.

like image 200
Richard Jordan Avatar answered Nov 05 '22 04:11

Richard Jordan


I'm the new maintainer of metric_fu and it should work now on ruby 1.9 without any problems. See configuration instructions at https://github.com/metricfu/metric_fu which include how you can have metric_fu load external coverage output (e.g. using simplecov)

Rcov on ruby 1.9 segfaults and fails a lot, so running it is disabled by default and the gem is no longer included as a dependency. However, you may still config it to run or load coverage stats you've already generated

Also, it works from the command-line now. Now need to bundle it or run rake or metrical

like image 29
BF4 Avatar answered Nov 05 '22 05:11

BF4