github-linguist 4.2.3 → 4.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/linguist/heuristics.rb +26 -1
- data/lib/linguist/language.rb +4 -0
- data/lib/linguist/languages.json +1 -1
- data/lib/linguist/languages.yml +338 -10
- data/lib/linguist/popular.yml +1 -1
- data/lib/linguist/samples.json +3379 -352
- data/lib/linguist/samples.rb +0 -4
- data/lib/linguist/shebang.rb +16 -7
- data/lib/linguist/vendor.yml +1 -0
- data/lib/linguist/version.rb +1 -1
- metadata +2 -2
data/lib/linguist/samples.rb
CHANGED
@@ -34,10 +34,6 @@ module Linguist
|
|
34
34
|
Dir.entries(ROOT).sort!.each do |category|
|
35
35
|
next if category == '.' || category == '..'
|
36
36
|
|
37
|
-
# Skip text and binary for now
|
38
|
-
# Possibly reconsider this later
|
39
|
-
next if category == 'Text' || category == 'Binary'
|
40
|
-
|
41
37
|
dirname = File.join(ROOT, category)
|
42
38
|
Dir.entries(dirname).each do |filename|
|
43
39
|
next if filename == '.' || filename == '..'
|
data/lib/linguist/shebang.rb
CHANGED
@@ -18,23 +18,32 @@ module Linguist
|
|
18
18
|
#
|
19
19
|
# Returns a String or nil
|
20
20
|
def self.interpreter(data)
|
21
|
-
|
22
|
-
return unless match = /^#! ?(.+)$/.match(lines.first)
|
21
|
+
shebang = data.lines.first
|
23
22
|
|
24
|
-
|
25
|
-
|
23
|
+
# First line must start with #!
|
24
|
+
return unless shebang && shebang.start_with?("#!")
|
26
25
|
|
26
|
+
# Get the parts of the shebang without the #!
|
27
|
+
tokens = shebang.sub(/^#!\s*/, '').strip.split(' ')
|
28
|
+
|
29
|
+
# There was nothing after the #!
|
30
|
+
return if tokens.empty?
|
31
|
+
|
32
|
+
# Get the name of the interpreter
|
33
|
+
script = File.basename(tokens.first)
|
34
|
+
|
35
|
+
# Get next argument if interpreter was /usr/bin/env
|
27
36
|
script = tokens[1] if script == 'env'
|
28
37
|
|
29
|
-
#
|
38
|
+
# Interpreter was /usr/bin/env with no arguments
|
30
39
|
return unless script
|
31
40
|
|
32
41
|
# "python2.6" -> "python2"
|
33
|
-
script.sub!
|
42
|
+
script.sub! /(\.\d+)$/, ''
|
34
43
|
|
35
44
|
# Check for multiline shebang hacks that call `exec`
|
36
45
|
if script == 'sh' &&
|
37
|
-
lines.first(5).any? { |l| l.match(/exec (\w+).+\$0.+\$@/) }
|
46
|
+
data.lines.first(5).any? { |l| l.match(/exec (\w+).+\$0.+\$@/) }
|
38
47
|
script = $1
|
39
48
|
end
|
40
49
|
|
data/lib/linguist/vendor.yml
CHANGED
data/lib/linguist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-linguist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: charlock_holmes
|