Git Product home page Git Product logo

simplecov-small-badge's Introduction

SimpleCovSmallBadge

Gem Version Build Status Depfu Coverage RubyCritic

SimpleCovBadge is a gem that can be added to the Gemfile and will produce a file called coverage_badge.png in the coverage directory. It could be looking as follows dependent on how it is configured.

Badge

The idea is to created a badge for SimpleCov to create a persistable image that shows the coverage in percent as a badge.

Installation

The badge creation is dependent on the Repo-small-badge gem which creates and SVG badge. It can be installed in your Ruby library or rails app as part of the Gemfile as follows.

# In your gemfile
gem 'simplecov-small-badge', :require => false

This gem is an alternative and inspired by the great work in the other gem simplecov-badge which does a similar badge but looks different and cannot easily made small. So it's mostly an optical alternative.

Usage

Whereever you are integrating SimpleCov you can configure the SimpleCovSmallBadge gem as any formater can be configured. The default integration could looks as follows:

require 'simplecov_small_badge'

# Wherever your SimpleCov.start block is (spec_helper.rb, test_helper.rb, or .simplecov)
SimpleCov.start do
  # add your normal SimpleCov configs
  add_filter "/app/model"
  # call SimpleCov::Formatter::BadgeFormatter after the normal HTMLFormatter
  SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
    SimpleCov::Formatter::HTMLFormatter,
    SimpleCovSmallBadge::Formatter
  ])
end

# configure any options you want for SimpleCov::Formatter::BadgeFormatter
SimpleCovSmallBadge.configure do |config|
  # does not created rounded borders
  config.rounded_border = true
  # set the background for the title to darkgrey
  config.background = '#ffffcc'
end

Integration into Travis-CI via github-pages

This process is split into two steps.

  1. You need to create an access token for you github repository that can be configured to travis to allow password-less pushing. This is described in Github Help - Authenticating to GitHub / Creating a personal access token for the command line

  2. Configure travis to push the result to github-pages inspired from the Travis description and configuration to be found in .travis.yml

  3. Integrate your badge into the README.md as follows ![Coverage](https://marcgrimme.github.io/simplecov-small-badge/badges/coverage_badge_total.png)

Configuration Options

The behaviour of SimpleCovSmallBadge can be influenced by configuration options as defined in the configuration class.

Development

After checking out the repo, run bundle update to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it ( https://github.com/marcgrimme/simplecov-small-badge/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

simplecov-small-badge's People

Contributors

marcgrimme avatar depfu[bot] avatar dennyabraham avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.