mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 20:38:47 +00:00
Detect minified JS
This commit is contained in:
@@ -63,7 +63,14 @@ module Linguist
|
|||||||
end
|
end
|
||||||
|
|
||||||
def generated?
|
def generated?
|
||||||
['.xib', '.nib', '.pbxproj'].include?(pathname.extname)
|
if ['.xib', '.nib', '.pbxproj'].include?(pathname.extname)
|
||||||
|
true
|
||||||
|
elsif pathname.extname == '.js'
|
||||||
|
# JS is minified if any lines are longer than 1000c
|
||||||
|
lines.any? { |l| l.length > 1000 }
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vendored_paths = YAML.load_file(File.expand_path("../vendor.yml", __FILE__))
|
vendored_paths = YAML.load_file(File.expand_path("../vendor.yml", __FILE__))
|
||||||
|
|||||||
8936
test/fixtures/blob/jquery-1.6.1.js
vendored
Normal file
8936
test/fixtures/blob/jquery-1.6.1.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
18
test/fixtures/blob/jquery-1.6.1.min.js
vendored
Normal file
18
test/fixtures/blob/jquery-1.6.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -112,6 +112,10 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
assert blob("MainMenu.xib").generated?
|
assert blob("MainMenu.xib").generated?
|
||||||
assert blob("MainMenu.nib").generated?
|
assert blob("MainMenu.nib").generated?
|
||||||
assert blob("project.pbxproj").generated?
|
assert blob("project.pbxproj").generated?
|
||||||
|
|
||||||
|
# Minified JS
|
||||||
|
assert !blob("jquery-1.6.1.js").generated?
|
||||||
|
assert blob("jquery-1.6.1.min.js").generated?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_vendored
|
def test_vendored
|
||||||
|
|||||||
Reference in New Issue
Block a user