img-lint 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/img-lint +1 -1
- data/lib/img_lint/linter.rb +9 -7
- data/lib/img_lint/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cef312bda480bd565a3fa0129f7e0a2bdb5acba
|
4
|
+
data.tar.gz: a6bb76b6693cf0e87d0a3071ba08c825a5103e17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cfd16d63dc42a9702de342c553a4b0d5c557b0a4a9faaf715871fc78c34f6409feee37ab655db6a8d075b54ea5fe8474225bbb58fc582b416c08ebb38aef369
|
7
|
+
data.tar.gz: 583aaa380ec3aa287f09af1b442e76a4f74d227f484661537d658007a7d435e96e34501b098847ef368850c40ec8b1a79cd6d8e09ebe95ee039ececd8a8c3a19
|
data/bin/img-lint
CHANGED
data/lib/img_lint/linter.rb
CHANGED
@@ -28,8 +28,12 @@ module IMGLint
|
|
28
28
|
|
29
29
|
puts "No images found in #{path}" if verbose && images.empty?
|
30
30
|
|
31
|
-
images.
|
32
|
-
|
31
|
+
images.each_with_object({}) do |file, o|
|
32
|
+
image_size = File.new(file).size / 1024
|
33
|
+
|
34
|
+
if !excluded_file?(file) && image_size > config["max_file_size"]
|
35
|
+
o[file] = image_size
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
@@ -54,15 +58,13 @@ module IMGLint
|
|
54
58
|
|
55
59
|
puts "Suspicious images:"
|
56
60
|
|
57
|
-
|
58
|
-
|
59
|
-
hash
|
60
|
-
end
|
61
|
+
longest_image_path = fat_images.keys.max { |k| k.size }.size
|
62
|
+
longest_file_size = fat_images.values.max { |v| v.to_s.size }.size
|
61
63
|
|
62
64
|
fat_images.sort_by(&:last).reverse.each do |image, file_size|
|
63
65
|
image = image.sub(Dir.pwd, "") if Dir.pwd == path
|
64
66
|
|
65
|
-
puts [image, "#{file_size}Kb"].join("\t")
|
67
|
+
puts [image.ljust(longest_image_path), "#{file_size}Kb".rjust(longest_file_size)].join("\t")
|
66
68
|
end
|
67
69
|
end
|
68
70
|
end
|
data/lib/img_lint/version.rb
CHANGED