mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merge pull request #56 from jowido/detect-visualstudio-files
Detect visualstudio files
This commit is contained in:
@@ -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'].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
|
||||||
|
|||||||
@@ -937,7 +937,11 @@ XML:
|
|||||||
- .rdf
|
- .rdf
|
||||||
- .rss
|
- .rss
|
||||||
- .svg
|
- .svg
|
||||||
|
- .wxi
|
||||||
|
- .wxl
|
||||||
|
- .wxs
|
||||||
- .wsdl
|
- .wsdl
|
||||||
|
- .xaml
|
||||||
- .xml
|
- .xml
|
||||||
- .xsd
|
- .xsd
|
||||||
- .xsl
|
- .xsl
|
||||||
|
|||||||
@@ -123,6 +123,19 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
assert blob("MainMenu.nib").generated?
|
assert blob("MainMenu.nib").generated?
|
||||||
assert blob("project.pbxproj").generated?
|
assert blob("project.pbxproj").generated?
|
||||||
|
|
||||||
|
# Visual Studio Files
|
||||||
|
assert blob("project.csproj").generated?
|
||||||
|
assert blob("project.dbproj").generated?
|
||||||
|
assert blob("project.isproj").generated?
|
||||||
|
assert blob("project.pyproj").generated?
|
||||||
|
assert blob("project.rbproj").generated?
|
||||||
|
assert blob("project.vbproj").generated?
|
||||||
|
assert blob("project.vdproj").generated?
|
||||||
|
assert blob("project.vcxproj").generated?
|
||||||
|
assert blob("project.wixproj").generated?
|
||||||
|
assert blob("project.resx").generated?
|
||||||
|
assert blob("project.sln").generated?
|
||||||
|
|
||||||
# Long line
|
# Long line
|
||||||
assert !blob("uglify.js").generated?
|
assert !blob("uglify.js").generated?
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user