Class: Licensee
- Inherits:
-
Object
- Object
- Licensee
- Defined in:
- lib/licensee/matcher.rb,
lib/licensee.rb,
lib/licensee/license.rb,
lib/licensee/project.rb,
lib/licensee/version.rb,
lib/licensee/licenses.rb,
lib/licensee/license_file.rb,
lib/licensee/matchers/git_matcher.rb,
lib/licensee/filesystem_repository.rb,
lib/licensee/matchers/exact_matcher.rb,
lib/licensee/matchers/copyright_matcher.rb,
lib/licensee/matchers/levenshtein_matcher.rb
Overview
Abstract class to describe different matching strategies Must respond to:
- match
- confidence
Can assume file will be a Licensee::LicenseFile instance
Defined Under Namespace
Classes: CopyrightMatcher, ExactMatcher, FilesystemRepository, GitMatcher, InvalidLicense, LevenshteinMatcher, License, LicenseFile, Licenses, Matcher, Project
Constant Summary collapse
- CONFIDENCE_THRESHOLD =
Over which percent is a match considered a match by default
90- DOMAIN =
Base domain from which to build license URLs
"http://choosealicense.com"- VERSION =
"4.8.0"
Class Attribute Summary collapse
Class Method Summary collapse
-
.diff(path) ⇒ Object
Diffs the project license and the known license.
-
.license(path) ⇒ Object
Returns the license for a given git repo.
-
.licenses ⇒ Object
Returns an array of Licensee::License instances.
-
.matchers ⇒ Object
Array of matchers to use, in order of preference The order should be decending order of anticipated speed to match.
Class Attribute Details
.confidence_threshold ⇒ Object
51 52 53 |
# File 'lib/licensee.rb', line 51 def confidence_threshold @confidence_threshold ||= CONFIDENCE_THRESHOLD end |
Class Method Details
.diff(path) ⇒ Object
Diffs the project license and the known license
41 42 43 |
# File 'lib/licensee.rb', line 41 def diff(path) Licensee::Project.new(path).license_file.diff end |
.license(path) ⇒ Object
Returns the license for a given git repo
36 37 38 |
# File 'lib/licensee.rb', line 36 def license(path) Licensee::Project.new(path).license end |
.licenses ⇒ Object
Returns an array of Licensee::License instances
31 32 33 |
# File 'lib/licensee.rb', line 31 def licenses @licenses ||= Licensee::Licenses.list end |
.matchers ⇒ Object
Array of matchers to use, in order of preference The order should be decending order of anticipated speed to match
47 48 49 |
# File 'lib/licensee.rb', line 47 def matchers [Licensee::CopyrightMatcher, Licensee::ExactMatcher, Licensee::GitMatcher, Licensee::LevenshteinMatcher] end |