github-linguist 3.0.3 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 838570607a936e2f174977152ff0bbae10bb1b1e
4
- data.tar.gz: 9b39ccd935fca2893fa6a162f88bc362aebd32f3
3
+ metadata.gz: 4e8e9371bbc9d3eaaed04808599b7eda3940c7eb
4
+ data.tar.gz: d9a79084660829b6b1c8c88a8caeceb23e07e679
5
5
  SHA512:
6
- metadata.gz: b971f10f9b9881da94090dd011ae9b9fc66dac2bb46eac71987a52ace700e896a5cef6abd58090811aaf3ba90252cde733e9eacfb87a37f0e392a1fc1af53eaf
7
- data.tar.gz: 42d581654c0c7d8a1262739b499ad198b34841c51ce8e8f07a5a02d5fef690306274a23d73efa9dbb811e929c79d22d303541753af7aabb8d37ed42684045d54
6
+ metadata.gz: 932921bdc28d09e5919c9cba0fbc59dfda61a601bdfb887346c3be22d6490300d59492713d0e9c8c129f5c523d42a37d7db04e7aff72fc17efbd28ac621f5aa6
7
+ data.tar.gz: d40cc99df0f8fa0f0742bbb94f486dfd51da08ba45dc97c6915efad72029cd896b522be507c09bf50039acac1c24500087808bf637894bb83181daa5b35959c2
@@ -1,5 +1,4 @@
1
1
  require 'linguist/generated'
2
- require 'linguist/language'
3
2
 
4
3
  require 'charlock_holmes'
5
4
  require 'escape_utils'
@@ -52,5 +52,20 @@ module Linguist
52
52
  def size
53
53
  File.size(@path)
54
54
  end
55
+
56
+ # Public: Get file extension.
57
+ #
58
+ # Returns a String.
59
+ def extension
60
+ # File.extname returns nil if the filename is an extension.
61
+ extension = File.extname(name)
62
+ basename = File.basename(name)
63
+ # Checks if the filename is an extension.
64
+ if extension.empty? && basename[0] == "."
65
+ basename
66
+ else
67
+ extension
68
+ end
69
+ end
55
70
  end
56
71
  end
@@ -54,7 +54,7 @@ module Linguist
54
54
  name == 'Gemfile.lock' ||
55
55
  minified_files? ||
56
56
  compiled_coffeescript? ||
57
- xcode_project_file? ||
57
+ xcode_file? ||
58
58
  generated_parser? ||
59
59
  generated_net_docfile? ||
60
60
  generated_net_designer_file? ||
@@ -67,14 +67,14 @@ module Linguist
67
67
  generated_by_zephir?
68
68
  end
69
69
 
70
- # Internal: Is the blob an XCode project file?
70
+ # Internal: Is the blob an Xcode file?
71
71
  #
72
- # Generated if the file extension is an XCode project
72
+ # Generated if the file extension is an Xcode
73
73
  # file extension.
74
74
  #
75
75
  # Returns true of false.
76
- def xcode_project_file?
77
- ['.xib', '.nib', '.storyboard', '.pbxproj', '.xcworkspacedata', '.xcuserstate'].include?(extname)
76
+ def xcode_file?
77
+ ['.nib', '.xcworkspacedata', '.xcuserstate'].include?(extname)
78
78
  end
79
79
 
80
80
  # Internal: Is the blob minified files?
@@ -256,3 +256,4 @@ module Linguist
256
256
  end
257
257
  end
258
258
  end
259
+
@@ -9,6 +9,8 @@ end
9
9
  require 'linguist/classifier'
10
10
  require 'linguist/heuristics'
11
11
  require 'linguist/samples'
12
+ require 'linguist/file_blob'
13
+ require 'linguist/blob_helper'
12
14
 
13
15
  module Linguist
14
16
  # Language names that are recognizable by GitHub. Defined languages
@@ -109,7 +111,8 @@ module Linguist
109
111
  # A bit of an elegant hack. If the file is executable but extensionless,
110
112
  # append a "magic" extension so it can be classified with other
111
113
  # languages that have shebang scripts.
112
- if File.extname(name).empty? && blob.mode && (blob.mode.to_i(8) & 05) == 05
114
+ extension = FileBlob.new(name).extension
115
+ if extension.empty? && blob.mode && (blob.mode.to_i(8) & 05) == 05
113
116
  name += ".script!"
114
117
  end
115
118
 
@@ -189,7 +192,8 @@ module Linguist
189
192
  #
190
193
  # Returns all matching Languages or [] if none were found.
191
194
  def self.find_by_filename(filename)
192
- basename, extname = File.basename(filename), File.extname(filename)
195
+ basename = File.basename(filename)
196
+ extname = FileBlob.new(filename).extension
193
197
  langs = @filename_index[basename] +
194
198
  @extension_index[extname]
195
199
  langs.compact.uniq
@@ -1345,7 +1345,7 @@ MiniD: # Legacy
1345
1345
  Mirah:
1346
1346
  type: programming
1347
1347
  lexer: Ruby
1348
- search_term: ruby
1348
+ search_term: mirah
1349
1349
  color: "#c7a938"
1350
1350
  extensions:
1351
1351
  - .druby
@@ -740,6 +740,9 @@
740
740
  "Nginx": [
741
741
  "nginx.conf"
742
742
  ],
743
+ "PHP": [
744
+ ".php"
745
+ ],
743
746
  "Perl": [
744
747
  "ack"
745
748
  ],
@@ -782,6 +785,9 @@
782
785
  ".gvimrc",
783
786
  ".vimrc"
784
787
  ],
788
+ "XML": [
789
+ ".cproject"
790
+ ],
785
791
  "YAML": [
786
792
  ".gemrc"
787
793
  ],
@@ -791,8 +797,8 @@
791
797
  "exception.zep.php"
792
798
  ]
793
799
  },
794
- "tokens_total": 629226,
795
- "languages_total": 867,
800
+ "tokens_total": 630435,
801
+ "languages_total": 869,
796
802
  "tokens": {
797
803
  "ABAP": {
798
804
  "*/**": 1,
@@ -49935,7 +49941,7 @@
49935
49941
  },
49936
49942
  "PHP": {
49937
49943
  "<": 11,
49938
- "php": 12,
49944
+ "php": 14,
49939
49945
  "namespace": 28,
49940
49946
  "Symfony": 24,
49941
49947
  "Component": 24,
@@ -50659,6 +50665,19 @@
50659
50665
  "base_url": 1,
50660
50666
  "php_filter_info": 1,
50661
50667
  "filters": 2,
50668
+ "SHEBANG#!php": 4,
50669
+ "<?>": 1,
50670
+ "aMenuLinks": 1,
50671
+ "Array": 13,
50672
+ "Blog": 1,
50673
+ "SITE_DIR": 4,
50674
+ "Photos": 1,
50675
+ "photo": 1,
50676
+ "About": 1,
50677
+ "me": 1,
50678
+ "about": 1,
50679
+ "Contact": 1,
50680
+ "contacts": 1,
50662
50681
  "Field": 9,
50663
50682
  "FormField": 3,
50664
50683
  "ArrayAccess": 1,
@@ -50953,7 +50972,6 @@
50953
50972
  "isUnique": 1,
50954
50973
  "is_bool": 1,
50955
50974
  "sql": 1,
50956
- "SHEBANG#!php": 3,
50957
50975
  "echo": 2,
50958
50976
  "Yii": 3,
50959
50977
  "console": 3,
@@ -67048,9 +67066,9 @@
67048
67066
  "return": 1
67049
67067
  },
67050
67068
  "XML": {
67051
- "<?xml>": 11,
67052
- "version=": 17,
67053
- "encoding=": 7,
67069
+ "<?xml>": 12,
67070
+ "version=": 21,
67071
+ "encoding=": 8,
67054
67072
  "<Project>": 7,
67055
67073
  "ToolsVersion=": 6,
67056
67074
  "DefaultTargets=": 5,
@@ -67127,6 +67145,94 @@
67127
67145
  "<Compile>": 10,
67128
67146
  "<None>": 5,
67129
67147
  "</Project>": 7,
67148
+ "standalone=": 1,
67149
+ "<?fileVersion>": 1,
67150
+ "4": 1,
67151
+ "0": 2,
67152
+ "<cproject>": 1,
67153
+ "storage_type_id=": 1,
67154
+ "<storageModule>": 14,
67155
+ "moduleId=": 14,
67156
+ "<cconfiguration>": 2,
67157
+ "id=": 141,
67158
+ "buildSystemId=": 2,
67159
+ "name=": 270,
67160
+ "<externalSettings/>": 2,
67161
+ "<extensions>": 2,
67162
+ "<extension>": 12,
67163
+ "point=": 12,
67164
+ "</extensions>": 2,
67165
+ "</storageModule>": 7,
67166
+ "<configuration>": 2,
67167
+ "artifactName=": 2,
67168
+ "buildArtefactType=": 2,
67169
+ "buildProperties=": 2,
67170
+ "cleanCommand=": 2,
67171
+ "description=": 4,
67172
+ "cdt": 2,
67173
+ "managedbuild": 2,
67174
+ "config": 2,
67175
+ "gnu": 2,
67176
+ "exe": 2,
67177
+ "debug": 1,
67178
+ "1803931088": 1,
67179
+ "parent=": 2,
67180
+ "<folderInfo>": 2,
67181
+ "resourcePath=": 2,
67182
+ "<toolChain>": 2,
67183
+ "superClass=": 42,
67184
+ "<targetPlatform>": 2,
67185
+ "<builder>": 2,
67186
+ "buildPath=": 2,
67187
+ "keepEnvironmentInBuildfile=": 2,
67188
+ "managedBuildOn=": 2,
67189
+ "<tool>": 12,
67190
+ "<option>": 16,
67191
+ "value=": 11,
67192
+ "valueType=": 12,
67193
+ "<listOptionValue>": 4,
67194
+ "builtIn=": 4,
67195
+ "</option>": 4,
67196
+ "<inputType>": 8,
67197
+ "</tool>": 8,
67198
+ "defaultValue=": 2,
67199
+ "<additionalInput>": 4,
67200
+ "kind=": 6,
67201
+ "paths=": 4,
67202
+ "</inputType>": 2,
67203
+ "</toolChain>": 2,
67204
+ "</folderInfo>": 2,
67205
+ "<sourceEntries>": 2,
67206
+ "<entry>": 2,
67207
+ "flags=": 2,
67208
+ "</sourceEntries>": 2,
67209
+ "</configuration>": 2,
67210
+ "</cconfiguration>": 2,
67211
+ "release": 1,
67212
+ "32754498": 1,
67213
+ "<project>": 2,
67214
+ "projectType=": 1,
67215
+ "<autodiscovery>": 5,
67216
+ "enabled=": 125,
67217
+ "problemReportingEnabled=": 5,
67218
+ "selectedProfileId=": 5,
67219
+ "<profile>": 40,
67220
+ "<buildOutputProvider>": 40,
67221
+ "<openAction>": 40,
67222
+ "filePath=": 40,
67223
+ "<parser>": 80,
67224
+ "</buildOutputProvider>": 40,
67225
+ "<scannerInfoProvider>": 40,
67226
+ "<runAction>": 40,
67227
+ "arguments=": 40,
67228
+ "command=": 40,
67229
+ "useDefault=": 40,
67230
+ "</scannerInfoProvider>": 40,
67231
+ "</profile>": 40,
67232
+ "<scannerConfigBuildInfo>": 4,
67233
+ "instanceId=": 4,
67234
+ "</scannerConfigBuildInfo>": 4,
67235
+ "</cproject>": 1,
67130
67236
  "<SchemaVersion>": 2,
67131
67237
  "</SchemaVersion>": 2,
67132
67238
  "cfa7a11": 1,
@@ -67174,8 +67280,6 @@
67174
67280
  "FSharp": 1,
67175
67281
  "</Otherwise>": 1,
67176
67282
  "</Choose>": 1,
67177
- "<project>": 1,
67178
- "name=": 227,
67179
67283
  "xmlns": 2,
67180
67284
  "ea=": 2,
67181
67285
  "<description>": 4,
@@ -67230,14 +67334,12 @@
67230
67334
  "application": 2,
67231
67335
  "<ea:build>": 1,
67232
67336
  "<ea:property>": 1,
67233
- "value=": 1,
67234
67337
  "<ea:plugin>": 1,
67235
67338
  "</ea:build>": 1,
67236
67339
  "</info>": 1,
67237
67340
  "<configurations>": 1,
67238
67341
  "<conf>": 2,
67239
67342
  "visibility=": 2,
67240
- "description=": 2,
67241
67343
  "</configurations>": 1,
67242
67344
  "<dependencies>": 1,
67243
67345
  "<dependency>": 4,
@@ -69756,7 +69858,7 @@
69756
69858
  "Ox": 1006,
69757
69859
  "Oxygene": 157,
69758
69860
  "PAWN": 3263,
69759
- "PHP": 20724,
69861
+ "PHP": 20754,
69760
69862
  "Pan": 130,
69761
69863
  "Parrot Assembly": 6,
69762
69864
  "Parrot Internal Representation": 5,
@@ -69822,7 +69924,7 @@
69822
69924
  "Visual Basic": 581,
69823
69925
  "Volt": 388,
69824
69926
  "XC": 24,
69825
- "XML": 7057,
69927
+ "XML": 8236,
69826
69928
  "XProc": 22,
69827
69929
  "XQuery": 801,
69828
69930
  "XSLT": 44,
@@ -69956,7 +70058,7 @@
69956
70058
  "Ox": 3,
69957
70059
  "Oxygene": 1,
69958
70060
  "PAWN": 1,
69959
- "PHP": 9,
70061
+ "PHP": 10,
69960
70062
  "Pan": 1,
69961
70063
  "Parrot Assembly": 1,
69962
70064
  "Parrot Internal Representation": 1,
@@ -70022,7 +70124,7 @@
70022
70124
  "Visual Basic": 3,
70023
70125
  "Volt": 1,
70024
70126
  "XC": 1,
70025
- "XML": 13,
70127
+ "XML": 14,
70026
70128
  "XProc": 1,
70027
70129
  "XQuery": 1,
70028
70130
  "XSLT": 1,
@@ -70035,5 +70137,5 @@
70035
70137
  "fish": 3,
70036
70138
  "wisp": 1
70037
70139
  },
70038
- "md5": "cedc5d3fde7e7b87467bdf820d674b95"
70140
+ "md5": "1edee1d2c454fb877027ae980cd163ef"
70039
70141
  }
@@ -1,3 +1,3 @@
1
1
  module Linguist
2
- VERSION = "3.0.3"
2
+ VERSION = "3.1.0"
3
3
  end
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-linguist
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-07 00:00:00.000000000 Z
11
+ date: 2014-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: charlock_holmes
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.7.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.7.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: escape_utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.0.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.0.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mime-types
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.19'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.19'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pygments.rb
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.6.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.6.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rugged
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.21.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.21.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: json
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mocha
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: yajl-ruby
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  description: We use this library at GitHub to detect blob languages, highlight code,
@@ -145,6 +145,8 @@ executables:
145
145
  extensions: []
146
146
  extra_rdoc_files: []
147
147
  files:
148
+ - bin/linguist
149
+ - lib/linguist.rb
148
150
  - lib/linguist/blob_helper.rb
149
151
  - lib/linguist/classifier.rb
150
152
  - lib/linguist/file_blob.rb
@@ -161,8 +163,6 @@ files:
161
163
  - lib/linguist/tokenizer.rb
162
164
  - lib/linguist/vendor.yml
163
165
  - lib/linguist/version.rb
164
- - lib/linguist.rb
165
- - bin/linguist
166
166
  homepage: https://github.com/github/linguist
167
167
  licenses:
168
168
  - MIT
@@ -173,17 +173,17 @@ require_paths:
173
173
  - lib
174
174
  required_ruby_version: !ruby/object:Gem::Requirement
175
175
  requirements:
176
- - - '>='
176
+ - - ">="
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  requirements:
181
- - - '>='
181
+ - - ">="
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
184
  requirements: []
185
185
  rubyforge_project:
186
- rubygems_version: 2.0.3
186
+ rubygems_version: 2.2.2
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: GitHub Language detection