mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merge pull request #1734 from github/just-filenames
Removing extensions when they should be filenames
This commit is contained in:
@@ -595,9 +595,9 @@ module Linguist
|
||||
:ace_mode => options['ace_mode'],
|
||||
:wrap => options['wrap'],
|
||||
:group_name => options['group'],
|
||||
:searchable => options.key?('searchable') ? options['searchable'] : true,
|
||||
:searchable => options.fetch('searchable', true),
|
||||
:search_term => options['search_term'],
|
||||
:extensions => [options['extensions'].first] + options['extensions'][1..-1].sort,
|
||||
:extensions => Array(options['extensions']),
|
||||
:interpreters => options['interpreters'].sort,
|
||||
:filenames => options['filenames'],
|
||||
:popular => popular.include?(name)
|
||||
|
||||
@@ -33,15 +33,6 @@ AGS Script:
|
||||
- .ash
|
||||
tm_scope: source.c++
|
||||
|
||||
Ant Build System:
|
||||
type: data
|
||||
tm_scope: text.xml.ant
|
||||
extensions:
|
||||
- .ant.xml
|
||||
filenames:
|
||||
- build.xml
|
||||
- ant.xml
|
||||
|
||||
ANTLR:
|
||||
type: programming
|
||||
color: "#9DC3FF"
|
||||
@@ -117,6 +108,14 @@ Alloy:
|
||||
extensions:
|
||||
- .als
|
||||
|
||||
Ant Build System:
|
||||
type: data
|
||||
tm_scope: text.xml.ant
|
||||
extensions:
|
||||
filenames:
|
||||
- ant.xml
|
||||
- build.xml
|
||||
|
||||
ApacheConf:
|
||||
type: markup
|
||||
aliases:
|
||||
@@ -649,13 +648,6 @@ E:
|
||||
extensions:
|
||||
- .E
|
||||
|
||||
Ecere Projects:
|
||||
type: data
|
||||
group: JavaScript
|
||||
extensions:
|
||||
- .epj
|
||||
tm_scope: source.json
|
||||
|
||||
ECL:
|
||||
type: programming
|
||||
color: "#8a1267"
|
||||
@@ -671,6 +663,13 @@ Eagle:
|
||||
- .brd
|
||||
tm_scope: text.xml
|
||||
|
||||
Ecere Projects:
|
||||
type: data
|
||||
group: JavaScript
|
||||
extensions:
|
||||
- .epj
|
||||
tm_scope: source.json
|
||||
|
||||
Eiffel:
|
||||
type: programming
|
||||
color: "#946d57"
|
||||
@@ -767,8 +766,8 @@ Factor:
|
||||
extensions:
|
||||
- .factor
|
||||
filenames:
|
||||
- .factor-rc
|
||||
- .factor-boot-rc
|
||||
- .factor-rc
|
||||
|
||||
Fancy:
|
||||
type: programming
|
||||
@@ -809,13 +808,6 @@ G-code:
|
||||
- .gco
|
||||
- .gcode
|
||||
|
||||
Game Maker Language:
|
||||
type: programming
|
||||
color: "#8ad353"
|
||||
extensions:
|
||||
- .gml
|
||||
tm_scope: source.js
|
||||
|
||||
GAMS:
|
||||
type: programming
|
||||
extensions:
|
||||
@@ -860,6 +852,13 @@ GLSL:
|
||||
- .vrx
|
||||
- .vshader
|
||||
|
||||
Game Maker Language:
|
||||
type: programming
|
||||
color: "#8ad353"
|
||||
extensions:
|
||||
- .gml
|
||||
tm_scope: source.js
|
||||
|
||||
Genshi:
|
||||
extensions:
|
||||
- .kid
|
||||
@@ -1119,9 +1118,14 @@ INI:
|
||||
aliases:
|
||||
- dosini
|
||||
|
||||
Inno Setup:
|
||||
IRC log:
|
||||
search_term: irc
|
||||
aliases:
|
||||
- irc
|
||||
- irc logs
|
||||
extensions:
|
||||
- .iss
|
||||
- .irclog
|
||||
- .weechatlog
|
||||
|
||||
Idris:
|
||||
type: programming
|
||||
@@ -1144,15 +1148,6 @@ Inno Setup:
|
||||
extensions:
|
||||
- .iss
|
||||
|
||||
IRC log:
|
||||
search_term: irc
|
||||
aliases:
|
||||
- irc
|
||||
- irc logs
|
||||
extensions:
|
||||
- .irclog
|
||||
- .weechatlog
|
||||
|
||||
Io:
|
||||
type: programming
|
||||
color: "#a9188d"
|
||||
@@ -1471,9 +1466,9 @@ Makefile:
|
||||
- .mak
|
||||
- .mk
|
||||
filenames:
|
||||
- makefile
|
||||
- Makefile
|
||||
- GNUmakefile
|
||||
- Makefile
|
||||
- makefile
|
||||
interpreters:
|
||||
- make
|
||||
|
||||
@@ -1527,7 +1522,6 @@ Maven POM:
|
||||
type: data
|
||||
tm_scope: text.xml.pom
|
||||
extensions:
|
||||
- .pom.xml
|
||||
filenames:
|
||||
- pom.xml
|
||||
|
||||
@@ -1829,6 +1823,14 @@ Parrot:
|
||||
extensions:
|
||||
- .parrot # Dummy extension
|
||||
|
||||
Parrot Assembly:
|
||||
group: Parrot
|
||||
type: programming
|
||||
aliases:
|
||||
- pasm
|
||||
extensions:
|
||||
- .pasm
|
||||
|
||||
Parrot Internal Representation:
|
||||
group: Parrot
|
||||
tm_scope: source.parrot.pir
|
||||
@@ -1838,14 +1840,6 @@ Parrot Internal Representation:
|
||||
extensions:
|
||||
- .pir
|
||||
|
||||
Parrot Assembly:
|
||||
group: Parrot
|
||||
type: programming
|
||||
aliases:
|
||||
- pasm
|
||||
extensions:
|
||||
- .pasm
|
||||
|
||||
Pascal:
|
||||
type: programming
|
||||
color: "#b0ce4e"
|
||||
@@ -2002,10 +1996,10 @@ Python:
|
||||
- .wsgi
|
||||
- .xpy
|
||||
filenames:
|
||||
- wscript
|
||||
- SConstruct
|
||||
- SConscript
|
||||
- BUILD
|
||||
- SConscript
|
||||
- SConstruct
|
||||
- wscript
|
||||
interpreters:
|
||||
- python
|
||||
|
||||
@@ -2585,8 +2579,8 @@ VimL:
|
||||
filenames:
|
||||
- .vimrc
|
||||
- _vimrc
|
||||
- vimrc
|
||||
- gvimrc
|
||||
- vimrc
|
||||
|
||||
Visual Basic:
|
||||
type: programming
|
||||
@@ -2688,12 +2682,12 @@ XML:
|
||||
filenames:
|
||||
- .classpath
|
||||
- .project
|
||||
- Web.Debug.config
|
||||
- Web.Release.config
|
||||
- Web.config
|
||||
- build.xml.dist
|
||||
- packages.config
|
||||
- phpunit.xml.dist
|
||||
- Web.config
|
||||
- Web.Debug.config
|
||||
- Web.Release.config
|
||||
|
||||
XProc:
|
||||
type: programming
|
||||
|
||||
110
samples/Ant Build System/filenames/ant.xml
Normal file
110
samples/Ant Build System/filenames/ant.xml
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<project name="WebBuild">
|
||||
|
||||
<!-- generate timestamps -->
|
||||
<tstamp />
|
||||
|
||||
<!-- Debugging Macro -->
|
||||
<import file="echopath.xml" />
|
||||
|
||||
<!-- JS build files macro -->
|
||||
<import file="rhinoscript.xml" />
|
||||
|
||||
<!-- Component Build Files -->
|
||||
<import file="setup.xml" />
|
||||
<import file="clean.xml" />
|
||||
<import file="copy.xml" />
|
||||
<import file="file.transform.xml" />
|
||||
<import file="external.tools.xml" />
|
||||
<import file="rename.xml" />
|
||||
<import file="js.xml" />
|
||||
<import file="css.xml" />
|
||||
<import file="img.xml" />
|
||||
<import file="png8.xml" />
|
||||
<import file="yui.xml" />
|
||||
<import file="cdn.xml" />
|
||||
<import file="datauri.xml" />
|
||||
<import file="devlive.xml" />
|
||||
|
||||
<!-- This dirname is the only complete path we know for sure, everything builds off of it -->
|
||||
<dirname property="dir.build" file="${ant.file.WebBuild}" />
|
||||
|
||||
<!-- get name for newly built folder -->
|
||||
<basename property="app.name" file="${basedir}" />
|
||||
|
||||
<!-- read global properties file -->
|
||||
<property file="${dir.build}\build.properties" />
|
||||
|
||||
<!-- Build Directories -->
|
||||
<property name="dir.build.js" location="${dir.build}/js" />
|
||||
|
||||
<!-- App Directories -->
|
||||
<property name="dir.app" location="${dir.result}/${app.name}" />
|
||||
<property name="dir.app.temp" location="${dir.temp}/${app.name}" />
|
||||
<property name="dir.app.files" location="${dir.app.temp}/${dir.files}" />
|
||||
|
||||
<!-- Files -->
|
||||
<property name="mapping.js" location="${dir.app.temp}/${mapping.file.js}" />
|
||||
<property name="mapping.css" location="${dir.app.temp}/${mapping.file.css}" />
|
||||
<property name="mapping.img" location="${dir.app.temp}/${mapping.file.img}" />
|
||||
<property name="mapping.swf" location="${dir.app.temp}/${mapping.file.swf}" />
|
||||
<property name="mapping.fonts" location="${dir.app.temp}/${mapping.file.fonts}" />
|
||||
|
||||
<!-- Tool Directories -->
|
||||
<property name="dir.bin" location="${dir.build}/Bin" />
|
||||
<property name="dir.jar" location="${dir.bin}/jar" />
|
||||
|
||||
<!-- Tool Files -->
|
||||
<property name="tools.compressor" location="${dir.jar}/${tools.file.compressor}" />
|
||||
<property name="tools.cssembed" location="${dir.jar}/${tools.file.cssembed}" />
|
||||
<property name="tools.filetransform" location="${dir.jar}/${tools.file.filetransform}" />
|
||||
<property name="tools.optipng" location="${dir.bin}/${tools.file.optipng}" />
|
||||
<property name="tools.jpegtran" location="${dir.bin}/${tools.file.jpegtran}" />
|
||||
|
||||
|
||||
<!-- BUILD TARGETS -->
|
||||
|
||||
<!-- low level utility build targets -->
|
||||
|
||||
<!-- Build the tools -->
|
||||
<target name="-setup.build.tools"
|
||||
depends="-define.filetransform, -define.cssembed, -define.yuicompressor, -define.jsclasspath"
|
||||
/>
|
||||
|
||||
<!-- set up filesystem properties -->
|
||||
<target
|
||||
name="-setup"
|
||||
depends="-setup.mode, -setup.conditions, -setup.js, -setup.css, -setup.swf, -setup.img, -setup.fonts, -setup.yui"
|
||||
/>
|
||||
|
||||
<!-- utility-ish targets -->
|
||||
<target name="copy" depends="clean, tools, -copy" />
|
||||
<target name="tools" depends="-setup.build.tools" />
|
||||
<target name="finalize" depends="copy, -finalize" />
|
||||
<target name="-prepare" depends="copy, -setup" />
|
||||
|
||||
<!-- individual component build targets (empty descriptions are to make sure they show in "ant -p") -->
|
||||
<target name="devlive" depends="-prepare, -devlive" description="" />
|
||||
<target name="js" depends="-prepare, -js" description="" />
|
||||
<target name="css" depends="-prepare, -css" description="" />
|
||||
<target name="rename" depends="-prepare, -rename" description="" />
|
||||
<target name="yui" depends="-prepare, rename, -yui" description="" />
|
||||
<target name="cdn" depends="-prepare, -cdn" description="" />
|
||||
|
||||
<!-- high level build targets (Excluding of images is on purpose here, it's slow) -->
|
||||
<target name="core"
|
||||
depends="devlive, js, css, cdn, rename, yui, -js.inline"
|
||||
description="Core build work"
|
||||
/>
|
||||
|
||||
<target name="prod"
|
||||
depends="core, finalize"
|
||||
description="Full Production Build"
|
||||
/>
|
||||
|
||||
<!-- debug target -->
|
||||
<target name="debug" depends="-setup">
|
||||
<echoproperties/>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
@@ -1,207 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>renpengben</groupId>
|
||||
<artifactId>spring4mvc-jpa</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>spring4mvc-jpa Maven Webapp</name>
|
||||
|
||||
<url>https://renpengben.github.io</url>
|
||||
|
||||
<description>spring4mvc-jpa</description>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.7</java.version>
|
||||
<junit.version>4.11</junit.version>
|
||||
<slf4j.version>1.7.7</slf4j.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
|
||||
<spring.version>4.0.5.RELEASE</spring.version>
|
||||
<spring.data.jpa.version>1.6.0.RELEASE</spring.data.jpa.version>
|
||||
<cglib.version>2.1_3</cglib.version>
|
||||
|
||||
<mysql.version>5.1.31</mysql.version>
|
||||
<hibernate.version>4.3.5.Final</hibernate.version>
|
||||
<hibernate-validator.version>5.1.1.Final</hibernate-validator.version>
|
||||
<druid-version>1.0.6</druid-version>
|
||||
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-expression</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aspects</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-jpa</artifactId>
|
||||
<version>${spring.data.jpa.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>junit-dep</artifactId>
|
||||
<groupId>junit</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib-nodep</artifactId>
|
||||
<version>${cglib.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- JPA -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-entitymanager</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>${hibernate-validator.version}</version>
|
||||
<scope>compile</scope>
|
||||
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>${druid-version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -349,12 +349,6 @@ class TestLanguage < Test::Unit::TestCase
|
||||
assert_equal '.coffee', Language['CoffeeScript'].primary_extension
|
||||
assert_equal '.t', Language['Turing'].primary_extension
|
||||
assert_equal '.ts', Language['TypeScript'].primary_extension
|
||||
|
||||
# This is a nasty requirement, but there's some code in GitHub that
|
||||
# expects this. Really want to drop this.
|
||||
Language.all.each do |language|
|
||||
assert language.primary_extension, "#{language} has no primary extension"
|
||||
end
|
||||
end
|
||||
|
||||
def test_eql
|
||||
|
||||
@@ -1,57 +1,30 @@
|
||||
require 'test/unit'
|
||||
require 'yaml'
|
||||
|
||||
class TestPedantic < Test::Unit::TestCase
|
||||
Lib = File.expand_path("../../lib/linguist", __FILE__)
|
||||
|
||||
def file(name)
|
||||
File.read(File.join(Lib, name))
|
||||
end
|
||||
filename = File.expand_path("../../lib/linguist/languages.yml", __FILE__)
|
||||
LANGUAGES = YAML.load(File.read(filename))
|
||||
|
||||
def test_language_names_are_sorted
|
||||
languages = []
|
||||
file("languages.yml").lines.each do |line|
|
||||
if line =~ /^(\w+):$/
|
||||
languages << $1
|
||||
end
|
||||
end
|
||||
assert_sorted languages
|
||||
assert_sorted LANGUAGES.keys
|
||||
end
|
||||
|
||||
def test_extensions_are_sorted
|
||||
extensions = nil
|
||||
file("languages.yml").lines.each do |line|
|
||||
if line =~ /^ extensions:$/
|
||||
extensions = []
|
||||
elsif extensions && line =~ /^ - \.([\w\-\.]+)( *#.*)?$/
|
||||
extensions << $1
|
||||
else
|
||||
assert_sorted extensions[1..-1] if extensions
|
||||
extensions = nil
|
||||
end
|
||||
LANGUAGES.each do |name, language|
|
||||
extensions = language['extensions']
|
||||
assert_sorted extensions[1..-1] if extensions && extensions.size > 1
|
||||
end
|
||||
end
|
||||
|
||||
def test_filenames_are_sorted
|
||||
filenames = nil
|
||||
file("languages.yml").lines.each do |line|
|
||||
if line =~ /^ filenames:$/
|
||||
filenames = []
|
||||
elsif filenames && line =~ /^ - \.(\w+)$/
|
||||
filenames << $1
|
||||
else
|
||||
assert_sorted filenames if filenames
|
||||
filenames = nil
|
||||
end
|
||||
LANGUAGES.each do |name, language|
|
||||
assert_sorted language['filenames'] if language['filenames']
|
||||
end
|
||||
end
|
||||
|
||||
def assert_sorted(list)
|
||||
previous = nil
|
||||
list.each do |item|
|
||||
if previous && previous > item
|
||||
flunk "#{previous} should come after #{item}"
|
||||
end
|
||||
previous = item
|
||||
list.each_cons(2) do |previous, item|
|
||||
flunk "#{previous} should come after #{item}" if previous > item
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user