yptools 1.0.11 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yptools/autocre/yp_autocre.rb +2221 -0
- data/lib/yptools/autocre/yp_autoinit.rb +58 -0
- data/lib/yptools/help/yp_help.rb +5 -1
- data/lib/yptools/package/yp_package.rb +59 -47
- data/lib/yptools.rb +30 -1
- metadata +18 -2
@@ -0,0 +1,58 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
require 'colored'
|
5
|
+
require 'plist'
|
6
|
+
require 'json'
|
7
|
+
require_relative '../log/yp_log'
|
8
|
+
require_relative '../mgc/yp_makegarbagecode'
|
9
|
+
|
10
|
+
|
11
|
+
class YPAutoInit
|
12
|
+
|
13
|
+
def self.createObjcInitJson
|
14
|
+
yp_path = `pwd`
|
15
|
+
yp_path = yp_path.sub("\n","")
|
16
|
+
fileName = "YpImMessage.json"
|
17
|
+
filePath = yp_path + "/" + fileName
|
18
|
+
|
19
|
+
if File.exists?(filePath)
|
20
|
+
File.delete(filePath)
|
21
|
+
end
|
22
|
+
|
23
|
+
jsonContents = Array.new
|
24
|
+
|
25
|
+
jsonContentsJson = File.new(filePath, "w+")
|
26
|
+
|
27
|
+
jsonContents.push '{'
|
28
|
+
jsonContents.push ' "mode": "DAO",'
|
29
|
+
jsonContents.push ' "module": "YpImMessage",'
|
30
|
+
jsonContents.push ' "table": "yp_im_message",'
|
31
|
+
jsonContents.push ' "property": {'
|
32
|
+
jsonContents.push ' "id": "long",'
|
33
|
+
jsonContents.push ' "msgid": "int64_t",'
|
34
|
+
jsonContents.push ' "content": "NSString",'
|
35
|
+
jsonContents.push ' "sendTime": "NSDate",'
|
36
|
+
jsonContents.push ' "isMute": "BOOL",'
|
37
|
+
jsonContents.push ' "money": "CGFloat"'
|
38
|
+
jsonContents.push ' },'
|
39
|
+
jsonContents.push ' "index": {'
|
40
|
+
jsonContents.push ' "primary-autoincrement": "id"'
|
41
|
+
jsonContents.push ' },'
|
42
|
+
jsonContents.push ' "struct": {'
|
43
|
+
jsonContents.push ' "YpIdContent": ['
|
44
|
+
jsonContents.push ' "id",'
|
45
|
+
jsonContents.push ' "content"'
|
46
|
+
jsonContents.push ' ]'
|
47
|
+
jsonContents.push ' }'
|
48
|
+
jsonContents.push '}'
|
49
|
+
|
50
|
+
jsonContents.each { |lineText|
|
51
|
+
jsonContentsJson.syswrite(lineText);
|
52
|
+
jsonContentsJson.syswrite("\n");
|
53
|
+
}
|
54
|
+
|
55
|
+
jsonContentsJson.close
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
data/lib/yptools/help/yp_help.rb
CHANGED
@@ -2,7 +2,11 @@ class YPHelp
|
|
2
2
|
|
3
3
|
def self.message
|
4
4
|
puts %q{
|
5
|
-
|
5
|
+
|
6
|
+
autocre: use [yptools autocre ...] 自动化工具命令
|
7
|
+
use [yptools autocre -objc ...] 根据 json 自动创建 Objective-C 数据库操作文件 .h|.m 文件。(依赖三方库 FMDB )
|
8
|
+
use [yptools autocre -init] 构建数据库操作文件的json模板
|
9
|
+
|
6
10
|
install: use [yptools install mvvm] 为xcode创建OC语言的mvvm的模板
|
7
11
|
|
8
12
|
mgc: use [yptools mgc suffix] 在当前目录生成垃圾代码(当前目录需要有.xcworkspace或者.xcodeproj目录)
|
@@ -58,54 +58,67 @@ class YPPackage
|
|
58
58
|
end
|
59
59
|
|
60
60
|
puts yp_infoPlistPath
|
61
|
-
puts yp_mobileprovisionPath
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
yp_log_doing "
|
106
|
-
|
107
|
-
|
62
|
+
if yp_mobileprovisionPath.length > 0
|
63
|
+
puts yp_mobileprovisionPath
|
64
|
+
yp_mobileprovisionPlistPath = yp_resourceFile_app + "/" + "mobileprovision.plist"
|
65
|
+
# 解析描述文件
|
66
|
+
yp_mobileprovisionDatum = `security cms -D -i #{yp_mobileprovisionPath}`
|
67
|
+
|
68
|
+
puts yp_mobileprovisionPlistPath
|
69
|
+
|
70
|
+
yp_plistCreateFile = File.new(yp_mobileprovisionPlistPath,"w+")
|
71
|
+
yp_plistCreateFile.syswrite(yp_mobileprovisionDatum)
|
72
|
+
yp_plistCreateFile.close
|
73
|
+
|
74
|
+
yp_log_success "============================================================"
|
75
|
+
|
76
|
+
yp_plist = Plist.parse_xml(yp_mobileprovisionPlistPath)
|
77
|
+
|
78
|
+
if !yp_plist
|
79
|
+
yp_plist = {}
|
80
|
+
end
|
81
|
+
|
82
|
+
yp_appIDName = yp_plist["AppIDName"]
|
83
|
+
yp_applicationIdentifierPrefix = yp_plist["ApplicationIdentifierPrefix"]
|
84
|
+
yp_creationDate = yp_plist["CreationDate"]
|
85
|
+
yp_platform = yp_plist["Platform"]
|
86
|
+
yp_isXcodeManaged = yp_plist["IsXcodeManaged"]
|
87
|
+
yp_developerCertificates = yp_plist["DeveloperCertificates"]
|
88
|
+
yp_DER_Encoded_Profile = yp_plist["DER-Encoded-Profile"]
|
89
|
+
yp_entitlements = yp_plist["Entitlements"]
|
90
|
+
yp_expirationDate = yp_plist["ExpirationDate"]
|
91
|
+
yp_name = yp_plist["Name"]
|
92
|
+
yp_provisionsAllDevices = yp_plist["ProvisionsAllDevices"]
|
93
|
+
yp_teamIdentifier = yp_plist["TeamIdentifier"]
|
94
|
+
yp_teamName = yp_plist["TeamName"]
|
95
|
+
yp_timeToLive = yp_plist["TimeToLive"]
|
96
|
+
yp_uUID = yp_plist["UUID"]
|
97
|
+
yp_version = yp_plist["Version"]
|
98
|
+
yp_provisionedDevices = yp_plist["ProvisionedDevices"]
|
99
|
+
|
100
|
+
yp_log_success " 输出描述文件embedded.mobileprovision"
|
101
|
+
puts yp_mobileprovisionPlistPath
|
102
|
+
puts ''
|
103
|
+
yp_log_doing " 程序名称:\t#{yp_appIDName}"
|
104
|
+
yp_log_doing " 团队名称:\t#{yp_teamName}"
|
105
|
+
yp_log_doing " 创建时间:\t#{yp_creationDate}"
|
106
|
+
yp_log_fail " 过期时间:\t#{yp_expirationDate}"
|
107
|
+
yp_log_doing " 系统平台:\t#{yp_platform}"
|
108
|
+
|
109
|
+
if yp_provisionedDevices.class == Array
|
110
|
+
yp_log_doing " \n udids"
|
111
|
+
for device in yp_provisionedDevices
|
112
|
+
yp_log_doing " #{device}"
|
113
|
+
end
|
108
114
|
end
|
115
|
+
|
116
|
+
puts ''
|
117
|
+
|
118
|
+
else
|
119
|
+
yp_log_success "============================================================"
|
120
|
+
yp_log_success "==================== 来自 AppStore 下载 ===================="
|
121
|
+
|
109
122
|
end
|
110
123
|
|
111
124
|
# yp_log_msg " 标识符🚀:\t#{yp_applicationIdentifierPrefix}"
|
@@ -118,7 +131,6 @@ class YPPackage
|
|
118
131
|
# puts " 生存时间:\t#{yp_timeToLive}"
|
119
132
|
# puts " uuid🚀🚀:\t#{yp_uUID}"
|
120
133
|
# puts " 版本号🚀:\t#{yp_version}"
|
121
|
-
puts ''
|
122
134
|
yp_log_success "============================================================"
|
123
135
|
|
124
136
|
# puts yp_infoPlistPath
|
data/lib/yptools.rb
CHANGED
@@ -8,12 +8,33 @@ require_relative 'yptools/update/yp_update'
|
|
8
8
|
require_relative 'yptools/xcodeproj/yp_xcodeproj'
|
9
9
|
require_relative 'yptools/file/yp_updatecreatedate'
|
10
10
|
require_relative 'yptools/package/yp_package'
|
11
|
+
require_relative 'yptools/autocre/yp_autocre'
|
12
|
+
require_relative 'yptools/autocre/yp_autoinit'
|
11
13
|
|
12
14
|
class YPTools
|
13
15
|
|
14
16
|
def self.cmd_dispatch(argvs)
|
15
17
|
cmd = argvs[0]
|
16
18
|
case cmd
|
19
|
+
when 'autocre'
|
20
|
+
if argvs.size > 1
|
21
|
+
name = argvs[1]
|
22
|
+
case name
|
23
|
+
when '-init'
|
24
|
+
self.autoinit
|
25
|
+
when '-objc'
|
26
|
+
if argvs.size > 2
|
27
|
+
path = argvs[2]
|
28
|
+
self.autocre path
|
29
|
+
else
|
30
|
+
yp_log_fail "'yptools autocre -objc..' 参数缺失"
|
31
|
+
self.help
|
32
|
+
end
|
33
|
+
end
|
34
|
+
else
|
35
|
+
yp_log_fail "'yptools autocre ..' 参数缺失"
|
36
|
+
self.help
|
37
|
+
end
|
17
38
|
when 'install'
|
18
39
|
if argvs.size > 1
|
19
40
|
name = argvs[1]
|
@@ -99,6 +120,14 @@ class YPTools
|
|
99
120
|
YPXcodeproj.xcodeproj(cmd)
|
100
121
|
end
|
101
122
|
|
123
|
+
def self.autocre(name)
|
124
|
+
YPAutoCreate.createObjcSQL(name)
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.autoinit
|
128
|
+
YPAutoInit.createObjcInitJson
|
129
|
+
end
|
130
|
+
|
102
131
|
end
|
103
132
|
|
104
133
|
|
@@ -107,7 +136,7 @@ end
|
|
107
136
|
# 垃圾代码自动添加
|
108
137
|
# 自动打包功能
|
109
138
|
# SDK自动生成
|
110
|
-
#
|
139
|
+
# 根据db文件,自动创建OC数据库
|
111
140
|
|
112
141
|
#puts "🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀";
|
113
142
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yptools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chenghengsheng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: json
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: Some useful tools make me happy
|
112
126
|
email:
|
113
127
|
- 2534550460@qq.com
|
@@ -118,6 +132,8 @@ extra_rdoc_files: []
|
|
118
132
|
files:
|
119
133
|
- bin/yptools
|
120
134
|
- lib/yptools.rb
|
135
|
+
- lib/yptools/autocre/yp_autocre.rb
|
136
|
+
- lib/yptools/autocre/yp_autoinit.rb
|
121
137
|
- lib/yptools/file/yp_updatecreatedate.rb
|
122
138
|
- lib/yptools/help/yp_help.rb
|
123
139
|
- lib/yptools/install/yp_install.rb
|