yptools 1.0.10 → 1.0.12

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.
@@ -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
@@ -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目录)
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
- # ipa 自动解析
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.10
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - chenghengsheng
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-22 00:00:00.000000000 Z
11
+ date: 2022-11-01 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