From 9e1b7270d2f095060f16259e558dcb1d84e77595 Mon Sep 17 00:00:00 2001 From: Benjamin Fleischer Date: Thu, 7 Feb 2013 16:17:43 -0600 Subject: [PATCH] BF add metric_fu coverage usage notes --- README.md | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dac963bde..4da9ca0f5 100644 --- a/README.md +++ b/README.md @@ -19,16 +19,50 @@ See `metric_fu --help` for more options It is currently testing on MRI 1.8.7, 1.9.2, and 1.9.3 * The `japgolly-Saikuro` fork and `metric_fu-roodi` fork are a part of an attempt to get metric_fu working in a modern Ruby environment, specifically compatibility with Ruby 1.9 and Bundler. -* rcov may fail in ruby 1.9 * rails_best_practices is disabled in ruby 1.8 +* metric_fu no longer runs rcov itself. You may still use rcov metrics as documented below + +### Configuration + +see the .metrics file ## Documentation -TBD +### Using Coverage Metrics -### Configuration +in your .metrics file add the below to run pre-generated metrics -see the .metrics file + coverage_file = File.expand_path("coverage/rcov/rcov.txt", Dir.pwd) + config.add_metric(:rcov) + config.add_graph(:rcov) + config.configure_metric(:rcov, {:external => coverage_file}) + +if you want metric_fu to actually run rcov itself (1.8 only), just add + + def MetricFu.run_rcov?; true; end + +#### Rcov metrics with Ruby 1.8 + +To generate the same metrics metric_fu has been generating run from the root of your project before running metric_fu + + RAILS_ENV=test rcov $(ruby -e "puts Dir['{spec,test}/**/*_{spec,test}.rb'].join(' ')") --sort coverage --no-html --text-coverage --no-color --profile --exclude-only '.*' --include-file "\Aapp,\Alib" -Ispec >> coverage/rcov/rcov.txt + +### Simplecov metrics with Ruby 1.9 + +Add to your Gemfile or otherwise install + + gem 'simplecov' + # https://github.com/kina/simplecov-rcov-text + gem 'simplecov-rcov-text' + +Modify your spec_helper as per the SimpleCov docs and run your tests before running metric_fu + + #in your spec_helper + require 'simplecov' + require 'simplecov-rcov-text' + SimpleCov.formatter = SimpleCov::Formatter::RcovTextFormatter + SimpleCov.start + # SimpleCov.start 'rails' ### Historical