cocoapods-bb-PodAssistant 0.3.8.0 → 0.3.9.2
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 +4 -4
- data/README.md +19 -1
- data/bin/bb_tools +99 -0
- data/lib/cocoapods-bb-PodAssistant/command.rb +3 -1
- data/lib/cocoapods-bb-PodAssistant/gem_version.rb +1 -1
- data/lib/cocoapods-bb-PodAssistant/helpers/pod_module_helper.rb +14 -2
- data/lib/cocoapods-bb-PodAssistant/tools/class_unuse_finder.rb +129 -0
- data/lib/cocoapods-bb-PodAssistant/tools/count_code_line.rb +55 -0
- data/lib/cocoapods-bb-PodAssistant/tools/file_handle.rb +78 -0
- data/lib/cocoapods-bb-PodAssistant/tools/find_unuse_img.rb +132 -0
- data/lib/cocoapods-bb-PodAssistant/tools/get_size.rb +94 -0
- data/lib/cocoapods-bb-PodAssistant/tools/git_sets.rb +42 -0
- data/lib/cocoapods-bb-PodAssistant/tools/link_map.rb +381 -0
- data/lib/cocoapods-bb-PodAssistant/tools/podfile_tiled.rb +98 -0
- data/lib/cocoapods-bb-PodAssistant/tools/string_searcher.rb +129 -0
- data/lib/cocoapods-bb-PodAssistant/tools/temple-commit-msg.dat +141 -0
- data/lib/cocoapods-bb-PodAssistant/tools.rb +10 -0
- data/lib/cocoapods-bb-PodAssistant.rb +2 -0
- metadata +60 -10
@@ -0,0 +1,141 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# 设置默认编码
|
3
|
+
Encoding.default_external = Encoding::UTF_8
|
4
|
+
Encoding.default_internal = Encoding::UTF_8
|
5
|
+
|
6
|
+
require 'find'
|
7
|
+
|
8
|
+
class CommitMsg
|
9
|
+
attr_accessor :edit_file_path, :branch_name
|
10
|
+
def initialize(editing_file_path,branch_name)
|
11
|
+
@edit_file_path = editing_file_path
|
12
|
+
@branch_name = branch_name
|
13
|
+
end
|
14
|
+
|
15
|
+
# type 规范判断
|
16
|
+
def verify_branch_type
|
17
|
+
branch = @branch_name
|
18
|
+
pattern = /^(feature|bugfix|refactor|review|pref|hotfix|release|docs|main|master|develop|dev|global|qmw|pinyin|hanzi|freehanzi|beike)/
|
19
|
+
puts "===step.1===check commit branch:#{branch}"
|
20
|
+
puts "branch: #{pattern}"
|
21
|
+
if branch.downcase.match?(pattern)
|
22
|
+
puts "✅ Commit branch is valid!"
|
23
|
+
return true
|
24
|
+
else
|
25
|
+
puts "❌ Invalid commit branch. Please use the format:"
|
26
|
+
puts "branch: #{pattern}"
|
27
|
+
return false
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
# subject校验
|
32
|
+
def verify_subject(str)
|
33
|
+
subject = ''
|
34
|
+
contain_subs = str.split(" ")
|
35
|
+
if contain_subs.size == 2 #理想情况,也是大多数情况,只取subject即可
|
36
|
+
subject = contain_subs[1]
|
37
|
+
elsif contain_subs.size == 1
|
38
|
+
subject = str.gsub(/#{@branch_name}/,"")
|
39
|
+
else
|
40
|
+
contain_subs.delete_at(0)
|
41
|
+
subject = contain_subs.join("") #把剩下的数据组合起来
|
42
|
+
end
|
43
|
+
if subject.size > 50
|
44
|
+
fail_with_msg("subject内容过长,请不要超过50个字")
|
45
|
+
elsif subject == "subject"
|
46
|
+
fail_with_msg("请完善subject的内容")
|
47
|
+
else
|
48
|
+
puts "subject校验通过..."
|
49
|
+
end
|
50
|
+
end
|
51
|
+
# cause校验
|
52
|
+
def verify_cause(str)
|
53
|
+
if str.strip.size > 6
|
54
|
+
puts "Cause校验通过..."
|
55
|
+
else
|
56
|
+
fail_with_msg("请完善Cause内容")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
#solution校验
|
60
|
+
def verify_solution(str)
|
61
|
+
if str.strip.size > 9
|
62
|
+
puts "Solution校验通过..."
|
63
|
+
else
|
64
|
+
fail_with_msg("请完善Solution内容")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
# doc address校验
|
68
|
+
def verify_doc_address(str)
|
69
|
+
if str.strip.size > 21
|
70
|
+
puts "Doc Address校验通过..."
|
71
|
+
else
|
72
|
+
fail_with_msg("请完善Doc Address内容")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# 逐行校验
|
77
|
+
def handle_line(line)
|
78
|
+
handle_line_method = ''
|
79
|
+
if line.match(/^#{@branch_name.strip}/)
|
80
|
+
handle_line_method = 'verify_subject'
|
81
|
+
elsif line.match(/^Cause/)
|
82
|
+
handle_line_method = 'verify_cause'
|
83
|
+
elsif line.match(/^Solution/)
|
84
|
+
handle_line_method = 'verify_solution'
|
85
|
+
elsif line.match(/^Releated Doc Address/)
|
86
|
+
handle_line_method = 'verify_doc_address'
|
87
|
+
else
|
88
|
+
fail_with_msg("系统错误")
|
89
|
+
end
|
90
|
+
self.send(handle_line_method,line)
|
91
|
+
end
|
92
|
+
# 校验commit message内容是否符合规范
|
93
|
+
def verify_content
|
94
|
+
if File.file?(@edit_file_path)
|
95
|
+
pattern = /^(feature|bugfix|refactor|review|pref|hotfix|release|docs|update|fixbug|tag|add|revert|fix|feat|lock)/
|
96
|
+
File.read(@edit_file_path).each_line do |line|
|
97
|
+
puts "===step.2===check commit message:#{line}"
|
98
|
+
typeString = line
|
99
|
+
# 使用正则表达式提取 [] 中的内容
|
100
|
+
if match = line.match(/\[(.+?)\]/) || match = line.match(/\【(.+?)\】/)
|
101
|
+
typeString = "#{match[1]}"
|
102
|
+
elsif match = line.match(/^(\S+)/) # 匹配第一个空格前的内容
|
103
|
+
typeString = "#{match[1]}"
|
104
|
+
elsif match = line.match(/^(.*?):/) || match = line.match(/^(.*?):/) # 匹配冒号前的部分
|
105
|
+
typeString = "#{match[1]}"
|
106
|
+
end
|
107
|
+
puts "types:#{typeString.downcase}"
|
108
|
+
if typeString.downcase.match?(pattern)
|
109
|
+
puts "✅ Commit message is valid!"
|
110
|
+
else
|
111
|
+
puts "❌ Invalid commit message. Please use the format:"
|
112
|
+
puts "<type>(<scope>): <subject>"
|
113
|
+
puts "Valid types: #{pattern}"
|
114
|
+
puts "Example,[feature]、【feature】、feature:、feature:、feature(空格)"
|
115
|
+
handle_line(line)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
# faile method
|
121
|
+
def fail_with_msg(msg)
|
122
|
+
puts "\033[31m #{msg} \033[0m"
|
123
|
+
puts "\033[31m Commit Fail! \033[0m"
|
124
|
+
exit 1
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
puts "CommitLint是用于校验commit message的工具,开始校验中..."
|
129
|
+
branch_name = `git symbolic-ref --short HEAD`
|
130
|
+
file_path = ARGV[0]
|
131
|
+
commit_msg = CommitMsg.new(file_path,branch_name)
|
132
|
+
# 校验分支名是否符合规范,这里没有对taskid进行校验
|
133
|
+
# -------------------------------type校验-------------------------------
|
134
|
+
if commit_msg.verify_branch_type
|
135
|
+
puts "branch校验通过..."
|
136
|
+
if commit_msg.verify_content
|
137
|
+
puts "\033[32m commit success!\033[0m"
|
138
|
+
end
|
139
|
+
else
|
140
|
+
commit_msg.fail_with_msg("分支名称不符合规则,请按照约定规则处理")
|
141
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'cocoapods-bb-PodAssistant/gem_version'
|
2
|
+
require "cocoapods-bb-PodAssistant/tools/link_map"
|
3
|
+
require "cocoapods-bb-PodAssistant/tools/string_searcher"
|
4
|
+
require "cocoapods-bb-PodAssistant/tools/find_unuse_img"
|
5
|
+
require "cocoapods-bb-PodAssistant/tools/get_size"
|
6
|
+
require "cocoapods-bb-PodAssistant/tools/file_handle"
|
7
|
+
require "cocoapods-bb-PodAssistant/tools/class_unuse_finder"
|
8
|
+
require "cocoapods-bb-PodAssistant/tools/count_code_line"
|
9
|
+
require "cocoapods-bb-PodAssistant/tools/git_sets"
|
10
|
+
require "cocoapods-bb-PodAssistant/tools/podfile_tiled"
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-bb-PodAssistant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- humin
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-06 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: cocoapods-core
|
@@ -94,10 +93,53 @@ dependencies:
|
|
94
93
|
- - ">="
|
95
94
|
- !ruby/object:Gem::Version
|
96
95
|
version: '0'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: gli
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
type: :runtime
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: spreadsheet
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
type: :runtime
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: colored2
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
type: :runtime
|
132
|
+
prerelease: false
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
97
138
|
description: A short description of cocoapods-bb-PodAssistant.
|
98
139
|
email:
|
99
140
|
- humin1102@126.com
|
100
141
|
executables:
|
142
|
+
- bb_tools
|
101
143
|
- match_decrypt
|
102
144
|
- match_encrypt
|
103
145
|
extensions: []
|
@@ -105,6 +147,7 @@ extra_rdoc_files: []
|
|
105
147
|
files:
|
106
148
|
- LICENSE.txt
|
107
149
|
- README.md
|
150
|
+
- bin/bb_tools
|
108
151
|
- bin/match_decrypt
|
109
152
|
- bin/match_encrypt
|
110
153
|
- lib/cocoapods-bb-PodAssistant.rb
|
@@ -140,6 +183,17 @@ files:
|
|
140
183
|
- lib/cocoapods-bb-PodAssistant/native/installer.rb
|
141
184
|
- lib/cocoapods-bb-PodAssistant/podfile.rb
|
142
185
|
- lib/cocoapods-bb-PodAssistant/source_provider_hook.rb
|
186
|
+
- lib/cocoapods-bb-PodAssistant/tools.rb
|
187
|
+
- lib/cocoapods-bb-PodAssistant/tools/class_unuse_finder.rb
|
188
|
+
- lib/cocoapods-bb-PodAssistant/tools/count_code_line.rb
|
189
|
+
- lib/cocoapods-bb-PodAssistant/tools/file_handle.rb
|
190
|
+
- lib/cocoapods-bb-PodAssistant/tools/find_unuse_img.rb
|
191
|
+
- lib/cocoapods-bb-PodAssistant/tools/get_size.rb
|
192
|
+
- lib/cocoapods-bb-PodAssistant/tools/git_sets.rb
|
193
|
+
- lib/cocoapods-bb-PodAssistant/tools/link_map.rb
|
194
|
+
- lib/cocoapods-bb-PodAssistant/tools/podfile_tiled.rb
|
195
|
+
- lib/cocoapods-bb-PodAssistant/tools/string_searcher.rb
|
196
|
+
- lib/cocoapods-bb-PodAssistant/tools/temple-commit-msg.dat
|
143
197
|
- lib/cocoapods_plugin.rb
|
144
198
|
- spec/command/PodAssistant_spec.rb
|
145
199
|
- spec/spec_helper.rb
|
@@ -147,7 +201,6 @@ homepage: https://github.com/BMPaaS/cocoapods-bb-PodAssistant
|
|
147
201
|
licenses:
|
148
202
|
- MIT
|
149
203
|
metadata: {}
|
150
|
-
post_install_message:
|
151
204
|
rdoc_options: []
|
152
205
|
require_paths:
|
153
206
|
- lib
|
@@ -155,17 +208,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
155
208
|
requirements:
|
156
209
|
- - ">="
|
157
210
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
211
|
+
version: '2.6'
|
159
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
213
|
requirements:
|
161
214
|
- - ">="
|
162
215
|
- !ruby/object:Gem::Version
|
163
216
|
version: '0'
|
164
217
|
requirements: []
|
165
|
-
rubygems_version: 3.
|
166
|
-
signing_key:
|
218
|
+
rubygems_version: 3.6.2
|
167
219
|
specification_version: 4
|
168
220
|
summary: A longer description of cocoapods-bb-PodAssistant.
|
169
|
-
test_files:
|
170
|
-
- spec/command/PodAssistant_spec.rb
|
171
|
-
- spec/spec_helper.rb
|
221
|
+
test_files: []
|