cocoapods-ykutility 0.0.12 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cocoapods-ykutility/command/Ykutility.rb +2 -1
  3. data/lib/cocoapods-ykutility/{function → command/create}/yk_create_pod_action.rb +43 -4
  4. data/lib/cocoapods-ykutility/{function → command/create}/yk_create_pod_config.rb +2 -1
  5. data/lib/cocoapods-ykutility/{function → command/create}/yk_exchange_tool.rb +1 -1
  6. data/lib/cocoapods-ykutility/command/{ykutility/create.rb → create.rb} +4 -2
  7. data/lib/cocoapods-ykutility/command/push/yk_api_analysis.rb +81 -0
  8. data/lib/cocoapods-ykutility/command/push/yk_api_parse.rb +68 -0
  9. data/lib/cocoapods-ykutility/command/push/yk_git_manager.rb +87 -0
  10. data/lib/cocoapods-ykutility/command/push.rb +102 -0
  11. data/lib/cocoapods-ykutility/gem_version.rb +2 -1
  12. data/lib/cocoapods-ykutility/{function → tools}/yk_log_tool.rb +8 -0
  13. data/podTemplate/example/YKRPC_POD_NAME_Example.xcodeproj/project.pbxproj +2 -2
  14. data/podTemplate/example/YKRPC_POD_NAME_Example.xcodeproj/project.xcworkspace/xcuserdata/imac24inch.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  15. data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.h +16 -0
  16. data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.m +27 -0
  17. data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.h +15 -0
  18. data/podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.m +27 -0
  19. data/podTemplate/register/swift/YKRPC_POD_NAME/Private/.gitkeep +0 -0
  20. data/podTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterRouter.swift +19 -0
  21. data/podTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterService.swift +20 -0
  22. metadata +79 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc117e8086c2837b3d7b49a2dc44c641ffd10dcb57dae7ae11178cf59f80cf45
4
- data.tar.gz: d44bf31e0a0f060750144297636ee2aca87195bab1176a4452a175f0956efa80
3
+ metadata.gz: 15081082459e430368dd8dbfae737c373a8086d6b96bcb7e22ffcb7ca7d66083
4
+ data.tar.gz: a9c819d9272170f5bbc3b56650b419c1c888bd596609ce9d56772c48a4f80ffa
5
5
  SHA512:
6
- metadata.gz: f878d8679e9c066e088736982a40098b0eabb9db1f0888dab221907d40379bad1fd9809a9924279d0e9551c3825da737f7b1e859e9501e38f7d8d6a302f16720
7
- data.tar.gz: c29dda8b533c1fa47273262a5bb9a7769bf5383b3f11ed6820de677426c3cdbbf1d693fd5d9003fd0b993340a610354fdd00545877f38178745e87cf6d55ce59
6
+ metadata.gz: 51c259c1c7939808a97479a8e61ba2e151ef7c9889617e7274bd279d7455f83847eca0cdccb708df2c644e5b2baff3143b9a3c84cd6a46ed68921f7553ac79a8
7
+ data.tar.gz: 17be23b7e5c19fdfb5a941eeecc3ae6f85b37de746447d281b2d15396e8212b2a0a317968c4f324d1380d4a1f98a6706cfd8c7ae222ea3f9481a6832a0731e06
@@ -1,5 +1,6 @@
1
1
  require 'cocoapods'
2
- require 'cocoapods-ykutility/command/ykutility/create'
2
+ require 'cocoapods-ykutility/command/create'
3
+ require 'cocoapods-ykutility/command/push'
3
4
 
4
5
  module Pod
5
6
  class Command
@@ -4,13 +4,13 @@ module YKPod
4
4
  require 'cocoapods'
5
5
 
6
6
  class YKCreate
7
- require 'cocoapods-ykutility/function/yk_create_pod_config'
8
- require 'cocoapods-ykutility/function/yk_log_tool'
7
+ require 'cocoapods-ykutility/command/create/yk_create_pod_config'
8
+ require 'cocoapods-ykutility/tools/yk_log_tool'
9
9
  require 'find'
10
10
  include YKPod::YKLogTool
11
11
 
12
12
  require 'cocoapods-ykutility/gem_version'
13
- require 'cocoapods-ykutility/function/yk_exchange_tool'
13
+ require 'cocoapods-ykutility/command/create/yk_exchange_tool'
14
14
  include YKPod::YKExchangeTool
15
15
 
16
16
  def initialize(conf)
@@ -26,6 +26,7 @@ module YKPod
26
26
 
27
27
  @template_pod_path = File.join(CocoapodsYkPodUtility::YK_POD_TEMPLATE_PATH, @config.language)
28
28
  @template_example_path = File.join(CocoapodsYkPodUtility::YK_POD_TEMPLATE_PATH, "example")
29
+ @register_pod_path = File.join(CocoapodsYkPodUtility::YK_POD_BUSINESS_REGISTER_PATH, @config.language)
29
30
 
30
31
  time_str = Time.now.strftime("%Y/%m/%d")
31
32
  year_str = Time.now.strftime("%Y")
@@ -46,7 +47,7 @@ module YKPod
46
47
  code = create_path
47
48
  exit!(code) unless code == 0
48
49
 
49
- code = create_pod
50
+ code = create_pod()
50
51
  exit!(code) unless code == 0
51
52
 
52
53
  if @config.with_demo
@@ -73,6 +74,7 @@ module YKPod
73
74
  pod_dir_cache = File.join(@project_dir_dest, "#{@config.prefix_name}_cache")
74
75
  pod_dir_dest = File.join(@project_dir_dest)
75
76
  FileUtils.copy_entry(@template_pod_path, pod_dir_cache)
77
+ prepare_business_pod_files(pod_dir_cache)
76
78
 
77
79
  # 改文件夹
78
80
  file_arr = updateFileDirs(pod_dir_cache, 'YKRPC_POD_NAME',@config.prefix_name)
@@ -85,11 +87,35 @@ module YKPod
85
87
  return 0
86
88
  end
87
89
 
90
+ def prepare_business_pod_files(pod_dir_cache)
91
+ return unless @config.with_register == true
92
+ FileUtils.copy_entry(@register_pod_path, pod_dir_cache)
93
+ # 添加私有依赖
94
+ spec_file_path = File.join(pod_dir_cache, "YKRPC_POD_NAME.podspec")
95
+
96
+ # 在倒数第二行插入新语句
97
+ # s.dependency "YKRouterComponent"
98
+ # s.dependency "YKModuleServiceComponent.swift" #swift 服务中间件, 如果是纯oc组件,请注释此中间件
99
+ de_router = "spec.dependency \"YKRouterComponent\"\n"
100
+ de_service = "spec.dependency \"YKModuleServiceComponent"
101
+ if @config.language == "swift"
102
+ de_service += ".swift\" #swift 服务中间件\n"
103
+ else
104
+ de_service += "\" #oc 服务中间件\n"
105
+ end
106
+
107
+ lines = File.readlines(spec_file_path)
108
+ lines.insert(-2, de_router)
109
+ lines.insert(-2, de_service)
110
+ File.open(spec_file_path, 'w') { |file| file.puts(lines.join) }
111
+ end
112
+
88
113
  def create_example()
89
114
  ykNotice "create example"
90
115
  example_dir_cache = File.join(@project_dir_dest, "Example_cache")
91
116
 
92
117
  FileUtils.copy_entry(@template_example_path, example_dir_cache)
118
+ prepare_business_pod_source(example_dir_cache)
93
119
 
94
120
  # 改文件夹
95
121
  file_arr = updateFileDirs(example_dir_cache, 'YKRPC_POD_NAME', @config.prefix_name)
@@ -103,6 +129,19 @@ module YKPod
103
129
  return 0
104
130
  end
105
131
 
132
+
133
+ def prepare_business_pod_source(example_dir_cache)
134
+ return unless @config.with_register == true
135
+ pod_file_cache = File.join(example_dir_cache, "podfile")
136
+
137
+
138
+ # 在第二行插入新语句
139
+ source_pri = "http://gitlab.y" + "ea" + "hk" + "a.com/App/iOS/YeahkaNativeComSpecsIndex.git"
140
+ lines = File.readlines(pod_file_cache)
141
+ lines.insert(2, "source \"#{source_pri}\"\n")
142
+ File.open(pod_file_cache, 'w') { |file| file.puts(lines.join) }
143
+ end
144
+
106
145
  def pod_install
107
146
  ykNotice "open project"
108
147
  Dir.chdir(@example_dir_dest) do
@@ -3,12 +3,13 @@
3
3
  module YKPod
4
4
 
5
5
  class YKCreatePodConfig
6
- attr_accessor :name, :language, :with_demo, :author, :author_email, :prefix, :path
6
+ attr_accessor :name, :language, :with_demo, :with_register, :author, :author_email, :prefix, :path
7
7
 
8
8
  def initialize()
9
9
  @name = ""
10
10
  @language = ""
11
11
  @with_demo = true
12
+ @with_register = false
12
13
  @author = open("|git config --global user.name").gets.strip.gsub('.', '')
13
14
  @author_email = open("|git config --global user.email").gets.strip
14
15
  @prefix = "YK"
@@ -2,7 +2,7 @@
2
2
 
3
3
  module YKPod
4
4
  module YKExchangeTool
5
- require 'cocoapods-ykutility/function/yk_log_tool'
5
+ require 'cocoapods-ykutility/tools/yk_log_tool'
6
6
  include YKPod::YKLogTool
7
7
  def updateFileDirs(rootDir, keyWord, destWord)
8
8
  Dir.glob("#{rootDir}/**/**/**/**").each do |name|
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
- require 'cocoapods-ykutility/function/yk_create_pod_action'
2
+ require 'cocoapods-ykutility/command/create/yk_create_pod_action'
3
3
  require 'cocoapods-ykutility/gem_version'
4
4
 
5
5
  module Pod
6
6
  class Command
7
7
  class Ykutility < Command
8
8
 
9
- require 'cocoapods-ykutility/function/yk_create_pod_config'
9
+ require 'cocoapods-ykutility/command/create/yk_create_pod_config'
10
10
  class Create < Ykutility
11
11
 
12
12
  self.summary = 'Creates a new Pod'
@@ -27,6 +27,7 @@ module Pod
27
27
  ['--email=EMAIL', 'Email'],
28
28
  ['--prefix=PREFIX', 'Prefix header'],
29
29
  ['--pod-path=PATH', 'Pod created at path'],
30
+ ['--business', 'With service/router register template'],
30
31
  ].concat(super)
31
32
  end
32
33
 
@@ -36,6 +37,7 @@ module Pod
36
37
  @config.name = argv.shift_argument
37
38
  @config.language = (["objc", "oc"].include? argv.option('language', "swift").downcase) ? "objc" : "swift"
38
39
  @config.with_demo = !argv.flag?('no-demo', false)
40
+ @config.with_register = argv.flag?('business', false)
39
41
  @config.author = argv.option('author', open("|git config --global user.name").gets).strip.gsub('.', '')
40
42
  @config.author_email = argv.option('email', open("|git config --global user.email").gets).strip
41
43
  @config.prefix = argv.option('prefix', "YK")
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YKApi
4
+ class YkApiAnalysis
5
+ require 'cocoapods-ykutility/tools/yk_log_tool'
6
+ require 'cocoapods-ykutility/command/push/yk_api_parse'
7
+
8
+ require 'cocoapods'
9
+
10
+ include YKPod::YKLogTool
11
+
12
+ attr_accessor :spec_list, :pod_names, :version
13
+ def initialize(podspec_files, source_urls)
14
+ @spec_files = podspec_files
15
+ @source_urls = source_urls
16
+
17
+ @public_headers = []
18
+ @source_files = []
19
+ @swift_files = []
20
+ @pod_names = []
21
+ @version = ""
22
+ end
23
+
24
+ def execute
25
+ analysis_all_specs
26
+ analysis_api
27
+ end
28
+
29
+ def all_pod_names
30
+ "\"#{@pod_names.join(" ")}\""
31
+ end
32
+
33
+ private
34
+ def analysis_all_specs()
35
+ @spec_files.each do |one|
36
+ valid = Pod::Validator.new(one, @source_urls)
37
+ spec = valid.linter.spec
38
+ @version = spec.version.to_s
39
+ analysis_one_spec(spec)
40
+ end
41
+
42
+ ykMessage "all public header files:\n#{@public_headers.join("\n")}"
43
+ ykMessage "all source code files:\n#{@source_files.join("\n")}"
44
+ @swift_files = @source_files.find_all do |onePath|
45
+ onePath.extname == ".swift"
46
+ end
47
+ ykMessage "all swift files:\n#{@swift_files}"
48
+ end
49
+
50
+ def analysis_one_spec(spec)
51
+ path_list = Pod::Sandbox::PathList.new(spec.defined_in_file.dirname)
52
+ file_accessor = Pod::Sandbox::FileAccessor.new(path_list, spec.consumer(Pod::Platform.ios))
53
+ public_header_arr = file_accessor.public_headers
54
+ ykMessage("#{spec.name} --> plubic_headers:\n#{public_header_arr.join("\n")}")
55
+ @public_headers.concat(public_header_arr) unless public_header_arr.blank?
56
+ @pod_names.append(spec.name)
57
+
58
+ source_file_arr = file_accessor.source_files
59
+ ykMessage("#{spec.name} --> source_files:\n#{source_file_arr.join("\n")}")
60
+ @source_files.concat(source_file_arr) unless source_file_arr.blank?
61
+
62
+ sub_spec_arr = spec.subspecs
63
+ ykNotice "#{spec.name} has sub_specs: #{sub_spec_arr.join(",\t")}" unless sub_spec_arr.blank?
64
+ sub_spec_arr.each do |oneSub|
65
+ analysis_one_spec(oneSub)
66
+ end
67
+ end
68
+
69
+ def analysis_api
70
+ api_output_dir = File.join(Dir.pwd, "Api")
71
+ if File.exist?(api_output_dir)
72
+ FileUtils.rm_r(api_output_dir)
73
+ end
74
+
75
+ FileUtils.mkdir(api_output_dir)
76
+ analysis_success = YKApi::YkApiParser.new(@public_headers, @swift_files, api_output_dir).analysis
77
+ analysis_success
78
+ end
79
+
80
+ end
81
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YKApi
4
+ class YkApiParser
5
+
6
+ require 'cocoapods-ykutility/tools/yk_log_tool'
7
+ include YKPod::YKLogTool
8
+
9
+ def initialize(objc_header_file_list, swift_file_list, output_dir)
10
+ @objc_header_files = objc_header_file_list
11
+ @swift_file_list = swift_file_list
12
+ @output_dir = output_dir
13
+ @json_cache = File.join(output_dir, "json_files_tem")
14
+ FileUtils.rm_r(@json_cache) if File.exist?(@json_cache)
15
+ FileUtils.mkdir(@json_cache)
16
+ end
17
+
18
+ def analysis
19
+ json_arr_objc = parse_objc
20
+ json_arr_swift = parse_swift
21
+ create_api(json_arr_objc, json_arr_swift)
22
+ end
23
+
24
+ private
25
+ def parse_objc
26
+ ykNotice("#{self.class} --> #{__method__}")
27
+ # sourcekitten doc --objc NSBundle+YKInternational.h -- -x objective-c -isysroot $(xcrun --show-sdk-path --sdk iphonesimulator) -fmodules > 123
28
+ cache_arr = []
29
+ @objc_header_files.each do |one|
30
+ cache_path = File.join(@json_cache, one.basename)
31
+ cmd = "sourcekitten doc --single-file --objc \"#{one}\" -- -x objective-c -isysroot $(xcrun --show-sdk-path --sdk iphonesimulator) -fmodules > \"#{cache_path}\""
32
+ ykMessage("cmd: #{cmd}")
33
+ code = system(cmd)
34
+ cache_arr.append("\"#{cache_path}\"")
35
+ end
36
+
37
+ cache_arr
38
+ end
39
+
40
+ def parse_swift
41
+ ykNotice("#{self.class} --> #{__method__}")
42
+ # sourcekitten doc --single-file $input_file -- -j4 $input_file >> $temp_outout
43
+
44
+ cache_arr = []
45
+ @swift_file_list.each do |one|
46
+ cache_path = File.join(@json_cache, one.basename)
47
+ cmd = "sourcekitten doc --single-file \"#{one}\" -- -j4 \"#{one}\" > \"#{cache_path}\""
48
+ ykNotice("cmd: #{cmd}")
49
+ code = system(cmd)
50
+ cache_arr.append("\"#{cache_path}\"")
51
+ end
52
+
53
+ cache_arr
54
+ end
55
+
56
+ def create_api(json_objc_arr, json_swift_arr)
57
+ json_all = json_objc_arr + json_swift_arr
58
+
59
+ json_all.map
60
+ cmd = "jazzy --min-acl public --sourcekitten-sourcefile #{json_all.join(",")}"
61
+ cmd << " -o \"#{@output_dir}\""
62
+ ykMessage("cmd: \n#{cmd}")
63
+ cmd_result =system(cmd)
64
+ cmd_result
65
+ end
66
+
67
+ end
68
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'git'
4
+ module Git
5
+ class Base
6
+ def is_clean
7
+ cmd = "git status --short"
8
+ @cmd_out_put = []
9
+ IO.popen(cmd) do |f|
10
+ line = f.gets
11
+ @cmd_out_put << line unless line.blank?
12
+ end
13
+
14
+ @cmd_out_put.blank?
15
+ end
16
+ end
17
+ end
18
+
19
+ module YKUtitlityGitModule
20
+ class YKGitManager
21
+ require 'git'
22
+ require 'cocoapods-ykutility/tools/yk_log_tool'
23
+ include YKPod::YKLogTool
24
+
25
+ def initialize(dir)
26
+ @dir = dir
27
+
28
+ Dir.chdir(dir) do
29
+ @git = Git.open(Dir.pwd)
30
+ end
31
+ end
32
+
33
+ def prepare
34
+ is_clean = @git.is_clean
35
+ if is_clean == false
36
+ ykNotice("work tree dirty, work finish") unless is_clean
37
+ return false
38
+ end
39
+ return true
40
+ end
41
+
42
+ def commit_for_api(commit_message)
43
+ begin
44
+ @git.add(:all => true)
45
+ @git.commit(commit_message)
46
+ @git.push('origin', @git.current_branch)
47
+ rescue Git::FailedError => e
48
+ puts(e.to_s)
49
+ end
50
+ end
51
+
52
+ def update_tag(dest_tag)
53
+ delete_dest_tag(dest_tag.to_s) # 删除原有tag
54
+ create_dest_tag(dest_tag.to_s) # 新建tag
55
+ end
56
+
57
+ private
58
+
59
+ def create_dest_tag(dest_tag)
60
+ return false unless prepare == true
61
+
62
+ puts "start create tag"
63
+ @git.add_tag(dest_tag, :m => "\"#{dest_tag}\" -- auto created with api document, by 'cocoapods-ykutility'")
64
+ @git.push('origin', dest_tag)
65
+ end
66
+
67
+ def delete_dest_tag(dest_tag)
68
+ # 此处需要防止本地有tag, 而远端不存在, 所以此处做如下操作
69
+ # 1. 检查本地tag
70
+ # 2. 删除本地tag
71
+ # 3. 拉取远端tag
72
+ # 4. 删除本地和远端tag
73
+
74
+ begin
75
+ exist_tag = @git.tag(dest_tag)
76
+ rescue Git::GitTagNameDoesNotExist => e
77
+ end
78
+
79
+ ykNotice("tag [#{dest_tag}] existed, we delete it on local and remote \"origin\"") unless exist_tag.blank?
80
+ begin
81
+ @git.delete_tag(dest_tag) unless exist_tag.blank?
82
+ @git.push('origin', dest_tag, :delete => true) unless exist_tag.blank?
83
+ rescue Git::FailedError => e
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pod
4
+ class Command
5
+ class Ykutility < Command
6
+ class Push < Ykutility
7
+ require 'cocoapods/command/repo/push'
8
+ require 'cocoapods-ykutility/tools/yk_log_tool'
9
+ require 'cocoapods-ykutility/command/push/yk_api_analysis'
10
+ require 'cocoapods-ykutility/command/push/yk_git_manager'
11
+
12
+ include YKPod::YKLogTool
13
+
14
+ include Pod::Config::Mixin
15
+ self.summary = 'Release a new pod version'
16
+
17
+ self.description = <<-DESC
18
+ 组件发布新版本
19
+ DESC
20
+
21
+ attr_accessor :repo_push_cmd
22
+ attr_accessor :argv_cache
23
+
24
+ self.arguments = Pod::Command::Repo::Push.arguments
25
+
26
+ def self.options
27
+ Pod::Command::Repo::Push.options.concat(super)
28
+ end
29
+
30
+ def initialize(argv)
31
+ # 如果有一部分参数是本类特有的,需要在此处优先取出
32
+ argv_map = argv.remainder
33
+ argv_new = CLAide::ARGV.new(argv.remainder)
34
+ @repo_push_cmd = Pod::Command::Repo::Push.new(argv_new)
35
+
36
+ # 因为这部分参数是 本类 和 Pod::Command::Repo::Push 共有的, 所以本类用 argv 取参数, Pod::Command::Repo::Push使用 argv_map 取参数
37
+ @repo = argv.shift_argument
38
+ @podspec = argv.shift_argument
39
+ @source = source_for_repo
40
+ @source_urls = argv.option('sources', config.sources_manager.all.map(&:url).append(Pod::TrunkSource::TRUNK_REPO_URL).uniq.join(',')).split(',')
41
+ argv_extra = argv_new.remainder
42
+ argv_extra.append("--help") if argv_map.include?("--help")
43
+ super(CLAide::ARGV.new(argv_extra))
44
+ end
45
+
46
+ def validate! # 此处validate 是复制 Pod::Command::Repo::Push , 因为如果直接用 self.repo_push_cmd.validate! 会导致提示显示的是 Pod::Command::Repo::Push 的使用说明
47
+ super
48
+
49
+ help! 'A spec-repo name or url is required.' unless @repo
50
+ unless @source && @source.repo.directory?
51
+ raise Informative,
52
+ "Unable to find the `#{@repo}` repo. " \
53
+ 'If it has not yet been cloned, add it via `pod repo add`.'
54
+ end
55
+ end
56
+
57
+ def run
58
+ gitmanager = YKUtitlityGitModule::YKGitManager.new(Dir.pwd)
59
+ return false unless gitmanager.prepare == true
60
+
61
+ ykNotice "pod ykutility push running !"
62
+ self.repo_push_cmd.run # 使用Pod::Command::Repo::Push,发布pod
63
+
64
+ ykNotice "pod ykutility analysis create document running !"
65
+ api_analysis = YKApi::YkApiAnalysis.new(podspec_files, @source_urls)
66
+ aanlysis_success = api_analysis.execute
67
+ raise Informative, "Failed to analysis Component api: #{api_analysis.all_pod_names}" unless aanlysis_success == true
68
+ # 解析podspec, 识别出 公共文件, tag
69
+ # 根据公共文件,生成接口文档
70
+ # 检查tag是否存在,删除已有tag, 删除远端已有tag
71
+ # 添加接口文档,并提交,生成对应版本的tag,并对送到远端
72
+ version = api_analysis.version
73
+
74
+ gitmanager.commit_for_api("create api document for version: #{version.to_s}")
75
+ gitmanager.update_tag(version.to_s)
76
+
77
+ end
78
+
79
+ private
80
+
81
+ def podspec_files
82
+ if @podspec
83
+ path = Pathname(@podspec)
84
+ raise Informative, "Couldn't find #{@podspec}" unless path.exist?
85
+ [path]
86
+ else
87
+ files = Pathname.glob('*.podspec{,.json}')
88
+ raise Informative, "Couldn't find any podspec files in current directory" if files.empty?
89
+ files
90
+ end
91
+ end
92
+
93
+ def source_for_repo
94
+ self.config.sources_manager.source_with_name_or_url(@repo) unless @repo.nil?
95
+ rescue
96
+ nil
97
+ end
98
+
99
+ end
100
+ end
101
+ end
102
+ end
@@ -1,4 +1,5 @@
1
1
  module CocoapodsYkPodUtility
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.14"
3
3
  YK_POD_TEMPLATE_PATH = File.expand_path(File.join(__FILE__, '../../../podTemplate'))
4
+ YK_POD_BUSINESS_REGISTER_PATH = File.expand_path(File.join(__FILE__, '../../../podTemplate/register'))
4
5
  end
@@ -2,7 +2,10 @@
2
2
 
3
3
  module YKPod
4
4
  module YKLogTool
5
+ require 'cocoapods'
6
+
5
7
  def ykWarning(message)
8
+ verbose = Pod::Config.instance.verbose
6
9
  puts "\n[⚠️] #{message}".yellow
7
10
  return 0
8
11
  end
@@ -12,6 +15,11 @@ module YKPod
12
15
  return 0
13
16
  end
14
17
 
18
+ def ykMessage(message)
19
+ puts "\n#{message}" if Pod::Config.instance.verbose
20
+ return 0
21
+ end
22
+
15
23
  def ykError(message)
16
24
  puts "\n[❌] #{message}".red
17
25
  return 1
@@ -3,7 +3,7 @@
3
3
  archiveVersion = 1;
4
4
  classes = {
5
5
  };
6
- objectVersion = 56;
6
+ objectVersion = 55;
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
@@ -104,7 +104,7 @@
104
104
  };
105
105
  };
106
106
  buildConfigurationList = FDDD855D299DED6500EAB62E /* Build configuration list for PBXProject "YKRPC_POD_NAME_Example" */;
107
- compatibilityVersion = "Xcode 14.0";
107
+ compatibilityVersion = "Xcode 13.0";
108
108
  developmentRegion = en;
109
109
  hasScannedForEncodings = 0;
110
110
  knownRegions = (
@@ -0,0 +1,16 @@
1
+ //
2
+ // YKRPC_POD_NAMERegisterRouter.h
3
+ // YKRPC_POD_NAME
4
+ //
5
+ // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ NS_ASSUME_NONNULL_BEGIN
11
+
12
+ @interface YKRPC_POD_NAMERegisterRouter : NSObject
13
+
14
+ @end
15
+
16
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,27 @@
1
+ //
2
+ // YKRPC_POD_NAMERegisterRouter.m
3
+ // YKRPC_POD_NAME
4
+ //
5
+ // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
6
+ //
7
+
8
+ #import "YKRPC_POD_NAMERegisterRouter.h"
9
+ #import <YKRouterComponent/YKRouterComponentHeader.h>
10
+
11
+ @interface YKRPC_POD_NAMERegisterRouter()<YKRouterComponentRegisterProtocol>
12
+
13
+ @end
14
+
15
+ @implementation YKRPC_POD_NAMERegisterRouter
16
+
17
+ + (void)ykRouterRegisterExecute {
18
+ [[YKRouterComponent shareInstance] ykRegisterUrlPartterns:@"XXXRouterStr" error:nil action:^(YKRouterUrlRequest * _Nonnull urlRequest, YKRouterUrlCompletion _Nonnull completetion) {
19
+ // xxxVC *vc = [[xxxVC alloc] init];
20
+ // UIViewController *topVC = urlRequest.fromVC ? urlRequest.fromVC : [UIViewController topController];
21
+ // [topVC.navigationController pushViewController:vc animated:YES];
22
+ }];
23
+ }
24
+
25
+
26
+ @end
27
+
@@ -0,0 +1,15 @@
1
+ //
2
+ // YKRPC_POD_NAMERegisterService.h
3
+ // YKRPC_POD_NAME
4
+ //
5
+ // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ /**
11
+ Service Register for the module.
12
+ */
13
+ @interface YKRPC_POD_NAMERegisterService : NSObject
14
+
15
+ @end
@@ -0,0 +1,27 @@
1
+ //
2
+ // YKRPC_POD_NAMERegisterService.m
3
+ // YKRPC_POD_NAME
4
+ //
5
+ // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
6
+ //
7
+
8
+ #import "YKRPC_POD_NAMERegisterService.h"
9
+ #import <YKModuleServiceComponent/YKModuleServiceComponentHeader.h>
10
+
11
+ @interface YKRPC_POD_NAMERegisterService()<YKModuleServiceRegisterProtocol, SUAdvertisementServiceProtocol>
12
+ @end
13
+ @implementation SUAdvertisementServiceRegister
14
+
15
+ + (void)ykModuleServiceRegistAction {
16
+ YKModuleServiceRegisterExecute(SUAdvertisementServiceRegister.class, @protocol(SUAdvertisementServiceProtocol), nil);
17
+ }
18
+
19
+ @end
20
+
21
+ #pragma mark - xxxxServiceProtocol method
22
+ // @interface YKRPC_POD_NAMERegisterService(serProtocol)<xxxxServiceProtocol>
23
+ // +(void)xxxxAction {
24
+ // // service execute code
25
+ //
26
+ // }
27
+ // @end
@@ -0,0 +1,19 @@
1
+ //
2
+ // YKRPC_POD_NAMERegisterRouter.swift
3
+ // YKRPC_POD_NAME
4
+ //
5
+ // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
6
+ //
7
+
8
+ import YKRouterComponent
9
+
10
+ private class YKRPC_POD_NAMERegisterRouter: NSObject, YKRouterComponentRegisterProtocol {
11
+ public static func ykRouterRegisterExecute() {
12
+ // YKRouterRegisterUrlParttern("xxxxxxRouterString", nil) { (req: YKRouterUrlRequest, com: YKRouterUrlCompletion?) in
13
+ // let topVC = req.fromVC ?? UIViewController.getTopVC()
14
+ // let vc = REUserProfileVC()
15
+ // topVC?.navigationController?.pushViewController(vc, animated: true)
16
+ // }
17
+ }
18
+ }
19
+
@@ -0,0 +1,20 @@
1
+ //
2
+ // YKRPC_POD_NAMERegisterService.swift
3
+ // YKRPC_POD_NAME
4
+ //
5
+ // Created by YKPRC_AUTHOR_NAME on YKPRC_CREATE_DATE.
6
+ //
7
+ import YKModuleServiceComponentSwift
8
+
9
+ private class YKRPC_POD_NAMERegisterService: NSObject, YKModuleServiceRegisterProtocol {
10
+ static func ykModuleServiceRegistAction() {
11
+ // YKModuleServiceComponent().ykRegistModule(REHomeServiceRegist.self, protocol: XXXXProtocol.self, err: nil)
12
+ }
13
+ }
14
+
15
+ // extension REHomeServiceRegist: XXXXProtocol {
16
+ // static mehtod for XXXXProtocol
17
+ // static func xxxxx() -> xxxxxObjc {
18
+ // return XXXXX()
19
+ // }
20
+ // }
metadata CHANGED
@@ -1,15 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-ykutility
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - stephen.chen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-17 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2023-07-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jazzy
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: git
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
13
69
  description: 创建定制化标准组件.
14
70
  email:
15
71
  - stephenchen@yeahka.com
@@ -20,12 +76,16 @@ files:
20
76
  - lib/cocoapods-ykutility.rb
21
77
  - lib/cocoapods-ykutility/command.rb
22
78
  - lib/cocoapods-ykutility/command/Ykutility.rb
23
- - lib/cocoapods-ykutility/command/ykutility/create.rb
24
- - lib/cocoapods-ykutility/function/yk_create_pod_action.rb
25
- - lib/cocoapods-ykutility/function/yk_create_pod_config.rb
26
- - lib/cocoapods-ykutility/function/yk_exchange_tool.rb
27
- - lib/cocoapods-ykutility/function/yk_log_tool.rb
79
+ - lib/cocoapods-ykutility/command/create.rb
80
+ - lib/cocoapods-ykutility/command/create/yk_create_pod_action.rb
81
+ - lib/cocoapods-ykutility/command/create/yk_create_pod_config.rb
82
+ - lib/cocoapods-ykutility/command/create/yk_exchange_tool.rb
83
+ - lib/cocoapods-ykutility/command/push.rb
84
+ - lib/cocoapods-ykutility/command/push/yk_api_analysis.rb
85
+ - lib/cocoapods-ykutility/command/push/yk_api_parse.rb
86
+ - lib/cocoapods-ykutility/command/push/yk_git_manager.rb
28
87
  - lib/cocoapods-ykutility/gem_version.rb
88
+ - lib/cocoapods-ykutility/tools/yk_log_tool.rb
29
89
  - lib/cocoapods_plugin.rb
30
90
  - podTemplate/example/Podfile
31
91
  - podTemplate/example/Podfile.lock
@@ -52,6 +112,13 @@ files:
52
112
  - podTemplate/objc/YKRPC_POD_NAME/Private/.gitkeep
53
113
  - podTemplate/objc/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.h
54
114
  - podTemplate/objc/YKRPC_POD_NAME/Public/YKRPC_POD_NAME.m
115
+ - podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.h
116
+ - podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterRouter.m
117
+ - podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.h
118
+ - podTemplate/register/objc/YKRPC_POD_NAME/Private/Register/YKRPC_POD_NAMERegisterService.m
119
+ - podTemplate/register/swift/YKRPC_POD_NAME/Private/.gitkeep
120
+ - podTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterRouter.swift
121
+ - podTemplate/register/swift/YKRPC_POD_NAME/Private/register/YKRPC_POD_NAMERegisterService.swift
55
122
  - podTemplate/swift/LICENSE
56
123
  - podTemplate/swift/README.md
57
124
  - podTemplate/swift/YKRPC_POD_NAME.podspec
@@ -62,7 +129,7 @@ homepage: https://github.com/stephen5652/cocoapods-yk-pod-utility.git
62
129
  licenses:
63
130
  - MIT
64
131
  metadata: {}
65
- post_install_message:
132
+ post_install_message:
66
133
  rdoc_options: []
67
134
  require_paths:
68
135
  - lib
@@ -77,8 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
144
  - !ruby/object:Gem::Version
78
145
  version: '0'
79
146
  requirements: []
80
- rubygems_version: 3.2.3
81
- signing_key:
147
+ rubygems_version: 3.1.6
148
+ signing_key:
82
149
  specification_version: 4
83
150
  summary: 一款cocoapods插件,用于创建定制化标准组件.
84
151
  test_files: []