Morecane

What?

The cane gem provides a great framework for running quality checks over your ruby project as part of continuous integration build. It comes with a few checks out of the box, but also provides an API for loading custom checks.

This gem provides a set of additional checks that I use across my projects. Maybe you’ll find the useful as well.

How?

Install this project like any rubygem:

gem install morecane

Or add it to your Gemfile:

gem 'morecane'

Then create a new rake task and load in the checks you require

require 'cane/rake_task'
require 'morecane'

desc "Run cane to check quality metrics"
Cane::RakeTask.new(:quality) do |cane|
  cane.use Morecane::EncodingCheck, encoding_glob: "{app,lib,spec}/**/*.rb"
end

Checks

Here is a list of the checks available in this gem and the options they take.

Morecane::EncodingCheck

Ensure files have a ruby encoding marker in the first two lines.

  • encoding_glob - a string to specify the files to check. You probably want something list “app,lib,spec/*/.rb”

Morecane::MustMatchCheck

Ensure files match a given regular expression.

  • must_match_glob - a string to specify the files to check. You probably want something list “app,lib/*/.rb”

  • must_match_regexp - a regular expression to check each file against

Morecane::MustNotMatchCheck

Ensure files do not match a given regular expression.

  • must_not_match_glob - a string to specify the files to check. You probably want something list “app,lib/*/.rb”

  • must_not_match_regexp - a regular expression to check each file against

Who?

This gem is written and maintained by James Healy <[email protected]>

More?

For more information on cane, check out it’s comprehensive README

https://github.com/square/cane