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: 2e1e1a7718b77767e54ace762fb5420384221cc8ae52cf9fa14a35b0c1a469f7
4
- data.tar.gz: 3889d0720f7f1bc0bd999359ff1913e9d6391b3c05bda0064895723a46bfb489
3
+ metadata.gz: 68cb2128e5a916a9c9e8b1e8b030facbfce360cb253b7d3efd9317c55e687521
4
+ data.tar.gz: e20133b18410c6f992a2987358f93f2d96a264bae8ce9d0416b4d0bcf6b79ec8
5
5
  SHA512:
6
- metadata.gz: 5b375db806bda54a709c9cf5694a0ac1def3ff3e3591f80e9ee20de7848d2da9601589de8d9bfa42e159771baa2712a6d49447a9712d0b2743d7a1bceed01d88
7
- data.tar.gz: 1f592af25e91098415c5d20052fe8644f2d4406a8b96dd07dfdf233cce934ce56fac8b23cffb55ee42ae2859f4f4a54a4cd0e94602d068a8eed68d06fc35d231
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 HbhGit < Command
6
- self.summary = '自定的githook相关命令'
5
+ class Hbh < Command
6
+ class Git < Hbh
7
+ self.summary = '自定的githook相关命令'
7
8
 
8
- self.description = <<-DESC
9
- 自定的githook相关命令.
10
- DESC
11
-
12
- self.arguments = "hbhgit"
9
+ self.description = <<-DESC
10
+ 自定的githook相关命令.
11
+ DESC
12
+
13
+ # self.arguments = "hbhgit"
13
14
 
14
- def initialize(argv)
15
- super
16
- end
15
+ def initialize(argv)
16
+ super
17
+ end
17
18
 
18
- def run
19
- UI.puts "同步Git相关命令"
20
- GitHooksSync.new.sync()
21
- UI.puts "同步完成"
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,3 @@
1
1
  module CocoapodsHbh
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -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
- is_turn_tinypng = get_config()
28
+ tinypng_key = get_config()
28
29
 
29
- if !is_turn_tinypng.nil? && !is_turn_tinypng.empty?
30
- Tinify.key = is_turn_tinypng
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
- puts "开始使用tinypng压缩图片"
36
- for item in imgArr do
37
- fileSize =%x(du -sh #{item})
38
- puts "原文件大小:#{fileSize}"
39
- Tinify.from_file("#{item}").to_file("#{item}")
40
- addChangeFile = %x(git add #{item})
41
- optimizedFileSize =%x(du -sh #{item})
42
- puts "压缩后文件:#{optimizedFileSize}"
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"
@@ -6,5 +6,6 @@ if [ -f ${path}/swiftlint.sh ]; then
6
6
  fi
7
7
  #判断Tinypng图片压缩文件是否存在
8
8
  if [ -f ${path}/imageTinypng.rb ]; then
9
+ ruby=$(which ruby)
9
10
  ruby .git/hooks/imageTinypng.rb
10
11
  fi
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.6
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-16 00:00:00.000000000 Z
11
+ date: 2022-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel