yk_command 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.idea/sonarlint/issuestore/index.pb +1 -11
  3. data/lib/yk_command/.DS_Store +0 -0
  4. data/lib/yk_command/commands.rb +2 -1
  5. data/lib/yk_command/module/module_handler.rb +47 -107
  6. data/lib/yk_command/module/template/.DS_Store +0 -0
  7. data/lib/yk_command/module/template/objc/BusinessHeader.h +0 -0
  8. data/lib/yk_command/module/template/objc/CategoryHeader.h +0 -2
  9. data/lib/yk_command/module/template/objc/RouterRegister.m +8 -15
  10. data/lib/yk_command/module/template/objc/ServiceRegister.m +4 -8
  11. data/lib/yk_command/module/template/swift/.DS_Store +0 -0
  12. data/lib/yk_command/module/template/{tools → swift}/PrefixHeader_swift.swift +0 -0
  13. data/lib/yk_command/module/template/swift/RouterRegisterSwift.swift +4 -4
  14. data/lib/yk_command/module/template/swift/ServiceRegisterSwift.swift +3 -3
  15. data/lib/yk_command/project/full_component_demo_template/NAME.podspec +13 -13
  16. data/lib/yk_command/project/full_component_demo_template/templates/ios/Example/PROJECT/CPDViewController.m +13 -28
  17. data/lib/yk_command/project/full_component_demo_template/templates/swift/Example/PROJECT/ViewController.swift +18 -10
  18. data/lib/yk_command/project/setup/ConfigureiOS.rb +1 -2
  19. data/lib/yk_command/project/setup/TemplateConfigurator.rb +4 -4
  20. data/lib/yk_command/project/yk_project.rb +5 -0
  21. data/lib/yk_command/version.rb +1 -1
  22. metadata +5 -18
  23. data/lib/yk_command/module/template/objc/RouterDefine.h +0 -14
  24. data/lib/yk_command/module/template/objc/ServiceProtocol.h +0 -15
  25. data/lib/yk_command/module/template/objc/demo/AppDelegate.swift +0 -16
  26. data/lib/yk_command/module/template/objc/demo/DemoVC_sw.swift +0 -30
  27. data/lib/yk_command/module/template/objc/demo/DemoViewController.h +0 -17
  28. data/lib/yk_command/module/template/objc/demo/DemoViewController.m +0 -28
  29. data/lib/yk_command/module/template/objc/demo/DemoViewModel.h +0 -14
  30. data/lib/yk_command/module/template/objc/demo/DemoViewModel.m +0 -19
  31. data/lib/yk_command/module/template/swift/ModuleRegisterMix.h +0 -17
  32. data/lib/yk_command/module/template/swift/ModuleRegisterMix.m +0 -61
  33. data/lib/yk_command/module/template/swift/ModuleRegisterSwift.swift +0 -41
  34. data/lib/yk_command/module/template/swift/RouterDefineSwift.swift +0 -15
  35. data/lib/yk_command/module/template/tools/.DS_Store +0 -0
  36. data/lib/yk_command/module/template/tools/PrefixHeader.pch +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f040cbe03968a6a21d06f5b7e4c7f5298f17a492d5c858d756928bbf1388d58
4
- data.tar.gz: 4dbd51254178b5ed5b9375ce138c69fc120b206e0e8c0926c60bc09ad46c71be
3
+ metadata.gz: be65a7c2288fc57e31f8a34211a1155e7d3ac040b3a9ce312c74ddb87e75f5e2
4
+ data.tar.gz: 2f7e12d9ab2884ac180ce1a5f77e104fafa9e0c36bde7fa08482d94dd7b29be8
5
5
  SHA512:
6
- metadata.gz: 7e0baa1b2df34984201586c2351d8540c9fc3939ddd2528c304168370c33cbd13df3cb5f6fb9ca6863974b676bcbdfc7f775034b4828e1629ed96cff4de331c9
7
- data.tar.gz: 47f96a4896ff0b92ef293d7f40763e098da3c7987a9a75a69558cd2c7cfd9dac678f72110ef6db73ee4f2ba5e59bb4add066c1eeabfcf659143059eec1b38586
6
+ metadata.gz: 8eeff4266d02b1496bdde08469fa30c888173451771c339ef06490608cd1862f5497e9463d2fd139d9773313dbe1e78052bf5817f41eec483997e7faa3e813c4
7
+ data.tar.gz: 2cf0deb795d35afdc5e3e57b83bd6f6349840f4ccb3ef405eb824bba14df69049263bbc8a2e889363d120f0f84d220b5c35e33ee4ec966b8906003470813f438
@@ -45,8 +45,6 @@ b
45
45
  2lib/yk_command/project/setup/ProjectManipulator.rb,f/6/f6e109e4c314cef09022792f4b88dd267a682d28
46
46
  d
47
47
  4lib/yk_command/project/setup/TemplateConfigurator.rb,8/f/8f9b3c6ba85192218bf69497d64693c792545edb
48
- W
49
- 'lib/yk_command/module/module_handler.rb,8/4/841f2109f591be400d71147c5dfcb8a1cc2d144b
50
48
  =
51
49
 
52
50
  A
@@ -71,12 +69,8 @@ klib/yk_command/project/full_component_demo_template/templates/ios/Example/PROJE
71
69
  elib/yk_command/project/full_component_demo_template/templates/ios/Example/PROJECT/CPDViewController.m,c/9/c973c369f2aa20ae7393f8ad1bae5fcc9dad88a6
72
70
  �
73
71
  hlib/yk_command/project/full_component_demo_template/templates/swift/Example/PROJECT/ViewController.swift,e/a/ea5310f3594c5f758431573a3eee2e3cb34f8370
74
- n
75
- >lib/yk_command/module/template/swift/RouterRegisterSwift.swift,e/7/e7859f10f0642d758bd3e51a5c1fc8dd30857da0
76
72
  q
77
73
  Alib/yk_command/project/full_component_demo_template/POD_README.md,0/d/0dbcd16920547d0b8058e424f5bbc22888b9d24c
78
- J
79
- lib/yk_command/commands.rb,9/0/90c3ae459446d94ee4d518d1d70cf0d7c221b395
80
74
  v
81
75
  Flib/yk_command/project/simple_component_demo_template/NAME-osx.podspec,6/c/6c61bf367999c685c974253a7e78b0d53b7bdc75
82
76
  r
@@ -90,8 +84,4 @@ h
90
84
  j
91
85
  :lib/yk_command/module/template/objc/demo/AppDelegate.swift,7/0/703a9a497b73c9ae46f475cf01385805ce3107d9
92
86
  n
93
- >lib/yk_command/module/template/swift/ModuleRegisterSwift.swift,a/c/ace0d6f0fec5ed05717682fdff9078acfde3a7a3
94
- T
95
- $lib/yk_command/project/yk_project.rb,5/6/56b2d27b09b172bae1a27bc07f664d2ed5a6c3c6
96
- I
97
- lib/yk_command/version.rb,c/5/c5e8ad55d5b356f308ba78bbba690733f246ebcb
87
+ >lib/yk_command/module/template/swift/ModuleRegisterSwift.swift,a/c/ace0d6f0fec5ed05717682fdff9078acfde3a7a3
Binary file
@@ -42,9 +42,10 @@ module YkCommand
42
42
  desc 'create_host_app <Path>', '生成一个 App 工程'
43
43
  method_option :create_host_app, aliases: '-csd'
44
44
  def create_host_app(path = nil)
45
- put ' -- '
45
+ puts' -- '
46
46
  #TODO 实现创建一个host app项目,分为纯净版本,类似于Xcode的初始项目,和包含基础组件和热门组件用于生产目的的项目
47
47
  #
48
+ YkProject.new(true).create_host('TestApp','swift','YK','Tom',path);
48
49
  end
49
50
 
50
51
 
@@ -17,132 +17,72 @@ module YkCommand
17
17
 
18
18
  no_commands do
19
19
  def yk_module_folders
20
- class_folder_path = "#{@final_path}/#{@name}/Classes"
21
20
 
22
- first_level_folders = %w[Public Private]
23
-
24
- # public_level_folders = ['Register']
25
- # public_level_folders.each do |folder|
26
- # path = "#{class_folder_path}/Public/#{folder}"
27
- # empty_directory path
28
- # end
29
-
30
- private_level_folders = %w[Business Category Vendor Tools]
31
-
32
- first_level_folders.each do |folder|
33
- path = "#{class_folder_path}/#{folder}"
34
- empty_directory path
35
- end
36
-
37
- private_level_folders.each do |folder|
38
- path = "#{class_folder_path}/Private/#{folder}"
39
- empty_directory path
40
- end
41
21
  end
42
22
 
43
23
  YkCommand::ModuleHandler.source_root(File.dirname(__FILE__))
44
24
 
45
25
  def yk_template_files
46
26
 
47
- # objc register
48
- register_path = "#{@final_path}/#{@name}/Classes/Private/RegisterOC"
49
- registger = {
50
- 'RouterRegister.h' => 'RouterRegister',
51
- 'RouterRegister.m' => 'RouterRegister',
52
- 'ServiceRegister.h' => 'ServiceRegister',
53
- 'ServiceRegister.m' => 'ServiceRegister'
54
- }
27
+ module_root_path = File.join(@final_path, @name)
28
+ module_classes_path = File.join(module_root_path, "Classes")
29
+ file_root_path = File.join(__dir__, "template")
55
30
 
56
- registger.each do |file_name, _folder|
57
- final_file = "#{register_path}/#{@prefixed_module}#{file_name}"
58
- template "#{__dir__}/template/objc/#{file_name}", final_file
59
- end
31
+ # assets bundle
32
+ FileUtils.mkdir(File.join(module_root_path, "Assets", "Images.xcassets"))
33
+ # resources directory
34
+ FileUtils.mkdir(File.join(module_root_path,"Resources"))
60
35
 
61
- #swift register
62
- s_register_path = "#{@final_path}/#{@name}/Classes/Private/RegisterSwift"
63
- s_registger = {
64
- 'ModuleRegisterMix.h' => 'Bridge',
65
- 'ModuleRegisterMix.m' => 'Bridge',
66
- 'ModuleRegisterSwift.swift' => 'Bridge',
67
- 'RouterRegisterSwift.swift' => 'Router',
68
- 'ServiceRegisterSwift.swift' => 'Service',
69
- }
36
+ dest_dir_business = "Work/Business"
37
+ dest_dir_category = "Work/Category"
38
+ dest_dir_vendor = "Work/Vendor"
39
+ dest_dir_tools = "Work/Tools"
70
40
 
71
- s_registger.each do |file_name, _folder|
72
- s_final_file = File.join(s_register_path, _folder, "#{@prefixed_module}#{file_name}")
73
- template "#{__dir__}/template/swift/#{file_name}", s_final_file
74
- end
41
+ dest_dir_register_oc = "Work/RegisterOC"
42
+ dest_dir_register_swift = "Work/RegisterSwift"
75
43
 
76
- #assets bundle
77
- assets_path = "#{@final_path}/#{@name}/Assets"
78
- FileUtils.mkdir(File.join(@final_path, @name, "Assets", "Images.xcassets"))
79
-
80
- #public
81
- public_folder_path = "#{@final_path}/#{@name}/Classes/Public"
82
- template_code_filename = [
83
- 'ServiceProtocol.h',
84
- 'RouterDefine.h',
85
- 'Helper.h',
86
- 'Helper.m',
87
- ]
88
- template_code_filename.each do |file_name|
89
- final_file = "#{public_folder_path}/#{@prefixed_module}#{file_name}"
90
- source = "#{__dir__}/template/objc/#{file_name}"
91
- template source, final_file
92
- end
44
+ dest_dir_pch = "."
45
+ # pch file
46
+ file_dir_pch = File.join(file_root_path, "objc")
47
+ file_arr_pch = {
48
+ 'PrefixHeader.pch' => dest_dir_pch,
49
+ }
93
50
 
94
- # router define
95
- swift_template_code_filename = [
96
- 'RouterDefineSwift.swift',
97
- 'Tool.swift',
98
- ]
99
- swift_template_code_filename.each do |file_name|
100
- final_file = "#{public_folder_path}/#{@prefixed_module}#{file_name}"
101
- source = "#{__dir__}/template/swift/#{file_name}"
102
- template source, final_file
51
+ file_arr_pch.each do |file, folder|
52
+ template(File.join(file_dir_pch, file), File.join(module_classes_path, folder, "#{@project}#{file}"))
103
53
  end
104
54
 
105
- private_folder_path = "#{@final_path}/#{@name}/Classes/Private"
106
- #common file
107
- # pch_file_name = "PrefixHeader.pch"
108
- # final_file = "#{private_folder_path}/#{@prefixed_module}#{pch_file_name}"
109
- # source = "#{__dir__}/template/objc/#{pch_file_name}"
110
- # template source, final_file
111
-
112
- private_level_folder_files = {
113
- 'PrefixHeader.pch' => '.',
114
- 'CategoryHeader.h' => 'Category',
115
- 'ToolsHeader.h' => 'Tools',
116
- 'vendorHeader.h' => 'Vendor'
55
+ # objc files
56
+ file_dir_oc = File.join(file_root_path, "objc")
57
+ file_arr_oc = {
58
+ 'RouterRegister.h' => dest_dir_register_oc,
59
+ 'RouterRegister.m' => dest_dir_register_oc,
60
+ 'ServiceRegister.h' => dest_dir_register_oc,
61
+ 'ServiceRegister.m' => dest_dir_register_oc,
62
+ 'CategoryHeader.h' => dest_dir_category,
63
+ 'ToolsHeader.h' => dest_dir_tools,
64
+ 'Helper.h' => dest_dir_tools,
65
+ 'Helper.m' => dest_dir_tools,
66
+ 'VendorHeader.h' => dest_dir_vendor,
67
+ 'BusinessHeader.h' => dest_dir_business,
117
68
  }
118
69
 
119
- private_level_folder_files.each do |file_name, folder|
120
- final_prefix = @prefixed_module
121
- if file_name == 'PrefixHeader.pch'
122
- final_prefix = @name
123
- end
124
-
125
- final_file = "#{private_folder_path}/#{folder}/#{final_prefix}#{file_name}"
126
- source = "#{__dir__}/template/objc/#{file_name}"
127
- template source, final_file
70
+ file_arr_oc.each do |file, folder|
71
+ template(File.join(file_dir_oc, file), File.join(module_classes_path, folder, "#{@prefixed_module}#{file}"))
128
72
  end
129
73
 
130
- #demo oc
131
- business_demo_path = "#{@final_path}/#{@name}/Classes/Private/Business/Demo"
132
- demo_replace_file = ['DemoViewController.h', 'DemoViewController.m', 'DemoViewModel.h', 'DemoViewModel.m']
133
- demo_replace_file.each do |file_name|
134
- final_file = "#{business_demo_path}/oc/#{@prefixed_module}#{file_name}"
135
- source = "#{__dir__}/template/objc/demo/#{file_name}"
136
- template source, final_file
137
- end
74
+ # swift files
75
+ file_dir_swift = File.join(file_root_path, "swift")
76
+ file_arr_swift = {
77
+ 'RouterRegisterSwift.swift' => dest_dir_register_swift,
78
+ 'ServiceRegisterSwift.swift' => dest_dir_register_swift,
79
+
80
+ 'PrefixHeader_swift.swift' => dest_dir_pch,
81
+ 'Tool.swift' => dest_dir_tools,
82
+ }
138
83
 
139
- #demo swift
140
- business_demo_path = "#{@final_path}/#{@name}/Classes/Private/Business/Demo"
141
- demo_replace_file = ['DemoVC_sw.swift', "AppDelegate.swift"]
142
- demo_replace_file.each do |file_name|
143
- final_file = "#{business_demo_path}/Swift/#{@prefixed_module}#{file_name}"
144
- source = "#{__dir__}/template/objc/demo/#{file_name}"
145
- template source, final_file
84
+ file_arr_swift.each do |file, folder|
85
+ template(File.join(file_dir_swift, file), File.join(module_classes_path, folder, "#{@prefixed_module}#{file}"))
146
86
  end
147
87
 
148
88
 
@@ -9,6 +9,4 @@
9
9
  #ifndef <%= @prefixed_module %>CategoryHeader_h
10
10
  #define <%= @prefixed_module %>CategoryHeader_h
11
11
 
12
- #import <YKCategoryComponent/YKCategoriesComponentHeader.h>
13
-
14
12
  #endif /* <%= @prefixed_module %>CategoryHeader_h */
@@ -10,23 +10,16 @@
10
10
 
11
11
  #import <YKRouterComponent/YKRouterComponentHeader.h>
12
12
 
13
- #import "<%= @prefixed_module %>RouterDefine.h"
14
-
15
- #import "<%= @prefixed_module %>DemoViewController.h"
16
-
17
- #import <<%= @name %>/<%= @name %>-Swift.h>
18
-
13
+ @interface <%= @prefixed_module %>RouterRegister()<YKRouterComponentRegisterProtocol>
14
+ @end
19
15
  @implementation <%= @prefixed_module %>RouterRegister
20
16
 
21
- @YKRouterRegister() {
22
-
23
- [[YKRouterComponent shareInstance] ykRegisterUrlPartterns:kDemoRouterString error:nil action:^(YKRouterUrlRequest * _Nonnull urlRequest, YKRouterUrlCompletion _Nonnull completetion) {
24
-
25
- <%= @prefixed_module %>DemoViewController *vc = [[<%= @prefixed_module %>DemoViewController alloc] init];
26
- [[UIViewController yk_topViewController].navigationController pushViewController:vc animated:YES];
27
-
28
- }];
29
-
17
+ + (void)ykRouterRegisterExecute {
18
+ // [[YKRouterComponent shareInstance] ykRegisterUrlPartterns:@"kDemoRouterString" error:nil action:^(YKRouterUrlRequest * _Nonnull urlRequest, YKRouterUrlCompletion _Nonnull completetion) {
19
+ //
20
+ // UIViewController *vc = [[UIViewController alloc] init];
21
+ // [urlRequest.fromVC.navigationController pushViewController:vc animated:YES];
22
+ // }];
30
23
  }
31
24
 
32
25
 
@@ -9,17 +9,13 @@
9
9
  #import "<%= @prefixed_module %>ServiceRegister.h"
10
10
  #import <YKModuleServiceComponent/YKModuleServiceComponentHeader.h>
11
11
 
12
- #import "<%= @prefixed_module %>ServiceProtocol.h"
13
-
14
-
15
- #import "<%= @prefixed_module %>DemoViewModel.h"
16
-
12
+ @interface <%= @prefixed_module %>ServiceRegister()<YKModuleServiceRegisterProtocol>
13
+ @end
17
14
 
18
15
  @implementation <%= @prefixed_module %>ServiceRegister
19
16
 
20
- @YKModuleServiceRegister(){
21
- YKModuleServiceRegisterExecute(<%= @prefixed_module %>DemoViewModel.class, @protocol(<%= @prefixed_module %>ServiceProtocol), nil);
17
+ + (void)ykModuleServiceRegistAction {
18
+ // YKModuleServiceRegisterExecute(XXXX.class, @protocol(XXXProtocol), nil);
22
19
  }
23
20
 
24
-
25
21
  @end
@@ -15,9 +15,9 @@ class <%= @prefixed_module %>RouterRegisterSwift: NSObject {
15
15
  extension <%= @prefixed_module %>RouterRegisterSwift: YKRouterComponentRegisterProtocol {
16
16
  static func ykRouterRegisterExecute() {
17
17
  //注册路由 kRouter_example_POD_NAME_swift
18
- YKRouterRegisterUrlParttern(<%= @prefixed_module %>RouterConstants.testVC_swift, nil) { (urlRequest: YKRouterUrlRequest, complete: YKRouterUrlCompletion?) in
19
- let vc = <%= @prefixed_module %>DemoVC_sw()
20
- urlRequest.fromVC?.navigationController?.pushViewController(vc, animated: true)
21
- }
18
+ //YKRouterRegisterUrlParttern("routerUrl", nil) { (urlRequest: YKRouterUrlRequest, complete: YKRouterUrlCompletion?) in
19
+ //let vc = UIViewController()
20
+ //urlRequest.fromVC?.navigationController?.pushViewController(vc, animated: true)
21
+ //}
22
22
  }
23
23
  }
@@ -7,14 +7,14 @@
7
7
 
8
8
  import Foundation
9
9
 
10
- import YKModuleServiceComponent
10
+ import YKModuleServiceComponentSwift
11
11
 
12
12
  class <%= @prefixed_module %>ServiceRegisterSwift: NSObject, YKModuleServiceRegisterProtocol {
13
- static func ykModuleServiceRegitAction() {
13
+ static func ykModuleServiceRegistAction() {
14
14
  //注册服务 NSObject --> NSObjectProtocol NSObjectProtocol为 swift 协议
15
15
  //YKModuleServiceComponent().ykRegistModuleService(service: NSObject.self, protocol: NSObjectProtocol.self, err: nil)
16
16
 
17
17
  //注册服务 NSObject --> NSObjectProtocol NSObjectProtocol为 OC 协议
18
- // YKService().ykRegisterModuleService_oc(NSObject.self, protocol: NSObjectProtocol.self, err: nil)
18
+ //YKService().ykRegisterModuleService_oc(NSObject.self, protocol: NSObjectProtocol.self, err: nil)
19
19
  }
20
20
  }
@@ -92,14 +92,12 @@ Pod::Spec.new do |spec|
92
92
  #
93
93
 
94
94
  spec.source_files = '${POD_NAME}/Classes/**/*.{h,m,mm,c,cpp,swift,pch}'
95
- spec.exclude_files = "Classes/Exclude"
96
- spec.prefix_header_file = '${POD_NAME}/Classes/Private/${POD_NAME}PrefixHeader.pch'
97
- spec.public_header_files = '${POD_NAME}/Classes/Public/**/*.h'
98
-
99
- # spec.public_header_files = "Classes/**/*.h"
100
-
95
+ # spec.exclude_files = "Classes/Exclude" #排除文件
101
96
 
97
+ spec.prefix_header_file = '${POD_NAME}/Classes/${POD_NAME}PrefixHeader.pch'
102
98
 
99
+ spec.project_header_files = '${POD_NAME}/Classes/{Category,Register,Tools,Vendor,Business}/**/*.{h}'
100
+ #spec.public_header_files = '${POD_NAME}/Classes/Public/**/*.h' #此处放置组件的对外暴漏的头文件
103
101
 
104
102
  # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
105
103
  #
@@ -110,10 +108,12 @@ Pod::Spec.new do |spec|
110
108
  #
111
109
 
112
110
  # spec.resource = "icon.png"
113
- # spec.resources = "Resources/*.png"
114
- spec.resource_bundles = {
111
+ # 放置 json,font,jpg,png等资源
112
+ spec.resources = "${POD_NAME}/{Classes,Resources}/**/*.{png,jpg,font,json,xib}"
113
+
114
+ spec.resource_bundles = {
115
115
  '${POD_NAME}' => ['${POD_NAME}/Assets/**/*.xcassets']
116
- }
116
+ }
117
117
  # spec.preserve_paths = "FilesToSave", "MoreFilesToSave"
118
118
 
119
119
 
@@ -141,11 +141,11 @@ Pod::Spec.new do |spec|
141
141
  # spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
142
142
  # spec.dependency "JSONKit", "~> 1.4"
143
143
 
144
-
145
-
146
- spec.dependency "YKCategoryComponent"
144
+ # 组件化架构中间件
147
145
  spec.dependency "YKModuleLifeCircleComponent"
148
146
  spec.dependency "YKRouterComponent"
149
- spec.dependency "YKModuleServiceComponent"
147
+ spec.dependency "YKModuleServiceComponent" # oc 服务中间件
148
+ spec.dependency "YKModuleServiceComponent.swift" #swift 服务中间件, 如果是纯oc组件,请注释此中间件
150
149
 
150
+ # 其他依赖pod
151
151
  end
@@ -11,11 +11,6 @@
11
11
  #import <YKRouterComponent/YKRouterComponentHeader.h>
12
12
  #import <YKModuleServiceComponent/YKModuleServiceComponentHeader.h>
13
13
 
14
- #import <PROJECT/CPDPROJECTServiceProtocol.h>
15
-
16
- #import <PROJECT/CPDPROJECTRouterDefine.h>
17
- #import <PROJECT/CPDPROJECTHelper.h>
18
-
19
14
  @interface CPDViewController ()
20
15
 
21
16
  @end
@@ -28,35 +23,25 @@
28
23
  self.navigationItem.title = [NSString stringWithFormat:@"%@",@"PROJECT Demo"];
29
24
  }
30
25
 
31
-
32
26
  - (IBAction)routerEvent:(id)sender {
33
27
  NSLog(@"这里调用模块的路由");
34
- [self yk_openUrl:kDemoRouterString parameter:@{}];
35
-
36
- UIImage *img1 = kModuleResourceImage_PROJECT(@"123");
37
- NSLog(@"img1:%@", img1);
28
+ // YKRouterUrlRequest* request = [YKRouterUrlRequest instanceWithBuilder:^(YKRouterUrlRequest * _Nonnull builder) {
29
+ // builder.url = @"url";
30
+ // builder.parameter = @{};
31
+ // }];
32
+ // return [[YKRouterComponent shareInstance] ykOpenUrl:request complete:^(YKRouterUrlResponse * _Nonnull urlResponse) {
33
+ //
34
+ // }];
38
35
  }
39
36
 
40
37
  - (IBAction)serviceEvent:(id)sender {
41
38
  NSLog(@"这里调用模块的服务");
42
- NSError *err;
43
- __kindof Class<CPDPROJECTServiceProtocol> cls =YKModuleServiceWithProtocol(@protocol(CPDPROJECTServiceProtocol), &err);
44
- if (!err) {
45
- NSObject <CPDPROJECTServiceProtocol>* obj = [[cls alloc] init];
46
- [obj replaceThisMethod];
47
- }
39
+ // NSError *err;
40
+ // __kindof Class<NSObject> cls =YKModuleServiceWithProtocol(@protocol(CPDPROJECTServiceProtocol), &err);
41
+ // if (!err) {
42
+ // NSObject <CPDPROJECTServiceProtocol>* obj = [[cls alloc] init];
43
+ // [obj replaceThisMethod];
44
+ // }
48
45
  }
49
46
 
50
- - (void)yk_openUrl:(NSString *)url parameter:(NSDictionary *__nullable)parameters {
51
-
52
- YKRouterUrlRequest* request = [YKRouterUrlRequest instanceWithBuilder:^(YKRouterUrlRequest * _Nonnull builder) {
53
- builder.url = url;
54
- builder.parameter = parameters;
55
- }];
56
- return [[YKRouterComponent shareInstance] ykOpenUrl:request complete:^(YKRouterUrlResponse * _Nonnull urlResponse) {
57
-
58
- }];
59
- }
60
-
61
-
62
47
  @end
@@ -11,9 +11,7 @@ import UIKit
11
11
  import PROJECT
12
12
 
13
13
  import YKRouterComponent
14
- import YKModuleServiceComponent
15
-
16
-
14
+ import YKModuleServiceComponentSwift
17
15
 
18
16
  class ViewController: UIViewController {
19
17
 
@@ -26,18 +24,28 @@ class ViewController: UIViewController {
26
24
 
27
25
  @IBAction func routerEvent(_ sender: Any) {
28
26
  print("---调用路由---")
29
- YKRouterComponent.shareInstance().ykOpenUrlInstance(CPDPROJECTRouterConstants.testVC_swift, fromVC: self, complete: nil)
30
-
31
- let img1 = CPDPROJECTTool.kResourceImage(name: "123")
32
-
33
- let img2 = kModuleResourceImage_PROJECT("123")
34
- print("img1:\(img1)")
35
- print("img2:\(img2)")
27
+ // YKRouterComponent.shareInstance().ykOpenUrlInstance("routerUrl", fromVC: self, complete: nil)
36
28
  }
37
29
 
38
30
 
39
31
  @IBAction func serviceEvent(_ sender: Any) {
40
32
  print("---调用服务---")
33
+ // oc 专用接口
34
+ // let ser: AnyClass? = YKModuleServiceComponent().ykModule(with: NSObjectProtocol.self, error: nil)
35
+ // guard let ser: NSObjectProtocol.Type = ser as? NSObjectProtocol.Type else {
36
+ // print("no ser confor to protocol:\(XXX_SwiftProtocol.self)")
37
+ // return
38
+ // }
39
+ // ser.xxx()
40
+
41
+ // swift / oc 通用接口
42
+ // let ser: AnyClass? = YKModuleServiceComponent().ykModule(protocol: XXX_SwiftProtocol.self, error: nil)
43
+ // guard let ser: XXX_SwiftProtocol.Type = ser as? XXX_SwiftProtocol.Type else{
44
+ // print("no ser confor to protocol:\(XXX_SwiftProtocol.self)")
45
+ // return
46
+ // }
47
+ //
48
+ // ser.xxx()
41
49
  }
42
50
  }
43
51
 
@@ -93,8 +93,7 @@ module Pod
93
93
 
94
94
  # # remove podspec for osx
95
95
  # `rm ./NAME-osx.podspec`
96
-
97
- `touch #{$current_dir}/Pod/Classes/ReplaceMe.swift`
96
+ `touch #{$current_dir}/Pod/Classes/ReplaceMe.m`
98
97
 
99
98
  `mv #{$current_dir}/templates/ios/* #{$current_dir}`
100
99
 
@@ -107,13 +107,13 @@ module Pod
107
107
  end
108
108
 
109
109
  def add_yk_pods
110
- self.add_pod_to_podfile "YKCategoryComponent"
110
+ # self.add_pod_to_podfile "YKCategoryComponent"
111
111
  self.add_pod_to_podfile "YKModuleLifeCircleComponent"
112
112
  self.add_pod_to_podfile "YKRouterComponent"
113
- self.add_pod_to_podfile "YKModuleServiceComponent"
114
-
113
+
115
114
  if @framework == "swift"
116
- self.add_pod_to_podfile "SnapKit"
115
+ # self.add_pod_to_podfile "SnapKit"
116
+ self.add_pod_to_podfile "YKModuleServiceComponent.swift"
117
117
  else
118
118
  self.add_pod_to_podfile "YKModuleServiceComponent"
119
119
  end
@@ -22,6 +22,11 @@ module YkCommand
22
22
 
23
23
  end
24
24
 
25
+ def create_host(app_name, framework, prefix, author, at_path)
26
+ prepare_project(app_name,framework, prefix, author, at_path)
27
+ end
28
+
29
+
25
30
  def prepare_project(pod_name, framework, prefix, author, at_path)
26
31
 
27
32
  des_path = Pathname.new(at_path)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YkCommand
4
- VERSION = '0.6.4'.freeze
4
+ VERSION = '0.6.5'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yk_command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Major Tom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-16 00:00:00.000000000 Z
11
+ date: 2022-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -283,35 +283,22 @@ files:
283
283
  - lib/yk_command/module/module_handler.rb
284
284
  - lib/yk_command/module/template/.DS_Store
285
285
  - lib/yk_command/module/template/objc/.DS_Store
286
+ - lib/yk_command/module/template/objc/BusinessHeader.h
286
287
  - lib/yk_command/module/template/objc/CategoryHeader.h
287
288
  - lib/yk_command/module/template/objc/Helper.h
288
289
  - lib/yk_command/module/template/objc/Helper.m
289
290
  - lib/yk_command/module/template/objc/PrefixHeader.pch
290
- - lib/yk_command/module/template/objc/RouterDefine.h
291
291
  - lib/yk_command/module/template/objc/RouterRegister.h
292
292
  - lib/yk_command/module/template/objc/RouterRegister.m
293
- - lib/yk_command/module/template/objc/ServiceProtocol.h
294
293
  - lib/yk_command/module/template/objc/ServiceRegister.h
295
294
  - lib/yk_command/module/template/objc/ServiceRegister.m
296
295
  - lib/yk_command/module/template/objc/ToolsHeader.h
297
296
  - lib/yk_command/module/template/objc/VendorHeader.h
298
- - lib/yk_command/module/template/objc/demo/AppDelegate.swift
299
- - lib/yk_command/module/template/objc/demo/DemoVC_sw.swift
300
- - lib/yk_command/module/template/objc/demo/DemoViewController.h
301
- - lib/yk_command/module/template/objc/demo/DemoViewController.m
302
- - lib/yk_command/module/template/objc/demo/DemoViewModel.h
303
- - lib/yk_command/module/template/objc/demo/DemoViewModel.m
304
297
  - lib/yk_command/module/template/swift/.DS_Store
305
- - lib/yk_command/module/template/swift/ModuleRegisterMix.h
306
- - lib/yk_command/module/template/swift/ModuleRegisterMix.m
307
- - lib/yk_command/module/template/swift/ModuleRegisterSwift.swift
308
- - lib/yk_command/module/template/swift/RouterDefineSwift.swift
298
+ - lib/yk_command/module/template/swift/PrefixHeader_swift.swift
309
299
  - lib/yk_command/module/template/swift/RouterRegisterSwift.swift
310
300
  - lib/yk_command/module/template/swift/ServiceRegisterSwift.swift
311
301
  - lib/yk_command/module/template/swift/Tool.swift
312
- - lib/yk_command/module/template/tools/.DS_Store
313
- - lib/yk_command/module/template/tools/PrefixHeader.pch
314
- - lib/yk_command/module/template/tools/PrefixHeader_swift.swift
315
302
  - lib/yk_command/module/yk_module.rb
316
303
  - lib/yk_command/project/.DS_Store
317
304
  - lib/yk_command/project/full_component_demo_template/.gitignore
@@ -472,7 +459,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
472
459
  - !ruby/object:Gem::Version
473
460
  version: '0'
474
461
  requirements: []
475
- rubygems_version: 3.1.6
462
+ rubygems_version: 3.3.7
476
463
  signing_key:
477
464
  specification_version: 4
478
465
  summary: a short summary, because RubyGems requires one.
@@ -1,14 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>RouterDefine.h
3
- // <%= @project %>
4
- //
5
- // Created by <%= @author %> on <%= @date %>.
6
- //
7
- //
8
-
9
- #ifndef <%= @prefixed_module %>RouterDefine_h
10
- #define <%= @prefixed_module %>RouterDefine_h
11
-
12
- static NSString *kDemoRouterString = @"<%= @prefixed_module %>DemoPage";
13
-
14
- #endif /* <%= @prefixed_module %>RouterDefine_h */
@@ -1,15 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>ServiceProtocol.h
3
- // <%= @project %>
4
- //
5
- // Created by <%= @author %> on <%= @date %>.
6
- //
7
- //
8
-
9
- #import <Foundation/Foundation.h>
10
-
11
- @protocol <%= @prefixed_module %>ServiceProtocol <NSObject>
12
-
13
- - (void)replaceThisMethod;
14
-
15
- @end
@@ -1,16 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>AppDelegate.swift
3
- // <%= @project %>
4
- //
5
- // Created by <%= @author %> on <%= @date %>.
6
- //
7
-
8
- import UIKit
9
-
10
- class <%= @prefixed_module %>AppDelegate: UIResponder, UIApplicationDelegate {
11
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
12
- // Override point for customization after application launch.
13
- print("\(self)--\(#function)")
14
- return true
15
- }
16
- }
@@ -1,30 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>DemoVC_sw.swift
3
- // <%= @project %>
4
- //
5
- // Created by <%= @author %> on <%= @date %>.
6
- //
7
-
8
- import UIKit
9
-
10
- class <%= @prefixed_module %>DemoVC_sw: UIViewController {
11
- override func viewDidLoad() {
12
- super.viewDidLoad()
13
- view.backgroundColor = .cyan
14
- title = NSStringFromClass(type(of: self))
15
-
16
- // Do any additional setup after loading the view.
17
- }
18
-
19
-
20
- /*
21
- // MARK: - Navigation
22
-
23
- // In a storyboard-based application, you will often want to do a little preparation before navigation
24
- override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
25
- // Get the new view controller using segue.destination.
26
- // Pass the selected object to the new view controller.
27
- }
28
- */
29
-
30
- }
@@ -1,17 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>DemoViewController.h
3
- // <%= @project %>
4
- //
5
- // Created by <%= @author %> on <%= @date %>.
6
- //
7
- //
8
-
9
- #import <UIKit/UIKit.h>
10
-
11
- NS_ASSUME_NONNULL_BEGIN
12
-
13
- @interface <%= @prefixed_module %>DemoViewController : UIViewController
14
-
15
- @end
16
-
17
- NS_ASSUME_NONNULL_END
@@ -1,28 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>DemoViewController.m
3
- // <%= @project %>
4
- //
5
- // Created by <%= @author %> on <%= @date %>.
6
- //
7
- //
8
-
9
-
10
- #import "<%= @prefixed_module %>DemoViewController.h"
11
-
12
- @interface <%= @prefixed_module %>DemoViewController ()
13
-
14
- @end
15
-
16
- @implementation <%= @prefixed_module %>DemoViewController
17
-
18
- - (void)viewDidLoad {
19
- [super viewDidLoad];
20
- // Do any additional setup after loading the view from its nib.
21
- NSLog(@"----- viewDidLoad -----");
22
- self.view.backgroundColor = [UIColor colorWithRed:0.3 green:0.4 blue:0.35 alpha:1.0];
23
- self.navigationItem.title = @"<%= @prefixed_module %>DemoViewController";
24
- }
25
-
26
-
27
-
28
- @end
@@ -1,14 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>DemoViewModel.h
3
- // <%= @project %>
4
- //
5
- // Created by <%= @author %> on <%= @date %>.
6
- //
7
- //
8
-
9
- #import <Foundation/Foundation.h>
10
-
11
- #import "<%= @prefixed_module %>ServiceProtocol.h"
12
- @interface <%= @prefixed_module %>DemoViewModel : NSObject <<%= @prefixed_module %>ServiceProtocol>
13
-
14
- @end
@@ -1,19 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>DemoViewModel.m
3
- // <%= @project %>
4
- //
5
- // Created by <%= @author %> on <%= @date %>.
6
- //
7
- //
8
-
9
- #import "<%= @prefixed_module %>DemoViewModel.h"
10
-
11
-
12
- @implementation <%= @prefixed_module %>DemoViewModel
13
-
14
- - (void)replaceThisMethod {
15
- NSLog(@"----- replace me -----");
16
- }
17
-
18
-
19
- @end
@@ -1,17 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>ModuleRegisterMix.h
3
- //
4
- // <%= @project %>
5
- //
6
- // Created by <%= @author %> on <%= @date %>.
7
- //
8
-
9
- #import <Foundation/Foundation.h>
10
-
11
- NS_ASSUME_NONNULL_BEGIN
12
-
13
- @interface <%= @prefixed_module %>ModuleRegisterMix : NSObject
14
-
15
- @end
16
-
17
- NS_ASSUME_NONNULL_END
@@ -1,61 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>ModuleRegisterMix.m
3
- //
4
- // <%= @project %>
5
- //
6
- // Created by <%= @author %> on <%= @date %>.
7
- //
8
-
9
- #import "<%= @prefixed_module %>ModuleRegisterMix.h"
10
-
11
- #import "<%= @prefixed_module %>RouterDefine.h"
12
-
13
- #import "<%= @prefixed_module %>DemoViewController.h"
14
-
15
- #import <<%= @name %>/<%= @name %>-Swift.h>
16
- #import <YKRouterComponent/YKRouterComponentHeader.h>
17
- #import <YKRouterComponent/YKRouterComponentHeader.h>
18
- #import <YKModuleLifeCircleComponent/YKModuleLifeCircleComponentHeader.h>
19
-
20
- @interface <%= @prefixed_module %>ModuleRegisterMix()
21
- @end
22
-
23
- @implementation <%= @prefixed_module %>ModuleRegisterMix
24
-
25
- @end
26
-
27
- #pragma mark - AppLife define
28
- @interface <%= @prefixed_module %>ModuleRegisterMix(AppLife)
29
- @end
30
- @implementation <%= @prefixed_module %>ModuleRegisterMix(AppLife)
31
- @YKModuleLifeRegister(){
32
- YKModuleLifeDefineRegisters(@[
33
- <%= @prefixed_module %>ModuleRegisterSwift.class, //此处关联swift版本的声明周期托管器, 遵循STAppLifeCircleRegisterProtocol
34
- ]);
35
- }
36
- @end
37
-
38
-
39
- #pragma mark - Service define --以下代码为预置代码,无需改动
40
- @interface <%= @prefixed_module %>ModuleRegisterMix(Service)
41
- @end
42
- @implementation <%= @prefixed_module %>ModuleRegisterMix(Service)
43
- @YKModuleServiceRegister(){
44
- YKModuleServiceDefineRegisterClsArr(@[
45
- <%= @prefixed_module %>ModuleRegisterSwift.class,//此处关联Swift版本的服务注册器, 遵循YKServiceRegisterProtocol
46
- ]);
47
- }
48
- @end
49
-
50
-
51
- #pragma mark - Router define --以下代码为预置代码,无需改动
52
- @interface <%= @prefixed_module %>ModuleRegisterMix(router)
53
- @end
54
- @implementation <%= @prefixed_module %>ModuleRegisterMix(Router)
55
- @YKRouterRegister(){
56
- YKRouterDefineRegisters(@[
57
- <%= @prefixed_module %>ModuleRegisterSwift.class, //此处关联Swift版本的路由注册器, 遵循YKRouterRegisterProtocol
58
- ]);
59
- }
60
- @end
61
-
@@ -1,41 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>ModuleRegisterSwift.swift
3
- //
4
- // <%= @project %>
5
- //
6
- // Created by <%= @author %> on <%= @date %>.
7
- //
8
-
9
- import UIKit
10
- import YKRouterComponent
11
- import YKModuleServiceComponent
12
- import YKModuleLifeCircleComponent
13
-
14
- @objc
15
- public class <%= @prefixed_module %>ModuleRegisterSwift: NSObject {
16
- }
17
-
18
-
19
- //MARK: - Applife
20
- extension <%= @prefixed_module %>ModuleRegisterSwift: YKModuleLifeCircleRegisterProtocol {
21
- public static func ykModuleLifeRegisterExecute() {
22
- YKModuleLifeCollocation(<%= @prefixed_module %>AppDelegate()) //托管swift版本的appDelegate
23
- }
24
- }
25
-
26
-
27
- //MARK: - Service --以下代码为预置代码,无需改动
28
- extension <%= @prefixed_module %>ModuleRegisterSwift: YKModuleServiceRegisterProtocol {
29
- public static func ykModuleServiceRegitAction() {
30
- // 声明swift版本的服务注册器,此处其实是过了一次桥,通过中间WRMaileServiceRegister_swift,将WRMaileServiceRegister_swift保护起来,使其不需要\@objc\声明
31
- YKModuleServiceComponent().ykDefineRegisters(clsArr: [<%= @prefixed_module %>ServiceRegisterSwift.self])
32
- }
33
- }
34
-
35
- //MARK: - Router --以下代码为预置代码,无需改动
36
- extension <%= @prefixed_module %>ModuleRegisterSwift: YKRouterComponentRegisterProtocol {
37
- public static func ykRouterRegisterExecute() {
38
- // 声明swift版本的路由注册器,此处其实是过了一次桥,通过中间POD_NAMERegister_swift,将POD_NAMERegister_routerSwift保护起来,使其不需要\@objc\声明
39
- YKRouterDefineRegisters([<%= @prefixed_module %>RouterRegisterSwift.self])
40
- }
41
- }
@@ -1,15 +0,0 @@
1
- //
2
- // <%= @prefixed_module %>RouterDefineSwift.swift
3
- // <%= @project %>
4
- //
5
- // Created by <%= @author %> on <%= @date %>.
6
- //
7
- //
8
-
9
-
10
- import Foundation
11
-
12
- @objc
13
- public class <%= @prefixed_module %>RouterConstants: NSObject {
14
- @objc public static let testVC_swift: String = "testVC_swift"
15
- }
@@ -1,15 +0,0 @@
1
- //
2
- // POD_NAMEPrefixHeader.pch
3
- // Pods
4
- //
5
- // Created by PROJECT_OWNER on TODAYS_DATE.
6
- // Copyright (c) TODAYS_YEAR PROJECT_ORGANIZATIONNAME. All rights reserved.
7
- //
8
-
9
- #ifndef POD_NAMEPrefixHeader_pch
10
- #define POD_NAMEPrefixHeader_pch
11
-
12
- // Include any system framework and library headers here that should be included in all compilation units.
13
- // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
14
-
15
- #endif /* POD_NAMEPrefixHeader_pch */