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 watch percent is a match considered a match
90- DOMAIN =
Base domain from which to build license URLs
"http://choosealicense.com"- VERSION =
"4.7.0"
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 Method Details
.diff(path) ⇒ Object
Diffs the project license and the known license
39 40 41 |
# File 'lib/licensee.rb', line 39 def diff(path) Licensee::Project.new(path).license_file.diff end |
.license(path) ⇒ Object
Returns the license for a given git repo
34 35 36 |
# File 'lib/licensee.rb', line 34 def license(path) Licensee::Project.new(path).license end |
.licenses ⇒ Object
Returns an array of Licensee::License instances
29 30 31 |
# File 'lib/licensee.rb', line 29 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
45 46 47 |
# File 'lib/licensee.rb', line 45 def matchers [Licensee::CopyrightMatcher, Licensee::ExactMatcher, Licensee::GitMatcher, Licensee::LevenshteinMatcher] end |