Detect GFortran module files as generated

This commit is contained in:
Paul Chaignon
2015-04-19 16:56:38 +02:00
parent da9bda0e27
commit e073e91d62
3 changed files with 28 additions and 7 deletions

View File

@@ -69,7 +69,7 @@ module Linguist
generated_protocol_buffer? ||
generated_jni_header? ||
vcr_cassette? ||
generated_kicad_module?
generated_module?
end
# Internal: Is the blob an Xcode file?
@@ -313,17 +313,22 @@ module Linguist
return lines[0].include?("Generated by Cython")
end
# Internal: Is it a KiCAD module file?
# Internal: Is it a KiCAD or GFortran module file?
#
# KiCAD module files contain:
# PCBNEW-LibModule-V1 yyyy-mm-dd h:mm:ss XM
# on the first line.
#
# GFortran module files contain:
# GFORTRAN module version 'x' created from
# on the first line.
#
# Return true of false
def generated_kicad_module?
def generated_module?
return false unless extname == '.mod'
return false unless lines.count > 1
return lines[0].include?("PCBNEW-LibModule-V")
return lines[0].include?("PCBNEW-LibModule-V") ||
lines[0].include?("GFORTRAN module version '")
end
end
end