cocoapods-aomi-bin 0.1.14 → 0.1.15
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/lib/cocoapods-lhj-bin/command/bin/model.rb +32 -16
- data/lib/cocoapods-lhj-bin/gem_version.rb +1 -1
- metadata +1 -1
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
|
@@ -10,6 +10,7 @@ module Pod
|
|
10
10
|
|
11
11
|
def initialize(argv)
|
12
12
|
@url = argv.shift_argument
|
13
|
+
@model_pre_name = argv.option('model-pre', 'ML')
|
13
14
|
@models = []
|
14
15
|
end
|
15
16
|
|
@@ -20,6 +21,7 @@ module Pod
|
|
20
21
|
detail_msg = res_body['detailMsg']
|
21
22
|
fetch_models(nil, detail_msg) if detail_msg
|
22
23
|
print_models
|
24
|
+
print_models_implementation
|
23
25
|
end
|
24
26
|
|
25
27
|
def validate!
|
@@ -29,10 +31,12 @@ module Pod
|
|
29
31
|
def fetch_models(name, obj)
|
30
32
|
model = obj
|
31
33
|
model = obj.first if obj.respond_to? :<<
|
32
|
-
@models.unshift({name: name, value: model})
|
33
|
-
model.
|
34
|
-
|
35
|
-
|
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
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
@@ -41,17 +45,21 @@ module Pod
|
|
41
45
|
@models.each do |model|
|
42
46
|
model_name = ''
|
43
47
|
model_name = model[:name].gsub('List', '').gsub('Vo', '').gsub(/^\w/) { $&.upcase } if model[:name]
|
44
|
-
puts "@interface
|
48
|
+
puts "@interface #{@model_pre_name}#{model_name}Model : NSObject"
|
45
49
|
model[:value].each do |key, value|
|
46
50
|
print_property(key, value)
|
47
51
|
end
|
48
|
-
puts "@end\n\n"
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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 "}"
|
55
63
|
puts "@end\n\n\n"
|
56
64
|
end
|
57
65
|
end
|
@@ -72,13 +80,21 @@ module Pod
|
|
72
80
|
puts "///#{value}"
|
73
81
|
puts "@property (nonatomic, assign) BOOL #{key};"
|
74
82
|
elsif value.instance_of? Array
|
75
|
-
|
76
|
-
|
77
|
-
|
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
|
78
91
|
elsif value.instance_of? Hash
|
79
92
|
puts "///#{key}"
|
80
93
|
name = key.gsub('List', '').gsub('Vo', '').gsub(/^\w/) { $&.upcase }
|
81
|
-
puts "@property (nonatomic, strong)
|
94
|
+
puts "@property (nonatomic, strong) #{@model_pre_name}#{name}Model *#{key};"
|
95
|
+
else
|
96
|
+
puts "///#{value}"
|
97
|
+
puts "@property (nonatomic, copy) NSString *#{key};"
|
82
98
|
end
|
83
99
|
end
|
84
100
|
end
|