mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Merge pull request #1732 from github/filename-matches-multiple-langages
Require samples if filename matches multiple languages
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,4 +1,4 @@ | ||||
| Gemfile.lock | ||||
| /Gemfile.lock | ||||
| .bundle/ | ||||
| benchmark/ | ||||
| lib/linguist/samples.json | ||||
|   | ||||
| @@ -431,11 +431,6 @@ module Linguist | ||||
|     # Returns the extensions Array | ||||
|     attr_reader :filenames | ||||
|  | ||||
|     # Public: Return all possible extensions for language | ||||
|     def all_extensions | ||||
|       (extensions + [primary_extension]).uniq | ||||
|     end | ||||
|  | ||||
|     # Deprecated: Get primary extension | ||||
|     # | ||||
|     # Defaults to the first extension but can be overridden | ||||
| @@ -593,9 +588,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,13 @@ Alloy: | ||||
|   extensions: | ||||
|   - .als | ||||
|  | ||||
| Ant Build System: | ||||
|   type: data | ||||
|   tm_scope: text.xml.ant | ||||
|   filenames: | ||||
|   - ant.xml | ||||
|   - build.xml | ||||
|  | ||||
| ApacheConf: | ||||
|   type: markup | ||||
|   aliases: | ||||
| @@ -649,13 +647,6 @@ E: | ||||
|   extensions: | ||||
|   - .E | ||||
|  | ||||
| Ecere Projects: | ||||
|   type: data | ||||
|   group: JavaScript | ||||
|   extensions: | ||||
|   - .epj | ||||
|   tm_scope: source.json | ||||
|  | ||||
| ECL: | ||||
|   type: programming | ||||
|   color: "#8a1267" | ||||
| @@ -671,6 +662,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 +765,8 @@ Factor: | ||||
|   extensions: | ||||
|   - .factor | ||||
|   filenames: | ||||
|     - .factor-rc | ||||
|     - .factor-boot-rc | ||||
|     - .factor-rc | ||||
|  | ||||
| Fancy: | ||||
|   type: programming | ||||
| @@ -812,13 +810,6 @@ G-code: | ||||
|   - .gco | ||||
|   - .gcode | ||||
|  | ||||
| Game Maker Language: | ||||
|   type: programming | ||||
|   color: "#8ad353" | ||||
|   extensions: | ||||
|   - .gml | ||||
|   tm_scope: source.js | ||||
|  | ||||
| GAMS: | ||||
|   type: programming | ||||
|   extensions: | ||||
| @@ -863,6 +854,13 @@ GLSL: | ||||
|   - .vrx | ||||
|   - .vshader | ||||
|  | ||||
| Game Maker Language: | ||||
|   type: programming | ||||
|   color: "#8ad353" | ||||
|   extensions: | ||||
|   - .gml | ||||
|   tm_scope: source.js | ||||
|  | ||||
| Genshi: | ||||
|   extensions: | ||||
|   - .kid | ||||
| @@ -1122,9 +1120,14 @@ INI: | ||||
|   aliases: | ||||
|   - dosini | ||||
|  | ||||
| Inno Setup: | ||||
| IRC log: | ||||
|   search_term: irc | ||||
|   aliases: | ||||
|   - irc | ||||
|   - irc logs | ||||
|   extensions: | ||||
|   - .iss | ||||
|   - .irclog | ||||
|   - .weechatlog | ||||
|  | ||||
| Idris: | ||||
|   type: programming | ||||
| @@ -1147,15 +1150,6 @@ Inno Setup: | ||||
|   extensions: | ||||
|   - .iss | ||||
|  | ||||
| IRC log: | ||||
|   search_term: irc | ||||
|   aliases: | ||||
|   - irc | ||||
|   - irc logs | ||||
|   extensions: | ||||
|   - .irclog | ||||
|   - .weechatlog | ||||
|  | ||||
| Io: | ||||
|   type: programming | ||||
|   color: "#a9188d" | ||||
| @@ -1474,9 +1468,9 @@ Makefile: | ||||
|   - .mak | ||||
|   - .mk | ||||
|   filenames: | ||||
|   - makefile | ||||
|   - Makefile | ||||
|   - GNUmakefile | ||||
|   - Makefile | ||||
|   - makefile | ||||
|   interpreters: | ||||
|   - make | ||||
|  | ||||
| @@ -1529,8 +1523,6 @@ Matlab: | ||||
| Maven POM: | ||||
|   type: data | ||||
|   tm_scope: text.xml.pom | ||||
|   extensions: | ||||
|   - .pom.xml | ||||
|   filenames: | ||||
|   - pom.xml | ||||
|  | ||||
| @@ -1832,6 +1824,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 | ||||
| @@ -1841,14 +1841,6 @@ Parrot Internal Representation: | ||||
|   extensions: | ||||
|   - .pir | ||||
|  | ||||
| Parrot Assembly: | ||||
|   group: Parrot | ||||
|   type: programming | ||||
|   aliases: | ||||
|   - pasm | ||||
|   extensions: | ||||
|   - .pasm | ||||
|  | ||||
| Pascal: | ||||
|   type: programming | ||||
|   color: "#b0ce4e" | ||||
| @@ -2005,10 +1997,10 @@ Python: | ||||
|   - .wsgi | ||||
|   - .xpy | ||||
|   filenames: | ||||
|   - wscript | ||||
|   - SConstruct | ||||
|   - SConscript | ||||
|   - BUILD | ||||
|   - SConscript | ||||
|   - SConstruct | ||||
|   - wscript | ||||
|   interpreters: | ||||
|   - python | ||||
|  | ||||
| @@ -2588,8 +2580,8 @@ VimL: | ||||
|   filenames: | ||||
|   - .vimrc | ||||
|   - _vimrc | ||||
|   - vimrc | ||||
|   - gvimrc | ||||
|   - vimrc | ||||
|  | ||||
| Visual Basic: | ||||
|   type: programming | ||||
| @@ -2691,12 +2683,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
									
								
								samples/Ant Build System/filenames/build.xml
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								samples/Ant Build System/filenames/build.xml
									
									
									
									
									
										Symbolic link
									
								
							| @@ -0,0 +1 @@ | ||||
| ant.xml | ||||
							
								
								
									
										207
									
								
								samples/Maven POM/filenames/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										207
									
								
								samples/Maven POM/filenames/pom.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,207 @@ | ||||
| <?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> | ||||
							
								
								
									
										42
									
								
								samples/Ruby/filenames/Gemfile.lock
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								samples/Ruby/filenames/Gemfile.lock
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| PATH | ||||
|   remote: . | ||||
|   specs: | ||||
|     github-linguist (4.0.1) | ||||
|       charlock_holmes (~> 0.7.3) | ||||
|       escape_utils (~> 1.0.1) | ||||
|       mime-types (>= 1.19) | ||||
|       rugged (~> 0.22.0b1) | ||||
|     github-linguist-grammars (4.0.1) | ||||
|  | ||||
| GEM | ||||
|   remote: https://rubygems.org/ | ||||
|   specs: | ||||
|     charlock_holmes (0.7.3) | ||||
|     coderay (1.1.0) | ||||
|     escape_utils (1.0.1) | ||||
|     metaclass (0.0.4) | ||||
|     method_source (0.8.2) | ||||
|     mime-types (2.4.3) | ||||
|     mocha (1.1.0) | ||||
|       metaclass (~> 0.0.1) | ||||
|     plist (3.1.0) | ||||
|     pry (0.10.1) | ||||
|       coderay (~> 1.1.0) | ||||
|       method_source (~> 0.8.1) | ||||
|       slop (~> 3.4) | ||||
|     rake (10.3.2) | ||||
|     rugged (0.22.0b1) | ||||
|     slop (3.6.0) | ||||
|     yajl-ruby (1.2.1) | ||||
|  | ||||
| PLATFORMS | ||||
|   ruby | ||||
|  | ||||
| DEPENDENCIES | ||||
|   github-linguist! | ||||
|   github-linguist-grammars! | ||||
|   mocha | ||||
|   plist (~> 3.1) | ||||
|   pry | ||||
|   rake | ||||
|   yajl-ruby | ||||
| @@ -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 | ||||
|   | ||||
| @@ -55,20 +55,28 @@ class TestSamples < Test::Unit::TestCase | ||||
|   end | ||||
|  | ||||
|   # If a language extension isn't globally unique then make sure there are samples | ||||
|   def test_presence | ||||
|     Linguist::Language.all.each do |language| | ||||
|       language.all_extensions.each do |extension| | ||||
|         language_matches = Language.find_by_filename("foo#{extension}") | ||||
|   Linguist::Language.all.each do |language| | ||||
|     define_method "test_#{language.name}_has_samples" do | ||||
|       language.extensions.each do |extension| | ||||
|         language_matches = Language.find_by_extension(extension) | ||||
|  | ||||
|         # If there is more than one language match for a given extension | ||||
|         # then check that there are examples for that language with the extension | ||||
|         # Check for samples if more than one language matches the given extension. | ||||
|         if language_matches.length > 1 | ||||
|           language_matches.each do |language| | ||||
|             assert File.directory?("samples/#{language.name}"), "#{language.name} is missing a samples directory" | ||||
|             assert Dir.glob("samples/#{language.name}/*#{extension}").any?, "#{language.name} is missing samples for extension #{extension}" | ||||
|           language_matches.each do |match| | ||||
|             samples = "samples/#{match.name}/*#{extension}" | ||||
|             assert Dir.glob(samples).any?, "Missing samples in #{samples.inspect}. See https://github.com/github/linguist/blob/master/CONTRIBUTING.md" | ||||
|           end | ||||
|         end | ||||
|       end | ||||
|  | ||||
|       language.filenames.each do |filename| | ||||
|         # Check for samples if more than one language matches the given filename | ||||
|         if Language.find_by_filename(filename).size > 1 | ||||
|           sample = "samples/#{language.name}/filenames/#{filename}" | ||||
|           assert File.exists?(sample), | ||||
|             "Missing sample in #{sample.inspect}. See https://github.com/github/linguist/blob/master/CONTRIBUTING.md" | ||||
|         end | ||||
|       end | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								vendor/cache/mime-types-1.25.1.gem
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/cache/mime-types-1.25.1.gem
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								vendor/cache/yajl-ruby-1.1.0.gem
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/cache/yajl-ruby-1.1.0.gem
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user