cocoapods-hbh 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68cb2128e5a916a9c9e8b1e8b030facbfce360cb253b7d3efd9317c55e687521
|
4
|
+
data.tar.gz: e20133b18410c6f992a2987358f93f2d96a264bae8ce9d0416b4d0bcf6b79ec8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a0a64f0d1c9f39e727bb88e2c96fc5ef2b586bff21b55ca551a6fdd8bb0d5cb7d81dea2a2bde1d48f4673e22f828e79225664029bd8f39e1b4ecd3327e5cd80
|
7
|
+
data.tar.gz: 8998baf5668e58f1ee26ac2d19ba0def65813a8ebcc572e78a762e138fd81c877d70ee9916f990d7f497e2d06ca5c6032cd2782e470f705ca875f072d63530aa
|
@@ -2,25 +2,26 @@ require 'cocoapods-hbh/git_hooks/githooks_sync'
|
|
2
2
|
|
3
3
|
module Pod
|
4
4
|
class Command
|
5
|
-
class
|
6
|
-
|
5
|
+
class Hbh < Command
|
6
|
+
class Git < Hbh
|
7
|
+
self.summary = '自定的githook相关命令'
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
self.description = <<-DESC
|
10
|
+
自定的githook相关命令.
|
11
|
+
DESC
|
12
|
+
|
13
|
+
# self.arguments = "hbhgit"
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
def initialize(argv)
|
16
|
+
super
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
def run
|
20
|
+
UI.puts "同步Git相关命令"
|
21
|
+
GitHooksSync.new.sync()
|
22
|
+
UI.puts "同步完成"
|
23
|
+
end
|
22
24
|
end
|
23
|
-
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
@@ -3,6 +3,7 @@ require 'cocoapods-hbh/command/hbh'
|
|
3
3
|
require 'cocoapods-hbh/git_hooks/githooks_sync'
|
4
4
|
|
5
5
|
module CocoapodsHBHGitHooks
|
6
|
+
include Pod
|
6
7
|
Pod::HooksManager.register('cocoapods-hbh', :post_update) do |context|
|
7
8
|
GitHooksSync.new.sync()
|
8
9
|
Pod::UI.puts "恭喜你, 你已经 `pod update` 结束了."
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
require 'tinify'
|
2
3
|
require 'yaml'
|
3
4
|
class TinyPngImage
|
@@ -24,22 +25,24 @@ class TinyPngImage
|
|
24
25
|
end
|
25
26
|
### 根据条件开始使用tinypng压缩图片
|
26
27
|
def start_tinypng
|
27
|
-
|
28
|
+
tinypng_key = get_config()
|
28
29
|
|
29
|
-
if !
|
30
|
-
Tinify.key =
|
30
|
+
if !tinypng_key.nil? && !tinypng_key.empty?
|
31
|
+
Tinify.key = tinypng_key
|
31
32
|
# diffFile = %x(git diff --cached --name-only --diff-filter=ACM)
|
32
33
|
diffFile = %x(git diff --cached --name-only --diff-filter=ACM -- '*.jpg' '*.png' '*.jpeg')
|
33
34
|
diffArr = diffFile.split("\n")
|
34
35
|
imgArr = get_all_img(diffArr)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
if imgArr.count > 0
|
37
|
+
puts "开始使用tinypng压缩图片"
|
38
|
+
for item in imgArr do
|
39
|
+
fileSize =%x(du -sh #{item})
|
40
|
+
puts "原文件大小:#{fileSize}"
|
41
|
+
Tinify.from_file("#{item}").to_file("#{item}")
|
42
|
+
addChangeFile = %x(git add #{item})
|
43
|
+
optimizedFileSize =%x(du -sh #{item})
|
44
|
+
puts "压缩后文件:#{optimizedFileSize}"
|
45
|
+
end
|
43
46
|
end
|
44
47
|
else
|
45
48
|
puts "请到.git/hbh_git_config文件里配置tinypng_key"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-hbh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zanju
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|