cocoapods-ykutility 0.0.18 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/configPodTemplate/example/CommonFiles/.gitkeep +0 -0
  3. data/configPodTemplate/example/CommonFiles/CommonFile.swift +9 -0
  4. data/configPodTemplate/example/NotificationContent/Base.lproj/MainInterface.storyboard +43 -0
  5. data/configPodTemplate/example/NotificationContent/Info.plist +40 -0
  6. data/configPodTemplate/example/NotificationContent/NotificationViewController.swift +25 -0
  7. data/configPodTemplate/example/NotificationService/Info.plist +38 -0
  8. data/configPodTemplate/example/NotificationService/NotificationService.swift +36 -0
  9. data/configPodTemplate/example/Podfile +53 -0
  10. data/configPodTemplate/example/READ.md +76 -0
  11. data/configPodTemplate/example/README_resource/appExtensionNameDiscussion.png +0 -0
  12. data/configPodTemplate/example/TargetMain/AppDelegate.swift +32 -0
  13. data/configPodTemplate/example/TargetMain/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  14. data/configPodTemplate/example/TargetMain/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
  15. data/configPodTemplate/example/TargetMain/Assets.xcassets/Contents.json +6 -0
  16. data/configPodTemplate/example/TargetMain/Base.lproj/LaunchScreen.storyboard +45 -0
  17. data/configPodTemplate/example/TargetMain/Info.plist +47 -0
  18. data/configPodTemplate/example/TargetMain/ViewController.swift +29 -0
  19. data/configPodTemplate/example/TargetMain/ViewController.xib +46 -0
  20. data/configPodTemplate/example/TargetMain/YKRPC_POD_NAMEEmptyOC.h +16 -0
  21. data/configPodTemplate/example/TargetMain/YKRPC_POD_NAMEEmptyOC.m +18 -0
  22. data/configPodTemplate/example/TargetMain/YKRPC_POD_NAME_Example-Bridging-Header.h +4 -0
  23. data/configPodTemplate/example/config/iOS-config/target-main/Shared.xcconfig +105 -0
  24. data/configPodTemplate/example/config/iOS-config/target-main/config-custom/Shared.xcconfig +2 -0
  25. data/configPodTemplate/example/config/iOS-config/target-main/config-custom/debug.xcconfig +9 -0
  26. data/configPodTemplate/example/config/iOS-config/target-main/config-custom/release.xcconfig +9 -0
  27. data/configPodTemplate/example/config/iOS-config/target-main/config-enterprise/Shared.xcconfig +1 -0
  28. data/configPodTemplate/example/config/iOS-config/target-main/config-enterprise/debug.xcconfig +9 -0
  29. data/configPodTemplate/example/config/iOS-config/target-main/config-enterprise/release.xcconfig +9 -0
  30. data/configPodTemplate/example/config/iOS-config/target-main-Q/Shared.xcconfig +105 -0
  31. data/configPodTemplate/example/config/iOS-config/target-main-Q/config-custom/Shared.xcconfig +2 -0
  32. data/configPodTemplate/example/config/iOS-config/target-main-Q/config-custom/debug.xcconfig +9 -0
  33. data/configPodTemplate/example/config/iOS-config/target-main-Q/config-custom/release.xcconfig +9 -0
  34. data/configPodTemplate/example/config/iOS-config/target-main-Q/config-enterprise/Shared.xcconfig +1 -0
  35. data/configPodTemplate/example/config/iOS-config/target-main-Q/config-enterprise/debug.xcconfig +9 -0
  36. data/configPodTemplate/example/config/iOS-config/target-main-Q/config-enterprise/release.xcconfig +9 -0
  37. data/configPodTemplate/example/config/iOS-config/target-notificationContent/Shared.xcconfig +5 -0
  38. data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-custom/Shared.xcconfig +2 -0
  39. data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-custom/debug.xcconfig +129 -0
  40. data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-custom/release.xcconfig +9 -0
  41. data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-enterprise/Shared.xcconfig +2 -0
  42. data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-enterprise/debug.xcconfig +129 -0
  43. data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-enterprise/release.xcconfig +9 -0
  44. data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/Shared.xcconfig +5 -0
  45. data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-custom/Shared.xcconfig +2 -0
  46. data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-custom/debug.xcconfig +129 -0
  47. data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-custom/release.xcconfig +9 -0
  48. data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-enterprise/Shared.xcconfig +2 -0
  49. data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-enterprise/debug.xcconfig +129 -0
  50. data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-enterprise/release.xcconfig +9 -0
  51. data/configPodTemplate/example/config/iOS-config/target-notificationService/Shared.xcconfig +7 -0
  52. data/configPodTemplate/example/config/iOS-config/target-notificationService/config-custom/Shared.xcconfig +2 -0
  53. data/configPodTemplate/example/config/iOS-config/target-notificationService/config-custom/debug.xcconfig +129 -0
  54. data/configPodTemplate/example/config/iOS-config/target-notificationService/config-custom/release.xcconfig +9 -0
  55. data/configPodTemplate/example/config/iOS-config/target-notificationService/config-enterprise/Shared.xcconfig +3 -0
  56. data/configPodTemplate/example/config/iOS-config/target-notificationService/config-enterprise/debug.xcconfig +129 -0
  57. data/configPodTemplate/example/config/iOS-config/target-notificationService/config-enterprise/release.xcconfig +9 -0
  58. data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/Shared.xcconfig +7 -0
  59. data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-custom/Shared.xcconfig +2 -0
  60. data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-custom/debug.xcconfig +129 -0
  61. data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-custom/release.xcconfig +9 -0
  62. data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-enterprise/Shared.xcconfig +3 -0
  63. data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-enterprise/debug.xcconfig +129 -0
  64. data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-enterprise/release.xcconfig +9 -0
  65. data/configPodTemplate/example/config/iOS-targets-Q.yml +137 -0
  66. data/configPodTemplate/example/config/iOS-targets.yml +135 -0
  67. data/configPodTemplate/example/config/project-config/Shared.xcconfig +470 -0
  68. data/configPodTemplate/example/config/project-config/config-custom/Shared.xcconfig +8 -0
  69. data/configPodTemplate/example/config/project-config/config-custom/debug.xcconfig +127 -0
  70. data/configPodTemplate/example/config/project-config/config-custom/release.xcconfig +60 -0
  71. data/configPodTemplate/example/config/project-config/config-enterprise/Shared.xcconfig +20 -0
  72. data/configPodTemplate/example/config/project-config/config-enterprise/debug.xcconfig +127 -0
  73. data/configPodTemplate/example/config/project-config/config-enterprise/release.xcconfig +59 -0
  74. data/configPodTemplate/example/project.yml +37 -0
  75. data/configPodTemplate/objc/LICENSE +19 -0
  76. data/configPodTemplate/objc/README.md +60 -0
  77. data/configPodTemplate/objc/YKRPC_POD_NAME/Assets/Images.xcassets/.gitkeep +0 -0
  78. data/configPodTemplate/objc/YKRPC_POD_NAME/Private/.gitkeep +0 -0
  79. data/configPodTemplate/objc/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.h +16 -0
  80. data/configPodTemplate/objc/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.m +12 -0
  81. data/configPodTemplate/objc/YKRPC_POD_NAME.podspec +62 -0
  82. data/configPodTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.h +16 -0
  83. data/configPodTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.m +27 -0
  84. data/configPodTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.h +15 -0
  85. data/configPodTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.m +27 -0
  86. data/configPodTemplate/register/swift/YKRPC_POD_NAME/Private/.gitkeep +0 -0
  87. data/configPodTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterRouter.swift +19 -0
  88. data/configPodTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterService.swift +20 -0
  89. data/configPodTemplate/swift/LICENSE +19 -0
  90. data/configPodTemplate/swift/README.md +60 -0
  91. data/configPodTemplate/swift/YKRPC_POD_NAME/Assets/Images.xcassets/.gitkeep +0 -0
  92. data/configPodTemplate/swift/YKRPC_POD_NAME/Private/.gitkeep +0 -0
  93. data/configPodTemplate/swift/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.swift +6 -0
  94. data/configPodTemplate/swift/YKRPC_POD_NAME.podspec +61 -0
  95. data/lib/cocoapods-ykutility/command/Ykutility.rb +1 -0
  96. data/lib/cocoapods-ykutility/command/create/yk_create_pod_action.rb +7 -7
  97. data/lib/cocoapods-ykutility/command/create/yk_exchange_tool.rb +1 -0
  98. data/lib/cocoapods-ykutility/command/gen/yk_gen_create_action.rb +162 -0
  99. data/lib/cocoapods-ykutility/command/gen.rb +74 -0
  100. data/lib/cocoapods-ykutility/gem_version.rb +4 -1
  101. data/podTemplate/example/Podfile +1 -1
  102. data/podTemplate/example/YKRPC_POD_NAME_Example/AppDelegate.swift +1 -1
  103. data/podTemplate/example/YKRPC_POD_NAME_Example/Base.lproj/LaunchScreen.storyboard +1 -1
  104. data/podTemplate/example/YKRPC_POD_NAME_Example/Base.lproj/Main.storyboard +1 -1
  105. data/podTemplate/example/YKRPC_POD_NAME_Example/SceneDelegate.swift +1 -1
  106. data/podTemplate/example/YKRPC_POD_NAME_Example/ViewController.swift +1 -1
  107. data/podTemplate/example/YKRPC_POD_NAME_Example.xcodeproj/project.pbxproj +1 -1
  108. data/podTemplate/objc/LICENSE +1 -1
  109. data/podTemplate/objc/README.md +4 -4
  110. data/podTemplate/objc/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.h +1 -1
  111. data/podTemplate/objc/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.m +1 -1
  112. data/podTemplate/objc/YKRPC_POD_NAME.podspec +3 -3
  113. data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.h +1 -1
  114. data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.m +1 -1
  115. data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.h +1 -1
  116. data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.m +1 -1
  117. data/podTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterRouter.swift +1 -1
  118. data/podTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterService.swift +1 -1
  119. data/podTemplate/swift/README.md +4 -4
  120. data/podTemplate/swift/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.swift +1 -1
  121. data/podTemplate/swift/YKRPC_POD_NAME.podspec +3 -3
  122. metadata +98 -3
@@ -0,0 +1,61 @@
1
+ Pod::Spec.new do |spec|
2
+
3
+ spec.name = "YKRPC_POD_NAME"
4
+ spec.version = "0.0.1"
5
+ spec.summary = "YKRPC_POD_NAME 说明."
6
+ spec.description = <<-DESC
7
+ YKRPC_POD_NAME long description of the pod here.
8
+ DESC
9
+
10
+ spec.homepage = 'http://github.com/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME'
11
+ spec.license = { :type => "MIT", :file => "LICENSE" }
12
+ spec.author = { "YKRPC_AUTHOR_NAME" => "YKRPC_AUTHOR_EMAIL" }
13
+ spec.ios.deployment_target = '9.0'
14
+
15
+ spec.source = { :git => "http://github/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME.git", :tag => "#{spec.version}" }
16
+
17
+
18
+ # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
19
+ spec.source_files = 'YKRPC_POD_NAME/{Public,Private}/**/*.{h,m,mm,c,cpp,swift}'
20
+ # spec.exclude_files = "YKRPC_POD_NAME/Exclude" #排除文件
21
+
22
+ spec.project_header_files = 'YKRPC_POD_NAME/Private/**/*.{h}'
23
+ spec.public_header_files = 'YKRPC_POD_NAME/Public/**/*.h' #此处放置组件的对外暴漏的头文件
24
+
25
+ # ――― binary framework/lib ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
26
+ #spec.vendored_frameworks = 'YKRPC_POD_NAME/Private/**/*.framework'
27
+ #spec.vendored_libraries = 'YKRPC_POD_NAME/Private/**/*.a'
28
+
29
+ # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
30
+ # 放置 json,font,jpg,png等资源
31
+ # spec.resources = ["YKRPC_POD_NAME/{Public,Private}/**/*.{xib}"]
32
+ # spec.resource_bundles = {
33
+ # 'YKRPC_POD_NAME' => ['YKRPC_POD_NAME/Assets/*.xcassets', "YKRPC_POD_NAME/{Public,Private}/**/*.{png,jpg,font,json}"]
34
+ # }
35
+
36
+
37
+ # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
38
+ # spec.framework = "SomeFramework"
39
+ # spec.frameworks = "SomeFramework", "AnotherFramework"
40
+ # spec.library = "iconv"
41
+ # spec.libraries = "iconv", "xml2"
42
+
43
+
44
+ # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
45
+ # spec.requires_arc = true
46
+
47
+ # spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
48
+
49
+ # 其他依赖pod
50
+ # spec.dependency "XXXXXXXX"
51
+
52
+ # spec.subspec 'WithLoad' do |ss|
53
+ # ss.source_files = 'YKHawkeye/Src/MethodUseTime/**/*{.h,.m}'
54
+ # ss.pod_target_xcconfig = {
55
+ # 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) YKHawkeyeWithLoad'
56
+ # }
57
+ # ss.dependency 'YKHawkeye/Core'
58
+ # ss.vendored_frameworks = 'YKHawkeye/Framework/*.framework'
59
+ # end
60
+
61
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cocoapods'
2
2
  require 'cocoapods-ykutility/command/create'
3
+ require 'cocoapods-ykutility/command/gen'
3
4
  require 'cocoapods-ykutility/command/push'
4
5
 
5
6
  module Pod
@@ -33,11 +33,11 @@ module YKPod
33
33
  # 关键字替换
34
34
  @keyMap = {
35
35
  "YKRPC_POD_NAME" => @config.prefix_name,
36
- "YKPRC_AUTHOR_NAME" => @config.author,
37
- "YKPRC_AUTHOR_EMAIL" => @config.author_email,
38
- "YKPRC_CLASS_PREFIX" => @config.prefix,
39
- "YKPRC_CREATE_DATE" => time_str,
40
- "YKPRC_CREATE_YEAR" => year_str,
36
+ "YKRPC_AUTHOR_NAME" => @config.author,
37
+ "YKRPC_AUTHOR_EMAIL" => @config.author_email,
38
+ "YKRPC_CLASS_PREFIX" => @config.prefix,
39
+ "YKRPC_CREATE_DATE" => time_str,
40
+ "YKRPC_CREATE_YEAR" => year_str,
41
41
  }
42
42
 
43
43
  end
@@ -79,7 +79,7 @@ module YKPod
79
79
  # 改文件夹
80
80
  file_arr = updateFileDirs(pod_dir_cache, 'YKRPC_POD_NAME',@config.prefix_name)
81
81
 
82
- # 替换 YKRPC_POD_NAME YKPRC_AUTHOR_NAME YKPRC_AUTHOR_EMAIL YKPRC_CREATE_DATE YKPRC_CREATE_YEAR
82
+ # 替换 YKRPC_POD_NAME YKRPC_AUTHOR_NAME YKRPC_AUTHOR_EMAIL YKRPC_CREATE_DATE YKRPC_CREATE_YEAR
83
83
  updateFiles(file_arr, @keyMap)
84
84
 
85
85
  FileUtils.copy_entry(pod_dir_cache, pod_dir_dest)
@@ -120,7 +120,7 @@ module YKPod
120
120
  # 改文件夹
121
121
  file_arr = updateFileDirs(example_dir_cache, 'YKRPC_POD_NAME', @config.prefix_name)
122
122
 
123
- # 替换 YKRPC_POD_NAME YKPRC_AUTHOR_NAME YKPRC_AUTHOR_EMAIL YKPRC_CREATE_DATE YKPRC_CREATE_YEAR
123
+ # 替换 YKRPC_POD_NAME YKRPC_AUTHOR_NAME YKRPC_AUTHOR_EMAIL YKRPC_CREATE_DATE YKRPC_CREATE_YEAR
124
124
  updateFiles(file_arr, @keyMap)
125
125
 
126
126
  FileUtils.copy_entry(example_dir_cache, @example_dir_dest)
@@ -5,6 +5,7 @@ module YKPod
5
5
  require 'cocoapods-ykutility/tools/yk_log_tool'
6
6
  require 'file_exists'
7
7
  include YKPod::YKLogTool
8
+
8
9
  def updateFileDirs(rootDir, keyWord, destWord)
9
10
  Dir.glob("#{rootDir}/**/**/**/**").each do |name|
10
11
  next if File.directory?(name) == false
@@ -0,0 +1,162 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YKPod
4
+ require 'fileutils'
5
+
6
+ class YKGenCreate
7
+
8
+ require 'cocoapods-ykutility/command/create/yk_create_pod_config'
9
+ require 'cocoapods-ykutility/tools/yk_log_tool'
10
+ require 'find'
11
+ include YKPod::YKLogTool
12
+
13
+ require 'cocoapods-ykutility/gem_version'
14
+ require 'cocoapods-ykutility/command/create/yk_exchange_tool'
15
+ include YKPod::YKExchangeTool
16
+
17
+ def initialize(conf)
18
+
19
+ @config = YKPod::YKCreatePodConfig
20
+ @config = conf
21
+
22
+ # name = conf.start_with?(conf.prefix) ? name : conf.prefix + name
23
+ # @config.name = name
24
+
25
+ l_path = @config.path
26
+ @project_dir_dest = File.join(@config.path, @config.prefix_name)
27
+ @example_dir_dest = File.join(@project_dir_dest, "Example")
28
+
29
+ @template_pod_path = File.join(CocoapodsYkPodUtility::YK_GEN_TEMPLATE_PATH, @config.language)
30
+ @template_example_path = File.join(CocoapodsYkPodUtility::YK_GEN_TEMPLATE_PATH, "example")
31
+ @register_pod_path = File.join(CocoapodsYkPodUtility::YK_GEN_BUSINESS_REGISTER_PATH, @config.language)
32
+
33
+ time_str = Time.now.strftime("%Y/%m/%d")
34
+ year_str = Time.now.strftime("%Y")
35
+ # 关键字替换
36
+ @keyMap = {
37
+ "YKRPC_POD_NAME" => @config.prefix_name,
38
+ "YKRPC_AUTHOR_NAME" => @config.author,
39
+ "YKRPC_AUTHOR_EMAIL" => @config.author_email,
40
+ "YKRPC_CLASS_PREFIX" => @config.prefix,
41
+ "YKRPC_CREATE_DATE" => time_str,
42
+ "YKRPC_CREATE_YEAR" => year_str,
43
+ }
44
+
45
+ end
46
+
47
+ def createAction()
48
+ ykNotice "create gen project execute: \n name: #{@config.name} \n language: #{@config.language} \n with_demo: #{@config.with_demo} \n path: #{@config.path} \n author: #{@config.author}\n author_email: #{@config.author_email}"
49
+ code = create_path
50
+ exit!(code) unless code == 0
51
+
52
+ code = create_pod()
53
+ exit!(code) unless code == 0
54
+
55
+ if @config.with_demo
56
+ code = create_example
57
+ exit!(code) unless code == 0
58
+
59
+ pod_install
60
+ end
61
+
62
+ end
63
+
64
+ private
65
+
66
+ def create_path()
67
+ ykNotice "模板路径:#{@template_pod_path}"
68
+ return ykError("文件已存在: #{@project_dir_dest}") if File.exist?(@project_dir_dest)
69
+
70
+ FileUtils.mkdir(@project_dir_dest)
71
+ return 0
72
+ end
73
+
74
+ def create_pod()
75
+ ykNotice "create pod"
76
+ pod_dir_cache = File.join(@project_dir_dest, "#{@config.prefix_name}_cache")
77
+ pod_dir_dest = File.join(@project_dir_dest)
78
+ FileUtils.copy_entry(@template_pod_path, pod_dir_cache)
79
+ prepare_business_pod_files(pod_dir_cache)
80
+
81
+ # 改文件夹
82
+ file_arr = updateFileDirs(pod_dir_cache, 'YKRPC_POD_NAME',@config.prefix_name)
83
+
84
+ # 替换 YKRPC_POD_NAME YKRPC_AUTHOR_NAME YKRPC_AUTHOR_EMAIL YKRPC_CREATE_DATE YKRPC_CREATE_YEAR
85
+ updateFiles(file_arr, @keyMap)
86
+
87
+ FileUtils.copy_entry(pod_dir_cache, pod_dir_dest)
88
+ FileUtils.rm_r(pod_dir_cache)
89
+ return 0
90
+ end
91
+
92
+ def prepare_business_pod_files(pod_dir_cache)
93
+ return unless @config.with_register == true
94
+ FileUtils.copy_entry(@register_pod_path, pod_dir_cache)
95
+ # 添加私有依赖
96
+ spec_file_path = File.join(pod_dir_cache, "YKRPC_POD_NAME.podspec")
97
+
98
+ # 在倒数第二行插入新语句
99
+ # s.dependency "YKRouterComponent"
100
+ # s.dependency "YKModuleServiceComponent.swift" #swift 服务中间件, 如果是纯oc组件,请注释此中间件
101
+ de_router = "spec.dependency \"YKRouterComponent\"\n"
102
+ de_service = "spec.dependency \"YKModuleServiceComponent"
103
+ if @config.language == "swift"
104
+ de_service += ".swift\" #swift 服务中间件\n"
105
+ else
106
+ de_service += "\" #oc 服务中间件\n"
107
+ end
108
+
109
+ lines = File.readlines(spec_file_path)
110
+ lines.insert(-2, de_router)
111
+ lines.insert(-2, de_service)
112
+ File.open(spec_file_path, 'w') { |file| file.puts(lines.join) }
113
+ end
114
+
115
+ def create_example()
116
+ ykNotice "create example"
117
+ example_dir_cache = File.join(@project_dir_dest, "Example_cache")
118
+
119
+ FileUtils.copy_entry(@template_example_path, example_dir_cache)
120
+ prepare_business_pod_source(example_dir_cache)
121
+
122
+ ykNotice "gen generate"
123
+ system("cd #{example_dir_cache} && xcodegen generate")
124
+
125
+ # 改文件夹
126
+ file_arr = updateFileDirs(example_dir_cache, 'YKRPC_POD_NAME', @config.prefix_name)
127
+
128
+ # 替换 YKRPC_POD_NAME YKRPC_AUTHOR_NAME YKRPC_AUTHOR_EMAIL YKRPC_CREATE_DATE YKRPC_CREATE_YEAR
129
+ updateFiles(file_arr, @keyMap)
130
+
131
+ FileUtils.copy_entry(example_dir_cache, @example_dir_dest)
132
+ FileUtils.rm_r(example_dir_cache)
133
+
134
+ return 0
135
+ end
136
+
137
+
138
+ def prepare_business_pod_source(example_dir_cache)
139
+ return unless @config.with_register == true
140
+ pod_file_cache = File.join(example_dir_cache, "podfile")
141
+
142
+
143
+ # 在第二行插入新语句
144
+ source_pri = "http://gitlab.y" + "ea" + "hk" + "a.com/App/iOS/YeahkaNativeComSpecsIndex.git"
145
+ lines = File.readlines(pod_file_cache)
146
+ lines.insert(2, "source \"#{source_pri}\"\n")
147
+ File.open(pod_file_cache, 'w') { |file| file.puts(lines.join) }
148
+ end
149
+
150
+ def pod_install
151
+ ykNotice "open project"
152
+ Dir.chdir(@example_dir_dest) do
153
+ system('pod install')
154
+ system('pod install')
155
+ system('open -a /Applications/Xcode.app ./*.xcworkspace')
156
+ end
157
+ end
158
+
159
+
160
+ end
161
+
162
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+ require 'cocoapods-ykutility/command/gen/yk_gen_create_action'
3
+ require 'cocoapods-ykutility/gem_version'
4
+
5
+ module Pod
6
+ class Command
7
+ class Ykutility < Command
8
+
9
+ require 'cocoapods-ykutility/command/create/yk_create_pod_config'
10
+ class Gen < Ykutility
11
+
12
+ self.summary = 'Creates a new project by xcodegen'
13
+
14
+ self.description = <<-DESC
15
+ 通过XcodeGen创建项目
16
+ DESC
17
+
18
+ self.arguments = [
19
+ CLAide::Argument.new('NAME', true)
20
+ ]
21
+
22
+ def self.options
23
+ [
24
+ ['--language=LANGUAGE', 'Language [ ObjC / Swift ]'],
25
+ ['--no-demo', 'Without a demo application for your library'],
26
+ ['--author=AUTHOR', 'Author'],
27
+ ['--email=EMAIL', 'Email'],
28
+ ['--prefix=PREFIX', 'Prefix header'],
29
+ ['--pod-path=PATH', 'Pod created at path'],
30
+ ['--business', 'With service/router register template'],
31
+ ].concat(super)
32
+ end
33
+
34
+ def initialize(argv)
35
+ @config = YKPod::YKCreatePodConfig.new()
36
+
37
+ @config.name = argv.shift_argument
38
+ @config.language = (["objc", "oc"].include? argv.option('language', "swift").downcase) ? "objc" : "swift"
39
+ @config.with_demo = !argv.flag?('no-demo', false)
40
+ @config.with_register = argv.flag?('business', false)
41
+ @config.author = argv.option('author', open("|git config --global user.name").gets).strip.gsub('.', '')
42
+ @config.author_email = argv.option('email', open("|git config --global user.email").gets).strip
43
+ @config.prefix = argv.option('prefix', "YK")
44
+ @config.path = File.expand_path(argv.option('pod-path', Dir.getwd.to_s))
45
+ super
46
+ @additional_args = argv.remainder!
47
+ end
48
+
49
+ def validate!
50
+ super
51
+ help! 'A name for the Pod is required.' unless @config.name
52
+ help! 'The Pod name cannot contain spaces.' if @config.name =~ /\s/
53
+ help! 'The Pod name cannot contain plusses.' if @config.name =~ /\+/
54
+ help! "The Pod name cannot begin with a '.'" if @config.name[0, 1] == '.'
55
+ end
56
+
57
+ def run
58
+ puts("create pod run")
59
+ YKPod::YKGenCreate.new(@config).createAction
60
+ end
61
+
62
+ # Runs the template configuration utilities.
63
+ #
64
+ # @return [void]
65
+ #
66
+ def print_info
67
+ UI.puts "\nTo learn more about the template see `#{CocoapodsYkPodUtility::YK_POD_TEMPLATE_PATH}`."
68
+ end
69
+
70
+ end
71
+
72
+ end
73
+ end
74
+ end
@@ -1,5 +1,8 @@
1
1
  module CocoapodsYkPodUtility
2
- VERSION = '0.0.18'
2
+ VERSION = '1.0.1'
3
3
  YK_POD_TEMPLATE_PATH = File.expand_path(File.join(__FILE__, '../../../podTemplate'))
4
4
  YK_POD_BUSINESS_REGISTER_PATH = File.expand_path(File.join(__FILE__, '../../../podTemplate/register'))
5
+
6
+ YK_GEN_TEMPLATE_PATH = File.expand_path(File.join(__FILE__, '../../../configPodTemplate'))
7
+ YK_GEN_BUSINESS_REGISTER_PATH = File.expand_path(File.join(__FILE__, '../../../configPodTemplate/register'))
5
8
  end
@@ -23,7 +23,7 @@ end
23
23
  # cocoapods pod install hook
24
24
  post_install do |installer|
25
25
  # 添加创建时候类前缀
26
- installer.pods_project.root_object.attributes["CLASSPREFIX"] = "YKPRC_CLASS_PREFIX" # 添加 class prefix
26
+ installer.pods_project.root_object.attributes["CLASSPREFIX"] = "YKRPC_CLASS_PREFIX" # 添加 class prefix
27
27
  # project编辑配置
28
28
  installer.pods_project.build_configurations.each do |config|
29
29
  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
@@ -2,7 +2,7 @@
2
2
  // AppDelegate.swift
3
3
  // YKRPC_POD_NAME_Example
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
7
7
 
8
8
  import UIKit
@@ -22,7 +22,7 @@
22
22
  <nil key="textColor"/>
23
23
  <nil key="highlightedColor"/>
24
24
  </label>
25
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vWs-zc-qKa">
25
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vWs-zc-qKa">
26
26
  <rect key="frame" x="20" y="766" width="353" height="12"/>
27
27
  <fontDescription key="fontDescription" type="system" pointSize="10"/>
28
28
  <nil key="textColor"/>
@@ -22,7 +22,7 @@
22
22
  <nil key="textColor"/>
23
23
  <nil key="highlightedColor"/>
24
24
  </label>
25
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iEE-t8-eTf">
25
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iEE-t8-eTf">
26
26
  <rect key="frame" x="20" y="766" width="353" height="12"/>
27
27
  <fontDescription key="fontDescription" type="system" pointSize="10"/>
28
28
  <nil key="textColor"/>
@@ -2,7 +2,7 @@
2
2
  // SceneDelegate.swift
3
3
  // YKRPC_POD_NAME_Example
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
7
7
 
8
8
  import UIKit
@@ -2,7 +2,7 @@
2
2
  // ViewController.swift
3
3
  // YKRPC_POD_NAME_Example
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
7
7
 
8
8
  import UIKit
@@ -94,7 +94,7 @@
94
94
  isa = PBXProject;
95
95
  attributes = {
96
96
  BuildIndependentTargetsInParallel = 1;
97
- CLASSPREFIX = YKPRC_CLASS_PREFIX;
97
+ CLASSPREFIX = YKRPC_CLASS_PREFIX;
98
98
  LastSwiftUpdateCheck = 1410;
99
99
  LastUpgradeCheck = 1410;
100
100
  TargetAttributes = {
@@ -1,4 +1,4 @@
1
- Copyright (c) YKPRC_CREATE_YEAR YKPRC_AUTHOR_NAME <YKPRC_AUTHOR_EMAIL>
1
+ Copyright (c) YKRPC_CREATE_YEAR YKRPC_AUTHOR_NAME <YKRPC_AUTHOR_EMAIL>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -1,8 +1,8 @@
1
1
  # YKRPC_POD_NAME
2
2
 
3
- [![CI Status](https://img.shields.io/travis/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME.svg?style=flat)](https://travis-ci.org/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME)
3
+ [![CI Status](https://img.shields.io/travis/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME.svg?style=flat)](https://travis-ci.org/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME)
4
4
  [![Version](https://img.shields.io/cocoapods/v/YKRPC_POD_NAME.svg?style=flat)](https://cocoapods.org/pods/YKRPC_POD_NAME)
5
- [![License](https://img.shields.io/cocoapods/l/YKRPC_POD_NAME.svg?style=flat)](https://github.com/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME/blob/701ff106db3caa805f9dab12df7749c03c889c47/LICENSE)
5
+ [![License](https://img.shields.io/cocoapods/l/YKRPC_POD_NAME.svg?style=flat)](https://github.com/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME/blob/701ff106db3caa805f9dab12df7749c03c889c47/LICENSE)
6
6
  [![Platform](https://img.shields.io/cocoapods/p/YKRPC_POD_NAME.svg?style=flat)](https://cocoapods.org/pods/YKRPC_POD_NAME)
7
7
 
8
8
  ## 摘要
@@ -49,12 +49,12 @@ pod 'YKRPC_POD_NAME', '~> x.x.x'
49
49
 
50
50
  ## 历史版本
51
51
 
52
- - [1.0.0](http://github/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME/tag/1.0.0)
52
+ - [1.0.0](http://github/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME/tag/1.0.0)
53
53
 
54
54
  - 初始化版本
55
55
  - 提供: xxx, xxx 功能
56
56
 
57
- - [1.0.1](http://github/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME/tag/1.0.1)
57
+ - [1.0.1](http://github/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME/tag/1.0.1)
58
58
 
59
59
  - 修复
60
60
  - 提供: xxx, xxx 功能
@@ -2,7 +2,7 @@
2
2
  // YKRPC_POD_NAME.h
3
3
  // Pod
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
7
7
 
8
8
  #import <Foundation/Foundation.h>
@@ -2,7 +2,7 @@
2
2
  // YKRPC_POD_NAME.m
3
3
  // Pod
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
7
7
 
8
8
  #import "YKRPC_POD_NAME.h"
@@ -7,12 +7,12 @@ Pod::Spec.new do |spec|
7
7
  YKRPC_POD_NAME long description of the pod here.
8
8
  DESC
9
9
 
10
- spec.homepage = 'http://github.com/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME'
10
+ spec.homepage = 'http://github.com/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME'
11
11
  spec.license = { :type => "MIT", :file => "FILE_LICENSE" }
12
- spec.author = { "YKPRC_AUTHOR_NAME" => "YKPRC_AUTHOR_EMAIL" }
12
+ spec.author = { "YKRPC_AUTHOR_NAME" => "YKRPC_AUTHOR_EMAIL" }
13
13
  spec.ios.deployment_target = '9.0'
14
14
 
15
- spec.source = { :git => "http://github/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME.git", :tag => "#{spec.version}" }
15
+ spec.source = { :git => "http://github/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME.git", :tag => "#{spec.version}" }
16
16
 
17
17
 
18
18
  # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
@@ -2,7 +2,7 @@
2
2
  // YKRPC_POD_NAMERegisterRouter.h
3
3
  // YKRPC_POD_NAME
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
7
7
 
8
8
  #import <Foundation/Foundation.h>
@@ -2,7 +2,7 @@
2
2
  // YKRPC_POD_NAMERegisterRouter.m
3
3
  // YKRPC_POD_NAME
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
7
7
 
8
8
  #import "YKRPC_POD_NAMERegisterRouter.h"
@@ -2,7 +2,7 @@
2
2
  // YKRPC_POD_NAMERegisterService.h
3
3
  // YKRPC_POD_NAME
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
7
7
 
8
8
  #import <Foundation/Foundation.h>
@@ -2,7 +2,7 @@
2
2
  // YKRPC_POD_NAMERegisterService.m
3
3
  // YKRPC_POD_NAME
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
7
7
 
8
8
  #import "YKRPC_POD_NAMERegisterService.h"
@@ -2,7 +2,7 @@
2
2
  // YKRPC_POD_NAMERegisterRouter.swift
3
3
  // YKRPC_POD_NAME
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
7
7
 
8
8
  import YKRouterComponent
@@ -2,7 +2,7 @@
2
2
  // YKRPC_POD_NAMERegisterService.swift
3
3
  // YKRPC_POD_NAME
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
7
7
  import YKModuleServiceComponentSwift
8
8
 
@@ -1,8 +1,8 @@
1
1
  # YKRPC_POD_NAME
2
2
 
3
- [![CI Status](https://img.shields.io/travis/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME.svg?style=flat)](https://travis-ci.org/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME)
3
+ [![CI Status](https://img.shields.io/travis/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME.svg?style=flat)](https://travis-ci.org/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME)
4
4
  [![Version](https://img.shields.io/cocoapods/v/YKRPC_POD_NAME.svg?style=flat)](https://cocoapods.org/pods/YKRPC_POD_NAME)
5
- [![License](https://img.shields.io/cocoapods/l/YKRPC_POD_NAME.svg?style=flat)](https://github.com/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME/blob/701ff106db3caa805f9dab12df7749c03c889c47/LICENSE)
5
+ [![License](https://img.shields.io/cocoapods/l/YKRPC_POD_NAME.svg?style=flat)](https://github.com/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME/blob/701ff106db3caa805f9dab12df7749c03c889c47/LICENSE)
6
6
  [![Platform](https://img.shields.io/cocoapods/p/YKRPC_POD_NAME.svg?style=flat)](https://cocoapods.org/pods/YKRPC_POD_NAME)
7
7
 
8
8
  ## 摘要
@@ -49,12 +49,12 @@ pod 'YKRPC_POD_NAME', '~> x.x.x'
49
49
 
50
50
  ## 历史版本
51
51
 
52
- - [1.0.0](http://github/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME/tag/1.0.0)
52
+ - [1.0.0](http://github/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME/tag/1.0.0)
53
53
 
54
54
  - 初始化版本
55
55
  - 提供: xxx, xxx 功能
56
56
 
57
- - - [1.0.1](http://github/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME/tag/1.0.1)
57
+ - - [1.0.1](http://github/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME/tag/1.0.1)
58
58
 
59
59
  - 修复
60
60
  - 提供: xxx, xxx 功能
@@ -2,5 +2,5 @@
2
2
  // YKRPC_POD_NAME.swift
3
3
  // Pod
4
4
  //
5
- // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
5
+ // Created by YKRPC_AUTHOR_NAME on YKRPC_CREATE_DATE.
6
6
  //
@@ -7,12 +7,12 @@ Pod::Spec.new do |spec|
7
7
  YKRPC_POD_NAME long description of the pod here.
8
8
  DESC
9
9
 
10
- spec.homepage = 'http://github.com/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME'
10
+ spec.homepage = 'http://github.com/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME'
11
11
  spec.license = { :type => "MIT", :file => "FILE_LICENSE" }
12
- spec.author = { "YKPRC_AUTHOR_NAME" => "YKPRC_AUTHOR_EMAIL" }
12
+ spec.author = { "YKRPC_AUTHOR_NAME" => "YKRPC_AUTHOR_EMAIL" }
13
13
  spec.ios.deployment_target = '9.0'
14
14
 
15
- spec.source = { :git => "http://github/YKPRC_AUTHOR_NAME/YKRPC_POD_NAME.git", :tag => "#{spec.version}" }
15
+ spec.source = { :git => "http://github/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME.git", :tag => "#{spec.version}" }
16
16
 
17
17
 
18
18
  # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #