0.0
The project is in a healthy, maintained state
Shields::Badge.gem_total_downloads(path_parameters: {gem: 'rails'}) => "[![RubyGems Total Downloads](https://img.shields.io/gem/dt/rails?)](https://rubygems.org/gems/rails)"
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.0, >= 1.0.6
~> 2.5, >= 2.5.1
~> 13.0
~> 6.11
~> 6.4
~> 3.13
~> 1.0, >= 1.0.6
~> 1.75
~> 22.1, >= 22.1.3
~> 0.6, >= 0.6.0
~> 1.47
~> 0.9, >= 0.9.37
~> 0.0, >= 0.0.10

Runtime

~> 0.3.0
>= 1.1.8, < 3
 Project Readme

Galtzo.com Logo by Aboling0, CC BY-SA 4.0 Galtzo.com Logo by Aboling0, CC BY-SA 4.0 Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5

๐Ÿ“› Shields::Badge

Version License: MIT Downloads Rank Open Source Helpers Depfu Coveralls Test Coverage QLTY Test Coverage QLTY Maintainability CI Heads CI Runtime Dependencies @ HEAD CI Current CI JRuby CI Supported CI Legacy CI Test Coverage CI Style CodeQL


Liberapay Goal Progress Sponsor Me on Github Buy me a coffee Donate on Polar Donate to my FLOSS or refugee efforts at ko-fi.com Donate to my FLOSS or refugee efforts using Patreon

RubyGem version of the interactive tool found at shields.io/badges.

If you use this project, or badges from Shields.io, please help increase Shields.io's rate limit by authorizing the Shields.io GitHub application. Read more about how it works.

Federated DVCS Repository Status Issues PRs Wiki CI Discussions
๐Ÿงช galtzo-floss/shields-badge on GitLab The Truth ๐Ÿ’š ๐Ÿ’š ๐Ÿ’š ๐Ÿ€ Tiny Matrix โž–
๐ŸงŠ galtzo-floss/shields-badge on CodeBerg An Ethical Mirror (Donate) โž– ๐Ÿ’š โž– โญ•๏ธ No Matrix โž–
๐Ÿ™ galtzo-floss/shields-badge on GitHub A Dirty Mirror ๐Ÿ’š ๐Ÿ’š โž– ๐Ÿ’ฏ Full Matrix โž–
๐ŸŽฎ๏ธ Discord Server Live Chat on Discord Let's talk about this library!

Upgrading Runtime Gem Dependencies

Great care has been taken to ensure this gem is working with all the leading versions per each minor version of Ruby of all the runtime dependencies it can install with.

What does that mean specifically for the runtime dependencies?

We are approaching 100% test coverage of lines and branches, and this test suite runs across a large matrix covering the latest patch for each of the following minor versions:

  • MRI Ruby @ v3.1, v3.2, v3.3, v3.4, HEAD
  • JRuby @ v9.4, v10.0, HEAD
  • TruffleRuby @ v24.1, HEAD
  • gem castkit @ v0, HEAD โฉ๏ธ bnlucas/castkit
  • gem version_gem @ v1, HEAD โฉ๏ธ oauth-xx/version_gem

You should upgrade this gem with confidence*.

  • This gem follows a strict & correct (according to the maintainer of SemVer; more info) interpretation of SemVer.
    • Dropping support for any of the runtime dependency versions above will be a major version bump.
    • If you aren't on one of the minor versions above, make getting there a priority.
  • You should upgrade the dependencies of this gem with confidence*.
  • Please do upgrade, and then, when it goes smooth as butter please sponsor me. Thanks!

* MIT license; I am unable to make guarantees.

๐Ÿšš Test matrix brought to you by ๐Ÿ”Ž appraisal++
Adds back support for old Rubies โœจ appraisal PR #250
Adds support for eval_gemfile โœจ appraisal PR #248
Please review my PRs!
Standard Library Dependencies

The various versions are tested within whatever Ruby includes them, via the Ruby test matrix.

  • uri

If you use a discrete gem version it should also work fine!

Quick Usage Example for AI and Copy / Pasting

Do you ever lay awake at night thinking?

  • How is the CI looking for kettle-soup-cover? kettle-rb/kettle-soup-cover check runs (branch: main)
  • What is the current coverage on oauth2 gem? oauth-xx/oauth2 test coverage
  • How many commits have there been since last release of gem_bench? pboling/gem_bench commits since latest release
  • What is the download rank (all time) for anonymous_active_record? RubyGems Download Rank
  • What is the download rank (today) for sanitize_email? RubyGems Download Rank
  • What are the total downloads of rubocop-lts? RubyGems Total Downloads
  • How many stars does flag_shih_tzu have? GitHub Stars

Or maybe you want to build a dashboard of badges for all your projects...

For the badges that have been implemented, all options on Shields.io are available.

# Optional: Eager load all badges (otherwise they will load the first time called through method_missing)
Shields::Badge.register_all

# All Path Parameters are supported
Shields::Badge.github_branch_check_runs(user: "kettle-rb", repo: "kettle-soup-cover", branch: "main")
# => "[![kettle-rb/kettle-soup-cover check runs (branch: main)](https://img.shields.io/github/check-runs/kettle-rb/kettle-soup-cover/main?)](https://github.com/kettle-rb/kettle-soup-cover/actions)"
Shields::Badge.coveralls(user: "oauth-xx", repo: "oauth2", vcs_type: "github")
# => "[![oauth-xx/oauth2 test coverage](https://img.shields.io/coverallsCoverage/github/oauth-xx/oauth2?)](https://github.com/oauth-xx/oauth2/actions)"
Shields::Badge.github_commits_since_latest_release(user: "pboling", repo: "gem_bench")
# => "[![pboling/gem_bench commits since latest release](https://img.shields.io/github/commits-since/pboling/gem_bench/latest?)](https://github.com/pboling/gem_bench/releases)"
Shields::Badge.gem_download_rank(period: "rt", gem: "anonymous_active_record")
# => "[![RubyGems Download Rank](https://img.shields.io/gem/rt/anonymous_active_record?)](https://rubygems.org/gems/anonymous_active_record)"
Shields::Badge.gem_download_rank(gem: "sanitize_email", period: "rd")
# => "[![RubyGems Download Rank](https://img.shields.io/gem/rd/sanitize_email?)](https://rubygems.org/gems/sanitize_email)"
Shields::Badge.gem_total_downloads(gem: "rubocop-lts")
# => "[![RubyGems Total Downloads](https://img.shields.io/gem/dt/rubocop-lts?)](https://rubygems.org/gems/rubocop-lts)"
Shields::Badge.github_repo_stars(user: "pboling", repo: "flag_shih_tzu")
# => "[![GitHub Stars](https://img.shields.io/github/stars/pboling/flag_shih_tzu?)](https:///github.com/pboling/flag_shih_tzu/stargazers)"

# All Query Parameters are supported; check Usage section below.

๐Ÿ’ก Info you can shake a stick at

Tokens to Remember Gem name Gem namespace
Works with JRuby JRuby 9.4 Compat JRuby 10.0 Compat JRuby HEAD Compat
Works with Truffle Ruby Truffle Ruby 24.1 Compat Truffle Ruby HEAD Compat
Works with MRI Ruby 3 Ruby 3.1 Compat Ruby 3.2 Compat Ruby 3.3 Compat Ruby 3.4 Compat Ruby HEAD Compat
Source Source on GitLab.com Source on CodeBerg.org Source on Github.com The best SHA: dQw4w9WgXcQ!
Documentation Current release on RubyDoc.info YARD on Galtzo.com BDFL Blog Wiki
Compliance License: MIT ๐Ÿ“„ilo-declaration-img Security Policy Contributor Covenant 2.1 SemVer 2.0.0
Style Enforced Code Style Linter Keep-A-Changelog 1.0.0 Gitmoji Commits
Support Live Chat on Discord Get help from me on Upwork Get help from me on Codementor
Enterprise Support Get help from me on Tidelift
๐Ÿ’กSubscribe for support guarantees covering all FLOSS dependencies!
๐Ÿ’กTidelift is part of Sonar!
๐Ÿ’กTidelift pays maintainers to maintain the software you depend on!
๐Ÿ“Š@Pointy Haired Boss: An enterprise support subscription is "never gonna let you down", and supports open source maintainers!
Comrade BDFL ๐ŸŽ–๏ธ Follow Me on LinkedIn Follow Me on Ruby.Social Follow Me on Bluesky Contact BDFL My technical writing
... ๐Ÿ’– Find Me on WellFound: Find Me on CrunchBase My LinkTree More About Me ๐ŸงŠ ๐Ÿ™ ๐Ÿ›– ๐Ÿงช

๐Ÿš€ Release Documentation

Version 1.0.x

1.0.x CHANGELOGs and READMEs
Version Release Date CHANGELOG README
1.0.0 2025-05-29 v1.0.0 CHANGELOG v1.0.0 README

โœจ Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add shields-badge

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install shields-badge

๐Ÿ”’ Secure Installation

shields-badge is cryptographically signed, and has verifiable SHA-256 and SHA-512 checksums by stone_checksums. Be sure the gem you install hasnโ€™t been tampered with by following the instructions below.

Add my public key (if you havenโ€™t already, expires 2045-04-29) as a trusted certificate:

gem cert --add <(curl -Ls https://raw.github.com/galtzo-floss/shields-badge/main/certs/pboling.pem)

You only need to do that once. Then proceed to install with:

gem install shields-badge -P MediumSecurity

The MediumSecurity trust profile will verify signed gems, but allow the installation of unsigned dependencies.

This is necessary because not all of shields-badgeโ€™s dependencies are signed, so we cannot use HighSecurity.

If you want to up your security game full-time:

bundle config set --global trust-policy MediumSecurity

NOTE: Be prepared to track down certs for signed gems and add them the same way you added mine.

Shields::Badge for Enterprise

Available as part of the Tidelift Subscription.

The maintainers of this and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. Learn more.

Security contact information

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

For more see SECURITY.md.

Compatibility

Targeted ruby compatibility is non-EOL versions of Ruby, currently 3.2, 3.3, and 3.4. Compatibility is further distinguished as "Best Effort Support" or "Incidental Support" for older versions of Ruby. This gem will install on Ruby versions >= v3.1 for 1.x releases.

Ruby Engine Compatibility Policy

This gem is tested against MRI, JRuby, and Truffleruby. Each of those has varying versions that target a specific version of MRI Ruby. This gem should work in the just-listed Ruby engines according to the targeted MRI compatibility of each version, though there are exceptions for certain things.

Ruby Version Compatibility Policy

If something doesn't work on one of the supported versions, it's a bug.

Ruby Shields::Badge Version Maintenance Branch Targeted Support Best Effort Support Incidental Support
1๏ธโƒฃ 1.0.x main 3.2, 3.3, 3.4 3.1 N/A

NOTE: The 1.4 series will only receive critical security updates. See SECURITY.md.

๐Ÿ”ง Basic Usage

All parameters are in snake case when passing as Ruby arguments. Certain parameters are configured to serialize as camel case (lower first) when formatted. This is all automatic, and you don't need to worry about it. You can even supply the parameters in camel case (lower first) if you want.

Setup

Require the library (if this gem is in your Gemfile bundler will do this for you):

require "shields/badge"

Prefer method_missing or eager load?

The first time they are invoked, the badge generation methods on Shields::Badge will automatically require the badge tooling they need to generate a badge. If you want to avoid method_missing, you can eager load all the badges with Shields::Badge.register_all.

Path Parameters

These are generally required arguments and vary from badge to badge.

See the specs for examples. There is a spec for every badge, and at least one spec that utilizes every available path parameter.

Query Parameters

Most of these are optional arguments, but the odd one is required.

The query parameters that all badges share are:

path_parameters = {gem: "orange"}
query_parameters = {
  style: "flat",
  logo: "github",
  logo_color: "yellow",
  logo_size: "auto",
  label: "banana",
  label_color: "blue",
  color: "black",
  cache_seconds: "3600",
  link: "https://example.com/green/red",
}
# NOTE: You can specify path and query parameters separately, or as top-level arguments.
Shields::Badge.gem_total_downloads(path_parameters:, query_parameters:)
# => "[![RubyGems Total Downloads](https://img.shields.io/gem/dt/orange?style=flat&logo=github&logoColor=yellow&logoSize=auto&label=banana&labelColor=blue&color=black&cacheSeconds=3600&link=https%3A%2F%2Fexample.com%2Fgreen%2Fred)](https://rubygems.org/gems/orange)
Shields::Badge.gem_total_downloads(**path_parameters, **query_parameters)
# => "[![RubyGems Total Downloads](https://img.shields.io/gem/dt/orange?style=flat&logo=github&logoColor=yellow&logoSize=auto&label=banana&labelColor=blue&color=black&cacheSeconds=3600&link=https%3A%2F%2Fexample.com%2Fgreen%2Fred)](https://rubygems.org/gems/orange)

All the optional values supported by Shields.io are supported. Some badges have additional query parameters.

For the arguments that are designated as camel case (lower first) on Shields.io, it doesn't matter if you supply the arguments in camel case (lower first) or snake case, as they will both work.

The above snake case arguments result in the same badge as the below camel case arguments:

path_parameters = {gem: "orange"}
query_parameters = {
  style: "flat",
  logo: "github",
  logoColor: "yellow",
  logoSize: "auto",
  label: "banana",
  labelColor: "blue",
  color: "black",
  cacheSeconds: "3600",
  link: "https://example.com/green/red",
}
Shields::Badge.gem_total_downloads(path_parameters:, query_parameters:)
# => "[![RubyGems Total Downloads](https://img.shields.io/gem/dt/orange?style=flat&logo=github&logoColor=yellow&logoSize=auto&label=banana&labelColor=blue&color=black&cacheSeconds=3600&link=https%3A%2F%2Fexample.com%2Fgreen%2Fred)](https://rubygems.org/gems/orange)

# And again it doesn't matter if the arguments are top-level or nested inside path and query parameters:
Shields::Badge.gem_total_downloads(**path_parameters, **query_parameters)
# => "[![RubyGems Total Downloads](https://img.shields.io/gem/dt/orange?style=flat&logo=github&logoColor=yellow&logoSize=auto&label=banana&labelColor=blue&color=black&cacheSeconds=3600&link=https%3A%2F%2Fexample.com%2Fgreen%2Fred)](https://rubygems.org/gems/orange)

See the specs for more examples. There is a spec for every badge, and at least one spec that utilizes every available query parameter.

Formatters

Shields.io has 5 output formats. Of those, 2 have been implemented here, and PRs are welcome for the remainder.

URL Markdown rSt AsciiDoc HTML
Implemented ๐Ÿ’š ๐Ÿ’š โณ๏ธ โณ๏ธ โณ๏ธ
Module ...::ImageSrcUrl ...::Markdown โณ๏ธ โณ๏ธ โณ๏ธ
Source image_src_url.rb markdown.rb โณ๏ธ โณ๏ธ โณ๏ธ

Legend

  • ... => Shields::Formatters
  • โณ๏ธ => Please submit a Pull Request to implement this formatter

Check the sources of the two that are done. They are very easy to write. This is a great project to get started with open source, because it is well tested, and patterned after the Shields.io website.

๐Ÿ” Security

See SECURITY.md.

๐Ÿค Contributing

If you need some ideas of where to help, you could work on adding more code coverage, or if it is already ๐Ÿ’ฏ (see below) check issues, or PRs, or use the gem and think about how it could be better.

We Keep A Changelog so if you make changes, remember to update it.

See CONTRIBUTING.md for more detailed instructions.

๐Ÿš€ Release Instructions

See CONTRIBUTING.md.

Code Coverage

Coveralls Test Coverage QLTY Test Coverage

๐Ÿช‡ Code of Conduct

Everyone interacting with this project's codebases, issue trackers, chat rooms and mailing lists agrees to follow the Contributor Covenant 2.1.

๐ŸŒˆ Contributors

Contributors

Made with contributors-img.

Also see GitLab Contributors: https://gitlab.com/galtzo-floss/shields-badge/-/graphs/main

โญ๏ธ Star History

Star History Chart

๐Ÿ“Œ Versioning

This Library adheres to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions.

๐Ÿ“Œ Is "Platform Support" part of the public API?

Yes. But I'm obligated to include notes...

SemVer should, but doesn't explicitly, say that dropping support for specific Platforms is a breaking change to an API. It is obvious to many, but not all, and since the spec is silent, the bike shedding is endless.

dropping support for a platform is both obviously and objectively a breaking change

To get a better understanding of how SemVer is intended to work over a project's lifetime, read this article from the creator of SemVer:

As a result of this policy, and the interpretive lens used by the maintainer, you can (and should) specify a dependency on these libraries using the Pessimistic Version Constraint with two digits of precision.

For example:

spec.add_dependency("shields-badge", "~> 1.0")

See CHANGELOG.md for list of releases.

๐Ÿ“„ License

The gem is available as open source under the terms of the MIT License License: MIT. See LICENSE.txt for the official Copyright Notice.

ยฉ Copyright

  • Copyright (c) 2025 Peter H.ย Boling, of Galtzo.com Galtzo.com Logo by Aboling0, CC BY-SA 4.0 , and shields-badge contributors

๐Ÿค‘ One more thing

You made it to the bottom of the page, so perhaps you'll indulge me for another 20 seconds. I maintain many dozens of gems, including this one, because I want Ruby to be a great place for people to solve problems, big and small. Please consider supporting my efforts via the giant yellow link below, or one of the others at the head of this README.

Buy me a latte

Deprecated Badges

CodeCov currently fails to parse the coverage upload.

CodeCov Test Coverage

Coverage Graph