only check for shebangs in executable files

This commit is contained in:
Aman Gupta
2011-11-23 01:37:01 -08:00
parent 61a59c8e84
commit d2118d1471
16 changed files with 9 additions and 1 deletions

View File

@@ -146,7 +146,8 @@ module Linguist
# #
# Return true or false # Return true or false
def shebang_extname? def shebang_extname?
extname.empty? extname.empty? &&
(mode.to_i(8) & 05) == 05
end end
MEGABYTE = 1024 * 1024 MEGABYTE = 1024 * 1024

View File

@@ -32,6 +32,13 @@ module Linguist
# Returns a String # Returns a String
attr_reader :name attr_reader :name
# Public: Read file permissions
#
# Returns a String like '100644'
def mode
File.stat(@path).mode.to_s(8)
end
# Public: Read file contents. # Public: Read file contents.
# #
# Returns a String. # Returns a String.

0
test/fixtures/script.bash vendored Normal file → Executable file
View File

0
test/fixtures/script.foo vendored Normal file → Executable file
View File

0
test/fixtures/script.groovy vendored Normal file → Executable file
View File

0
test/fixtures/script.js vendored Normal file → Executable file
View File

0
test/fixtures/script.mrb vendored Normal file → Executable file
View File

0
test/fixtures/script.nu vendored Normal file → Executable file
View File

0
test/fixtures/script.pl vendored Normal file → Executable file
View File

0
test/fixtures/script.py vendored Normal file → Executable file
View File

0
test/fixtures/script.rake vendored Normal file → Executable file
View File

0
test/fixtures/script.rb vendored Normal file → Executable file
View File

0
test/fixtures/script.rkt vendored Normal file → Executable file
View File

0
test/fixtures/script.scala vendored Normal file → Executable file
View File

0
test/fixtures/script.sh vendored Normal file → Executable file
View File

0
test/fixtures/script.zsh vendored Normal file → Executable file
View File