Licensee

A Ruby Gem to detect under what license a project is distributed.

Gem Version Maintainability Test Coverage PRs Welcome

The problem

The solution

Licensee automates the process of reading LICENSE files and compares their contents to known licenses using a several strategies (which we call “Matchers”). It attempts to determine a project’s license in the following order:

Special thanks to @vmg for his Git and algorithmic prowess.

Installation

To use the latest released gem from RubyGems:

gem install licensee

To use licensee programmatically in your own Ruby project, add gem 'licensee' to your project’s Gemfile.

To run licensee directly from source:

gem install bundler
bundle install
bundle exec bin/licensee

On Windows, the last line needs to include the Ruby interpreter:

bundle exec ruby bin\licensee

Docker

Licensee also comes with a Dockerfile if you prefer to run Licensee within a Docker container:

  1. git clone https://github.com/licensee/licensee && cd licensee
  2. docker build . --tag licensee
  3. docker run licensee [COMMAND] (see command line usage)

Example (detecting the license of rails/rails on GitHub): docker run licensee detect rails/rails --remote

Documentation

See the docs folder for more information. You may be interested in:

Semantic Versioning

This project conforms to semver. As a result of this policy, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision. For example:

spec.add_dependency 'licensee', '~> 1.0'

This means your project is compatible with licensee 1.0 up until 2.0. You can also set a higher minimum version:

spec.add_dependency 'licensee', '~> 1.1'