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 +4 -4
- data/bin/img-lint +39 -18
- data/config/default.yml +2 -0
- 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: 29860afa014eac2d56512a7737fe74b99494f0f3
|
4
|
+
data.tar.gz: 693f34d70655716e14a649ad0900654530ebb201
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
11
|
-
|
12
|
-
opts.banner = "Usage: img-lint [options]"
|
10
|
+
if ARGV.first == "install"
|
11
|
+
require "fileutils"
|
13
12
|
|
14
|
-
|
15
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
end.parse!
|
24
|
+
opts.banner = unindent(<<-TEXT)
|
25
|
+
img-lint help
|
26
26
|
|
27
|
-
|
28
|
-
config.merge!(options)
|
27
|
+
1. img-lint install
|
29
28
|
|
30
|
-
|
29
|
+
This will copy default config to your local .img-lint.yml file
|
31
30
|
|
32
|
-
|
33
|
-
|
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
data/lib/img_lint/version.rb
CHANGED