XCode and Visual Studio project detection in seperate methods

This commit is contained in:
Joris den Ouden
2011-07-26 22:13:25 +02:00
parent 0a842a5b5f
commit 5eec0034d1

View File

@@ -171,6 +171,7 @@ module Linguist
# #
# Includes: # Includes:
# - XCode project XML files # - XCode project XML files
# - Visual Studio project XNL files
# - Minified JavaScript # - Minified JavaScript
# #
# Please add additional test coverage to # Please add additional test coverage to
@@ -178,7 +179,7 @@ module Linguist
# #
# Return true or false # Return true or false
def generated? def generated?
if ['.xib', '.nib', '.pbxproj', '.xcworkspacedata', '.xcuserstate', '.csproj', '.dbproj', '.fsproj', '.pyproj', '.rbproj', '.vbproj', '.vcxproj', '.wixproj', '.resx', '.sln', '.vdproj', '.isproj'].include?(extname) if xcode_project_file? || visual_studio_project_file?
true true
elsif generated_coffeescript? || minified_javascript? elsif generated_coffeescript? || minified_javascript?
true true
@@ -187,6 +188,36 @@ module Linguist
end end
end end
# Internal: Is the blob an XCode project file?
#
# Generated if the file extension is an XCode project
# file extension.
#
# Returns true of false.
def xcode_project_file?
if ['.xib', '.nib', '.pbxproj', '.xcworkspacedata', '.xcuserstate'].include?(extname)
true
else
false
end
end
# Internal: Is the blob a Visual Studio project file?
#
# Generated if the file extension is a Visual Studio project
# file extension.
#
# Returns true of false.
def visual_studio_project_file?
if ['.csproj', '.dbproj', '.fsproj', '.pyproj', '.rbproj', '.vbproj', '.vcxproj', '.wixproj', '.resx', '.sln', '.vdproj', '.isproj'].include?(extname)
true
else
false
end
end
# Internal: Is the blob minified JS? # Internal: Is the blob minified JS?
# #
# Consider JS minified if the average line length is # Consider JS minified if the average line length is