module Licensee

A project file is a file within a project that contains license information Currently extended by LicenseFile, PackageManagerFile, and ReadmeFile

Sublcasses should implement the possible_matchers method

Filesystem-based project

Analyze a folder on the filesystem for license information

Project files for this project type will contain the following keys:

:name - the relative file name
:dir  - the directory path containing the file

Licensee::Project represents an open source project on disk It is not used directly, but rather is extended by FSProject and GitProject depending on the type of file system access available

Subclasses must implement the Files and LoadFile private methods

Constants

CONFIDENCE_THRESHOLD

Over which percent is a match considered a match by default

DOMAIN

Base domain from which to build license URLs

VERSION

Attributes

confidence_threshold[W]

Public Class Methods

confidence_threshold() click to toggle source
# File lib/licensee.rb, line 49
def confidence_threshold
  @confidence_threshold ||= CONFIDENCE_THRESHOLD
end
inverse_confidence_threshold() click to toggle source

Inverse of the confidence threshold, represented as a float By default this will be 0.02

# File lib/licensee.rb, line 55
def inverse_confidence_threshold
  @inverse_confidence_threshold ||=
    (1 - Licensee.confidence_threshold / 100.0).round(2)
end
license(path) click to toggle source

Returns the license for a given path

# File lib/licensee.rb, line 35
def license(path)
  Licensee.project(path).license
end
licenses(options = {}) click to toggle source

Returns an array of Licensee::License instances

# File lib/licensee.rb, line 30
def licenses(options = {})
  Licensee::License.all(options)
end
project(path, **args) click to toggle source
# File lib/licensee.rb, line 39
def project(path, **args)
  if path =~ %r{\Ahttps://github.com}
    Licensee::Projects::GitHubProject.new(path, **args)
  else
    Licensee::Projects::GitProject.new(path, **args)
  end
rescue Licensee::Projects::GitProject::InvalidRepository
  Licensee::Projects::FSProject.new(path, **args)
end