cocoapods-aomi-bin 0.1.13 → 0.1.14
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 +2 -0
- data/lib/cocoapods-lhj-bin/command/bin/local/fetch.rb +1 -0
- data/lib/cocoapods-lhj-bin/command/bin/model.rb +87 -0
- data/lib/cocoapods-lhj-bin/command/bin/reverse_import.rb +76 -0
- data/lib/cocoapods-lhj-bin/gem_version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ae0f1c3d276bd9f8b0cd9a8f6fd44b98152a7e5bf47e3f9e5fd1b652173013e
|
4
|
+
data.tar.gz: eb24bbf850884f1cc01a801960a78d3d1d39cf1796d11ca350a97791bae34ffb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7232bbe4165e66208653984d2a5f92827fdd68da37109db474c0c278b364df17376eeab3f720b220cf9fe06ebf10cc3c0f5f62360ae63c86ce209ac71c28c3a0
|
7
|
+
data.tar.gz: 2ba17d477ce1401f7d7e25cb1c7b47e11a46e74572ed6dcb1b619e946a784a1d854da6b1129acf257817e14bdca3d7d0b10641588bd954d300ef4f60d3a4712f
|
@@ -6,6 +6,7 @@ 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'
|
11
12
|
require 'cocoapods-lhj-bin/command/bin/local/filter'
|
@@ -13,6 +14,7 @@ require 'cocoapods-lhj-bin/command/bin/local/micro_service'
|
|
13
14
|
require 'cocoapods-lhj-bin/command/bin/local/upload'
|
14
15
|
require 'cocoapods-lhj-bin/command/bin/trans'
|
15
16
|
require 'cocoapods-lhj-bin/command/bin/lhj'
|
17
|
+
require 'cocoapods-lhj-bin/command/bin/model'
|
16
18
|
require 'cocoapods-lhj-bin/command/bin/config/push'
|
17
19
|
require 'cocoapods-lhj-bin/command/bin/oss/list'
|
18
20
|
require 'cocoapods-lhj-bin/command/bin/oss/del'
|
@@ -77,6 +77,7 @@ module Pod
|
|
77
77
|
fname = File.basename(file)
|
78
78
|
dir_name = File.dirname(file)
|
79
79
|
mod_name = framework_name(dir_name)
|
80
|
+
# ('a'..'z').to_a.shuffle[0..12].join
|
80
81
|
key = "#{mod_name}.#{File.basename(file, '.*')}.#{rand(36**8).to_s(36)}"
|
81
82
|
cn_str = str[2, str.length - 3]
|
82
83
|
en_str = cn_str.gsub(/[\u4e00-\u9fa5]/, 'x')
|
@@ -0,0 +1,87 @@
|
|
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
|
+
@models = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
uri = URI.parse(@url)
|
18
|
+
res = Net::HTTP.get_response(uri)
|
19
|
+
res_body = JSON.parse(res.body)
|
20
|
+
detail_msg = res_body['detailMsg']
|
21
|
+
fetch_models(nil, detail_msg) if detail_msg
|
22
|
+
print_models
|
23
|
+
end
|
24
|
+
|
25
|
+
def validate!
|
26
|
+
help! "请输入url" unless @url
|
27
|
+
end
|
28
|
+
|
29
|
+
def fetch_models(name, obj)
|
30
|
+
model = obj
|
31
|
+
model = obj.first if obj.respond_to? :<<
|
32
|
+
@models.unshift({name: name, value: model})
|
33
|
+
model.each do |key, value|
|
34
|
+
if (value.instance_of? Hash) || (value.instance_of? Array)
|
35
|
+
fetch_models(key, value)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def print_models
|
41
|
+
@models.each do |model|
|
42
|
+
model_name = ''
|
43
|
+
model_name = model[:name].gsub('List', '').gsub('Vo', '').gsub(/^\w/) { $&.upcase } if model[:name]
|
44
|
+
puts "@interface ML#{model_name}Model : NSObject"
|
45
|
+
model[:value].each do |key, value|
|
46
|
+
print_property(key, value)
|
47
|
+
end
|
48
|
+
puts "@end\n\n"
|
49
|
+
puts "@implementation ML#{model_name}Model"
|
50
|
+
if model[:name]
|
51
|
+
puts "+(NSDictionary *)modelContainerPropertyGenericClass {"
|
52
|
+
puts " return @{@\"#{model[:name]}\" : ML#{model_name}Model.class};"
|
53
|
+
puts "}"
|
54
|
+
end
|
55
|
+
puts "@end\n\n\n"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def print_property(key, value)
|
60
|
+
if value.instance_of? String
|
61
|
+
puts "///#{value}"
|
62
|
+
puts "@property (nonatomic, copy) NSString *#{key};"
|
63
|
+
elsif value.instance_of? Integer
|
64
|
+
puts "///#{value}"
|
65
|
+
puts "@property (nonatomic, assign) NSInteger #{key};"
|
66
|
+
puts "///#{value}" if value > 1000
|
67
|
+
puts "@property (nonatomic, strong) MLCentNumber *#{key};" if value > 1000
|
68
|
+
elsif value.instance_of? Float
|
69
|
+
puts "///#{value}"
|
70
|
+
puts "@property (nonatomic, assign) CGFloat #{key};"
|
71
|
+
elsif (value.instance_of? TrueClass) || (value.instance_of? FalseClass)
|
72
|
+
puts "///#{value}"
|
73
|
+
puts "@property (nonatomic, assign) BOOL #{key};"
|
74
|
+
elsif value.instance_of? Array
|
75
|
+
puts "///#{key}"
|
76
|
+
name = key.gsub('List', '').gsub('Vo', '').gsub(/^\w/) { $&.upcase }
|
77
|
+
puts "@property (nonatomic, strong) NSArray<ML#{name}Model *> *#{key};"
|
78
|
+
elsif value.instance_of? Hash
|
79
|
+
puts "///#{key}"
|
80
|
+
name = key.gsub('List', '').gsub('Vo', '').gsub(/^\w/) { $&.upcase }
|
81
|
+
puts "@property (nonatomic, strong) ML#{name}Model *#{key};"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
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
|
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.14
|
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
|
@@ -122,9 +122,11 @@ files:
|
|
122
122
|
- lib/cocoapods-lhj-bin/command/bin/local/local.rb
|
123
123
|
- lib/cocoapods-lhj-bin/command/bin/local/micro_service.rb
|
124
124
|
- lib/cocoapods-lhj-bin/command/bin/local/upload.rb
|
125
|
+
- lib/cocoapods-lhj-bin/command/bin/model.rb
|
125
126
|
- lib/cocoapods-lhj-bin/command/bin/oss/del.rb
|
126
127
|
- lib/cocoapods-lhj-bin/command/bin/oss/list.rb
|
127
128
|
- lib/cocoapods-lhj-bin/command/bin/repo/update.rb
|
129
|
+
- lib/cocoapods-lhj-bin/command/bin/reverse_import.rb
|
128
130
|
- lib/cocoapods-lhj-bin/command/bin/spec/create.rb
|
129
131
|
- lib/cocoapods-lhj-bin/command/bin/spec/push.rb
|
130
132
|
- lib/cocoapods-lhj-bin/command/bin/trans.rb
|