Class: Licensed::Sources::Manifest::Dependency
- Inherits:
-
Dependency
- Object
- Licensee::Projects::FSProject
- Dependency
- Licensed::Sources::Manifest::Dependency
- Defined in:
- lib/licensed/sources/manifest.rb
Constant Summary collapse
- ANY_EXCEPT_COMMENT_CLOSE_REGEX =
/(\*(?!\/)|[^\*])*/m.freeze
- HEADER_LICENSE_REGEX =
/ ( \/\* #{ANY_EXCEPT_COMMENT_CLOSE_REGEX}#{Licensee::Matchers::Copyright::COPYRIGHT_SYMBOLS}#{ANY_EXCEPT_COMMENT_CLOSE_REGEX} \*\/ ) /imx.freeze
Constants inherited from Dependency
Dependency::LEGAL_FILES_PATTERN
Instance Attribute Summary
Attributes inherited from Dependency
Instance Method Summary collapse
-
#initialize(name:, version:, path:, sources:, metadata: {}) ⇒ Dependency
constructor
A new instance of Dependency.
- #project_files ⇒ Object
-
#source_files ⇒ Object
Returns an enumeration of Licensee::ProjectFiles::LicenseFile representing licenses found in source header comments.
Methods inherited from Dependency
#errors?, #license_contents, #license_key, #notice_contents, #notice_files, #record
Constructor Details
#initialize(name:, version:, path:, sources:, metadata: {}) ⇒ Dependency
Returns a new instance of Dependency.
192 193 194 195 |
# File 'lib/licensed/sources/manifest.rb', line 192 def initialize(name:, version:, path:, sources:, metadata: {}) @sources = sources super(name: name, version: version, path: path, metadata: ) end |
Instance Method Details
#project_files ⇒ Object
197 198 199 200 201 |
# File 'lib/licensed/sources/manifest.rb', line 197 def project_files files = super files.concat(source_files) if files.empty? files end |
#source_files ⇒ Object
Returns an enumeration of Licensee::ProjectFiles::LicenseFile representing licenses found in source header comments
205 206 207 208 209 210 211 212 213 214 |
# File 'lib/licensed/sources/manifest.rb', line 205 def source_files @source_files ||= begin @sources .select { |file| File.file?(file) } .flat_map { |file| source_file_comments(file) } .map do |comment, file| Licensee::ProjectFiles::LicenseFile.new(comment, file) end end end |