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
#errors, #name, #path, #version
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?, #exist?, #license_contents, #license_key, #notice_contents, #record
Constructor Details
#initialize(name:, version:, path:, sources:, metadata: {}) ⇒ Dependency
Returns a new instance of Dependency.
186 187 188 189 |
# File 'lib/licensed/sources/manifest.rb', line 186 def initialize(name:, version:, path:, sources:, metadata: {}) @sources = sources super(name: name, version: version, path: path, metadata: ) end |
Instance Method Details
#project_files ⇒ Object
191 192 193 194 195 |
# File 'lib/licensed/sources/manifest.rb', line 191 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
199 200 201 202 203 204 205 206 207 208 |
# File 'lib/licensed/sources/manifest.rb', line 199 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 |