Cannot install metric_fu, how to switch to simplecov?

2.4k Views Asked by At

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

3

There are 3 best solutions below

0
On

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

0
On

Try rcov 0.9.11 as described here.

add to Gemfile (test section)

gem "rcov", "0.9.11"

rerun bundle install

run tests with bundle exec of course.

0
On

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.