From 4ec9145700228909774c9a7b9ac65ee2ffb6e103 Mon Sep 17 00:00:00 2001 From: Dan Luu Date: Fri, 25 Oct 2013 20:52:59 -0500 Subject: [PATCH 01/17] Add common VHDL file extensions --- lib/linguist/languages.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 52803496..72e55300 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1405,6 +1405,14 @@ VHDL: lexer: vhdl color: "#543978" primary_extension: .vhdl + extensions: + - .vhd + - .vhf + - .vhi + - .vho + - .vhs + - .vht + - .vhw Vala: type: programming From 56dec42c70439e8437a83640715c8f932caf0440 Mon Sep 17 00:00:00 2001 From: Haralan Dobrev Date: Sat, 23 Nov 2013 13:03:16 +0200 Subject: [PATCH 02/17] Add composer.lock to JSON filenames [Composer](http://getcomposer.org] uses one configuration file (composer.json) and one lock file (composer.lock). They both use valid JSON. Example: https://github.com/OpenBuildings/jam/blob/master/composer.lock --- lib/linguist/languages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index daef0e24..b899b4b8 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -747,6 +747,8 @@ JSON: - .sublime_session - .sublime-settings - .sublime-workspace + filenames: + - composer.lock Jade: group: HTML From b59d80b00c55cda2beea061a863ea0e183892c51 Mon Sep 17 00:00:00 2001 From: Mike Purvis Date: Sat, 23 Nov 2013 15:35:42 -0500 Subject: [PATCH 03/17] Add five new extensions to XML, YAML in support of ROS usage. These extensions are in common use in packages part of ROS, the Robot Operating System. [urdf](http://wiki.ros.org/urdf), [srdf](http://wiki.ros.org/srdf): These are Robot Description Files, XML documents which describe the physical realities of a robotics platform, for the purposes of consumption by common libraries. [xacro](http://wiki.ros.org/xacro) is for input files to the XML macro processor xacro, which is used in ROS to output URDF and SRDF files. [launch](http://wiki.ros.org/roslaunch/XML): Documents which describe sets of ROS nodes to launch together. [rviz](https://github.com/ros-visualization/rviz/blob/hydro-devel/default.rviz): YAML configuration files belonging to the [rviz](http://wiki.ros.org/rviz#Overview) utility. Each one has been in use for several years in various ROS-related applications; lots of examples should be apparent in orgs like ros, ros-drivers, ros-visualization, pr2, turtlebot, husky, etc. Thanks for your consideration! --- lib/linguist/languages.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index daef0e24..f35c057b 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1611,6 +1611,7 @@ XML: - .grxml - .jelly - .kml + - .launch - .mxml - .plist - .pluginspec @@ -1620,6 +1621,7 @@ XML: - .rdf - .rss - .scxml + - .srdf - .svg - .tmCommand - .tmLanguage @@ -1628,12 +1630,14 @@ XML: - .tmTheme - .tml - .ui + - .urdf - .vxml - .wsdl - .wxi - .wxl - .wxs - .x3d + - .xacro - .xaml - .xlf - .xliff @@ -1686,6 +1690,7 @@ YAML: primary_extension: .yml extensions: - .reek + - .rviz - .yaml eC: From 72026d3a3d809a630d6d52d1190b8001d54212a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20L=C3=A9caud=C3=A9?= Date: Sun, 24 Nov 2013 13:36:26 -0500 Subject: [PATCH 04/17] Changed primary extension for Max Changed primary extension for Max to .maxpat .mxt is a legacy file format. --- lib/linguist/languages.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 51b3c0a0..9498c1ff 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -949,10 +949,11 @@ Max: - max/msp - maxmsp search_term: max/msp - primary_extension: .mxt + primary_extension: .maxpat extensions: - .maxhelp - - .maxpat + - .mxt + - .pat MiniD: # Legacy searchable: false From f64a589e988a7b35706fe8af2f9bb0d6ff2042ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20L=C3=A9caud=C3=A9?= Date: Sun, 24 Nov 2013 13:54:10 -0500 Subject: [PATCH 05/17] Moved the Max examples to the Max folder --- lib/linguist/languages.yml | 11 ++++++++--- samples/{JSON => Max}/Hello.maxhelp | 0 samples/{JSON => Max}/Hello.maxpat | 0 3 files changed, 8 insertions(+), 3 deletions(-) rename samples/{JSON => Max}/Hello.maxhelp (100%) rename samples/{JSON => Max}/Hello.maxpat (100%) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 9498c1ff..50540a6e 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -747,6 +747,10 @@ JSON: - .sublime_session - .sublime-settings - .sublime-workspace + - .maxpat + - .maxhelp + - .maxpresets + - .maxproj filenames: - composer.lock @@ -944,7 +948,7 @@ Matlab: Max: type: programming color: "#ce279c" - lexer: Text only + lexer: JSON aliases: - max/msp - maxmsp @@ -952,8 +956,9 @@ Max: primary_extension: .maxpat extensions: - .maxhelp - - .mxt - - .pat + - .maxproj + - .mxt # Legacy + - .pat # Legacy MiniD: # Legacy searchable: false diff --git a/samples/JSON/Hello.maxhelp b/samples/Max/Hello.maxhelp similarity index 100% rename from samples/JSON/Hello.maxhelp rename to samples/Max/Hello.maxhelp diff --git a/samples/JSON/Hello.maxpat b/samples/Max/Hello.maxpat similarity index 100% rename from samples/JSON/Hello.maxpat rename to samples/Max/Hello.maxpat From a8ae3d3ae56d73f5b2f198f6c3e539b5b43b6e01 Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Sun, 24 Nov 2013 10:58:47 -0800 Subject: [PATCH 06/17] Just the extensions for now --- lib/linguist/languages.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 50540a6e..17545309 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -747,10 +747,6 @@ JSON: - .sublime_session - .sublime-settings - .sublime-workspace - - .maxpat - - .maxhelp - - .maxpresets - - .maxproj filenames: - composer.lock @@ -957,8 +953,8 @@ Max: extensions: - .maxhelp - .maxproj - - .mxt # Legacy - - .pat # Legacy + - .mxt + - .pat MiniD: # Legacy searchable: false From 9a5d52e4601d1d31983cd60bd18a062c648ba2dc Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Sun, 24 Nov 2013 10:59:52 -0800 Subject: [PATCH 07/17] Update samples --- lib/linguist/samples.json | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index 4ce97dfc..ac4fabfd 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -149,9 +149,7 @@ ".script!" ], "JSON": [ - ".json", - ".maxhelp", - ".maxpat" + ".json" ], "Julia": [ ".jl" @@ -205,6 +203,8 @@ ".m" ], "Max": [ + ".maxhelp", + ".maxpat", ".mxt" ], "Monkey": [ @@ -22921,10 +22921,10 @@ "logger": 2 }, "JSON": { - "{": 143, - "}": 143, - "[": 165, - "]": 165, + "{": 17, + "}": 17, + "[": 2, + "]": 2, "true": 3 }, "Julia": { @@ -28256,6 +28256,10 @@ "contents.colheaders": 1 }, "Max": { + "{": 126, + "}": 126, + "[": 163, + "]": 163, "max": 1, "v2": 1, ";": 39, @@ -43402,7 +43406,7 @@ "Jade": 3, "Java": 8987, "JavaScript": 76934, - "JSON": 619, + "JSON": 41, "Julia": 247, "Kotlin": 155, "KRL": 25, @@ -43419,7 +43423,7 @@ "Makefile": 50, "Markdown": 1, "Matlab": 11942, - "Max": 136, + "Max": 714, "Monkey": 207, "MoonScript": 1718, "Nemerle": 17, @@ -43528,7 +43532,7 @@ "Jade": 1, "Java": 6, "JavaScript": 20, - "JSON": 5, + "JSON": 3, "Julia": 1, "Kotlin": 1, "KRL": 1, @@ -43545,7 +43549,7 @@ "Makefile": 2, "Markdown": 1, "Matlab": 39, - "Max": 1, + "Max": 3, "Monkey": 1, "MoonScript": 1, "Nemerle": 1, @@ -43610,5 +43614,5 @@ "Xtend": 2, "YAML": 1 }, - "md5": "e0528838deafd471674bb0a8d79906ce" + "md5": "8a3ac1f1219fa2ba31eb0e5d6a22ee58" } \ No newline at end of file From 10cadb8725bffd48018e45d6a6a01e9fb05ea960 Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Tue, 3 Dec 2013 15:51:24 +1100 Subject: [PATCH 08/17] use JSON instead of YAML for loading samples.json --- lib/linguist/samples.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/linguist/samples.rb b/lib/linguist/samples.rb index d9099385..89f5a718 100644 --- a/lib/linguist/samples.rb +++ b/lib/linguist/samples.rb @@ -1,4 +1,4 @@ -require 'yaml' +require 'json' require 'linguist/md5' require 'linguist/classifier' @@ -14,7 +14,7 @@ module Linguist # Hash of serialized samples object if File.exist?(PATH) - DATA = YAML.load_file(PATH) + DATA = JSON.load(File.read(PATH)) end # Public: Iterate over each sample. From 27c9774d1b4859ee4ee83743aa0dfa8bc9c7923c Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Tue, 3 Dec 2013 15:55:25 +1100 Subject: [PATCH 09/17] prefer JSON, but fall back to YAML if JSON isn't available --- lib/linguist/samples.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/linguist/samples.rb b/lib/linguist/samples.rb index 89f5a718..c623d7d5 100644 --- a/lib/linguist/samples.rb +++ b/lib/linguist/samples.rb @@ -1,4 +1,8 @@ -require 'json' +begin + require 'json' +rescue LoadError + require 'yaml' +end require 'linguist/md5' require 'linguist/classifier' @@ -14,7 +18,8 @@ module Linguist # Hash of serialized samples object if File.exist?(PATH) - DATA = JSON.load(File.read(PATH)) + serializer = defined?(JSON) ? JSON : YAML + DATA = serializer.load(File.read(PATH)) end # Public: Iterate over each sample. From 3887acd91507b8a1e11e6249aeb7550297bfbb1e Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Tue, 3 Dec 2013 16:15:06 +1100 Subject: [PATCH 10/17] require escape_utils >= 0.3.1 --- github-linguist.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-linguist.gemspec b/github-linguist.gemspec index 33d9fed1..0b868e78 100644 --- a/github-linguist.gemspec +++ b/github-linguist.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.executables << 'linguist' s.add_dependency 'charlock_holmes', '~> 0.6.6' - s.add_dependency 'escape_utils', '~> 0.3.1' + s.add_dependency 'escape_utils', '>= 0.3.1' s.add_dependency 'mime-types', '~> 1.19' s.add_dependency 'pygments.rb', '~> 0.5.2' From 017c6fd3f2097bacf6f365abc4d083e12d7d440c Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Tue, 3 Dec 2013 16:42:18 +1100 Subject: [PATCH 11/17] force escape_utils 0.3.2 on ruby < 1.9.3 --- Gemfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Gemfile b/Gemfile index 851fabc2..3df9dcfc 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,7 @@ source 'https://rubygems.org' gemspec + +if RUBY_VERSION < "1.9.3" + # escape_utils 1.0.0 requires 1.9.3 and above + gem "escape_utils", "0.3.2" +end From 0fb7017add5a7cfccdb7b121e63f1dc0ae069143 Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Tue, 3 Dec 2013 19:17:32 -0800 Subject: [PATCH 12/17] Bump pygments.rb to 0.5.4 --- github-linguist.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-linguist.gemspec b/github-linguist.gemspec index 0b868e78..d1af4ba9 100644 --- a/github-linguist.gemspec +++ b/github-linguist.gemspec @@ -12,8 +12,8 @@ Gem::Specification.new do |s| s.add_dependency 'charlock_holmes', '~> 0.6.6' s.add_dependency 'escape_utils', '>= 0.3.1' s.add_dependency 'mime-types', '~> 1.19' - s.add_dependency 'pygments.rb', '~> 0.5.2' - + s.add_dependency 'pygments.rb', '~> 0.5.4' + s.add_development_dependency 'json' s.add_development_dependency 'mocha' s.add_development_dependency 'rake' From 61b8a8969fb9b70be4b0895fefe307f487d6a8ce Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Tue, 3 Dec 2013 19:21:32 -0800 Subject: [PATCH 13/17] 2.9.9 --- github-linguist.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-linguist.gemspec b/github-linguist.gemspec index d1af4ba9..ab5f35f1 100644 --- a/github-linguist.gemspec +++ b/github-linguist.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'github-linguist' - s.version = '2.9.8' + s.version = '2.9.9' s.summary = "GitHub Language detection" s.authors = "GitHub" From bf11900bc9ba1e62f936f468413efded9d31d252 Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 15:58:34 +1100 Subject: [PATCH 14/17] prefer to load from languages.json if it exists --- Rakefile | 9 +++++++++ lib/linguist/language.rb | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 08ce419b..0b3d16a4 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,7 @@ require 'rake/clean' require 'rake/testtask' +require 'yaml' +require 'json' task :default => :test @@ -13,6 +15,13 @@ task :samples do File.open('lib/linguist/samples.json', 'w') { |io| io.write json } end +task :build_gem do + languages = YAML.load_file("lib/linguist/languages.yml") + File.write("lib/linguist/languages.json", JSON.dump(languages)) + `gem build github-linguist.gemspec` + File.delete("lib/linguist/languages.json") +end + namespace :classifier do LIMIT = 1_000 diff --git a/lib/linguist/language.rb b/lib/linguist/language.rb index a8dc8f9f..69d20bc0 100644 --- a/lib/linguist/language.rb +++ b/lib/linguist/language.rb @@ -1,6 +1,10 @@ require 'escape_utils' require 'pygments' require 'yaml' +begin + require 'json' +rescue LoadError +end require 'linguist/classifier' require 'linguist/samples' @@ -455,7 +459,16 @@ module Linguist filenames = Samples::DATA['filenames'] popular = YAML.load_file(File.expand_path("../popular.yml", __FILE__)) - YAML.load_file(File.expand_path("../languages.yml", __FILE__)).each do |name, options| + languages_yml = File.expand_path("../languages.yml", __FILE__) + languages_json = File.expand_path("../languages.json", __FILE__) + + if File.exist?(languages_json) && defined?(JSON) + languages = JSON.load(File.read(languages_json)) + else + languages = YAML.load_file(languages_yml) + end + + languages.each do |name, options| options['extensions'] ||= [] options['filenames'] ||= [] From 283cc3a975f9a07557c468278dc9097bb6ad7824 Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Tue, 3 Dec 2013 21:12:12 -0800 Subject: [PATCH 15/17] 2.10.0 --- github-linguist.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-linguist.gemspec b/github-linguist.gemspec index ab5f35f1..26bded1b 100644 --- a/github-linguist.gemspec +++ b/github-linguist.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'github-linguist' - s.version = '2.9.9' + s.version = '2.10.0' s.summary = "GitHub Language detection" s.authors = "GitHub" From de636f1c0bf52179273f861e471c3138baabe9e9 Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Wed, 4 Dec 2013 02:08:58 -0800 Subject: [PATCH 16/17] Colors for agda and tex --- lib/linguist/languages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 17545309..2f089cca 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -70,6 +70,7 @@ Ada: Agda: type: programming + color: "#467C91" primary_extension: .agda ApacheConf: @@ -1477,6 +1478,7 @@ Tcsh: TeX: type: markup + color: "#3D6117" ace_mode: latex aliases: - latex From a04b9dd7cd2d79ff1cf15eebf36e4446d7bb1b9f Mon Sep 17 00:00:00 2001 From: Giacom Date: Wed, 4 Dec 2013 12:07:46 +0000 Subject: [PATCH 17/17] Updated the DM language to use the C++ lexer. --- lib/linguist/languages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 2f089cca..0f6c35a5 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -380,7 +380,7 @@ D-ObjDump: DM: type: programming color: "#075ff1" - lexer: Text only + lexer: C++ primary_extension: .dm aliases: - byond