cocoapods-aomi-bin 0.1.19 → 0.1.24

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: 0416aa32911cd1105fb8cc785d16ef9255347324dbfc0d26999c4393fcbfb414
4
- data.tar.gz: 346112074ef84c99ef22c39d374d6cc83b658cd1981ef782f170ca43a78330ae
3
+ metadata.gz: 524830d65e6ab6976b71a596760e02d3ab1778537d181fc0c3309d67fa8f16dc
4
+ data.tar.gz: b02d57e9a23525c083a64f5dcb420a03d35437eb566ae930dd02b8f18d6845ac
5
5
  SHA512:
6
- metadata.gz: 9374f154ead0d0a0ce600d9a8ce899f989f58556f0a6651687f63c3513874dec5fef798405ab6587606ba87b989442b57c0b67ee3f14fcfa698d7e05c183b280
7
- data.tar.gz: d82815aa70210dbfe3c6fdf3151fcd4be77b6b7c3340431cdb91e29e71729134b9ea3a9dff2fa1dbfa660cca13a522cba33d3d3726a052b26b5192ac04a8950f
6
+ metadata.gz: d907a713bdb39a9ced799f2bf23d67684d4e568d1cdcefb8f674963aec21ef16cf7109994e8f3574f0457eb0a9a531c37dbdb8230c010b40dac0289efff6c037
7
+ data.tar.gz: 612d18532a6b97633531c2a7e4a1a17a19a3d379637c7f31ee6080e85a87b24c61e8c6a81a5aae8605ad71f1b2df2e090f91199125f3722cb12d96e765853028
@@ -59,7 +59,7 @@ module Pod
59
59
  end
60
60
 
61
61
  def validate!
62
- # super
62
+ super
63
63
  # 这里由于 --help 是在 validate! 方法中提取的,会导致 --help 失效
64
64
  # pod lib create 也有这个问题
65
65
  banner! if @help
@@ -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,6 +7,7 @@ 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
@@ -50,6 +51,8 @@ module Pod
50
51
  puts " _#{name} = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@\"xxxx\"]];"
51
52
  elsif @type.eql?('UIButton')
52
53
  puts " _#{name} = [UIButton buttonWithType:UIButtonTypeCustom];"
54
+ elsif @type.eql?('UITableView')
55
+ puts " _#{name} = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];"
53
56
  else
54
57
  puts " _#{name} = [[#{@type} alloc] init];"
55
58
  end
@@ -73,6 +76,13 @@ module Pod
73
76
  puts " _#{name}.font = [UIFont systemFontOfSize:12.0 weight:UIFontWeightRegular];"
74
77
  elsif @type.eql?('UIView')
75
78
  puts " _#{name}.backgroundColor = kBackgroundColor;"
79
+ elsif @type.eql?('UITableView')
80
+ puts " _#{name}.backgroundColor = kBackgroundColor;"
81
+ puts " _#{name}.delegate = self;"
82
+ puts " _#{name}.delegate = self;"
83
+ puts " _#{name}.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];"
84
+ puts " _#{name}.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];"
85
+ puts " _#{name}.separatorStyle = UITableViewCellSeparatorStyleNone;"
76
86
  elsif @type.eql?('UIButton')
77
87
  puts " _#{name}.backgroundColor = kBackgroundColor;"
78
88
  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')
@@ -193,8 +243,9 @@ module Pod
193
243
  puts "\n\n"
194
244
  puts "@interface MLParamModel : NSObject"
195
245
  @data_json['req_query'].each do |h|
196
- puts "///#{h['desc']} #{h['example']}"
197
- puts "@property (nonatomic, copy) NSString *#{h['name']}"
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"
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = '0.1.19'
2
+ VERSION = '0.1.24'
3
3
  end
4
4
 
5
5
  module Pod
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.19
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-23 00:00:00.000000000 Z
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