Class: LicenseAuto::Matcher::FilepathName
- Inherits:
-
Object
- Object
- LicenseAuto::Matcher::FilepathName
- Defined in:
- lib/license_auto/matcher.rb
Constant Summary collapse
- LICENSE_PATTERN =
/(((?<license_name>.*)[-_])?licen[sc]e|copying|copyright|copyleft)+/i
- NOTICE_PATTERN =
/notice/i
- README_PATTERN =
/readme(?<extension>\..*)?/i
- DPKG_COPYRIGHT_PATTERN =
Debian Linux doc:
[4.2. copyright. Required files under the debian directory](https://www.debian.org/doc/manuals/maint-guide/dreq.en.html#copyright)
/^[^\/]+\/debian\/copyright$/
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ FilepathName
constructor
A new instance of FilepathName.
- #match_license_file ⇒ Object
- #match_notice_file ⇒ Object
- #match_readme_file ⇒ Object
-
#match_the_ref(ref) ⇒ Object
git ref: commit hash/branch/tag.
Constructor Details
#initialize(name) ⇒ FilepathName
Returns a new instance of FilepathName.
74 75 76 |
# File 'lib/license_auto/matcher.rb', line 74 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
61 62 63 |
# File 'lib/license_auto/matcher.rb', line 61 def name @name end |
Instance Method Details
#match_license_file ⇒ Object
78 79 80 |
# File 'lib/license_auto/matcher.rb', line 78 def match_license_file() LICENSE_PATTERN.match(@name) end |
#match_notice_file ⇒ Object
86 87 88 |
# File 'lib/license_auto/matcher.rb', line 86 def match_notice_file() NOTICE_PATTERN.match(@name) end |
#match_readme_file ⇒ Object
82 83 84 |
# File 'lib/license_auto/matcher.rb', line 82 def match_readme_file() README_PATTERN.match(@name) end |
#match_the_ref(ref) ⇒ Object
git ref: commit hash/branch/tag
92 93 94 95 |
# File 'lib/license_auto/matcher.rb', line 92 def match_the_ref(ref) version_pattern = /[vV]?#{@name.gsub(/\./, '\.').gsub(/\//, '\/')}$/i version_pattern.match(ref) end |