yk_command 0.6.2 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.idea/inspectionProfiles/Project_Default.xml +6 -0
  4. data/.idea/sonarlint/issuestore/index.pb +47 -31
  5. data/.idea/vcs.xml +2 -0
  6. data/.idea/yk_command.iml +58 -65
  7. data/.ruby-version +1 -1
  8. data/Gemfile +6 -3
  9. data/Gemfile.lock +11 -26
  10. data/debugProject/.DS_Store +0 -0
  11. data/lib/.DS_Store +0 -0
  12. data/lib/yk_command/.DS_Store +0 -0
  13. data/lib/yk_command/commands.rb +37 -20
  14. data/lib/yk_command/config/yk_config.rb +6 -7
  15. data/lib/yk_command/module/.DS_Store +0 -0
  16. data/lib/yk_command/module/module_handler.rb +48 -9
  17. data/lib/yk_command/module/template/.DS_Store +0 -0
  18. data/lib/yk_command/module/template/objc/.DS_Store +0 -0
  19. data/lib/yk_command/module/template/objc/Helper.h +16 -0
  20. data/lib/yk_command/module/template/objc/Helper.m +41 -0
  21. data/lib/yk_command/module/template/objc/demo/AppDelegate.swift +16 -0
  22. data/lib/yk_command/module/template/objc/demo/DemoVC_sw.swift +30 -0
  23. data/lib/yk_command/module/template/swift/.DS_Store +0 -0
  24. data/lib/yk_command/module/template/swift/ModuleRegisterMix.h +17 -0
  25. data/lib/yk_command/module/template/swift/ModuleRegisterMix.m +61 -0
  26. data/lib/yk_command/module/template/swift/ModuleRegisterSwift.swift +41 -0
  27. data/lib/yk_command/module/template/swift/RouterDefineSwift.swift +15 -0
  28. data/lib/yk_command/module/template/swift/RouterRegisterSwift.swift +23 -0
  29. data/lib/yk_command/module/template/swift/ServiceRegisterSwift.swift +20 -0
  30. data/lib/yk_command/module/template/swift/Tool.swift +53 -0
  31. data/lib/yk_command/module/template/tools/.DS_Store +0 -0
  32. data/lib/yk_command/module/template/tools/PrefixHeader.pch +15 -0
  33. data/lib/yk_command/module/template/tools/PrefixHeader_swift.swift +10 -0
  34. data/lib/yk_command/module/yk_module.rb +2 -2
  35. data/lib/yk_command/project/.DS_Store +0 -0
  36. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/.gitignore +0 -0
  37. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/.travis.yml +0 -0
  38. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/CODE_OF_CONDUCT.md +0 -0
  39. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/LICENSE +0 -0
  40. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/NAME-osx.podspec +0 -0
  41. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/NAME.podspec +5 -5
  42. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/POD_LICENSE +0 -0
  43. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/POD_README.md +0 -0
  44. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/Pod/Assets/.gitkeep +0 -0
  45. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/Pod/Classes/.gitkeep +0 -0
  46. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/README.md +0 -0
  47. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/configure +0 -0
  48. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT/Base.lproj/LaunchScreen.storyboard +0 -0
  49. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT/Base.lproj/Main.storyboard +0 -0
  50. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT/CPDAppDelegate.h +0 -0
  51. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT/CPDAppDelegate.m +0 -0
  52. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT/CPDViewController.h +0 -0
  53. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT/CPDViewController.m +3 -1
  54. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT/Images.xcassets/AppIcon.appiconset/Contents.json +0 -0
  55. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT/PROJECT-Info.plist +0 -0
  56. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT/PROJECT-Prefix.pch +0 -0
  57. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT/en.lproj/InfoPlist.strings +0 -0
  58. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT/main.m +0 -0
  59. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT.xcodeproj/project.pbxproj +0 -0
  60. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  61. data/lib/yk_command/project/full_component_demo_template/templates/ios/Example/PROJECT.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  62. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme +0 -0
  63. data/lib/yk_command/project/full_component_demo_template/templates/ios/Example/Podfile +34 -0
  64. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/Tests/Tests-Info.plist +0 -0
  65. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/Tests/Tests-Prefix.pch +0 -0
  66. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/Tests/Tests.m +0 -0
  67. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/ios/Example/Tests/en.lproj/InfoPlist.strings +0 -0
  68. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/PROJECT/AppDelegate.swift +0 -0
  69. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/PROJECT/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -0
  70. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/PROJECT/Base.lproj/Main.storyboard +0 -0
  71. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/PROJECT/Info.plist +0 -0
  72. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/PROJECT/PROJECT.entitlements +0 -0
  73. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/PROJECT/ViewController.swift +0 -0
  74. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/PROJECT.xcodeproj/project.pbxproj +0 -0
  75. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  76. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme +0 -0
  77. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/Podfile +0 -0
  78. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/Tests/Info.plist +0 -0
  79. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/macos-swift/Example/Tests/Tests.swift +0 -0
  80. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/swift/Example/PROJECT/AppDelegate.swift +0 -0
  81. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/swift/Example/PROJECT/Base.lproj/LaunchScreen.xib +0 -0
  82. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/swift/Example/PROJECT/Base.lproj/Main.storyboard +0 -0
  83. data/lib/yk_command/project/full_component_demo_template/templates/swift/Example/PROJECT/Example-Bridging-Header.h +4 -0
  84. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/swift/Example/PROJECT/Images.xcassets/AppIcon.appiconset/Contents.json +0 -0
  85. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/swift/Example/PROJECT/Info.plist +0 -0
  86. data/lib/yk_command/project/full_component_demo_template/templates/swift/Example/PROJECT/STTestAppDelegate.swift +16 -0
  87. data/lib/yk_command/project/full_component_demo_template/templates/swift/Example/PROJECT/Tests-Bridging-Header.h +4 -0
  88. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/swift/Example/PROJECT/ViewController.swift +7 -1
  89. data/lib/yk_command/project/full_component_demo_template/templates/swift/Example/PROJECT/YKEmptyOcFile.m +9 -0
  90. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/swift/Example/PROJECT.xcodeproj/project.pbxproj +41 -20
  91. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/swift/Example/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  92. data/lib/yk_command/project/full_component_demo_template/templates/swift/Example/PROJECT.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  93. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/swift/Example/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme +0 -0
  94. data/lib/yk_command/project/full_component_demo_template/templates/swift/Example/Podfile +35 -0
  95. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/swift/Example/Tests/Info.plist +0 -0
  96. data/lib/yk_command/project/{YKProjectTemplate → full_component_demo_template}/templates/swift/Example/Tests/Tests.swift +0 -0
  97. data/lib/yk_command/project/setup/ConfigureMacOSSwift.rb +1 -1
  98. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/.gitignore +0 -0
  99. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/.travis.yml +0 -0
  100. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/CODE_OF_CONDUCT.md +0 -0
  101. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/LICENSE +0 -0
  102. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/NAME-osx.podspec +0 -0
  103. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/NAME.podspec +1 -1
  104. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/POD_LICENSE +0 -0
  105. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/POD_README.md +0 -0
  106. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/Pod/Assets/.gitkeep +0 -0
  107. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/Pod/Classes/.gitkeep +0 -0
  108. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/README.md +0 -0
  109. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/configure +0 -0
  110. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT/Base.lproj/LaunchScreen.storyboard +0 -0
  111. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT/Base.lproj/Main.storyboard +0 -0
  112. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT/CPDAppDelegate.h +0 -0
  113. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT/CPDAppDelegate.m +0 -0
  114. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT/CPDViewController.h +0 -0
  115. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT/CPDViewController.m +0 -0
  116. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT/Images.xcassets/AppIcon.appiconset/Contents.json +0 -0
  117. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT/PROJECT-Info.plist +0 -0
  118. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT/PROJECT-Prefix.pch +0 -0
  119. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT/en.lproj/InfoPlist.strings +0 -0
  120. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT/main.m +0 -0
  121. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT.xcodeproj/project.pbxproj +0 -0
  122. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  123. data/lib/yk_command/project/simple_component_demo_template/templates/ios/Example/PROJECT.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  124. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme +0 -0
  125. data/lib/yk_command/project/{YKProjectTemplate → simple_component_demo_template}/templates/ios/Example/Podfile +0 -0
  126. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/Tests/Tests-Info.plist +0 -0
  127. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/Tests/Tests-Prefix.pch +0 -0
  128. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/Tests/Tests.m +0 -0
  129. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/ios/Example/Tests/en.lproj/InfoPlist.strings +0 -0
  130. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/PROJECT/AppDelegate.swift +0 -0
  131. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/PROJECT/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -0
  132. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/PROJECT/Base.lproj/Main.storyboard +0 -0
  133. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/PROJECT/Info.plist +0 -0
  134. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/PROJECT/PROJECT.entitlements +0 -0
  135. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/PROJECT/ViewController.swift +0 -0
  136. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/PROJECT.xcodeproj/project.pbxproj +0 -0
  137. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  138. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme +0 -0
  139. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/Podfile +0 -0
  140. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/Tests/Info.plist +0 -0
  141. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/macos-swift/Example/Tests/Tests.swift +0 -0
  142. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/swift/Example/PROJECT/AppDelegate.swift +0 -0
  143. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/swift/Example/PROJECT/Base.lproj/LaunchScreen.xib +0 -0
  144. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/swift/Example/PROJECT/Base.lproj/Main.storyboard +19 -2
  145. data/lib/yk_command/project/simple_component_demo_template/templates/swift/Example/PROJECT/EmptyOcFile.m +9 -0
  146. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/swift/Example/PROJECT/Images.xcassets/AppIcon.appiconset/Contents.json +0 -0
  147. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/swift/Example/PROJECT/Info.plist +0 -0
  148. data/lib/yk_command/project/simple_component_demo_template/templates/swift/Example/PROJECT/PROJECT_Example-Bridging-Header.h +4 -0
  149. data/lib/yk_command/project/simple_component_demo_template/templates/swift/Example/PROJECT/PROJECT_Tests-Bridging-Header.h +4 -0
  150. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/swift/Example/PROJECT/ViewController.swift +3 -1
  151. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/swift/Example/PROJECT.xcodeproj/project.pbxproj +41 -20
  152. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/swift/Example/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  153. data/lib/yk_command/project/simple_component_demo_template/templates/swift/Example/PROJECT.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  154. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/swift/Example/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme +0 -0
  155. data/lib/yk_command/project/{YKProjectTemplate → simple_component_demo_template}/templates/swift/Example/Podfile +0 -0
  156. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/swift/Example/Tests/Info.plist +0 -0
  157. data/lib/yk_command/project/{simple_project_template → simple_component_demo_template}/templates/swift/Example/Tests/Tests.swift +0 -0
  158. data/lib/yk_command/project/yk_project.rb +2 -2
  159. data/lib/yk_command/version.rb +1 -1
  160. metadata +147 -122
  161. data/.idea/sonarlint/issuestore/2/2/2264693887a1513e6c4ed16a6231e00d3045ec4e +0 -0
  162. data/.idea/sonarlint/issuestore/2/4/2461a61a84d866812e64ff95d40bd7836fb136ea +0 -0
  163. data/.idea/sonarlint/issuestore/2/e/2e113f2d3dc9bee6a98073d85966fbd9773c044f +0 -0
  164. data/.idea/sonarlint/issuestore/7/1/71fc201a1096db97453882ad1da5120a71f77bb5 +0 -0
  165. data/.idea/sonarlint/issuestore/7/e/7ed8a0c3d2507e911337de44fdef07f89e35091a +0 -0
  166. data/.idea/sonarlint/issuestore/9/5/95a45210972238034e9fed522811176fe20117d3 +0 -0
  167. data/.idea/sonarlint/issuestore/9/7/97c2c9c7adeb7fa2e6ffbf07cba2418868ac9739 +0 -0
  168. data/.idea/sonarlint/issuestore/a/d/ad7bffefc6248a8f673a10e668a82bdbbe38a3e3 +0 -0
  169. data/.idea/sonarlint/issuestore/e/5/e5580d669a0c327c5b0897ba7dd8465a3d4db45a +0 -0
  170. data/lib/yk_command/module/template/swift/RouterDefine.swift +0 -28
  171. data/lib/yk_command/project/simple_project_template/templates/ios/Example/Podfile +0 -19
  172. data/lib/yk_command/project/simple_project_template/templates/swift/Example/Podfile +0 -20
@@ -44,7 +44,8 @@ module YkCommand
44
44
 
45
45
  def yk_template_files
46
46
 
47
- register_path = "#{@final_path}/#{@name}/Classes/Private/Register"
47
+ # objc register
48
+ register_path = "#{@final_path}/#{@name}/Classes/Private/RegisterOC"
48
49
  registger = {
49
50
  'RouterRegister.h' => 'RouterRegister',
50
51
  'RouterRegister.m' => 'RouterRegister',
@@ -57,31 +58,59 @@ module YkCommand
57
58
  template "#{__dir__}/template/objc/#{file_name}", final_file
58
59
  end
59
60
 
60
- public_folder_path = "#{@final_path}/#{@name}/Classes/Public"
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
+ }
70
+
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
75
+
76
+ #assets bundle
77
+ assets_path = "#{@final_path}/#{@name}/Assets"
78
+ FileUtils.mkdir(File.join(@final_path, @name, "Assets", "Images.xcassets"))
61
79
 
62
- template_code_filename = ['ServiceProtocol.h', 'RouterDefine.h']
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
+ ]
63
88
  template_code_filename.each do |file_name|
64
89
  final_file = "#{public_folder_path}/#{@prefixed_module}#{file_name}"
65
90
  source = "#{__dir__}/template/objc/#{file_name}"
66
91
  template source, final_file
67
92
  end
68
93
 
69
- swift_template_code_filename = ['RouterDefine.swift']
94
+ # router define
95
+ swift_template_code_filename = [
96
+ 'RouterDefineSwift.swift',
97
+ 'Tool.swift',
98
+ ]
70
99
  swift_template_code_filename.each do |file_name|
71
- final_file = "#{public_folder_path}/#{@prefixed_module}_Swift_#{file_name}"
100
+ final_file = "#{public_folder_path}/#{@prefixed_module}#{file_name}"
72
101
  source = "#{__dir__}/template/swift/#{file_name}"
73
102
  template source, final_file
74
103
  end
75
104
 
76
105
  private_folder_path = "#{@final_path}/#{@name}/Classes/Private"
77
- #pch file
106
+ #common file
78
107
  # pch_file_name = "PrefixHeader.pch"
79
108
  # final_file = "#{private_folder_path}/#{@prefixed_module}#{pch_file_name}"
80
109
  # source = "#{__dir__}/template/objc/#{pch_file_name}"
81
110
  # template source, final_file
82
111
 
83
112
  private_level_folder_files = {
84
- 'PrefixHeader.pch' => 'Business',
113
+ 'PrefixHeader.pch' => '.',
85
114
  'CategoryHeader.h' => 'Category',
86
115
  'ToolsHeader.h' => 'Tools',
87
116
  'vendorHeader.h' => 'Vendor'
@@ -98,10 +127,20 @@ module YkCommand
98
127
  template source, final_file
99
128
  end
100
129
 
101
- business_demo_path = "#{@final_path}/#{@name}/Classes/Private/Business"
130
+ #demo oc
131
+ business_demo_path = "#{@final_path}/#{@name}/Classes/Private/Business/Demo"
102
132
  demo_replace_file = ['DemoViewController.h', 'DemoViewController.m', 'DemoViewModel.h', 'DemoViewModel.m']
103
133
  demo_replace_file.each do |file_name|
104
- final_file = "#{business_demo_path}/Demo/#{@prefixed_module}#{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
138
+
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}"
105
144
  source = "#{__dir__}/template/objc/demo/#{file_name}"
106
145
  template source, final_file
107
146
  end
@@ -0,0 +1,16 @@
1
+ //
2
+ // <%= @prefixed_module %>Helper.h
3
+ // <%= @project %>
4
+ //
5
+ // Created by <%= @author %> on <%= @date %>.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ NS_ASSUME_NONNULL_BEGIN
11
+
12
+ NSBundle * kModuleBundle_<%= @project %>(void);
13
+ NSBundle * kModuleResourceBundle_<%= @project %>(void);
14
+ UIImage * __nullable kModuleResourceImage_<%= @project %>(NSString *name);
15
+
16
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,41 @@
1
+ //
2
+ // <%= @prefixed_module %>Helper.m
3
+ // <%= @project %>
4
+ //
5
+ // Created by <%= @author %> on <%= @date %>.
6
+ //
7
+
8
+ #import "<%= @prefixed_module %>Helper.h"
9
+
10
+ @interface <%= @prefixed_module %>HelperPrivate: NSObject
11
+ @end
12
+
13
+ @implementation <%= @prefixed_module %>HelperPrivate
14
+ @end
15
+
16
+
17
+ NSString * const kModuleName<%= @project %> = @"<%= @project %>";
18
+
19
+ NSBundle * kModuleBundle_<%= @project %>(void) {
20
+ return [NSBundle bundleForClass:[<%= @prefixed_module %>HelperPrivate class]];
21
+ }
22
+
23
+ NSString * __nullable kModuleResourceBundlePath_<%= @project %>(void) {
24
+ NSString *bundlePath = [kModuleBundle_<%= @project %>() pathForResource:kModuleName<%= @project %> ofType:@"bundle"];
25
+ if (bundlePath.length == 0) { //bundle 不存在
26
+ return nil;
27
+ }
28
+ return bundlePath;
29
+ }
30
+
31
+ NSBundle * kModuleResourceBundle_<%= @project %>(void) {
32
+ NSString *path = kModuleResourceBundlePath_<%= @project %>();
33
+ return path.length ? [NSBundle bundleWithPath:path] : kModuleBundle_<%= @project %>();
34
+ }
35
+
36
+ UIImage * __nullable kModuleResourceImage_<%= @project %>(NSString *name) {
37
+ return [UIImage imageNamed:name inBundle:kModuleResourceBundle_<%= @project %>() compatibleWithTraitCollection:nil];
38
+ }
39
+
40
+
41
+
@@ -0,0 +1,16 @@
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
+ }
@@ -0,0 +1,30 @@
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
+ }
@@ -0,0 +1,17 @@
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
@@ -0,0 +1,61 @@
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
+
@@ -0,0 +1,41 @@
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
+ }
@@ -0,0 +1,15 @@
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
+ }
@@ -0,0 +1,23 @@
1
+ // <%= @prefixed_module %>RouterRegisterSwift.swift
2
+ //
3
+ // <%= @project %>
4
+ //
5
+ // Created by <%= @author %> on <%= @date %>.
6
+ //
7
+
8
+ import UIKit
9
+
10
+ import YKRouterComponent
11
+
12
+ class <%= @prefixed_module %>RouterRegisterSwift: NSObject {
13
+ }
14
+
15
+ extension <%= @prefixed_module %>RouterRegisterSwift: YKRouterComponentRegisterProtocol {
16
+ static func ykRouterRegisterExecute() {
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
+ }
22
+ }
23
+ }
@@ -0,0 +1,20 @@
1
+ //
2
+ // <%= @prefixed_module %>ServiceRegisterSwift.swift
3
+ // <%= @project %>
4
+ //
5
+ // Created by <%= @author %> on <%= @date %>.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ import YKModuleServiceComponent
11
+
12
+ class <%= @prefixed_module %>ServiceRegisterSwift: NSObject, YKModuleServiceRegisterProtocol {
13
+ static func ykModuleServiceRegitAction() {
14
+ //注册服务 NSObject --> NSObjectProtocol NSObjectProtocol为 swift 协议
15
+ //YKModuleServiceComponent().ykRegistModuleService(service: NSObject.self, protocol: NSObjectProtocol.self, err: nil)
16
+
17
+ //注册服务 NSObject --> NSObjectProtocol NSObjectProtocol为 OC 协议
18
+ // YKService().ykRegisterModuleService_oc(NSObject.self, protocol: NSObjectProtocol.self, err: nil)
19
+ }
20
+ }
@@ -0,0 +1,53 @@
1
+ //
2
+ // <%= @prefixed_module %>Tool.swift
3
+ // <%= @project %>
4
+ //
5
+ // Created by <%= @author %> on <%= @date %>.
6
+ //
7
+
8
+ import UIKit
9
+
10
+ @objc
11
+ open class <%= @prefixed_module %>Tool: NSObject {
12
+ static let kModuleName = "<%= @project %>"
13
+
14
+ private class func kResourceBundlePath() -> String? {
15
+ let bundlePath: String? = kModuleBundle().path(forResource: kModuleName, ofType: "bundle")
16
+ if bundlePath == nil { //bundle 不存在
17
+ print("\nPOD_NAME xcassets bundle not exist:\(kModuleName)\n")
18
+ }
19
+ return bundlePath
20
+ }
21
+
22
+ /// 组件bundle
23
+ @objc public class func kModuleBundle() -> Bundle{
24
+ let result = Bundle.init(for: <%= @prefixed_module %>Tool.self)
25
+ return result
26
+ }
27
+
28
+ /// 组件 素材bundle
29
+ @objc public class func kModuleResourceBundle() -> Bundle {
30
+ let path: String? = self.kResourceBundlePath()
31
+ var result = Bundle.main
32
+ if path != nil {
33
+ result = Bundle.init(path: path!)!
34
+ if result.isLoaded == false {
35
+ do {
36
+ try result.loadAndReturnError()
37
+ }
38
+ catch {
39
+
40
+ }
41
+ }
42
+ }
43
+
44
+ return result
45
+ }
46
+
47
+ ///资源组件 获取xcasserts 中图片
48
+ @objc public class func kResourceImage(name: String?) -> UIImage? {
49
+ let imgName = name ?? ""
50
+ let result = UIImage.init(named: imgName, in: kModuleResourceBundle(), compatibleWith: nil)
51
+ return result
52
+ }
53
+ }
@@ -0,0 +1,15 @@
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 */
@@ -0,0 +1,10 @@
1
+ //
2
+ // POD_NAMEPrefixHeader_swift.swift
3
+ // Pods
4
+ //
5
+ // Created by PROJECT_OWNER on TODAYS_DATE.
6
+ // Copyright (c) TODAYS_YEAR PROJECT_ORGANIZATIONNAME. All rights reserved.
7
+ //
8
+
9
+ //swift 版本的prefix 文件
10
+ // @_exported import SwiftyJSON
@@ -201,11 +201,11 @@ module YkCommand
201
201
 
202
202
  # host_a = 'yeah'
203
203
  # host_b = 'ka'
204
- # template_repo_url = "http://gitlab.#{host_a}#{host_b}.com/App/iOS/YKComponents/YKProjectTemplate.git"
204
+ # template_repo_url = "http://gitlab.#{host_a}#{host_b}.com/App/iOS/YKComponents/full_component_demo_template.git"
205
205
  # system("git clone #{template_repo_url} #{@final_path}")
206
206
 
207
207
  # FileUtils.remove_dir(@final_path, true)
208
- # FileUtils.cp_r('/Users/imacn24/Documents/dev/YKProjectTemplate', @final_path)
208
+ # FileUtils.cp_r('/Users/imacn24/Documents/dev/full_component_demo_template', @final_path)
209
209
  # FileUtils.remove_dir("#{@final_path}/.git", true)
210
210
  # end
211
211
 
Binary file
@@ -91,9 +91,9 @@ Pod::Spec.new do |spec|
91
91
  # Not including the public_header_files will make all headers public.
92
92
  #
93
93
 
94
- spec.source_files = '${POD_NAME}/Classes/**/*'
94
+ spec.source_files = '${POD_NAME}/Classes/**/*.{h,m,mm,c,cpp,swift,pch}'
95
95
  spec.exclude_files = "Classes/Exclude"
96
- spec.prefix_header_file = '${POD_NAME}/Classes/Private/Business/${POD_NAME}PrefixHeader.pch'
96
+ spec.prefix_header_file = '${POD_NAME}/Classes/Private/${POD_NAME}PrefixHeader.pch'
97
97
  spec.public_header_files = '${POD_NAME}/Classes/Public/**/*.h'
98
98
 
99
99
  # spec.public_header_files = "Classes/**/*.h"
@@ -111,9 +111,9 @@ Pod::Spec.new do |spec|
111
111
 
112
112
  # spec.resource = "icon.png"
113
113
  # spec.resources = "Resources/*.png"
114
- # spec.resource_bundles = {
115
- # '${POD_NAME}' => ['${POD_NAME}/**/*.{xib,png,json}']
116
- # }
114
+ spec.resource_bundles = {
115
+ '${POD_NAME}' => ['${POD_NAME}/Assets/**/*.xcassets']
116
+ }
117
117
  # spec.preserve_paths = "FilesToSave", "MoreFilesToSave"
118
118
 
119
119
 
@@ -14,6 +14,7 @@
14
14
  #import <PROJECT/CPDPROJECTServiceProtocol.h>
15
15
 
16
16
  #import <PROJECT/CPDPROJECTRouterDefine.h>
17
+ #import <PROJECT/CPDPROJECTHelper.h>
17
18
 
18
19
  @interface CPDViewController ()
19
20
 
@@ -32,7 +33,8 @@
32
33
  NSLog(@"这里调用模块的路由");
33
34
  [self yk_openUrl:kDemoRouterString parameter:@{}];
34
35
 
35
-
36
+ UIImage *img1 = kModuleResourceImage_PROJECT(@"123");
37
+ NSLog(@"img1:%@", img1);
36
38
  }
37
39
 
38
40
  - (IBAction)serviceEvent:(id)sender {
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,34 @@
1
+
2
+ platform :ios, '10.0'
3
+
4
+ inhibit_all_warnings!
5
+ use_modular_headers!
6
+ use_frameworks! :linkage => :static
7
+
8
+
9
+ #pod_install hook
10
+ post_install do |installer|
11
+
12
+ # 单个target编辑配置
13
+ installer.pods_project.targets.each do |target|
14
+ target.build_configurations.each do |config|
15
+ #config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
16
+
17
+ config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = "org.cocoapods.${PRODUCT_NAME}"
18
+ config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
19
+ config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
20
+ config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
21
+ end
22
+ end
23
+
24
+ end
25
+
26
+ target '${POD_NAME}_Example' do
27
+ pod '${POD_NAME}', :path => '../'
28
+
29
+ target '${POD_NAME}_Tests' do
30
+ inherit! :search_paths
31
+
32
+ ${INCLUDED_PODS}
33
+ end
34
+ end