Class: Licensee::Matchers::Package
- Defined in:
- lib/licensee/matchers/package.rb
Overview
Base matcher for package manager metadata files declaring a license.
Constant Summary collapse
- SPDX_SUFFIX_REGEX =
Regex matching SPDX compatibility suffixes that have no matching license entry in the database (e.g. LGPL-3.0-or-later → lgpl-3.0).
/-or-later\z|-only\z/i
Constants inherited from Matcher
Instance Attribute Summary
Attributes inherited from Matcher
Instance Method Summary collapse
Methods inherited from Matcher
Methods included from HashHelper
Constructor Details
This class inherits a constructor from Licensee::Matchers::Matcher
Instance Method Details
#confidence ⇒ Object
23 24 25 |
# File 'lib/licensee/matchers/package.rb', line 23 def confidence 90 end |
#license_property ⇒ Object
27 28 29 |
# File 'lib/licensee/matchers/package.rb', line 27 def license_property raise NotImplementedError, "#{self.class}#license_property is not implemented" end |
#match ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/licensee/matchers/package.rb', line 11 def match return @match if defined? @match prop = license_property return if prop.nil? || prop.to_s.empty? licenses = Licensee.licenses(hidden: true) @match = licenses.find { |l| l.key == prop } @match ||= match_by_spdx_base_key(prop, licenses) @match ||= License.find('other') end |