Merge branch 'master' into 1348-local

Conflicts:
	lib/linguist/samples.json
This commit is contained in:
Arfon Smith
2014-08-13 15:26:49 -07:00
4 changed files with 65 additions and 3 deletions

View File

@@ -532,6 +532,7 @@ module Linguist
if extnames = extensions[name] if extnames = extensions[name]
extnames.each do |extname| extnames.each do |extname|
if !options['extensions'].include?(extname) if !options['extensions'].include?(extname)
warn "#{name} has a sample with extension (#{extname}) that isn't explicitly defined in languages.yml" unless extname == '.script!'
options['extensions'] << extname options['extensions'] << extname
end end
end end

View File

@@ -260,6 +260,7 @@ C:
extensions: extensions:
- .c - .c
- .cats - .cats
- .h
- .w - .w
C#: C#:
@@ -288,6 +289,7 @@ C++:
- .cc - .cc
- .cxx - .cxx
- .H - .H
- .h
- .h++ - .h++
- .hh - .hh
- .hpp - .hpp
@@ -452,6 +454,7 @@ Coq:
type: programming type: programming
extensions: extensions:
- .coq - .coq
- .v
Cpp-ObjDump: Cpp-ObjDump:
type: data type: data
@@ -547,6 +550,7 @@ Dart:
Diff: Diff:
extensions: extensions:
- .diff - .diff
- .patch
Dogescript: Dogescript:
type: programming type: programming
@@ -631,6 +635,7 @@ Erlang:
color: "#0faf8d" color: "#0faf8d"
extensions: extensions:
- .erl - .erl
- .escript
- .hrl - .hrl
F#: F#:
@@ -706,6 +711,7 @@ Forth:
extensions: extensions:
- .fth - .fth
- .4th - .4th
- .forth
Frege: Frege:
type: programming type: programming
@@ -814,6 +820,9 @@ Gosu:
color: "#82937f" color: "#82937f"
extensions: extensions:
- .gs - .gs
- .gst
- .gsx
- .vark
Grace: Grace:
type: programming type: programming
@@ -849,6 +858,7 @@ Groovy:
color: "#e69f56" color: "#e69f56"
extensions: extensions:
- .groovy - .groovy
- .gradle
- .grt - .grt
- .gtpl - .gtpl
- .gvy - .gvy
@@ -953,6 +963,7 @@ IDL:
color: "#e3592c" color: "#e3592c"
extensions: extensions:
- .pro - .pro
- .dlm
INI: INI:
type: data type: data
@@ -1027,6 +1038,7 @@ JSON:
searchable: false searchable: false
extensions: extensions:
- .json - .json
- .lock
- .sublime-keymap - .sublime-keymap
- .sublime-mousemap - .sublime-mousemap
- .sublime-project - .sublime-project
@@ -1155,6 +1167,9 @@ Lasso:
color: "#2584c3" color: "#2584c3"
extensions: extensions:
- .lasso - .lasso
- .las
- .lasso9
- .ldml
Latte: Latte:
type: markup type: markup
@@ -1240,6 +1255,7 @@ Lua:
extensions: extensions:
- .lua - .lua
- .nse - .nse
- .pd_lua
- .rbxs - .rbxs
interpreters: interpreters:
- lua - lua
@@ -1385,6 +1401,7 @@ Myghty:
NSIS: NSIS:
extensions: extensions:
- .nsi - .nsi
- .nsh
Nemerle: Nemerle:
type: programming type: programming
@@ -1449,6 +1466,7 @@ OCaml:
color: "#3be133" color: "#3be133"
extensions: extensions:
- .ml - .ml
- .eliom
- .eliomi - .eliomi
- .ml4 - .ml4
- .mli - .mli
@@ -1469,6 +1487,7 @@ Objective-C:
- objc - objc
extensions: extensions:
- .m - .m
- .h
Objective-C++: Objective-C++:
type: programming type: programming
@@ -1516,6 +1535,7 @@ OpenEdge ABL:
- abl - abl
extensions: extensions:
- .p - .p
- .cls
Org: Org:
type: prose type: prose
@@ -1554,6 +1574,7 @@ PHP:
- .php - .php
- .aw - .aw
- .ctp - .ctp
- .module
- .php3 - .php3
- .php4 - .php4
- .php5 - .php5
@@ -1602,6 +1623,7 @@ Pascal:
extensions: extensions:
- .pas - .pas
- .dfm - .dfm
- .dpr
- .lpr - .lpr
Perl: Perl:
@@ -1611,12 +1633,14 @@ Perl:
extensions: extensions:
- .pl - .pl
- .PL - .PL
- .fcgi
- .perl - .perl
- .ph - .ph
- .plx - .plx
- .pm - .pm
- .pod - .pod
- .psgi - .psgi
- .t
interpreters: interpreters:
- perl - perl
@@ -1825,6 +1849,7 @@ Racket:
- .rkt - .rkt
- .rktd - .rktd
- .rktl - .rktl
- .scrbl
Ragel in Ruby Host: Ragel in Ruby Host:
type: programming type: programming
@@ -1894,7 +1919,10 @@ Ruby:
- .god - .god
- .irbrc - .irbrc
- .mspec - .mspec
- .pluginspec
- .podspec - .podspec
- .rabl
- .rake
- .rbuild - .rbuild
- .rbw - .rbw
- .rbx - .rbx
@@ -1968,6 +1996,7 @@ Sass:
group: CSS group: CSS
extensions: extensions:
- .sass - .sass
- .scss
Scala: Scala:
type: programming type: programming
@@ -1975,6 +2004,7 @@ Scala:
color: "#7dd3b0" color: "#7dd3b0"
extensions: extensions:
- .scala - .scala
- .sbt
- .sc - .sc
Scaml: Scaml:
@@ -1990,6 +2020,7 @@ Scheme:
- .scm - .scm
- .sld - .sld
- .sls - .sls
- .sps
- .ss - .ss
interpreters: interpreters:
- guile - guile
@@ -2001,6 +2032,8 @@ Scilab:
type: programming type: programming
extensions: extensions:
- .sci - .sci
- .sce
- .tst
Self: Self:
type: programming type: programming
@@ -2020,8 +2053,10 @@ Shell:
- zsh - zsh
extensions: extensions:
- .sh - .sh
- .bash
- .bats - .bats
- .tmux - .tmux
- .zsh
interpreters: interpreters:
- bash - bash
- sh - sh
@@ -2088,6 +2123,7 @@ Standard ML:
extensions: extensions:
- .ML - .ML
- .fun - .fun
- .sig
- .sml - .sml
Stata: Stata:
@@ -2288,6 +2324,7 @@ Visual Basic:
extensions: extensions:
- .vb - .vb
- .bas - .bas
- .cls
- .frm - .frm
- .frx - .frx
- .vba - .vba
@@ -2316,6 +2353,7 @@ XML:
- wsdl - wsdl
extensions: extensions:
- .xml - .xml
- .ant
- .axml - .axml
- .ccxml - .ccxml
- .clixml - .clixml
@@ -2329,6 +2367,7 @@ XML:
- .fsproj - .fsproj
- .glade - .glade
- .grxml - .grxml
- .ivy
- .jelly - .jelly
- .kml - .kml
- .launch - .launch

View File

@@ -43,6 +43,10 @@
# Normalize.css # Normalize.css
- normalize.css - normalize.css
# Animate.css
- animate.css
- animate.min.css
# Vendored dependencies # Vendored dependencies
- thirdparty/ - thirdparty/
- vendors?/ - vendors?/

View File

@@ -35,15 +35,33 @@ class TestSamples < Test::Unit::TestCase
assert_equal data['tokens_total'], data['language_tokens'].inject(0) { |n, (_, c)| n += c } assert_equal data['tokens_total'], data['language_tokens'].inject(0) { |n, (_, c)| n += c }
assert_equal data['tokens_total'], data['tokens'].inject(0) { |n, (_, ts)| n += ts.inject(0) { |m, (_, c)| m += c } } assert_equal data['tokens_total'], data['tokens'].inject(0) { |n, (_, ts)| n += ts.inject(0) { |m, (_, c)| m += c } }
end end
# Check that there aren't samples with extensions that aren't explicitly defined in languages.yml
def test_parity
extensions = Samples::DATA['extnames']
languages_yml = File.expand_path("../../lib/linguist/languages.yml", __FILE__)
languages = YAML.load_file(languages_yml)
languages.each do |name, options|
options['extensions'] ||= []
if extnames = extensions[name]
extnames.each do |extname|
next if extname == '.script!'
assert options['extensions'].include?(extname), "#{name} has a sample with extension (#{extname}) that isn't explicitly defined in languages.yml"
end
end
end
end
# If a language extension isn't globally unique then make sure there are samples # If a language extension isn't globally unique then make sure there are samples
def test_presence def test_presence
Linguist::Language.all.each do |language| Linguist::Language.all.each do |language|
language.all_extensions.each do |extension| language.all_extensions.each do |extension|
language_matches = Language.find_by_filename("foo#{extension}") language_matches = Language.find_by_filename("foo#{extension}")
# If there is more than one language match for a given 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 # then check that there are examples for that language with the extension
if language_matches.length > 1 if language_matches.length > 1
language_matches.each do |language| language_matches.each do |language|
assert File.directory?("samples/#{language.name}"), "#{language.name} is missing a samples directory" assert File.directory?("samples/#{language.name}"), "#{language.name} is missing a samples directory"