cocoapods-hbh 0.1.8 → 0.2.0

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: 68cb2128e5a916a9c9e8b1e8b030facbfce360cb253b7d3efd9317c55e687521
4
- data.tar.gz: e20133b18410c6f992a2987358f93f2d96a264bae8ce9d0416b4d0bcf6b79ec8
3
+ metadata.gz: aaa9a46dbd35d6f731cb779c53d98fc6ce5bdf2a7c7b07cd8a524cca704a22f9
4
+ data.tar.gz: 8daba11c634b15cdb5aaf5f0c9f0d91d1c9d7038d64b4ed86d64abc7794d574f
5
5
  SHA512:
6
- metadata.gz: 6a0a64f0d1c9f39e727bb88e2c96fc5ef2b586bff21b55ca551a6fdd8bb0d5cb7d81dea2a2bde1d48f4673e22f828e79225664029bd8f39e1b4ecd3327e5cd80
7
- data.tar.gz: 8998baf5668e58f1ee26ac2d19ba0def65813a8ebcc572e78a762e138fd81c877d70ee9916f990d7f497e2d06ca5c6032cd2782e470f705ca875f072d63530aa
6
+ metadata.gz: 9c6467fdf43be71dac1f3ec3281fb8e1ddce111259a3b5135a9db2421bbababaa849be9dea547671294be7894e11b5fc7f92328b37a1d603e7251b72fd2d9df5
7
+ data.tar.gz: b862ebfb616bd9a4d0b5250922d0943b6e33c14629a11139d11fcc17939640c8808eb28b61d898df986ebeffab671c8772f6975de25d14e7b64265f3331a1022
@@ -83,12 +83,12 @@ module Pod
83
83
  end
84
84
  end
85
85
  if moduleTag != nil and !moduleTag.empty?
86
- result = system("cd #{path_module} && git fetch && git checkout #{moduleTag}")
86
+ result = system("cd #{path_module} && git fetch origin tag #{moduleTag} && git checkout #{moduleTag}")
87
87
  raise "发生错误" unless result
88
88
  # `cd #{path_module} && git fetch && git checkout #{moduleTag}`
89
89
  # Pod::UI.puts "发生错误#{result}".red
90
90
  else
91
- result = system("cd #{path_module} && git fetch && git checkout #{moduleBranch} && git pull origin #{moduleBranch}")
91
+ result = system("cd #{path_module} && git fetch origin #{moduleBranch} && git checkout #{moduleBranch} && git pull origin #{moduleBranch}")
92
92
  raise "发生错误" unless result
93
93
 
94
94
  # Pod::UI.puts "发生错误#{result}".red
@@ -1,3 +1,3 @@
1
1
  module CocoapodsHbh
2
- VERSION = "0.1.8"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -19,8 +19,17 @@ module Pod
19
19
  end
20
20
  end
21
21
 
22
+ def findGitPath
23
+ _git_path = ".git"
24
+ if !File.directory?(_git_path)
25
+ _git_path = "../.git"
26
+ end
27
+ _git_path
28
+ end
29
+
22
30
  def copyFileToGit (file_name)
23
- if !File.directory?(".git")
31
+ git_path = findGitPath()
32
+ if !File.directory?(git_path)
24
33
  Pod::UI.puts "没有发现git工程"
25
34
  return
26
35
  end
@@ -28,44 +37,64 @@ module Pod
28
37
  # 在当前ruby项目的githook文件copy到项目里去做拦截
29
38
  # 如果项目里配置了 .git-hooks 文件件,将把里面的内容copy到项目里去做拦截
30
39
  # 项目里的.git-hooks 配置优先
31
- git_hooks = "#{File.dirname(__FILE__)}/../../script_source/#{file_name}"
40
+ hooks_path = "#{File.dirname(__FILE__)}/../../script_source/#{file_name}"
32
41
 
33
- if !File.exist?(git_hooks)
42
+ if !File.exist?(hooks_path)
34
43
  Pod::UI.puts "同步文件不存在"
35
44
  return
36
45
  end
46
+ git_hooks_path = "#{git_path}/hooks"
47
+ if !File.exist?(git_hooks_path)
48
+ FileUtils.mkdir_p git_hooks_path
49
+ end
37
50
 
38
- # git_hooks = '.git-hooks/.' unless Dir['.git-hooks/*'].empty?
51
+ copyHookAndChmod(hooks_path, git_hooks_path, file_name)
52
+ findSubmodulesHooks(hooks_path, git_path, file_name)
53
+ end
39
54
 
40
- if !File.directory?(".git/hooks")
41
- FileUtils.mkdir ".git/hooks"
55
+ def findSubmodulesHooks (git_hooks_path, git_path, file_name)
56
+ subGitHookPath = walk(git_path)
57
+ subGitHookPath.each do |path|
58
+ copyHookAndChmod(git_hooks_path, path, file_name)
42
59
  end
43
- path = ".git/hooks"
60
+ end
44
61
 
45
- FileUtils.cp_r(git_hooks, path)
46
-
47
- FileUtils.chmod("+x", "#{path}/#{file_name}")
48
- # Dir.open(path).each do |p|
49
- # filename = File.basename(p, File.extname(p))
50
- # if File.extname(p) == ".sh"
51
- # FileUtils.mv("#{path}/#{p}", "#{path}/#{filename}")
52
- # end
53
- # FileUtils.chmod("+x", "#{path}/#{filename}")
54
- # end
62
+ def copyHookAndChmod(git_hooks_path, path, file_name)
63
+ if File.exist?("#{path}/#{file_name}")
64
+ Pod::UI.puts "文件已经存在#{path}/#{file_name}"
65
+ return
66
+ else
67
+ FileUtils.cp_r(git_hooks_path, path)
68
+ FileUtils.chmod("+x", "#{path}/#{file_name}")
69
+ end
70
+
71
+ end
72
+
73
+ def walk (startPath, dirName = "hooks", first = true)
74
+ @pathArr=Array.new unless !first
75
+ Dir.foreach(startPath) do |x|
76
+ path = File.join(startPath, x)
77
+ if x =="." or x ==".."
78
+ next
79
+ elsif File.directory?(path)
80
+ if path.include?(dirName)
81
+ @pathArr << path
82
+ end
83
+ walk(path, dirName, false)
84
+ end
85
+ end
86
+ @pathArr
55
87
  end
56
88
 
57
89
  def deleteFileInGit (file_name)
58
- if !File.directory?(".git")
90
+ if !File.directory?(findGitPath())
59
91
  Pod::UI.puts "没有发现git工程"
60
92
  return
61
93
  end
62
-
63
94
  path = ".git/hooks/#{file_name}"
64
95
  if File.exist?(path)
65
96
  FileUtils.rm(path)
66
97
  end
67
-
68
-
69
98
  end
70
99
  end
71
100
  end
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.8
4
+ version: 0.2.0
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-23 00:00:00.000000000 Z
11
+ date: 2022-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel