img-lint 0.0.10 → 0.0.11

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: e9c41c67d77f9716868c1b61f9fed28a93e45933
4
- data.tar.gz: 0f0266bbb6b9a81ad4966f5bb6ddfb66e25e2e67
3
+ metadata.gz: 29860afa014eac2d56512a7737fe74b99494f0f3
4
+ data.tar.gz: 693f34d70655716e14a649ad0900654530ebb201
5
5
  SHA512:
6
- metadata.gz: d49c2ac142dba6585f3ece66e5a8546b06e74b0ae82746716239913ec2b989a62a1c467c92d2ce70835f1e598a16f08f8bb0c9d58a5e378851acfb57dc7319b0
7
- data.tar.gz: 3e5646b52d26f8715cedd46572870c0d9ab6c8afdabb85deb64c916a0e95824423bacfd9e520aaf4535b1325fa530f2f69f092a4f2cebdc3fc91f5cef29aa2e7
6
+ metadata.gz: dd1027be47bd990671476e1bfd3e241256bb6f3b9406e3f599023de9f46c95904d1c6f1847b270b601c170909bee257029d613c07937a308a77e89ce83270bb7
7
+ data.tar.gz: 0454792e509e7da64964bd6b8b894324c52cdeb9dded9a465d2e11ef32fa44eb2d480c16694c406f6e6f981e30fedcfd8956de65a13c16f8c7157a6c4595a36a
data/bin/img-lint CHANGED
@@ -7,27 +7,48 @@ require "img_lint/config"
7
7
  require "img_lint/linter"
8
8
  require "optparse"
9
9
 
10
- options = {}
11
- OptionParser.new do |opts|
12
- opts.banner = "Usage: img-lint [options]"
10
+ if ARGV.first == "install"
11
+ require "fileutils"
13
12
 
14
- opts.on("-p", "--path PATH", "Path to a folder with images") do |v|
15
- options["path"] = v
16
- end
13
+ target_file = File.join(Dir.pwd, ".img-lint.yml")
14
+ config_file = File.join(File.expand_path(File.dirname(__FILE__)), "..", "config", "default.yml")
17
15
 
18
- opts.on("-m", "--max-size MAX_SIZE", "Max image size allowed, '150' by default (150Kb)") do |v|
19
- options["max_file_size"] = v.to_i
20
- end
16
+ FileUtils.cp(config_file, target_file)
17
+ else
18
+ options = {}
19
+ OptionParser.new do |opts|
20
+ def unindent(s)
21
+ s.gsub(/^#{s.scan(/^[ \t]+(?=\S)/).min}/, '')
22
+ end
21
23
 
22
- opts.on("-f", "--format IMAGE_FORMATS", "Image formats, 'jpg,png,gif' by default") do |v|
23
- options["image_formats"] = v
24
- end
25
- end.parse!
24
+ opts.banner = unindent(<<-TEXT)
25
+ img-lint help
26
26
 
27
- config = IMGLint::Config.load
28
- config.merge!(options)
27
+ 1. img-lint install
29
28
 
30
- path = config.delete("path")
29
+ This will copy default config to your local .img-lint.yml file
31
30
 
32
- linter = IMGLint::Linter.new(config: config)
33
- linter.lint(path: path)
31
+ 2. img-lint [options]
32
+ TEXT
33
+
34
+ opts.on("-p", "--path PATH", "Path to a folder with images") do |v|
35
+ options["path"] = v
36
+ end
37
+
38
+ opts.on("-m", "--max-size MAX_SIZE", "Max image size allowed, '150' by default (150Kb)") do |v|
39
+ options["max_file_size"] = v.to_i
40
+ end
41
+
42
+ opts.on("-f", "--format IMAGE_FORMATS", "Image formats, 'jpg,png,gif' by default") do |v|
43
+ options["image_formats"] = v
44
+ end
45
+ end.parse!
46
+
47
+ config = IMGLint::Config.load
48
+ config.merge!(options)
49
+
50
+ path = config.delete("path")
51
+
52
+ linter = IMGLint::Linter.new(config: config)
53
+ linter.lint(path: path)
54
+ end
data/config/default.yml CHANGED
@@ -1,2 +1,4 @@
1
1
  max_file_size: 150 # Kb
2
2
  image_formats: "jpg,png,gif"
3
+ exclude:
4
+ - "tmp/**/**"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IMGLint
4
- VERSION = "0.0.10".freeze
4
+ VERSION = "0.0.11".freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: img-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoli Makarevich