Generate Status Badge Images

Shield-System lets you generate github style status images for use anywhere e.g. custom badges with tests results.

Background

I really like the travis,code climate and other services badges you can put on your github README and I wanted to make some I could use on my internal projects and also be able to change the colours and text easily to make badges with different information for different sets of tests and statuses.

Install

 gem install shield-system

Requires RMagick so imagemagick needs to be installed. on a mac with brew:

 brew install git (if you don't have git)
 brew install ghostscript
 brew install imagemagick

Usage

Create build status preset shields

()

()

()

()

()

()

 require 'shield_system'
 require 'presets/github_build_status.rb'

 output_path = File.dirname(__FILE__)
 build_status = GithubBuildStatus.new(output_path)
 build_status.shield(BuildStatus.passing)

Create custom shields

()

()

()

using a custom shield

 require 'shield_system'

 output_path = File.dirname(__FILE__)
 shield = ShieldSystem.new(output_path)
 shield.github_shield('acceptance','Acceptance Tests',BuildStatus.passing.name,'#25B9E6',BuildStatus.passing.colour,'#0C0861','white')
 shield.github_shield('functional','Functional Tests','108 Passing','#DCB9ED',BuildStatus.passing.colour,'#0C0861','white')
 shield.github_shield('end-to-end','Number of End to End Tests:','500','#F08C4A','#F08C4A','#0C0861','#0C0861')

changing height and font

()

()

 shield.github_shield('height','Dependencies','up-to-date',BuildStatus.key.colour,BuildStatus.passing.colour,BuildStatus.value.colour,'white',TRANSPARENT_BACKGROUND,FONT_EAGLE,30,15,'arial')
 shield.github_shield('font','GPA','4.0','#25B9E6',BuildStatus.passing.colour,'#0C0861','white',TRANSPARENT_BACKGROUND,FONT_EAGLE,20,13,'times')

Creating Sparklines

() ()

() ()

sparklines bar and pie

 # labels
 shield.label('build-history-label-bar', 'Build History', '#A8A7A5', 'white', TRANSPARENT_BACKGROUND, FONT_EAGLE, 28, 13)
 shield.label('build-history-label-pie', 'Passing Tests', '#A8A7A5', 'white', TRANSPARENT_BACKGROUND, FONT_EAGLE, 28, 13)
 # sparklines
 shield.sparkline_shield('build-history-bar', :bar, [100, 100, 90, 80, 90, 90, 100, 120, 120, 90, 80, 70, 100, 120])
 shield.sparkline_shield('build-history-pie', :pie, [70])

Additional Info

github_shield takes several configuration parameters:

github_shield(shield_name, key_text, status_text, key_colour, status_colour, key_text_colour, status_text_colour, background_colour=TRANSPARENT_BACKGROUND, custom_font=FONT_EAGLE, height=18, font_size=11, font_family=‘arial’, buffer=5)

most are self explanatory but here’s some clarification on the last ones:

Develop

Interested in contributing? Great just let me know how you want to help.