Skip to content

Latest commit

 

History

History
53 lines (34 loc) · 1.55 KB

README.md

File metadata and controls

53 lines (34 loc) · 1.55 KB

CodeownerParser

The goal of this gem is primarily to parse a CODEOWNER file and return the team associated with a file given the file path.

An ancillary goal is to allow you to route errors to a different team by file.

Installation

Add this line to your application's Gemfile:

gem 'codeowner_parser'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install codeowner_parser

Usage

See GitHub's documentation for examples of codeowner files.

require 'codeowner_parser'

str = <<~CODEOWNERS
*       @global-owner1 @global-owner2
*.js    @js-owner
*.go [email protected]
/build/logs/ @doctocat
docs/*  [email protected]
apps/ @octocat
/docs/ @doctocat
CODEOWNERS

parser = CodeownerParser.parse(str)
parser.owner('/build/docs/blah.json')
# => ['[email protected]']

Development

After checking out the repo, run bin/setup to install dependencies. You can also 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, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/will-in-wi/codeowner_parser.