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.
- checksums.yaml +4 -4
- data/configPodTemplate/example/CommonFiles/.gitkeep +0 -0
- data/configPodTemplate/example/CommonFiles/CommonFile.swift +9 -0
- data/configPodTemplate/example/NotificationContent/Base.lproj/MainInterface.storyboard +43 -0
- data/configPodTemplate/example/NotificationContent/Info.plist +40 -0
- data/configPodTemplate/example/NotificationContent/NotificationViewController.swift +25 -0
- data/configPodTemplate/example/NotificationService/Info.plist +38 -0
- data/configPodTemplate/example/NotificationService/NotificationService.swift +36 -0
- data/configPodTemplate/example/Podfile +53 -0
- data/configPodTemplate/example/READ.md +76 -0
- data/configPodTemplate/example/README_resource/appExtensionNameDiscussion.png +0 -0
- data/configPodTemplate/example/TargetMain/AppDelegate.swift +32 -0
- data/configPodTemplate/example/TargetMain/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- data/configPodTemplate/example/TargetMain/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
- data/configPodTemplate/example/TargetMain/Assets.xcassets/Contents.json +6 -0
- data/configPodTemplate/example/TargetMain/Base.lproj/LaunchScreen.storyboard +45 -0
- data/configPodTemplate/example/TargetMain/Info.plist +47 -0
- data/configPodTemplate/example/TargetMain/ViewController.swift +29 -0
- data/configPodTemplate/example/TargetMain/ViewController.xib +46 -0
- data/configPodTemplate/example/TargetMain/YKRPC_POD_NAMEEmptyOC.h +16 -0
- data/configPodTemplate/example/TargetMain/YKRPC_POD_NAMEEmptyOC.m +18 -0
- data/configPodTemplate/example/TargetMain/YKRPC_POD_NAME_Example-Bridging-Header.h +4 -0
- data/configPodTemplate/example/config/iOS-config/target-main/Shared.xcconfig +105 -0
- data/configPodTemplate/example/config/iOS-config/target-main/config-custom/Shared.xcconfig +2 -0
- data/configPodTemplate/example/config/iOS-config/target-main/config-custom/debug.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-main/config-custom/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-main/config-enterprise/Shared.xcconfig +1 -0
- data/configPodTemplate/example/config/iOS-config/target-main/config-enterprise/debug.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-main/config-enterprise/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-main-Q/Shared.xcconfig +105 -0
- data/configPodTemplate/example/config/iOS-config/target-main-Q/config-custom/Shared.xcconfig +2 -0
- data/configPodTemplate/example/config/iOS-config/target-main-Q/config-custom/debug.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-main-Q/config-custom/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-main-Q/config-enterprise/Shared.xcconfig +1 -0
- data/configPodTemplate/example/config/iOS-config/target-main-Q/config-enterprise/debug.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-main-Q/config-enterprise/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent/Shared.xcconfig +5 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-custom/Shared.xcconfig +2 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-custom/debug.xcconfig +129 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-custom/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-enterprise/Shared.xcconfig +2 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-enterprise/debug.xcconfig +129 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent/config-enterprise/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/Shared.xcconfig +5 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-custom/Shared.xcconfig +2 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-custom/debug.xcconfig +129 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-custom/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-enterprise/Shared.xcconfig +2 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-enterprise/debug.xcconfig +129 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationContent-Q/config-enterprise/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService/Shared.xcconfig +7 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService/config-custom/Shared.xcconfig +2 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService/config-custom/debug.xcconfig +129 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService/config-custom/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService/config-enterprise/Shared.xcconfig +3 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService/config-enterprise/debug.xcconfig +129 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService/config-enterprise/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/Shared.xcconfig +7 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-custom/Shared.xcconfig +2 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-custom/debug.xcconfig +129 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-custom/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-enterprise/Shared.xcconfig +3 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-enterprise/debug.xcconfig +129 -0
- data/configPodTemplate/example/config/iOS-config/target-notificationService-Q/config-enterprise/release.xcconfig +9 -0
- data/configPodTemplate/example/config/iOS-targets-Q.yml +137 -0
- data/configPodTemplate/example/config/iOS-targets.yml +135 -0
- data/configPodTemplate/example/config/project-config/Shared.xcconfig +470 -0
- data/configPodTemplate/example/config/project-config/config-custom/Shared.xcconfig +8 -0
- data/configPodTemplate/example/config/project-config/config-custom/debug.xcconfig +127 -0
- data/configPodTemplate/example/config/project-config/config-custom/release.xcconfig +60 -0
- data/configPodTemplate/example/config/project-config/config-enterprise/Shared.xcconfig +20 -0
- data/configPodTemplate/example/config/project-config/config-enterprise/debug.xcconfig +127 -0
- data/configPodTemplate/example/config/project-config/config-enterprise/release.xcconfig +59 -0
- data/configPodTemplate/example/project.yml +37 -0
- data/configPodTemplate/objc/LICENSE +19 -0
- data/configPodTemplate/objc/README.md +60 -0
- data/configPodTemplate/objc/YKRPC_POD_NAME/Assets/Images.xcassets/.gitkeep +0 -0
- data/configPodTemplate/objc/YKRPC_POD_NAME/Private/.gitkeep +0 -0
- data/configPodTemplate/objc/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.h +16 -0
- data/configPodTemplate/objc/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.m +12 -0
- data/configPodTemplate/objc/YKRPC_POD_NAME.podspec +62 -0
- data/configPodTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.h +16 -0
- data/configPodTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.m +27 -0
- data/configPodTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.h +15 -0
- data/configPodTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.m +27 -0
- data/configPodTemplate/register/swift/YKRPC_POD_NAME/Private/.gitkeep +0 -0
- data/configPodTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterRouter.swift +19 -0
- data/configPodTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterService.swift +20 -0
- data/configPodTemplate/swift/LICENSE +19 -0
- data/configPodTemplate/swift/README.md +60 -0
- data/configPodTemplate/swift/YKRPC_POD_NAME/Assets/Images.xcassets/.gitkeep +0 -0
- data/configPodTemplate/swift/YKRPC_POD_NAME/Private/.gitkeep +0 -0
- data/configPodTemplate/swift/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.swift +6 -0
- data/configPodTemplate/swift/YKRPC_POD_NAME.podspec +61 -0
- data/lib/cocoapods-ykutility/command/Ykutility.rb +1 -0
- data/lib/cocoapods-ykutility/command/create/yk_create_pod_action.rb +7 -7
- data/lib/cocoapods-ykutility/command/create/yk_exchange_tool.rb +1 -0
- data/lib/cocoapods-ykutility/command/gen/yk_gen_create_action.rb +162 -0
- data/lib/cocoapods-ykutility/command/gen.rb +74 -0
- data/lib/cocoapods-ykutility/gem_version.rb +4 -1
- data/podTemplate/example/Podfile +1 -1
- data/podTemplate/example/YKRPC_POD_NAME_Example/AppDelegate.swift +1 -1
- data/podTemplate/example/YKRPC_POD_NAME_Example/Base.lproj/LaunchScreen.storyboard +1 -1
- data/podTemplate/example/YKRPC_POD_NAME_Example/Base.lproj/Main.storyboard +1 -1
- data/podTemplate/example/YKRPC_POD_NAME_Example/SceneDelegate.swift +1 -1
- data/podTemplate/example/YKRPC_POD_NAME_Example/ViewController.swift +1 -1
- data/podTemplate/example/YKRPC_POD_NAME_Example.xcodeproj/project.pbxproj +1 -1
- data/podTemplate/objc/LICENSE +1 -1
- data/podTemplate/objc/README.md +4 -4
- data/podTemplate/objc/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.h +1 -1
- data/podTemplate/objc/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.m +1 -1
- data/podTemplate/objc/YKRPC_POD_NAME.podspec +3 -3
- data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.h +1 -1
- data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.m +1 -1
- data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.h +1 -1
- data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.m +1 -1
- data/podTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterRouter.swift +1 -1
- data/podTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterService.swift +1 -1
- data/podTemplate/swift/README.md +4 -4
- data/podTemplate/swift/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.swift +1 -1
- data/podTemplate/swift/YKRPC_POD_NAME.podspec +3 -3
- 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
|
@@ -33,11 +33,11 @@ module YKPod
|
|
33
33
|
# 关键字替换
|
34
34
|
@keyMap = {
|
35
35
|
"YKRPC_POD_NAME" => @config.prefix_name,
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
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
|
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
|
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)
|
@@ -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 = '
|
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
|
data/podTemplate/example/Podfile
CHANGED
@@ -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"] = "
|
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'
|
@@ -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
|
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
|
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"/>
|
data/podTemplate/objc/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c)
|
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
|
data/podTemplate/objc/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# YKRPC_POD_NAME
|
2
2
|
|
3
|
-
[![CI Status](https://img.shields.io/travis/
|
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/
|
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/
|
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/
|
57
|
+
- [1.0.1](http://github/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME/tag/1.0.1)
|
58
58
|
|
59
59
|
- 修复
|
60
60
|
- 提供: xxx, xxx 功能
|
@@ -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/
|
10
|
+
spec.homepage = 'http://github.com/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME'
|
11
11
|
spec.license = { :type => "MIT", :file => "FILE_LICENSE" }
|
12
|
-
spec.author = { "
|
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/
|
15
|
+
spec.source = { :git => "http://github/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME.git", :tag => "#{spec.version}" }
|
16
16
|
|
17
17
|
|
18
18
|
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
|
data/podTemplate/swift/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# YKRPC_POD_NAME
|
2
2
|
|
3
|
-
[![CI Status](https://img.shields.io/travis/
|
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/
|
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/
|
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/
|
57
|
+
- - [1.0.1](http://github/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME/tag/1.0.1)
|
58
58
|
|
59
59
|
- 修复
|
60
60
|
- 提供: xxx, xxx 功能
|
@@ -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/
|
10
|
+
spec.homepage = 'http://github.com/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME'
|
11
11
|
spec.license = { :type => "MIT", :file => "FILE_LICENSE" }
|
12
|
-
spec.author = { "
|
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/
|
15
|
+
spec.source = { :git => "http://github/YKRPC_AUTHOR_NAME/YKRPC_POD_NAME.git", :tag => "#{spec.version}" }
|
16
16
|
|
17
17
|
|
18
18
|
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
|