Project

cover_rage

0.0
The project is in a healthy, maintained state
cover_rage is a Ruby code coverage tool designed to be simple and easy to use. It can be used not only for test coverage but also in production services to identify unused code. Key features: 1. Runs in continuous processes (e.g., Rails servers) 2. Zero dependencies 3. Supports forking and daemonization without additional setup
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 5.3
~> 2.5
~> 13.0
~> 5.18
 Project Readme

cover_rage

test

cover_rage is a Ruby code coverage tool designed to be simple and easy to use. It can be used not only for test coverage but also in production services to identify unused code.

Key features:

  1. Runs in continuous processes (e.g., Rails servers)

  2. Zero dependencies

  3. Supports forking and daemonization without additional setup

Installation

gem install cover_rage

Setup

require 'cover_rage'

AND THAT’S IT!

No rack middleware, no fork callbacks, no configuration files, and no additional setup required.

It starts collecting coverage data and periodically writes to ./cover_rage.pstore.

To change the store type and location, refer to COVER_RAGE_STORE_URL below.

To export results to HTML later, run cover_rage.

Quick Start

cat >main.rb <<RUBY
s = 0
10.times do |x|
  s += x
end
fork
if s == 45
  p :ok
else
  p :ng
end
RUBY

gem install cover_rage
ruby -r cover_rage main.rb
cover_rage > cover_rage.html
demo

Integration with Ruby on Rails

No additional setup is required because Rails loads gems automatically, but you can customize the behavior by updating Gemfile.

To run cover_rage only in the test environment:

Gemfile
gem 'cover_rage', group: :test

To manually start cover_rage:

Gemfile
gem 'cover_rage', require: false
config/boot.rb
require 'cover_rage'

Exporting Results

cover_rage --format html

Run cover_rage -h for more information.

Environment Variables

  1. COVER_RAGE_STORE_URL

    Available URL schemes:

    1. pstore://ABSOLUTE_PATH_TO_PSTORE_FILE

    2. redis://REDIS_HOST

    3. sqlite://ABSOLUTE_PATH_TO_SQLITE_DB_FILE

    Ensure you have the necessary gems (e.g., sqlite3, redis) installed to use other store types.

    Defaults to pstore:$(pwd)/cover_rage.pstore.

  2. COVER_RAGE_INTERVAL

    It sets The interval in seconds between each write to the store.

    Defaults to 60.

  3. COVER_RAGE_PATH_PREFIX

    cover_rage will only record files that match the specified prefix.

    Defaults to Rails.root if the Rails constant is defined; otherwise, defaults to Dir.pwd.