img-lint 0.0.9 → 0.0.10

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: 9d51eb4e1c6c38a0242cee7bf3edf9282493dfeb
4
- data.tar.gz: c3f41c8c6c0d7bfdbf4568fe5fc78b390f1f96dd
3
+ metadata.gz: e9c41c67d77f9716868c1b61f9fed28a93e45933
4
+ data.tar.gz: 0f0266bbb6b9a81ad4966f5bb6ddfb66e25e2e67
5
5
  SHA512:
6
- metadata.gz: 5061e1c373624f829f482c5eed865907a81d4773574b8a7dae464a5ece36894383bdf3ef0c5d92df1ab6d5e16331480043707a43c22813424df328e85108789d
7
- data.tar.gz: 3e430377cfaa662aec07078714a0f0f9156ce98e351fdc95a0329bb8517bee7440f3d31e897863fc0173d4c4c6a27650c88999ae7c7d9a0eb3a021405a1522a9
6
+ metadata.gz: d49c2ac142dba6585f3ece66e5a8546b06e74b0ae82746716239913ec2b989a62a1c467c92d2ce70835f1e598a16f08f8bb0c9d58a5e378851acfb57dc7319b0
7
+ data.tar.gz: 3e5646b52d26f8715cedd46572870c0d9ab6c8afdabb85deb64c916a0e95824423bacfd9e520aaf4535b1325fa530f2f69f092a4f2cebdc3fc91f5cef29aa2e7
@@ -11,8 +11,8 @@ module IMGLint
11
11
 
12
12
  class << self
13
13
  def load
14
- user_config = File.exist?(user_file) ? YAML.load(File.read(user_file)) : {}
15
- default_config = YAML.load(File.read(DEFAULT_FILE))
14
+ user_config = File.exist?(user_file) ? YAML.safe_load(File.read(user_file)) : {}
15
+ default_config = YAML.safe_load(File.read(DEFAULT_FILE))
16
16
 
17
17
  default_config.merge(user_config)
18
18
  end
@@ -35,7 +35,7 @@ module IMGLint
35
35
 
36
36
  def exclude_patterns
37
37
  @exclude_patterns ||= config.fetch("exclude", []).map! do |pattern|
38
- if pattern.start_with?('/')
38
+ if pattern.start_with?("/")
39
39
  pattern
40
40
  else
41
41
  File.expand_path(pattern, File.expand_path(Dir.pwd))
@@ -50,16 +50,16 @@ module IMGLint
50
50
  end
51
51
 
52
52
  def print_report(path, fat_images, verbose)
53
- if !fat_images.empty? && verbose
54
- puts "Suspicious images:"
53
+ return if fat_images.empty? || !verbose
55
54
 
56
- fat_images.each do |image|
57
- file_size = File.new(image).size / 1024
55
+ puts "Suspicious images:"
58
56
 
59
- image.sub!(Dir.pwd, "") if Dir.pwd == path
57
+ fat_images.each do |image|
58
+ file_size = File.new(image).size / 1024
60
59
 
61
- puts [image, "#{file_size}Kb"].join("\t")
62
- end
60
+ image.sub!(Dir.pwd, "") if Dir.pwd == path
61
+
62
+ puts [image, "#{file_size}Kb"].join("\t")
63
63
  end
64
64
  end
65
65
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rake"
4
+ require "rake/tasklib"
5
+
6
+ module IMGLint
7
+ # Rake task
8
+ #
9
+ class RakeTask < Rake::TaskLib
10
+ def initialize(name = :img_lint)
11
+ @name = name
12
+
13
+ define
14
+ end
15
+
16
+ private
17
+
18
+ def define
19
+ desc "img-lint"
20
+
21
+ task(@name) do |_task|
22
+ require "img_lint"
23
+
24
+ linter = IMGLint::Linter.new
25
+ fat_images = linter.lint
26
+
27
+ exit fat_images.empty? ? 0 : 2
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IMGLint
4
- VERSION = "0.0.9".freeze
4
+ VERSION = "0.0.10".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.9
4
+ version: 0.0.10
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 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,47 +25,47 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.12'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '12.3'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '12.3'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '12.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '12.3'
55
55
  - !ruby/object:Gem::Dependency
56
- name: byebug
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '3.0'
69
69
  description: img-lint detects big images in your project
70
70
  email:
71
71
  - makaroni4@gmail.com
@@ -81,6 +81,7 @@ files:
81
81
  - lib/img_lint/config.rb
82
82
  - lib/img_lint/constants.rb
83
83
  - lib/img_lint/linter.rb
84
+ - lib/img_lint/rake_task.rb
84
85
  - lib/img_lint/version.rb
85
86
  homepage: https://github.com/makaroni4/img-lint
86
87
  licenses:
@@ -102,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
103
  version: '0'
103
104
  requirements: []
104
105
  rubyforge_project:
105
- rubygems_version: 2.5.1
106
+ rubygems_version: 2.2.5
106
107
  signing_key:
107
108
  specification_version: 4
108
109
  summary: IMG linter