mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merge remote-tracking branch 'github/master' into chapel-lang
Conflicts: lib/linguist/samples.json
This commit is contained in:
@@ -52,5 +52,20 @@ module Linguist
|
||||
def size
|
||||
File.size(@path)
|
||||
end
|
||||
|
||||
# Public: Get file extension.
|
||||
#
|
||||
# Returns a String.
|
||||
def extension
|
||||
# File.extname returns nil if the filename is an extension.
|
||||
extension = File.extname(name)
|
||||
basename = File.basename(name)
|
||||
# Checks if the filename is an extension.
|
||||
if extension.empty? && basename[0] == "."
|
||||
basename
|
||||
else
|
||||
extension
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -104,12 +104,13 @@ module Linguist
|
||||
#
|
||||
# We'll perform a more comprehensive test later which actually involves
|
||||
# looking for binary characters in the blob
|
||||
return nil if blob.likely_binary?
|
||||
return nil if blob.likely_binary? || blob.binary?
|
||||
|
||||
# A bit of an elegant hack. If the file is executable but extensionless,
|
||||
# append a "magic" extension so it can be classified with other
|
||||
# languages that have shebang scripts.
|
||||
if File.extname(name).empty? && blob.mode && (blob.mode.to_i(8) & 05) == 05
|
||||
extension = FileBlob.new(name).extension
|
||||
if extension.empty? && blob.mode && (blob.mode.to_i(8) & 05) == 05
|
||||
name += ".script!"
|
||||
end
|
||||
|
||||
@@ -124,7 +125,7 @@ module Linguist
|
||||
possible_language_names = possible_languages.map(&:name)
|
||||
|
||||
# Don't bother with binary contents or an empty file
|
||||
if blob.binary? || data.nil? || data == ""
|
||||
if data.nil? || data == ""
|
||||
nil
|
||||
# Check if there's a shebang line and use that as authoritative
|
||||
elsif (result = find_by_shebang(data)) && !result.empty?
|
||||
@@ -189,7 +190,8 @@ module Linguist
|
||||
#
|
||||
# Returns all matching Languages or [] if none were found.
|
||||
def self.find_by_filename(filename)
|
||||
basename, extname = File.basename(filename), File.extname(filename)
|
||||
basename = File.basename(filename)
|
||||
extname = FileBlob.new(filename).extension
|
||||
langs = @filename_index[basename] +
|
||||
@extension_index[extname]
|
||||
langs.compact.uniq
|
||||
@@ -401,7 +403,7 @@ module Linguist
|
||||
#
|
||||
# Returns the extensions Array
|
||||
attr_reader :filenames
|
||||
|
||||
|
||||
# Public: Return all possible extensions for language
|
||||
def all_extensions
|
||||
(extensions + [primary_extension]).uniq
|
||||
|
||||
@@ -743,6 +743,9 @@
|
||||
"Nginx": [
|
||||
"nginx.conf"
|
||||
],
|
||||
"PHP": [
|
||||
".php"
|
||||
],
|
||||
"Perl": [
|
||||
"ack"
|
||||
],
|
||||
@@ -785,6 +788,9 @@
|
||||
".gvimrc",
|
||||
".vimrc"
|
||||
],
|
||||
"XML": [
|
||||
".cproject"
|
||||
],
|
||||
"YAML": [
|
||||
".gemrc"
|
||||
],
|
||||
@@ -794,8 +800,8 @@
|
||||
"exception.zep.php"
|
||||
]
|
||||
},
|
||||
"tokens_total": 638833,
|
||||
"languages_total": 872,
|
||||
"tokens_total": 640042,
|
||||
"languages_total": 874,
|
||||
"tokens": {
|
||||
"ABAP": {
|
||||
"*/**": 1,
|
||||
@@ -50730,7 +50736,7 @@
|
||||
},
|
||||
"PHP": {
|
||||
"<": 11,
|
||||
"php": 12,
|
||||
"php": 14,
|
||||
"namespace": 28,
|
||||
"Symfony": 24,
|
||||
"Component": 24,
|
||||
@@ -51454,6 +51460,19 @@
|
||||
"base_url": 1,
|
||||
"php_filter_info": 1,
|
||||
"filters": 2,
|
||||
"SHEBANG#!php": 4,
|
||||
"<?>": 1,
|
||||
"aMenuLinks": 1,
|
||||
"Array": 13,
|
||||
"Blog": 1,
|
||||
"SITE_DIR": 4,
|
||||
"Photos": 1,
|
||||
"photo": 1,
|
||||
"About": 1,
|
||||
"me": 1,
|
||||
"about": 1,
|
||||
"Contact": 1,
|
||||
"contacts": 1,
|
||||
"Field": 9,
|
||||
"FormField": 3,
|
||||
"ArrayAccess": 1,
|
||||
@@ -51748,7 +51767,6 @@
|
||||
"isUnique": 1,
|
||||
"is_bool": 1,
|
||||
"sql": 1,
|
||||
"SHEBANG#!php": 3,
|
||||
"echo": 2,
|
||||
"Yii": 3,
|
||||
"console": 3,
|
||||
@@ -67843,9 +67861,9 @@
|
||||
"return": 1
|
||||
},
|
||||
"XML": {
|
||||
"<?xml>": 11,
|
||||
"version=": 17,
|
||||
"encoding=": 7,
|
||||
"<?xml>": 12,
|
||||
"version=": 21,
|
||||
"encoding=": 8,
|
||||
"<Project>": 7,
|
||||
"ToolsVersion=": 6,
|
||||
"DefaultTargets=": 5,
|
||||
@@ -67922,6 +67940,94 @@
|
||||
"<Compile>": 10,
|
||||
"<None>": 5,
|
||||
"</Project>": 7,
|
||||
"standalone=": 1,
|
||||
"<?fileVersion>": 1,
|
||||
"4": 1,
|
||||
"0": 2,
|
||||
"<cproject>": 1,
|
||||
"storage_type_id=": 1,
|
||||
"<storageModule>": 14,
|
||||
"moduleId=": 14,
|
||||
"<cconfiguration>": 2,
|
||||
"id=": 141,
|
||||
"buildSystemId=": 2,
|
||||
"name=": 270,
|
||||
"<externalSettings/>": 2,
|
||||
"<extensions>": 2,
|
||||
"<extension>": 12,
|
||||
"point=": 12,
|
||||
"</extensions>": 2,
|
||||
"</storageModule>": 7,
|
||||
"<configuration>": 2,
|
||||
"artifactName=": 2,
|
||||
"buildArtefactType=": 2,
|
||||
"buildProperties=": 2,
|
||||
"cleanCommand=": 2,
|
||||
"description=": 4,
|
||||
"cdt": 2,
|
||||
"managedbuild": 2,
|
||||
"config": 2,
|
||||
"gnu": 2,
|
||||
"exe": 2,
|
||||
"debug": 1,
|
||||
"1803931088": 1,
|
||||
"parent=": 2,
|
||||
"<folderInfo>": 2,
|
||||
"resourcePath=": 2,
|
||||
"<toolChain>": 2,
|
||||
"superClass=": 42,
|
||||
"<targetPlatform>": 2,
|
||||
"<builder>": 2,
|
||||
"buildPath=": 2,
|
||||
"keepEnvironmentInBuildfile=": 2,
|
||||
"managedBuildOn=": 2,
|
||||
"<tool>": 12,
|
||||
"<option>": 16,
|
||||
"value=": 11,
|
||||
"valueType=": 12,
|
||||
"<listOptionValue>": 4,
|
||||
"builtIn=": 4,
|
||||
"</option>": 4,
|
||||
"<inputType>": 8,
|
||||
"</tool>": 8,
|
||||
"defaultValue=": 2,
|
||||
"<additionalInput>": 4,
|
||||
"kind=": 6,
|
||||
"paths=": 4,
|
||||
"</inputType>": 2,
|
||||
"</toolChain>": 2,
|
||||
"</folderInfo>": 2,
|
||||
"<sourceEntries>": 2,
|
||||
"<entry>": 2,
|
||||
"flags=": 2,
|
||||
"</sourceEntries>": 2,
|
||||
"</configuration>": 2,
|
||||
"</cconfiguration>": 2,
|
||||
"release": 1,
|
||||
"32754498": 1,
|
||||
"<project>": 2,
|
||||
"projectType=": 1,
|
||||
"<autodiscovery>": 5,
|
||||
"enabled=": 125,
|
||||
"problemReportingEnabled=": 5,
|
||||
"selectedProfileId=": 5,
|
||||
"<profile>": 40,
|
||||
"<buildOutputProvider>": 40,
|
||||
"<openAction>": 40,
|
||||
"filePath=": 40,
|
||||
"<parser>": 80,
|
||||
"</buildOutputProvider>": 40,
|
||||
"<scannerInfoProvider>": 40,
|
||||
"<runAction>": 40,
|
||||
"arguments=": 40,
|
||||
"command=": 40,
|
||||
"useDefault=": 40,
|
||||
"</scannerInfoProvider>": 40,
|
||||
"</profile>": 40,
|
||||
"<scannerConfigBuildInfo>": 4,
|
||||
"instanceId=": 4,
|
||||
"</scannerConfigBuildInfo>": 4,
|
||||
"</cproject>": 1,
|
||||
"<SchemaVersion>": 2,
|
||||
"</SchemaVersion>": 2,
|
||||
"cfa7a11": 1,
|
||||
@@ -67969,8 +68075,6 @@
|
||||
"FSharp": 1,
|
||||
"</Otherwise>": 1,
|
||||
"</Choose>": 1,
|
||||
"<project>": 1,
|
||||
"name=": 227,
|
||||
"xmlns": 2,
|
||||
"ea=": 2,
|
||||
"<description>": 4,
|
||||
@@ -68025,14 +68129,12 @@
|
||||
"application": 2,
|
||||
"<ea:build>": 1,
|
||||
"<ea:property>": 1,
|
||||
"value=": 1,
|
||||
"<ea:plugin>": 1,
|
||||
"</ea:build>": 1,
|
||||
"</info>": 1,
|
||||
"<configurations>": 1,
|
||||
"<conf>": 2,
|
||||
"visibility=": 2,
|
||||
"description=": 2,
|
||||
"</configurations>": 1,
|
||||
"<dependencies>": 1,
|
||||
"<dependency>": 4,
|
||||
@@ -70552,7 +70654,7 @@
|
||||
"Ox": 1006,
|
||||
"Oxygene": 157,
|
||||
"PAWN": 3263,
|
||||
"PHP": 20724,
|
||||
"PHP": 20754,
|
||||
"Pan": 130,
|
||||
"Parrot Assembly": 6,
|
||||
"Parrot Internal Representation": 5,
|
||||
@@ -70618,7 +70720,7 @@
|
||||
"Visual Basic": 581,
|
||||
"Volt": 388,
|
||||
"XC": 24,
|
||||
"XML": 7057,
|
||||
"XML": 8236,
|
||||
"XProc": 22,
|
||||
"XQuery": 801,
|
||||
"XSLT": 44,
|
||||
@@ -70753,7 +70855,7 @@
|
||||
"Ox": 3,
|
||||
"Oxygene": 1,
|
||||
"PAWN": 1,
|
||||
"PHP": 9,
|
||||
"PHP": 10,
|
||||
"Pan": 1,
|
||||
"Parrot Assembly": 1,
|
||||
"Parrot Internal Representation": 1,
|
||||
@@ -70819,7 +70921,7 @@
|
||||
"Visual Basic": 3,
|
||||
"Volt": 1,
|
||||
"XC": 1,
|
||||
"XML": 13,
|
||||
"XML": 14,
|
||||
"XProc": 1,
|
||||
"XQuery": 1,
|
||||
"XSLT": 1,
|
||||
@@ -70832,5 +70934,5 @@
|
||||
"fish": 3,
|
||||
"wisp": 1
|
||||
},
|
||||
"md5": "bd012ec237a6d47ded2203578618abfc"
|
||||
"md5": "e1a3dc40ad721b18cc222fa645d65304"
|
||||
}
|
||||
@@ -40,6 +40,9 @@
|
||||
- foundation.min.css
|
||||
- foundation.css
|
||||
|
||||
# Normalize.css
|
||||
- normalize.css
|
||||
|
||||
# Vendored dependencies
|
||||
- thirdparty/
|
||||
- vendors?/
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Linguist
|
||||
VERSION = "3.0.2"
|
||||
VERSION = "3.0.3"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user