img-lint 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/img_lint/linter.rb +17 -1
- data/lib/img_lint/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d51eb4e1c6c38a0242cee7bf3edf9282493dfeb
|
4
|
+
data.tar.gz: c3f41c8c6c0d7bfdbf4568fe5fc78b390f1f96dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5061e1c373624f829f482c5eed865907a81d4773574b8a7dae464a5ece36894383bdf3ef0c5d92df1ab6d5e16331480043707a43c22813424df328e85108789d
|
7
|
+
data.tar.gz: 3e430377cfaa662aec07078714a0f0f9156ce98e351fdc95a0329bb8517bee7440f3d31e897863fc0173d4c4c6a27650c88999ae7c7d9a0eb3a021405a1522a9
|
data/lib/img_lint/linter.rb
CHANGED
@@ -29,7 +29,23 @@ module IMGLint
|
|
29
29
|
puts "No images found in #{path}" if verbose && images.empty?
|
30
30
|
|
31
31
|
images.select do |file|
|
32
|
-
File.new(file).size > config["max_file_size"] * 1024
|
32
|
+
!excluded_file?(file) && File.new(file).size > config["max_file_size"] * 1024
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def exclude_patterns
|
37
|
+
@exclude_patterns ||= config.fetch("exclude", []).map! do |pattern|
|
38
|
+
if pattern.start_with?('/')
|
39
|
+
pattern
|
40
|
+
else
|
41
|
+
File.expand_path(pattern, File.expand_path(Dir.pwd))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def excluded_file?(file_path)
|
47
|
+
exclude_patterns.any? do |pattern|
|
48
|
+
File.fnmatch?(pattern, file_path)
|
33
49
|
end
|
34
50
|
end
|
35
51
|
|
data/lib/img_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: img-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anatoli Makarevich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: img-lint detects big images in your project
|
56
70
|
email:
|
57
71
|
- makaroni4@gmail.com
|
@@ -88,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
102
|
version: '0'
|
89
103
|
requirements: []
|
90
104
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
105
|
+
rubygems_version: 2.5.1
|
92
106
|
signing_key:
|
93
107
|
specification_version: 4
|
94
108
|
summary: IMG linter
|