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
#additional_terms, #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, #metadata, #notice_contents, #record
Constructor Details
#initialize(name:, version:, path:, sources:, metadata: {}) ⇒ Dependency
Returns a new instance of Dependency.
181 182 183 184 |
# File 'lib/licensed/sources/manifest.rb', line 181 def initialize(name:, version:, path:, sources:, metadata: {}) @sources = sources super(name: name, version: version, path: path, metadata: ) end |
Instance Method Details
#project_files ⇒ Object
186 187 188 189 190 |
# File 'lib/licensed/sources/manifest.rb', line 186 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
194 195 196 197 198 199 200 201 202 203 |
# File 'lib/licensed/sources/manifest.rb', line 194 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 |