module Core

Public Class Methods

delete_header(path, config) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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