cocoapods-aomi-bin 0.1.21 → 0.1.26
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61ce22dc3e41408e8777e312780ce5a0a313acd15344f6026371e119d4af87f4
|
4
|
+
data.tar.gz: c0d34b7525c2ada3970d6d758a5082c67f8bbe00826f459571be509ea42de8eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aacb0bf501176001a01146859b4a460c7d3be79c907d2d9f4e9d15f00aaf40a11d06569587d8845bdbfe8c4a2b7f83ede9633a79bf3a864ecfa979cb574df52b
|
7
|
+
data.tar.gz: 9fc30ba67b383560b301bbd41e637904dade14a4f6afb451f45419830d514b08551b4db053e0715cf9f6b80a76c0ac27180ad71fe6d7a295d0294e58cfd8634c
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'net/https'
|
2
2
|
require 'uri'
|
3
3
|
require 'json'
|
4
|
+
require 'plist'
|
4
5
|
|
5
6
|
module Pod
|
6
7
|
class Command
|
@@ -15,6 +16,20 @@ module Pod
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def run
|
19
|
+
gen_model
|
20
|
+
# handle_plist
|
21
|
+
end
|
22
|
+
|
23
|
+
def handle_plist
|
24
|
+
entitlements_file = File.expand_path('~/config.plist')
|
25
|
+
result = Plist.parse_xml(entitlements_file)
|
26
|
+
result.delete('com.apple.security.application-groups')
|
27
|
+
result['type'] = '0'
|
28
|
+
result.delete('version')
|
29
|
+
result.save_plist(entitlements_file)
|
30
|
+
end
|
31
|
+
|
32
|
+
def gen_model
|
18
33
|
model = fetch_model
|
19
34
|
fetch_models(nil, model) if model
|
20
35
|
print_models
|
@@ -7,12 +7,35 @@ module Pod
|
|
7
7
|
def initialize(argv)
|
8
8
|
@name = argv.option('name', 'titleLabel')
|
9
9
|
@type = argv.option('type', 'UILabel')
|
10
|
+
super
|
10
11
|
end
|
11
12
|
|
12
13
|
def names
|
13
14
|
@name.split(",").map(&:strip)
|
14
15
|
end
|
15
16
|
|
17
|
+
def type
|
18
|
+
@ele_type ||= begin
|
19
|
+
if @type =~ /image/i
|
20
|
+
'UIImageView'
|
21
|
+
elsif @type =~ /stack/i
|
22
|
+
'UIStackView'
|
23
|
+
elsif @type =~ /label/i
|
24
|
+
'UILabel'
|
25
|
+
elsif @type =~ /table/i
|
26
|
+
'UITableView'
|
27
|
+
elsif @type =~ /text/i
|
28
|
+
'UITextField'
|
29
|
+
elsif @type =~ /button/i
|
30
|
+
'UIButton'
|
31
|
+
elsif @type =~ /view/i
|
32
|
+
'UIView'
|
33
|
+
else
|
34
|
+
@type
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
16
39
|
def run
|
17
40
|
print_declare
|
18
41
|
puts "\n\n"
|
@@ -26,13 +49,13 @@ module Pod
|
|
26
49
|
def print_declare
|
27
50
|
names.each do |name|
|
28
51
|
puts "///"
|
29
|
-
puts "@property (nonatomic, strong) #{
|
52
|
+
puts "@property (nonatomic, strong) #{type} *#{name};"
|
30
53
|
end
|
31
54
|
end
|
32
55
|
|
33
56
|
def print_instance
|
34
57
|
names.each do |name|
|
35
|
-
puts "-(#{
|
58
|
+
puts "-(#{type} *)#{name}"
|
36
59
|
puts "{"
|
37
60
|
puts " if(!_#{name}){"
|
38
61
|
print_alloc(name)
|
@@ -46,37 +69,50 @@ module Pod
|
|
46
69
|
end
|
47
70
|
|
48
71
|
def print_alloc(name)
|
49
|
-
if
|
72
|
+
if type.eql?('UIImageView')
|
50
73
|
puts " _#{name} = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@\"xxxx\"]];"
|
51
|
-
elsif
|
74
|
+
elsif type.eql?('UIButton')
|
52
75
|
puts " _#{name} = [UIButton buttonWithType:UIButtonTypeCustom];"
|
76
|
+
elsif type.eql?('UITableView')
|
77
|
+
puts " _#{name} = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];"
|
53
78
|
else
|
54
|
-
puts " _#{name} = [[#{
|
79
|
+
puts " _#{name} = [[#{type} alloc] init];"
|
55
80
|
end
|
56
81
|
end
|
57
82
|
|
58
83
|
def print_property(name)
|
59
|
-
if
|
84
|
+
if type.eql?('UILabel')
|
60
85
|
puts " _#{name}.textColor = kSetCOLOR(0x333333);"
|
61
86
|
puts " _#{name}.text = @\"xxxxxxxx\";"
|
62
87
|
puts " _#{name}.font = [UIFont systemFontOfSize:12.0 weight:UIFontWeightRegular];"
|
63
88
|
puts " _#{name}.textAlignment = NSTextAlignmentCenter;"
|
64
|
-
elsif
|
89
|
+
elsif type.eql?('UIImageView')
|
65
90
|
puts " _#{name}.backgroundColor = kBackgroundColor;"
|
66
91
|
puts " _#{name}.contentMode = UIViewContentModeScaleAspectFit;"
|
67
92
|
puts " _#{name}.clipsToBounds = YES;"
|
68
93
|
puts " _#{name}.layer.cornerRadius = 6.0f;"
|
69
94
|
puts " _#{name}.layer.borderColor = kLineColor.CGColor;"
|
70
95
|
puts " _#{name}.layer.borderWidth = 0.5;"
|
71
|
-
elsif
|
96
|
+
elsif type.eql?('UITextField')
|
72
97
|
puts " _#{name}.textColor = kSetCOLOR(0x333333);"
|
73
98
|
puts " _#{name}.font = [UIFont systemFontOfSize:12.0 weight:UIFontWeightRegular];"
|
74
|
-
elsif
|
99
|
+
elsif type.eql?('UIView')
|
100
|
+
puts " _#{name}.backgroundColor = kBackgroundColor;"
|
101
|
+
elsif type.eql?('UIStackView')
|
102
|
+
puts " _#{name}.axis = UILayoutConstraintAxisHorizontal;"
|
103
|
+
puts " _#{name}.distribution = UIStackViewDistributionFillEqually;"
|
104
|
+
elsif type.eql?('UITableView')
|
75
105
|
puts " _#{name}.backgroundColor = kBackgroundColor;"
|
76
|
-
|
106
|
+
puts " _#{name}.delegate = self;"
|
107
|
+
puts " _#{name}.delegate = self;"
|
108
|
+
puts " _#{name}.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];"
|
109
|
+
puts " _#{name}.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];"
|
110
|
+
puts " _#{name}.separatorStyle = UITableViewCellSeparatorStyleNone;"
|
111
|
+
elsif type.eql?('UIButton')
|
77
112
|
puts " _#{name}.backgroundColor = kBackgroundColor;"
|
78
113
|
puts " [_#{name} setTitle:@\"xxx\" forState:UIControlStateNormal];"
|
79
114
|
puts " [_#{name} setTitleColor:kSetCOLOR(0x999999) forState:UIControlStateNormal];"
|
115
|
+
puts " _#{name}.titleLabel.font = [UIFont systemFontOfSize:14.0 weight:UIFontWeightRegular];"
|
80
116
|
puts " [_#{name} setImage:[UIImage imageNamed:@\"xx\"] forState:UIControlStateNormal];"
|
81
117
|
puts " [_#{name} setImage:[UIImage imageNamed:@\"xx\"] forState:UIControlStateSelected];"
|
82
118
|
puts " [_#{name} addTarget:self action:@selector(actionHandler:) forControlEvents:UIControlEventTouchUpInside];"
|
@@ -90,13 +126,15 @@ module Pod
|
|
90
126
|
puts "[self.#{name}.trailingAnchor constraintEqualToAnchor:contentView.trailingAnchor constant:0].active = YES;"
|
91
127
|
puts "[self.#{name}.topAnchor constraintEqualToAnchor:contentView.topAnchor].active = YES;"
|
92
128
|
puts "[self.#{name}.bottomAnchor constraintEqualToAnchor:contentView.bottomAnchor].active = YES;"
|
129
|
+
puts "[self.#{name}.widthAnchor constraintEqualToConstant:80].active = YES;"
|
130
|
+
puts "[self.#{name}.heightAnchor constraintEqualToAnchor:80].active = YES;"
|
93
131
|
puts "\n\n"
|
94
132
|
end
|
95
133
|
end
|
96
134
|
|
97
135
|
def print_value
|
98
136
|
names.each do |name|
|
99
|
-
if
|
137
|
+
if type.eql?('UILabel')
|
100
138
|
puts "self.#{name}.text = @\"xxxxx\";"
|
101
139
|
end
|
102
140
|
end
|
@@ -8,9 +8,18 @@ module Pod
|
|
8
8
|
class Yapi < Bin
|
9
9
|
self.summary = '通过yapi接口生成请求'
|
10
10
|
|
11
|
+
def self.options
|
12
|
+
[
|
13
|
+
%w[--id api的id],
|
14
|
+
%w[--model-pre 模型的前缀],
|
15
|
+
%w[--save 保存生成文件]
|
16
|
+
]
|
17
|
+
end
|
18
|
+
|
11
19
|
def initialize(argv)
|
12
20
|
@id = argv.option('id')
|
13
21
|
@model_pre_name = argv.option('model-pre')
|
22
|
+
@save = argv.flag?('save', false)
|
14
23
|
@http_url = ''
|
15
24
|
@http_headers = []
|
16
25
|
@data_json = {}
|
@@ -20,12 +29,43 @@ module Pod
|
|
20
29
|
@type_trans = {}
|
21
30
|
@config_model_names = []
|
22
31
|
@model_names = []
|
32
|
+
super
|
23
33
|
end
|
24
34
|
|
25
35
|
def run
|
26
36
|
load_config
|
27
37
|
fetch_model
|
28
38
|
print_methods
|
39
|
+
save_to_file if @save
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_ding
|
43
|
+
require 'net/http'
|
44
|
+
require 'uri'
|
45
|
+
body = { "msgtype" => "text", "text" => { "content" => "error:上传蒲公英超时失败!" } }.to_json
|
46
|
+
Net::HTTP.post(URI('https://oapi.dingtalk.com/robot/send?access_token=6a3519057170cdb1b7274edfe43934c84a0062ffe2c9bcced434699296a7e26e'), body, "Content-Type" => "application/json")
|
47
|
+
end
|
48
|
+
|
49
|
+
def puts_h(str)
|
50
|
+
puts str
|
51
|
+
@h_file_array ||= []
|
52
|
+
@h_file_array << str
|
53
|
+
end
|
54
|
+
|
55
|
+
def puts_m(str)
|
56
|
+
puts str
|
57
|
+
@m_file_array ||= []
|
58
|
+
@m_file_array << str
|
59
|
+
end
|
60
|
+
|
61
|
+
def save_to_file
|
62
|
+
@model_names = []
|
63
|
+
file_name = gen_model_name('')
|
64
|
+
h_file = File.join('.', "#{file_name}.h")
|
65
|
+
m_file = File.join('.', "#{file_name}.m")
|
66
|
+
File.write(h_file, @h_file_array.join("\n")) if @h_file_array.count > 0
|
67
|
+
File.write(m_file, @m_file_array.join("\n")) if @m_file_array.count > 0
|
68
|
+
puts "\n\n生成文件成功!所在路径:\n#{File.expand_path(h_file)} \n#{File.expand_path(m_file)}"
|
29
69
|
end
|
30
70
|
|
31
71
|
def url_str
|
@@ -161,24 +201,25 @@ module Pod
|
|
161
201
|
@models.each do |model|
|
162
202
|
model_name = model[:name] || ''
|
163
203
|
model_properties = model[:properties]
|
164
|
-
|
204
|
+
puts_h "@interface #{model_name} : NSObject"
|
165
205
|
model_properties.each do |m|
|
166
206
|
print_model(m)
|
167
207
|
end
|
168
|
-
|
208
|
+
puts_h "@end\n\n\n"
|
169
209
|
end
|
170
210
|
end
|
171
211
|
|
172
212
|
def print_models_implementation
|
173
213
|
@models.each do |model|
|
174
|
-
|
214
|
+
puts_m "@implementation #{model[:name]}"
|
175
215
|
str = model[:properties].filter { |p| p[:type].eql?('array') && !p[:type_name].eql?('NSString') }.map{ |p| "@\"#{p[:key]}\": #{p[:type_name]}.class" }.join(', ')
|
176
216
|
if str && str.length > 0
|
177
|
-
|
178
|
-
|
179
|
-
|
217
|
+
puts_m "+(NSDictionary *)modelContainerPropertyGenericClass {"
|
218
|
+
puts_m " return @{#{str}};"
|
219
|
+
puts_m "}"
|
180
220
|
end
|
181
|
-
|
221
|
+
puts_m "@end\n"
|
222
|
+
puts "\n\n"
|
182
223
|
end
|
183
224
|
end
|
184
225
|
|
@@ -187,63 +228,68 @@ module Pod
|
|
187
228
|
type_name = m[:type_name]
|
188
229
|
type = m[:type]
|
189
230
|
des = m[:description] || ''
|
190
|
-
des.gsub!(/\n/, '')
|
231
|
+
des.gsub!(/\n/, ' ')
|
191
232
|
default = m[:default]
|
192
|
-
|
233
|
+
puts_h "///#{des} #{default}"
|
193
234
|
if type.eql?('integer')
|
194
|
-
|
235
|
+
puts_h "@property (nonatomic, assign) NSInteger #{key};"
|
236
|
+
if des.include?('分')
|
237
|
+
puts_h "/////////==========删掉其中一个属性"
|
238
|
+
puts_h "@property (nonatomic, strong) MLCentNumber *#{key};"
|
239
|
+
end
|
195
240
|
elsif type.eql?('cent')
|
196
|
-
|
241
|
+
puts_h "@property (nonatomic, strong) MLCentNumber *#{key};"
|
197
242
|
elsif type.eql?('string')
|
198
|
-
|
243
|
+
puts_h "@property (nonatomic, copy) NSString *#{key};"
|
199
244
|
elsif type.eql?('number')
|
200
|
-
|
245
|
+
puts_h "@property (nonatomic, strong) NSNumber *#{key};"
|
201
246
|
elsif type.eql?('float')
|
202
|
-
|
247
|
+
puts_h "@property (nonatomic, assign) CGFloat #{key};"
|
203
248
|
elsif type.eql?('double')
|
204
|
-
|
249
|
+
puts_h "@property (nonatomic, assign) double #{key};"
|
205
250
|
elsif type.eql?('boolean')
|
206
|
-
|
251
|
+
puts_h "@property (nonatomic, assign) BOOL #{key};"
|
207
252
|
elsif type.eql?('object')
|
208
|
-
|
253
|
+
puts_h "@property (nonatomic, strong) #{type_name} *#{key};"
|
209
254
|
elsif type.eql?('array')
|
210
|
-
|
255
|
+
puts_h "@property (nonatomic, strong) NSArray<#{type_name} *> *#{key};"
|
211
256
|
else
|
212
|
-
|
257
|
+
puts_h "@property (nonatomic, copy) NSString *#{key};"
|
213
258
|
end
|
214
259
|
end
|
215
260
|
|
216
261
|
def print_methods
|
217
262
|
puts "\n<===============方法调用=====================>\n"
|
218
|
-
|
219
|
-
|
220
|
-
|
263
|
+
puts_m "/**"
|
264
|
+
puts_m " * #{@data_json['title']} -- #{@data_json['username']}"
|
265
|
+
puts_m " */"
|
221
266
|
key_str = @data_json['path'].split('/').map{ |s| s.gsub(/[^A-Za-z0-9]/, '').gsub(/^\w/){ $&.upcase } }.join('')
|
222
267
|
key = "k#{key_str}URL"
|
223
|
-
|
224
|
-
|
225
|
-
|
268
|
+
puts_m "static NSString * const #{key} = @\"#{@data_json['path']}\";"
|
269
|
+
puts_m "\n\n"
|
270
|
+
puts_h "@interface MLParamModel : NSObject"
|
226
271
|
@data_json['req_query'].each do |h|
|
227
|
-
|
228
|
-
|
272
|
+
des = h['desc'].gsub(/\n/, ' ')
|
273
|
+
puts_h "///#{des} #{h['example']}"
|
274
|
+
puts_h "@property (nonatomic, copy) NSString *#{h['name']};"
|
229
275
|
end
|
230
|
-
|
276
|
+
puts_h "@end"
|
231
277
|
puts "\n\n"
|
232
278
|
model = @models.last
|
233
279
|
if @data_json['method'].eql?('GET')
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
280
|
+
puts_m " [MLNetworkingManager getWithUrl:#{key} params:nil response:^(MLResponseMessage *responseMessage) {"
|
281
|
+
puts_m " if (response.resultCode == 0 && !response.error){"
|
282
|
+
puts_m " NSDictionary *detailMsg = response.detailMsg"
|
283
|
+
puts_m " #{model[:name]} *model = [#{model[:name]} yy_modelWithDictionary:detailMsg];" if model
|
284
|
+
puts_m " }"
|
285
|
+
puts_m " }];"
|
240
286
|
else
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
287
|
+
puts_m " [MLNetworkingManager postWithUrl:#{key} params:nil response:^(MLResponseMessage *responseMessage) {"
|
288
|
+
puts_m " if (response.resultCode == 0 && !response.error){"
|
289
|
+
puts_m " NSDictionary *detailMsg = response.detailMsg"
|
290
|
+
puts_m " #{model[:name]} *model = [#{model[:name]} yy_modelWithDictionary:detailMsg];" if model
|
291
|
+
puts_m " }"
|
292
|
+
puts_m " }];"
|
247
293
|
end
|
248
294
|
end
|
249
295
|
end
|
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.26
|
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-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.8.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: plist
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.1.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.1.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|