cocoapods-aomi-bin 0.1.10 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-lhj-bin/command/bin.rb +4 -0
- data/lib/cocoapods-lhj-bin/command/bin/config/push.rb +2 -2
- data/lib/cocoapods-lhj-bin/command/bin/local/fetch.rb +13 -5
- data/lib/cocoapods-lhj-bin/command/bin/local/filter.rb +85 -0
- data/lib/cocoapods-lhj-bin/command/bin/local/local.rb +27 -27
- data/lib/cocoapods-lhj-bin/command/bin/local/micro_service.rb +89 -0
- data/lib/cocoapods-lhj-bin/command/bin/model.rb +103 -0
- data/lib/cocoapods-lhj-bin/command/bin/reverse_import.rb +76 -0
- data/lib/cocoapods-lhj-bin/config/local_config.rb +10 -5
- data/lib/cocoapods-lhj-bin/gem_version.rb +1 -1
- data/lib/cocoapods-lhj-bin/helpers/oss_helper.rb +2 -2
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed246e9a0f0e2f98e30932e84961ac9134201400e7b699264faf3f1f0cc122ae
|
4
|
+
data.tar.gz: 80944ebf177b7dcfebc249d45effba91be1072988261a841f19cf89000928a44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8704818341ad7763e15195dcc3f6a925d1a530fac67f027303cdab6ded57ebff868a1f84572999d44b35538dbe8d6d99d92d953ce3befe32d7055377b02c6eb1
|
7
|
+
data.tar.gz: f869b158e0a6cd7f5ae359e349a9547c0159bd4a72095af484308c1a2528cb2dd096c76acbbcfa53e65d0f5b1c982eeff8e5a1be1c2bb6a4513fde10634c80ed
|
@@ -6,11 +6,15 @@ require 'cocoapods-lhj-bin/command/bin/code'
|
|
6
6
|
require 'cocoapods-lhj-bin/command/bin/update'
|
7
7
|
require 'cocoapods-lhj-bin/command/bin/install'
|
8
8
|
require 'cocoapods-lhj-bin/command/bin/import'
|
9
|
+
require 'cocoapods-lhj-bin/command/bin/reverse_import'
|
9
10
|
require 'cocoapods-lhj-bin/command/bin/local/local'
|
10
11
|
require 'cocoapods-lhj-bin/command/bin/local/fetch'
|
12
|
+
require 'cocoapods-lhj-bin/command/bin/local/filter'
|
13
|
+
require 'cocoapods-lhj-bin/command/bin/local/micro_service'
|
11
14
|
require 'cocoapods-lhj-bin/command/bin/local/upload'
|
12
15
|
require 'cocoapods-lhj-bin/command/bin/trans'
|
13
16
|
require 'cocoapods-lhj-bin/command/bin/lhj'
|
17
|
+
require 'cocoapods-lhj-bin/command/bin/model'
|
14
18
|
require 'cocoapods-lhj-bin/command/bin/config/push'
|
15
19
|
require 'cocoapods-lhj-bin/command/bin/oss/list'
|
16
20
|
require 'cocoapods-lhj-bin/command/bin/oss/del'
|
@@ -18,8 +18,8 @@ module Pod
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def push_cn_hk
|
21
|
-
file = File.expand_path("#{Pod::Config.instance.home_dir}/
|
22
|
-
CBin::OSS::Helper.instance.upload('
|
21
|
+
file = File.expand_path("#{Pod::Config.instance.home_dir}/localizable_config.yml")
|
22
|
+
CBin::OSS::Helper.instance.upload('localizable_config.yml', file)
|
23
23
|
end
|
24
24
|
|
25
25
|
def push
|
@@ -50,7 +50,13 @@ module Pod
|
|
50
50
|
|
51
51
|
def handle_files
|
52
52
|
Dir.glob("#{@current_path}/**/*.{#{@file_type}}").each do |f|
|
53
|
-
|
53
|
+
dir_name = File.dirname(f)
|
54
|
+
if /Pods/ =~ f
|
55
|
+
mod_name = framework_name(dir_name)
|
56
|
+
handle_file f if /^ML/ =~ mod_name
|
57
|
+
else
|
58
|
+
handle_file f
|
59
|
+
end
|
54
60
|
end
|
55
61
|
end
|
56
62
|
|
@@ -61,7 +67,7 @@ module Pod
|
|
61
67
|
def handle_file(file)
|
62
68
|
File.open(file, 'r') do |f|
|
63
69
|
f.each_line do |line|
|
64
|
-
handle_line(file, line) if zh_ch_reg =~ line
|
70
|
+
handle_line(file, line) if zh_ch_reg =~ line && !((/DDLog/ =~ line) || (/NSLog/ =~ line))
|
65
71
|
end
|
66
72
|
end
|
67
73
|
end
|
@@ -71,6 +77,7 @@ module Pod
|
|
71
77
|
fname = File.basename(file)
|
72
78
|
dir_name = File.dirname(file)
|
73
79
|
mod_name = framework_name(dir_name)
|
80
|
+
# ('a'..'z').to_a.shuffle[0..12].join
|
74
81
|
key = "#{mod_name}.#{File.basename(file, '.*')}.#{rand(36**8).to_s(36)}"
|
75
82
|
cn_str = str[2, str.length - 3]
|
76
83
|
en_str = cn_str.gsub(/[\u4e00-\u9fa5]/, 'x')
|
@@ -102,9 +109,11 @@ module Pod
|
|
102
109
|
def update_source_header
|
103
110
|
Dir.glob("#{@current_path}/**/*.{m,h}").each do |f|
|
104
111
|
if f =~ /Pods/
|
105
|
-
|
112
|
+
dir_name = File.dirname(f)
|
113
|
+
mod_name = framework_name(dir_name)
|
114
|
+
handle_file f if /^ML/ =~ mod_name
|
106
115
|
else
|
107
|
-
handler_file
|
116
|
+
handler_file f
|
108
117
|
end
|
109
118
|
end
|
110
119
|
end
|
@@ -140,7 +149,6 @@ module Pod
|
|
140
149
|
end
|
141
150
|
result
|
142
151
|
end
|
143
|
-
|
144
152
|
end
|
145
153
|
end
|
146
154
|
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Bin < Command
|
8
|
+
class Filter < Bin
|
9
|
+
self.summary = '过滤重复对象'
|
10
|
+
|
11
|
+
def initialize(argv)
|
12
|
+
@current_path = argv.shift_argument || Dir.pwd
|
13
|
+
@file_type = argv.option('file-type', 'm,h')
|
14
|
+
@file_name = argv.option('file-name', 'MaucaoLife_zh_en.csv')
|
15
|
+
@cn_keys = []
|
16
|
+
@key_map = {}
|
17
|
+
@used_keys = []
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
fetch_keys
|
23
|
+
read_csv
|
24
|
+
gen_csv
|
25
|
+
end
|
26
|
+
|
27
|
+
def csv_file_name
|
28
|
+
file_name = @file_name
|
29
|
+
file_name = "#{@file_name}.csv" unless /.csv$/ =~ @file_name
|
30
|
+
file_name
|
31
|
+
end
|
32
|
+
|
33
|
+
def read_csv
|
34
|
+
path = File.join(@current_path, csv_file_name)
|
35
|
+
Dir.glob(path).each do |p|
|
36
|
+
CSV.foreach(p) do |row|
|
37
|
+
key = row[0]
|
38
|
+
if @used_keys.any? { |k| k.eql?(key) }
|
39
|
+
@cn_keys << { key: key, cn: row[1], en: row[2], fname: row[3], dirname: row[4] }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def gen_csv
|
46
|
+
file = File.join(@current_path, csv_file_name)
|
47
|
+
FileUtils.rm_rf(file) if File.exist?(file)
|
48
|
+
CSV.open(file, 'wb:utf-8') do |csv|
|
49
|
+
csv << %w[国际化key 中文 英文 所在文件 文件路径]
|
50
|
+
@cn_keys.each do |k|
|
51
|
+
csv << [k[:key], k[:cn], k[:en], k[:fname], k[:dirname]]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
UI.puts "生成csv文件完成.\n文件路径:#{File.absolute_path(file)}".green
|
55
|
+
end
|
56
|
+
|
57
|
+
def fetch_keys
|
58
|
+
Dir.glob("#{@current_path}/**/*.{#{@file_type}}").each do |f|
|
59
|
+
handle_file f
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def zh_ch_reg
|
64
|
+
/MLLocalizedString\([^)]+\)/
|
65
|
+
end
|
66
|
+
|
67
|
+
def handle_file(file)
|
68
|
+
File.open(file, 'r') do |f|
|
69
|
+
f.each_line do |line|
|
70
|
+
handle_line(file, line) if zh_ch_reg =~ line
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def handle_line(file, line)
|
76
|
+
line.scan(zh_ch_reg) do |str|
|
77
|
+
str[20, str.length - 22]
|
78
|
+
@used_keys << str[20, str.length - 22]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -42,7 +42,7 @@ module Pod
|
|
42
42
|
|
43
43
|
def run
|
44
44
|
down_load_csv_file if need_download
|
45
|
-
|
45
|
+
read_csv
|
46
46
|
if @key_map.keys.length.positive?
|
47
47
|
write_en_strings
|
48
48
|
write_zh_hk_strings
|
@@ -122,12 +122,27 @@ module Pod
|
|
122
122
|
download_keys
|
123
123
|
end
|
124
124
|
|
125
|
-
def
|
125
|
+
def read_csv
|
126
126
|
path = File.join(@current_path, read_csv_file_name)
|
127
|
-
Dir.glob(path).each do |
|
128
|
-
|
129
|
-
|
130
|
-
|
127
|
+
Dir.glob(path).each do |f|
|
128
|
+
read_csv_file f
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def read_csv_file(file)
|
133
|
+
key_c = CBin::LocalConfig.instance.get_col_by_name(file, 'csv_key_col')
|
134
|
+
cn_c = CBin::LocalConfig.instance.get_col_by_name(file, 'csv_cn_col')
|
135
|
+
en_c = CBin::LocalConfig.instance.get_col_by_name(file, 'csv_en_col')
|
136
|
+
trans_hk = CBin::LocalConfig.instance.get_col_by_name(file, 'trans_zh_hk')
|
137
|
+
trans_cn = CBin::LocalConfig.instance.get_col_by_name(file, 'trans_zh_cn')
|
138
|
+
CSV.foreach(file) do |row|
|
139
|
+
if row.length > 2
|
140
|
+
key = row[key_c]
|
141
|
+
cn_str = row[cn_c]
|
142
|
+
hk_str = row[cn_c]
|
143
|
+
cn_str = CBin::Trans::Helper.instance.trans_zh_cn_str(cn_str) if trans_cn
|
144
|
+
hk_str = CBin::Trans::Helper.instance.trans_zh_hk_str(hk_str) if trans_hk
|
145
|
+
@key_map[key] = { key: key, cn: cn_str, hk: hk_str, en: row[en_c] } unless key =~ /[\u4e00-\u9fa5]/
|
131
146
|
end
|
132
147
|
end
|
133
148
|
end
|
@@ -170,7 +185,7 @@ module Pod
|
|
170
185
|
|
171
186
|
def modify_format_string(file, line)
|
172
187
|
result = line
|
173
|
-
result = handle_modify_line(file, line) if zh_ch_reg =~ line
|
188
|
+
result = handle_modify_line(file, line) if zh_ch_reg =~ line && !((/DDLog/ =~ line) || (/NSLog/ =~ line))
|
174
189
|
result
|
175
190
|
end
|
176
191
|
|
@@ -194,17 +209,10 @@ module Pod
|
|
194
209
|
@key_map.values[index][:key] if index
|
195
210
|
end
|
196
211
|
|
197
|
-
def format_str(type
|
212
|
+
def format_str(type)
|
198
213
|
str = ''
|
199
214
|
@key_map.each do |k, v|
|
200
|
-
|
201
|
-
case area
|
202
|
-
when :hk
|
203
|
-
val = CBin::Trans::Helper.instance.trans_zh_hk_str val
|
204
|
-
when :cn
|
205
|
-
val = CBin::Trans::Helper.instance.trans_zh_cn_str val
|
206
|
-
end
|
207
|
-
str += "\"#{k}\" = \"#{val}\";\n"
|
215
|
+
str += "\"#{k}\" = \"#{v[type]}\";\n"
|
208
216
|
end
|
209
217
|
str
|
210
218
|
end
|
@@ -229,18 +237,12 @@ module Pod
|
|
229
237
|
end
|
230
238
|
|
231
239
|
def write_zh_cn_strings
|
232
|
-
|
233
|
-
gen_zh_cn_strings_file
|
234
|
-
else
|
235
|
-
copy_hk_to_cn_file
|
236
|
-
end
|
240
|
+
gen_zh_cn_strings_file
|
237
241
|
end
|
238
242
|
|
239
243
|
def gen_zh_cn_strings_file
|
240
244
|
file = File.join(@current_path, zh_cn_dir_name, generate_file_name)
|
241
|
-
|
242
|
-
area = :cn if CBin::LocalConfig.instance.config['trans_zh_cn']
|
243
|
-
content = format_str(:zh, area)
|
245
|
+
content = format_str(:cn)
|
244
246
|
write_to_file(file, content)
|
245
247
|
UI.puts "生成简体中文配置完成.文件路径:#{File.absolute_path(file)}\n".green
|
246
248
|
end
|
@@ -254,9 +256,7 @@ module Pod
|
|
254
256
|
|
255
257
|
def write_zh_hk_strings
|
256
258
|
file = File.join(@current_path, zh_hk_dir_name, generate_file_name)
|
257
|
-
|
258
|
-
area = :hk if CBin::LocalConfig.instance.config['trans_zh_hk']
|
259
|
-
content = format_str(:zh, area)
|
259
|
+
content = format_str(:hk)
|
260
260
|
write_to_file(file, content)
|
261
261
|
UI.puts "生成繁体中文配置完成.文件路径:#{File.absolute_path(file)}\n".green
|
262
262
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Bin < Command
|
8
|
+
class Service < Bin
|
9
|
+
self.summary = '微服务名变更'
|
10
|
+
|
11
|
+
def initialize(argv)
|
12
|
+
@current_path = argv.shift_argument || Dir.pwd
|
13
|
+
@file_type = argv.option('file-type', 'm,h')
|
14
|
+
@file_name = argv.option('file-name', 'service_map.csv')
|
15
|
+
@service_map = {}
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
read_csv
|
21
|
+
update_source
|
22
|
+
end
|
23
|
+
|
24
|
+
def read_csv
|
25
|
+
path = File.join(@current_path, csv_file_name)
|
26
|
+
Dir.glob(path).each do |p|
|
27
|
+
CSV.foreach(p) do |row|
|
28
|
+
@service_map[row[0]] = row[1] if row[0]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def csv_file_name
|
34
|
+
file_name = @file_name
|
35
|
+
file_name = "#{@file_name}.csv" unless /.csv$/ =~ @file_name
|
36
|
+
file_name
|
37
|
+
end
|
38
|
+
|
39
|
+
def update_source
|
40
|
+
Dir.glob("#{@current_path}/**/*.{m,h}").each do |f|
|
41
|
+
if f =~ /Pods/
|
42
|
+
update_file(f) if f =~ %r{Pods/ML}
|
43
|
+
else
|
44
|
+
update_file(f)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def update_file(file)
|
50
|
+
File.chmod(0o644, file)
|
51
|
+
str = file_string(file)
|
52
|
+
File.open(file, 'w+') do |f|
|
53
|
+
f.write(str)
|
54
|
+
end
|
55
|
+
File.chmod(0o444, file) if file =~ /Pods/
|
56
|
+
end
|
57
|
+
|
58
|
+
def file_string(file)
|
59
|
+
str = ''
|
60
|
+
File.open(file, 'r+') do |f|
|
61
|
+
f.each_line do |line|
|
62
|
+
str += format_string(f, line)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
str
|
66
|
+
end
|
67
|
+
|
68
|
+
def format_string(file, line)
|
69
|
+
result = line
|
70
|
+
if url_reg =~ line
|
71
|
+
line.scan(url_reg).flatten.each do |key|
|
72
|
+
result = result.gsub(key, @service_map[key]) if key && @service_map[key]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
result
|
76
|
+
end
|
77
|
+
|
78
|
+
def url_reg
|
79
|
+
@url_key_reg ||= begin
|
80
|
+
keys = @service_map.keys.join('|')
|
81
|
+
/(#{keys})/
|
82
|
+
end
|
83
|
+
@url_key_reg
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'net/https'
|
2
|
+
require 'uri'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Bin < Command
|
8
|
+
class Model < Bin
|
9
|
+
self.summary = '生成模型文件'
|
10
|
+
|
11
|
+
def initialize(argv)
|
12
|
+
@url = argv.shift_argument
|
13
|
+
@model_pre_name = argv.option('model-pre', 'ML')
|
14
|
+
@models = []
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
uri = URI.parse(@url)
|
19
|
+
res = Net::HTTP.get_response(uri)
|
20
|
+
res_body = JSON.parse(res.body)
|
21
|
+
detail_msg = res_body['detailMsg']
|
22
|
+
fetch_models(nil, detail_msg) if detail_msg
|
23
|
+
print_models
|
24
|
+
print_models_implementation
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate!
|
28
|
+
help! "请输入url" unless @url
|
29
|
+
end
|
30
|
+
|
31
|
+
def fetch_models(name, obj)
|
32
|
+
model = obj
|
33
|
+
model = obj.first if obj.respond_to? :<<
|
34
|
+
@models.unshift({name: name, value: model}) if model.instance_of? Hash
|
35
|
+
if model.instance_of? Hash
|
36
|
+
model.each do |key, value|
|
37
|
+
if (value.instance_of? Hash) || (value.instance_of? Array)
|
38
|
+
fetch_models(key, value)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def print_models
|
45
|
+
@models.each do |model|
|
46
|
+
model_name = ''
|
47
|
+
model_name = model[:name].gsub('List', '').gsub('Vo', '').gsub(/^\w/) { $&.upcase } if model[:name]
|
48
|
+
puts "@interface #{@model_pre_name}#{model_name}Model : NSObject"
|
49
|
+
model[:value].each do |key, value|
|
50
|
+
print_property(key, value)
|
51
|
+
end
|
52
|
+
puts "@end\n\n\n"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def print_models_implementation
|
57
|
+
@models.each do |model|
|
58
|
+
model_name = model[:name].gsub('List', '').gsub('Vo', '').gsub(/^\w/) { $&.upcase } if model[:name]
|
59
|
+
puts "@implementation #{@model_pre_name}#{model_name}Model"
|
60
|
+
puts "+(NSDictionary *)modelContainerPropertyGenericClass {"
|
61
|
+
puts " return @{@\"#{model[:name]}\" : #{@model_pre_name}#{model_name}Model.class};"
|
62
|
+
puts "}"
|
63
|
+
puts "@end\n\n\n"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def print_property(key, value)
|
68
|
+
if value.instance_of? String
|
69
|
+
puts "///#{value}"
|
70
|
+
puts "@property (nonatomic, copy) NSString *#{key};"
|
71
|
+
elsif value.instance_of? Integer
|
72
|
+
puts "///#{value}"
|
73
|
+
puts "@property (nonatomic, assign) NSInteger #{key};"
|
74
|
+
puts "///#{value}" if value > 1000
|
75
|
+
puts "@property (nonatomic, strong) MLCentNumber *#{key};" if value > 1000
|
76
|
+
elsif value.instance_of? Float
|
77
|
+
puts "///#{value}"
|
78
|
+
puts "@property (nonatomic, assign) CGFloat #{key};"
|
79
|
+
elsif (value.instance_of? TrueClass) || (value.instance_of? FalseClass)
|
80
|
+
puts "///#{value}"
|
81
|
+
puts "@property (nonatomic, assign) BOOL #{key};"
|
82
|
+
elsif value.instance_of? Array
|
83
|
+
if value.first.instance_of? String
|
84
|
+
puts "///#{key}"
|
85
|
+
puts "@property (nonatomic, strong) NSArray<NSString *> *#{key};"
|
86
|
+
else
|
87
|
+
puts "///#{key}"
|
88
|
+
name = key.gsub('List', '').gsub('Vo', '').gsub(/^\w/) { $&.upcase }
|
89
|
+
puts "@property (nonatomic, strong) NSArray<#{@model_pre_name}#{name}Model *> *#{key};"
|
90
|
+
end
|
91
|
+
elsif value.instance_of? Hash
|
92
|
+
puts "///#{key}"
|
93
|
+
name = key.gsub('List', '').gsub('Vo', '').gsub(/^\w/) { $&.upcase }
|
94
|
+
puts "@property (nonatomic, strong) #{@model_pre_name}#{name}Model *#{key};"
|
95
|
+
else
|
96
|
+
puts "///#{value}"
|
97
|
+
puts "@property (nonatomic, copy) NSString *#{key};"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'find'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
class Command
|
8
|
+
class Bin < Command
|
9
|
+
class ReverseImport < Bin
|
10
|
+
self.summary = '更改头文件引入'
|
11
|
+
|
12
|
+
def initialize(argv)
|
13
|
+
@current_path = argv.shift_argument || Dir.pwd
|
14
|
+
@framework_names = []
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
get_all_frameworks
|
20
|
+
get_import_headers
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_import_headers
|
24
|
+
Dir.glob("#{@current_path}/**/*.{m,h,pch}").each do |f|
|
25
|
+
header_handler_file(f) unless f =~ /Pods/
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_all_frameworks
|
30
|
+
folders = child_dir
|
31
|
+
folders.each { |name| @framework_names << name }
|
32
|
+
end
|
33
|
+
|
34
|
+
def framework_name_reg
|
35
|
+
@url_key_reg ||= begin
|
36
|
+
keys = @framework_names.join('|')
|
37
|
+
/#{keys}/
|
38
|
+
end
|
39
|
+
@url_key_reg
|
40
|
+
end
|
41
|
+
|
42
|
+
def pod_folder_name
|
43
|
+
File.join(@current_path, 'MacauLife', 'CustomPods')
|
44
|
+
end
|
45
|
+
|
46
|
+
def child_dir
|
47
|
+
dirs = Dir.entries(pod_folder_name)
|
48
|
+
dirs.reject!{ |d| File.directory?(d) }
|
49
|
+
dirs
|
50
|
+
end
|
51
|
+
|
52
|
+
def import_reg
|
53
|
+
/#import\s*<(.*)\/(.*)>$/
|
54
|
+
end
|
55
|
+
|
56
|
+
def header_handler_file(f)
|
57
|
+
str = ''
|
58
|
+
File.readlines(f).each do |l|
|
59
|
+
if import_reg =~ l
|
60
|
+
ma = l.match(import_reg)
|
61
|
+
if framework_name_reg =~ ma[1]
|
62
|
+
str += "#import \"#{ma[2]}\"\n"
|
63
|
+
else
|
64
|
+
str += l.dup
|
65
|
+
end
|
66
|
+
else
|
67
|
+
str += l.dup
|
68
|
+
end
|
69
|
+
end
|
70
|
+
File.write(f, str)
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -33,11 +33,16 @@ module CBin
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def load_config
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
syn_config_file unless File.exist?(config_file)
|
37
|
+
YAML.load_file(config_file)
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_col_by_name(file_name, col_name = 'csv_key_col')
|
41
|
+
m = config
|
42
|
+
col = m[col_name]
|
43
|
+
fo = m['read_targets'].find{ |o| /#{o['csv_file']}/ =~ file_name }
|
44
|
+
col = fo[col_name] if fo
|
45
|
+
col
|
41
46
|
end
|
42
47
|
|
43
48
|
def config
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-aomi-bin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lihaijian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -118,11 +118,15 @@ files:
|
|
118
118
|
- lib/cocoapods-lhj-bin/command/bin/lhj.rb
|
119
119
|
- lib/cocoapods-lhj-bin/command/bin/lib/lint.rb
|
120
120
|
- lib/cocoapods-lhj-bin/command/bin/local/fetch.rb
|
121
|
+
- lib/cocoapods-lhj-bin/command/bin/local/filter.rb
|
121
122
|
- lib/cocoapods-lhj-bin/command/bin/local/local.rb
|
123
|
+
- lib/cocoapods-lhj-bin/command/bin/local/micro_service.rb
|
122
124
|
- lib/cocoapods-lhj-bin/command/bin/local/upload.rb
|
125
|
+
- lib/cocoapods-lhj-bin/command/bin/model.rb
|
123
126
|
- lib/cocoapods-lhj-bin/command/bin/oss/del.rb
|
124
127
|
- lib/cocoapods-lhj-bin/command/bin/oss/list.rb
|
125
128
|
- lib/cocoapods-lhj-bin/command/bin/repo/update.rb
|
129
|
+
- lib/cocoapods-lhj-bin/command/bin/reverse_import.rb
|
126
130
|
- lib/cocoapods-lhj-bin/command/bin/spec/create.rb
|
127
131
|
- lib/cocoapods-lhj-bin/command/bin/spec/push.rb
|
128
132
|
- lib/cocoapods-lhj-bin/command/bin/trans.rb
|