cocoapods-aomi-bin 0.1.18 → 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb55502492ac052c7d2663e4b045a0b1f6662194621c1f3062a48967d8d0f4e5
|
4
|
+
data.tar.gz: 9825c8ee973005e7a441f2a7e43868de023c9342ef1c250bdca64c67fb8c3d76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73475f03e293309adf3cb1e639a0dfba8f626d8eda56b5f95b29b39d5df8a7c372b2b3d638b4e9cc106d94f52c542addbf481ce2955ff2d3a291b3dc02621ed6
|
7
|
+
data.tar.gz: 7dc7519922409b00dca459d9c479050324d5bf2265677b56c29f59914fd9935eec1797587dfcc14385498254a543eaa21b4ac403986fd325bf059af3e83c993f
|
@@ -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
|
@@ -50,6 +50,8 @@ module Pod
|
|
50
50
|
puts " _#{name} = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@\"xxxx\"]];"
|
51
51
|
elsif @type.eql?('UIButton')
|
52
52
|
puts " _#{name} = [UIButton buttonWithType:UIButtonTypeCustom];"
|
53
|
+
elsif @type.eql?('UITableView')
|
54
|
+
puts " _#{name} = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];"
|
53
55
|
else
|
54
56
|
puts " _#{name} = [[#{@type} alloc] init];"
|
55
57
|
end
|
@@ -73,6 +75,13 @@ module Pod
|
|
73
75
|
puts " _#{name}.font = [UIFont systemFontOfSize:12.0 weight:UIFontWeightRegular];"
|
74
76
|
elsif @type.eql?('UIView')
|
75
77
|
puts " _#{name}.backgroundColor = kBackgroundColor;"
|
78
|
+
elsif @type.eql?('UITableView')
|
79
|
+
puts " _#{name}.backgroundColor = kBackgroundColor;"
|
80
|
+
puts " _#{name}.delegate = self;"
|
81
|
+
puts " _#{name}.delegate = self;"
|
82
|
+
puts " _#{name}.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];"
|
83
|
+
puts " _#{name}.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];"
|
84
|
+
puts " _#{name}.separatorStyle = UITableViewCellSeparatorStyleNone;"
|
76
85
|
elsif @type.eql?('UIButton')
|
77
86
|
puts " _#{name}.backgroundColor = kBackgroundColor;"
|
78
87
|
puts " [_#{name} setTitle:@\"xxx\" forState:UIControlStateNormal];"
|
@@ -8,6 +8,13 @@ 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
|
+
]
|
16
|
+
end
|
17
|
+
|
11
18
|
def initialize(argv)
|
12
19
|
@id = argv.option('id')
|
13
20
|
@model_pre_name = argv.option('model-pre')
|
@@ -20,16 +27,22 @@ module Pod
|
|
20
27
|
@type_trans = {}
|
21
28
|
@config_model_names = []
|
22
29
|
@model_names = []
|
30
|
+
super
|
23
31
|
end
|
24
32
|
|
25
33
|
def run
|
26
34
|
load_config
|
27
35
|
fetch_model
|
28
|
-
print_models
|
29
|
-
print_models_implementation
|
30
36
|
print_methods
|
31
37
|
end
|
32
38
|
|
39
|
+
def test_ding
|
40
|
+
require 'net/http'
|
41
|
+
require 'uri'
|
42
|
+
body = { "msgtype" => "text", "text" => { "content" => "error:上传蒲公英超时失败!" } }.to_json
|
43
|
+
Net::HTTP.post(URI('https://oapi.dingtalk.com/robot/send?access_token=6a3519057170cdb1b7274edfe43934c84a0062ffe2c9bcced434699296a7e26e'), body, "Content-Type" => "application/json")
|
44
|
+
end
|
45
|
+
|
33
46
|
def url_str
|
34
47
|
"#{@http_url}#{api_id}"
|
35
48
|
end
|
@@ -68,6 +81,25 @@ module Pod
|
|
68
81
|
|
69
82
|
def fetch_model
|
70
83
|
res_json = req_model
|
84
|
+
begin
|
85
|
+
puts "\n<===============打印返回数据模型-Begin=====================>\n"
|
86
|
+
fetch_res_boy(res_json)
|
87
|
+
print_models
|
88
|
+
print_models_implementation
|
89
|
+
puts "\n<===============打印返回数据模型-End=====================>\n"
|
90
|
+
end
|
91
|
+
begin
|
92
|
+
puts "\n<===============打印请求模型-Begin=====================>\n"
|
93
|
+
@models = []
|
94
|
+
@model_names = []
|
95
|
+
fetch_req_body(res_json)
|
96
|
+
print_models
|
97
|
+
print_models_implementation
|
98
|
+
puts "\n<===============打印请求模型-End=====================>\n"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def fetch_res_boy(res_json)
|
71
103
|
if res_json && res_json['data']
|
72
104
|
@data_json = res_json['data']
|
73
105
|
if @data_json['res_body']
|
@@ -83,6 +115,21 @@ module Pod
|
|
83
115
|
end
|
84
116
|
end
|
85
117
|
|
118
|
+
def fetch_req_body(res_json)
|
119
|
+
if res_json && res_json['data']
|
120
|
+
@data_json = res_json['data']
|
121
|
+
if @data_json['req_body_other']
|
122
|
+
begin
|
123
|
+
res_body = JSON.parse(@data_json['req_body_other'])
|
124
|
+
res_body['name'] = gen_model_name('')
|
125
|
+
handle_model(res_body)
|
126
|
+
rescue => ex
|
127
|
+
puts ex
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
86
133
|
def gen_model_name(name)
|
87
134
|
n = name.gsub(/vo|model|list/i, '').gsub(/(.*)s$/, '\1').gsub(/^\w/) { $&.upcase }
|
88
135
|
if n.length <= 0
|
@@ -126,7 +173,6 @@ module Pod
|
|
126
173
|
end
|
127
174
|
|
128
175
|
def print_models
|
129
|
-
puts "\n<===============打印模型=====================>\n"
|
130
176
|
@models.each do |model|
|
131
177
|
model_name = model[:name] || ''
|
132
178
|
model_properties = model[:properties]
|
@@ -156,11 +202,15 @@ module Pod
|
|
156
202
|
type_name = m[:type_name]
|
157
203
|
type = m[:type]
|
158
204
|
des = m[:description] || ''
|
159
|
-
des.gsub!(/\n/, '')
|
205
|
+
des.gsub!(/\n/, ' ')
|
160
206
|
default = m[:default]
|
161
207
|
puts "///#{des} #{default}"
|
162
208
|
if type.eql?('integer')
|
163
209
|
puts "@property (nonatomic, assign) NSInteger #{key};"
|
210
|
+
if des.include?('分')
|
211
|
+
puts "/////////==========删掉其中一个属性"
|
212
|
+
puts "@property (nonatomic, strong) MLCentNumber *#{key};"
|
213
|
+
end
|
164
214
|
elsif type.eql?('cent')
|
165
215
|
puts "@property (nonatomic, strong) MLCentNumber *#{key};"
|
166
216
|
elsif type.eql?('string')
|
@@ -192,9 +242,10 @@ module Pod
|
|
192
242
|
puts "static NSString * const #{key} = @\"#{@data_json['path']}\";"
|
193
243
|
puts "\n\n"
|
194
244
|
puts "@interface MLParamModel : NSObject"
|
195
|
-
@data_json['
|
196
|
-
|
197
|
-
puts "
|
245
|
+
@data_json['req_query'].each do |h|
|
246
|
+
des = h['desc'].gsub(/\n/, ' ')
|
247
|
+
puts "///#{des} #{h['example']}"
|
248
|
+
puts "@property (nonatomic, copy) NSString *#{h['name']};"
|
198
249
|
end
|
199
250
|
puts "@end"
|
200
251
|
puts "\n\n"
|
@@ -203,14 +254,14 @@ module Pod
|
|
203
254
|
puts " [MLNetworkingManager getWithUrl:#{key} params:nil response:^(MLResponseMessage *responseMessage) {"
|
204
255
|
puts " if (response.resultCode == 0 && !response.error){"
|
205
256
|
puts " NSDictionary *detailMsg = response.detailMsg"
|
206
|
-
puts " #{model[:name]} *model = [#{model[:name]} yy_modelWithDictionary:detailMsg];"
|
257
|
+
puts " #{model[:name]} *model = [#{model[:name]} yy_modelWithDictionary:detailMsg];" if model
|
207
258
|
puts " }"
|
208
259
|
puts " }];"
|
209
260
|
else
|
210
261
|
puts " [MLNetworkingManager postWithUrl:#{key} params:nil response:^(MLResponseMessage *responseMessage) {"
|
211
262
|
puts " if (response.resultCode == 0 && !response.error){"
|
212
263
|
puts " NSDictionary *detailMsg = response.detailMsg"
|
213
|
-
puts " #{model[:name]} *model = [#{model[:name]} yy_modelWithDictionary:detailMsg];"
|
264
|
+
puts " #{model[:name]} *model = [#{model[:name]} yy_modelWithDictionary:detailMsg];" if model
|
214
265
|
puts " }"
|
215
266
|
puts " }];"
|
216
267
|
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.23
|
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-02 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
|