cocoapods-bb-PodAssistant 0.3.7.1 → 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/babybus/helpers/babybus_info_plist_helper.rb +8 -3
- 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,129 @@
|
|
1
|
+
require 'find'
|
2
|
+
require 'spreadsheet'
|
3
|
+
module BBItools
|
4
|
+
# 字符串操作类
|
5
|
+
class StringHandle
|
6
|
+
# originStr中是否包含targetStrs中的内容
|
7
|
+
def self.containsStr(originStr,targetStrs)
|
8
|
+
targetStrs.each_with_index {|item,idx|
|
9
|
+
if originStr.include?(item)
|
10
|
+
return idx
|
11
|
+
end
|
12
|
+
}
|
13
|
+
return -1
|
14
|
+
end
|
15
|
+
end
|
16
|
+
# 搜索结果类
|
17
|
+
class SearchResult
|
18
|
+
attr_accessor :file_name, :in_line, :result_str, :key_str
|
19
|
+
|
20
|
+
def initialize(tempName,tempInLine,tempResultStr,tempKeyStr)
|
21
|
+
@file_name = tempName
|
22
|
+
@in_line = tempInLine
|
23
|
+
@result_str = tempResultStr
|
24
|
+
@key_str = tempKeyStr
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Main class
|
29
|
+
class StringSearcher
|
30
|
+
attr_accessor :search_strs, :search_in, :result
|
31
|
+
def initialize(temp_SearchStrs,temp_SearchIn)
|
32
|
+
@search_strs = temp_SearchStrs
|
33
|
+
@search_in = temp_SearchIn
|
34
|
+
@result = []
|
35
|
+
end
|
36
|
+
# 第二步开始搜索
|
37
|
+
def search
|
38
|
+
if check_exist
|
39
|
+
handle_method = ''
|
40
|
+
if File.file?(@search_in) #如果是文件
|
41
|
+
handle_method = "search_in_file"
|
42
|
+
else
|
43
|
+
handle_method = "search_in_folder"
|
44
|
+
end
|
45
|
+
self.send(handle_method,@search_in)
|
46
|
+
else
|
47
|
+
puts "\033[31m文件不存在,请检查输入是否正确\033[0m"
|
48
|
+
return
|
49
|
+
end
|
50
|
+
end
|
51
|
+
# 从文件查找
|
52
|
+
def search_in_file(temp_file)
|
53
|
+
line_index = 1
|
54
|
+
File.read(temp_file).each_line do |line|
|
55
|
+
haveIndex = StringHandle.containsStr(line,@search_strs)
|
56
|
+
if haveIndex != -1
|
57
|
+
search_result = SearchResult.new(temp_file,line_index,line,@search_strs[haveIndex])
|
58
|
+
@result << search_result
|
59
|
+
end
|
60
|
+
line_index = line_index + 1
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# 从文件夹查找
|
65
|
+
def search_in_folder(unuse)
|
66
|
+
puts @search_in_folder
|
67
|
+
Find.find(@search_in) do |filename|
|
68
|
+
if File.file?(filename) #如果是文件,则从文件中查找,忽略文件夹
|
69
|
+
search_in_file(filename)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
# 第一步:检查是否存在
|
74
|
+
def check_exist
|
75
|
+
if File.file?(@search_in)
|
76
|
+
puts "\033[32m从文件中查找\033[0m"
|
77
|
+
return true
|
78
|
+
elsif File::directory?(@search_in)
|
79
|
+
puts "\033[32m从文件夹中查找\033[0m"
|
80
|
+
return true
|
81
|
+
else
|
82
|
+
return false
|
83
|
+
end
|
84
|
+
end
|
85
|
+
# 第一个参数为要搜索的文件或者文件夹名称
|
86
|
+
# 第二个参数为要搜索的字符串
|
87
|
+
def self.search_result(temp_search_in,temp_search_strs)
|
88
|
+
if temp_search_in.nil?
|
89
|
+
puts "\033[31m传入的参数有误,第一个参数为要搜索的文件或者文件夹名称,第二个参数为要搜索的字符串(如要查找多个str使用英文,分割),两个参数中间用空格区分\033[0m"
|
90
|
+
return
|
91
|
+
end
|
92
|
+
if temp_search_strs.nil?
|
93
|
+
puts "\033[31m传入的参数有误,第一个参数为要搜索的文件或者文件夹名称,第二个参数为要搜索的字符串(如要查找多个str使用英文,分割),两个参数中间用空格区分\033[0m"
|
94
|
+
return
|
95
|
+
end
|
96
|
+
# 传入的可能是字符串数组
|
97
|
+
searcher = StringSearcher.new(temp_search_strs.split(","),temp_search_in)
|
98
|
+
searcher.search
|
99
|
+
if searcher.result.size == 0
|
100
|
+
puts "\033[32m没有找到相关字段\033[0m"
|
101
|
+
return
|
102
|
+
end
|
103
|
+
# 输出搜索的内容
|
104
|
+
Spreadsheet.client_encoding = 'utf-8'
|
105
|
+
book = Spreadsheet::Workbook.new
|
106
|
+
sheet1 = book.create_worksheet
|
107
|
+
sheet1.row(0)[0] = "文件名"
|
108
|
+
sheet1.row(0)[1] = "包含字符串"
|
109
|
+
sheet1.row(0)[2] = "文件所在目录"
|
110
|
+
sheet1.row(0)[3] = "查找内容所在行"
|
111
|
+
sheet1.row(0)[4] = "查找结果Str"
|
112
|
+
|
113
|
+
searcher.result.each_with_index do |item,i|
|
114
|
+
sheet1.row(i+1)[0] = File.basename(item.file_name)
|
115
|
+
sheet1.row(i+1)[1] = item.key_str
|
116
|
+
sheet1.row(i+1)[2] = File.dirname(item.file_name)
|
117
|
+
sheet1.row(i+1)[3] = item.in_line
|
118
|
+
sheet1.row(i+1)[4] = item.result_str
|
119
|
+
if i < 10
|
120
|
+
puts "#{item.key_str} is in file:#{File.basename(item.file_name)} and Inline:#{item.in_line}"
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
puts "\033[32m查找成功,内容已经保存到#{File.dirname(searcher.search_in)},请点击查看\033[0m"
|
126
|
+
book.write "#{File.dirname(searcher.search_in)}/search_result.xls"
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -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: []
|