diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index 88226954..a9b934f9 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -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 diff --git a/test/fixtures/Generated/ms2.mod b/test/fixtures/Generated/ms2.mod new file mode 100644 index 00000000..1866c8d6 --- /dev/null +++ b/test/fixtures/Generated/ms2.mod @@ -0,0 +1,19 @@ +GFORTRAN module version '0' created from ms2.f90 on Thu Sep 5 10:09:19 2013 +MD5:8a80cd5db1bc612a28603959302dbf37 -- If you edit this, you'll get what you deserve. + +(() () () () () () () () () () () () () () () () () () () () () () () () +() () ()) + +() + +() + +() + +() + +(2 'ms2' 'ms2' 'ms2' 1 ((MODULE UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN +UNKNOWN) (UNKNOWN 0 0 0 UNKNOWN ()) 0 0 () () 0 () () () 0 0) +) + +('ms2' 0 2) diff --git a/test/test_blob.rb b/test/test_blob.rb index 88d4c795..6d919d14 100644 --- a/test/test_blob.rb +++ b/test/test_blob.rb @@ -243,9 +243,6 @@ class TestBlob < Minitest::Test # Cython-generated C/C++ assert sample_blob("C/sgd_fast.c").generated? assert sample_blob("C++/wrapper_inner.cpp").generated? - - # KiCAD module files - assert fixture_blob("Generated/ABM8G.mod").generated? end def test_vendored