image_tinify 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/exe/image_tinify +17 -2
- data/lib/command.rb +1 -0
- data/lib/image_tinify.rb +0 -1
- data/lib/image_tinify/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 511ab2be46434d57becaf337d643551fa8c87da1244ccbb6d5795e1cea4cd44a
|
4
|
+
data.tar.gz: 3350ffc65f92b0b50e6e7bb8fdc51ce0bbf7d4aa4c6661bb8ea2b6c30d0cc3b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39288cbb277b06f6606d893f7632bf0abf39dee45b9d3fb56526a4d5d786f002d2f745a34d16ea0b894f9b5260936c18e0ef88368e3aeb5f440e45ea90fcd1bc
|
7
|
+
data.tar.gz: b9bddbbe9a527c28ab3e93e037237b989bd406769965fd9c0c6782be8615e0a4876973107ece9c6ae418b59d7bcfe512df1119ebbb75e2227aee4eaa81a514b8
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
image_tinify (1.0.
|
4
|
+
image_tinify (1.0.1)
|
5
5
|
chunky_png (~> 1.3.11)
|
6
6
|
claide (~> 1.0.3)
|
7
7
|
tinify (~> 1.5.0)
|
@@ -9,7 +9,7 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
chunky_png (1.3.
|
12
|
+
chunky_png (1.3.14)
|
13
13
|
claide (1.0.3)
|
14
14
|
httpclient (2.8.3)
|
15
15
|
rake (12.3.2)
|
data/exe/image_tinify
CHANGED
@@ -11,8 +11,9 @@ ImageTinify::show_version(argv)
|
|
11
11
|
|
12
12
|
should_list = argv.arguments.include?('list')
|
13
13
|
should_compress = argv.arguments.include?('compress')
|
14
|
+
should_mark = argv.arguments.include?('mark')
|
14
15
|
|
15
|
-
ImageTinify::show_help if !(should_list || should_compress)
|
16
|
+
ImageTinify::show_help if !(should_list || should_compress || should_mark)
|
16
17
|
|
17
18
|
key = argv.option('key')
|
18
19
|
key ||= ImageTinify::random_key if should_compress
|
@@ -29,6 +30,8 @@ images = []
|
|
29
30
|
uncompressed_images = []
|
30
31
|
# 本次压缩的图片
|
31
32
|
compress_images = []
|
33
|
+
# 本次标记的图片
|
34
|
+
markted_images = []
|
32
35
|
|
33
36
|
# 获取所有图片
|
34
37
|
image_tinify.find_all_images root, proc { |path|
|
@@ -42,18 +45,29 @@ image_tinify.find_uncompressed_images(images) { |path|
|
|
42
45
|
|
43
46
|
begin
|
44
47
|
uncompressed_images.each { |path|
|
48
|
+
rel_path = image_tinify.relative_path(path)
|
45
49
|
if should_compress
|
46
50
|
size_before = File.stat(path).size
|
51
|
+
puts "- Compressing #{rel_path}"
|
47
52
|
if image_tinify.compress_image(path)
|
48
53
|
compress_images << path
|
49
54
|
image_tinify.mark_compressed(path)
|
50
55
|
size_after = File.stat(path).size
|
51
56
|
puts " 压缩成功, [#{size_before}] => [#{size_after}]"
|
57
|
+
puts " [WARNING] Size increased" if size_before < size_after
|
52
58
|
else
|
53
59
|
puts " 压缩失败"
|
54
60
|
end
|
61
|
+
elsif should_mark
|
62
|
+
puts "- Marking #{rel_path}"
|
63
|
+
if image_tinify.mark_compressed(path)
|
64
|
+
puts " 标记为已压缩"
|
65
|
+
else
|
66
|
+
puts " 标记失败"
|
67
|
+
end
|
68
|
+
markted_images << path
|
55
69
|
else
|
56
|
-
puts
|
70
|
+
puts "- Uncompressed #{rel_path}"
|
57
71
|
end
|
58
72
|
}
|
59
73
|
rescue Exception => e
|
@@ -64,4 +78,5 @@ ensure
|
|
64
78
|
puts " 图片总数: #{images.count}"
|
65
79
|
puts " 未压缩: #{uncompressed_images.count}"
|
66
80
|
puts " 本次压缩: #{compress_images.count}" if should_compress
|
81
|
+
puts " 本次标记: #{markted_images.count}" if should_mark
|
67
82
|
end
|
data/lib/command.rb
CHANGED
data/lib/image_tinify.rb
CHANGED
data/lib/image_tinify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_tinify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiangzhuoyi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chunky_png
|
@@ -78,7 +78,7 @@ homepage: http://code.kaipao.cc/ios-team/image_tinify
|
|
78
78
|
licenses:
|
79
79
|
- MIT
|
80
80
|
metadata: {}
|
81
|
-
post_install_message:
|
81
|
+
post_install_message:
|
82
82
|
rdoc_options: []
|
83
83
|
require_paths:
|
84
84
|
- lib
|
@@ -93,8 +93,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
|
-
rubygems_version: 3.
|
97
|
-
signing_key:
|
96
|
+
rubygems_version: 3.0.8
|
97
|
+
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Compress image.
|
100
100
|
test_files: []
|