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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b572b2ab3cbb809acfc3f0679fc268055e454b97
4
- data.tar.gz: e039f988782ceefde38c4970d024e440a1b4f976
3
+ metadata.gz: 9d51eb4e1c6c38a0242cee7bf3edf9282493dfeb
4
+ data.tar.gz: c3f41c8c6c0d7bfdbf4568fe5fc78b390f1f96dd
5
5
  SHA512:
6
- metadata.gz: a3d9a569e5d9bfbb022af56f034d6e2823ad63cca3c8fb615c7ca958246e97b7cd196a7cdb786da4a2687d58aeb7657fb3b7ad76a43984541019c465b68093c1
7
- data.tar.gz: 728fed8c31c2fae34349571ae0da8fb7c8045b102ac497d101ab033a3a9af9da51d3a70227df343f8228445068a4daf59947b5fd61877b6b5b0523c13e2ca1d1
6
+ metadata.gz: 5061e1c373624f829f482c5eed865907a81d4773574b8a7dae464a5ece36894383bdf3ef0c5d92df1ab6d5e16331480043707a43c22813424df328e85108789d
7
+ data.tar.gz: 3e430377cfaa662aec07078714a0f0f9156ce98e351fdc95a0329bb8517bee7440f3d31e897863fc0173d4c4c6a27650c88999ae7c7d9a0eb3a021405a1522a9
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IMGLint
4
- VERSION = "0.0.8".freeze
4
+ VERSION = "0.0.9".freeze
5
5
  end
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.8
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-07 00:00:00.000000000 Z
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.2.5
105
+ rubygems_version: 2.5.1
92
106
  signing_key:
93
107
  specification_version: 4
94
108
  summary: IMG linter