Module: Core
- Defined in:
- lib/core.rb
Class Method Summary collapse
- .delete_header(path, config) ⇒ Object
- .has_header(path, config) ⇒ Object
- .licensify(path, config) ⇒ Object
- .validate_header(path, config) ⇒ Object
Class Method Details
.delete_header(path, config) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/core.rb', line 31 def Core.delete_header(path, config) template = config.template ext = File.extname(path) detected = HeaderDetector.detect(path, template, config.get_comment(ext)) FileModification.delete_lines(path, detected[:start], detected[:matches].length) if detected end |
.has_header(path, config) ⇒ Object
38 39 40 41 42 |
# File 'lib/core.rb', line 38 def Core.has_header(path, config) template = config.template ext = File.extname(path) HeaderDetector.detect(path, template, config.get_comment(ext)) end |
.licensify(path, config) ⇒ Object
26 27 28 29 |
# File 'lib/core.rb', line 26 def Core.licensify(path, config) header = HeaderGenerator.create_for(path, config) FileModification.insert_lines_with_offset(path, header, config.offset) end |
.validate_header(path, config) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/core.rb', line 44 def Core.validate_header(path, config) template = config.template ext = File.extname(path) detected = HeaderDetector.detect(path, template, config.get_comment(ext)) return [{type: :no_header_found}] if !detected HeaderValidator.diff(detected, config.project_info.merge({file_name: File.basename(path)})) end |