Detect KiCAD module files as generated

This commit is contained in:
Paul Chaignon
2015-04-19 16:19:52 +02:00
parent 0e996e4bb7
commit da9bda0e27
3 changed files with 70 additions and 1 deletions

View File

@@ -68,7 +68,8 @@ module Linguist
generated_protocol_buffer_go? ||
generated_protocol_buffer? ||
generated_jni_header? ||
vcr_cassette?
vcr_cassette? ||
generated_kicad_module?
end
# Internal: Is the blob an Xcode file?
@@ -311,5 +312,18 @@ module Linguist
return false unless lines.count > 1
return lines[0].include?("Generated by Cython")
end
# Internal: Is it a KiCAD module file?
#
# KiCAD module files contain:
# PCBNEW-LibModule-V1 yyyy-mm-dd h:mm:ss XM
# on the first line.
#
# Return true of false
def generated_kicad_module?
return false unless extname == '.mod'
return false unless lines.count > 1
return lines[0].include?("PCBNEW-LibModule-V")
end
end
end