pindo 5.14.7 → 5.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pindo/base/aeshelper.rb +53 -22
- data/lib/pindo/base/git_handler.rb +295 -32
- data/lib/pindo/client/giteeclient.rb +15 -6
- data/lib/pindo/command/android/autobuild.rb +7 -5
- data/lib/pindo/command/appstore/autobuild.rb +5 -2
- data/lib/pindo/command/appstore/cert.rb +6 -0
- data/lib/pindo/command/appstore/iap.rb +2 -3
- data/lib/pindo/command/ios/autobuild.rb +31 -21
- data/lib/pindo/command/ios/cert.rb +1 -1
- data/lib/pindo/command/jps/apptest.rb +1 -1
- data/lib/pindo/command/jps/bind.rb +6 -2
- data/lib/pindo/command/jps/media.rb +6 -2
- data/lib/pindo/command/jps/upload.rb +6 -4
- data/lib/pindo/command/repo/clone.rb +110 -32
- data/lib/pindo/command/repo/subgit.rb +91 -0
- data/lib/pindo/command/repo.rb +1 -0
- data/lib/pindo/command/unity/autobuild.rb +6 -4
- data/lib/pindo/command/unity/packbuild.rb +14 -7
- data/lib/pindo/command/utils/tag.rb +5 -3
- data/lib/pindo/command/web/autobuild.rb +7 -5
- data/lib/pindo/command.rb +1 -1
- data/lib/pindo/config/build_info_manager.rb +37 -14
- data/lib/pindo/module/appstore/bundleid_helper.rb +7 -3
- data/lib/pindo/module/build/git_repo_helper.rb +14 -35
- data/lib/pindo/module/cert/cert_helper.rb +33 -9
- data/lib/pindo/module/cert/xcode_cert_helper.rb +17 -7
- data/lib/pindo/module/pgyer/pgyerhelper.rb +110 -22
- data/lib/pindo/module/task/model/build/android_build_dev_task.rb +3 -2
- data/lib/pindo/module/task/model/build/ios_build_dev_task.rb +3 -2
- data/lib/pindo/module/task/model/git/git_commit_task.rb +107 -48
- data/lib/pindo/module/task/model/git/git_tag_task.rb +21 -20
- data/lib/pindo/module/task/model/git_task.rb +49 -0
- data/lib/pindo/module/task/model/jps/jps_bind_package_task.rb +8 -5
- data/lib/pindo/module/task/model/jps/jps_upload_media_task.rb +21 -13
- data/lib/pindo/module/task/model/jps/jps_workflow_message_task.rb +8 -4
- data/lib/pindo/module/task/model/resign/ipa_local_resign_task.rb +5 -0
- data/lib/pindo/options/core/option_item.rb +4 -5
- data/lib/pindo/options/groups/git_options.rb +40 -0
- data/lib/pindo/options/helpers/git_constants.rb +28 -0
- data/lib/pindo/version.rb +1 -1
- metadata +11 -15
|
@@ -411,12 +411,11 @@ module Pindo
|
|
|
411
411
|
puts "key_id : #{key_id}"
|
|
412
412
|
puts "private_key : #{private_key}"
|
|
413
413
|
|
|
414
|
-
|
|
414
|
+
@app_store_connect = AppStoreDevApi::Client.new(
|
|
415
415
|
issuer_id: issuer_id,
|
|
416
416
|
key_id: key_id,
|
|
417
417
|
private_key: private_key
|
|
418
|
-
|
|
419
|
-
@app_store_connect = AppStoreDevApi::Client.new
|
|
418
|
+
)
|
|
420
419
|
end
|
|
421
420
|
end
|
|
422
421
|
|
|
@@ -144,9 +144,10 @@ module Pindo
|
|
|
144
144
|
|
|
145
145
|
# Git 参数
|
|
146
146
|
@args_release_branch = @options[:release_branch] || 'master'
|
|
147
|
-
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc]
|
|
148
|
-
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type]
|
|
147
|
+
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
|
|
148
|
+
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
|
|
149
149
|
@args_tag_pre = @options[:tag_pre] || 'v'
|
|
150
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
150
151
|
|
|
151
152
|
super
|
|
152
153
|
@additional_args = argv.remainder!
|
|
@@ -222,7 +223,8 @@ module Pindo
|
|
|
222
223
|
# 提前询问用户如何处理未提交的文件
|
|
223
224
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
224
225
|
project_dir: config[:project_path],
|
|
225
|
-
interactive:
|
|
226
|
+
interactive: @args_git_commit.nil?,
|
|
227
|
+
default_process_type: @args_git_commit
|
|
226
228
|
)
|
|
227
229
|
git_commit_task = Pindo::TaskSystem::GitCommitTask.new(
|
|
228
230
|
config[:project_path],
|
|
@@ -348,24 +350,32 @@ module Pindo
|
|
|
348
350
|
|
|
349
351
|
# 6. 创建媒体附件上传任务(如果需要,只依赖 Git 提交任务)
|
|
350
352
|
if @args_media_flag
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
353
|
+
begin
|
|
354
|
+
# 获取 Git 管理类型的工作流(不同于 IPA 上传的工作流)
|
|
355
|
+
git_app_info_obj, git_workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
356
|
+
working_directory: config[:project_path],
|
|
357
|
+
proj_name: @args_proj_name,
|
|
358
|
+
package_type: nil, # package_type 在 manage_type=git 时会被忽略
|
|
359
|
+
manage_type: "git"
|
|
360
|
+
)
|
|
358
361
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
362
|
+
media_upload_task = Pindo::TaskSystem::JPSUploadMediaTask.new(
|
|
363
|
+
[], # 空数组,自动从 JPSMedia/ 目录查找
|
|
364
|
+
config[:project_path], # upload_path
|
|
365
|
+
app_info_obj: git_app_info_obj,
|
|
366
|
+
workflow_info: git_workflow_info,
|
|
367
|
+
project_name: @args_proj_name
|
|
368
|
+
)
|
|
369
|
+
# 依赖 Git 提交任务
|
|
370
|
+
media_upload_task.dependencies << git_commit_task.id
|
|
371
|
+
tasks << media_upload_task
|
|
372
|
+
rescue => e
|
|
373
|
+
puts ""
|
|
374
|
+
puts " ⚠️ 跳过媒体上传任务: #{e.message}"
|
|
375
|
+
puts " 💡 提示: 请在 JPS 后台配置 Git 类型的工作流(manage_type: git)"
|
|
376
|
+
puts ""
|
|
377
|
+
# 不抛出异常,继续执行后续任务
|
|
378
|
+
end
|
|
369
379
|
end
|
|
370
380
|
|
|
371
381
|
# 7. 创建 Git Commit 绑定任务(如果需要,依赖上传任务)
|
|
@@ -390,7 +400,7 @@ module Pindo
|
|
|
390
400
|
git_app_info_obj, git_workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
391
401
|
working_directory: config[:project_path],
|
|
392
402
|
proj_name: @args_proj_name,
|
|
393
|
-
package_type:
|
|
403
|
+
package_type: nil,
|
|
394
404
|
manage_type: "git"
|
|
395
405
|
)
|
|
396
406
|
|
|
@@ -57,6 +57,9 @@ module Pindo
|
|
|
57
57
|
# Task 参数
|
|
58
58
|
@args_select_flag = @options[:select] || false
|
|
59
59
|
|
|
60
|
+
# Git 参数
|
|
61
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
62
|
+
|
|
60
63
|
super(argv)
|
|
61
64
|
end
|
|
62
65
|
|
|
@@ -91,7 +94,7 @@ module Pindo
|
|
|
91
94
|
app_info_obj, git_workflow_info = pgyer_helper.prepare_upload(
|
|
92
95
|
working_directory: project_path,
|
|
93
96
|
proj_name: @args_proj_name,
|
|
94
|
-
package_type:
|
|
97
|
+
package_type: nil,
|
|
95
98
|
manage_type: "git"
|
|
96
99
|
)
|
|
97
100
|
|
|
@@ -127,7 +130,8 @@ module Pindo
|
|
|
127
130
|
# Git 提交任务
|
|
128
131
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
129
132
|
project_dir: project_path,
|
|
130
|
-
interactive:
|
|
133
|
+
interactive: @args_git_commit.nil?,
|
|
134
|
+
default_process_type: @args_git_commit
|
|
131
135
|
)
|
|
132
136
|
|
|
133
137
|
git_commit_task = Pindo::TaskSystem::GitCommitTask.new(
|
|
@@ -70,6 +70,9 @@ module Pindo
|
|
|
70
70
|
# Task 参数
|
|
71
71
|
@args_select_flag = @options[:select] || false
|
|
72
72
|
|
|
73
|
+
# Git 参数
|
|
74
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
75
|
+
|
|
73
76
|
super(argv)
|
|
74
77
|
end
|
|
75
78
|
|
|
@@ -102,7 +105,7 @@ module Pindo
|
|
|
102
105
|
app_info_obj, workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
103
106
|
working_directory: project_path,
|
|
104
107
|
proj_name: @args_proj_name,
|
|
105
|
-
package_type:
|
|
108
|
+
package_type: nil, # package_type 在 manage_type=git 时会被忽略
|
|
106
109
|
manage_type: "git"
|
|
107
110
|
)
|
|
108
111
|
|
|
@@ -119,7 +122,8 @@ module Pindo
|
|
|
119
122
|
# 1. 提前询问用户如何处理未提交的文件
|
|
120
123
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
121
124
|
project_dir: project_path,
|
|
122
|
-
interactive:
|
|
125
|
+
interactive: @args_git_commit.nil?,
|
|
126
|
+
default_process_type: @args_git_commit
|
|
123
127
|
)
|
|
124
128
|
|
|
125
129
|
# 2. 创建 Git 提交任务
|
|
@@ -59,7 +59,7 @@ module Pindo
|
|
|
59
59
|
# 定义此命令使用的参数项
|
|
60
60
|
def self.option_items
|
|
61
61
|
@option_items ||= Pindo::Options::OptionGroup.merge(
|
|
62
|
-
Pindo::Options::JPSOptions.
|
|
62
|
+
Pindo::Options::JPSOptions.select(:proj, :send, :desc, :resign),
|
|
63
63
|
Pindo::Options::GitOptions.all
|
|
64
64
|
)
|
|
65
65
|
end
|
|
@@ -103,9 +103,10 @@ module Pindo
|
|
|
103
103
|
|
|
104
104
|
# Git 参数
|
|
105
105
|
@args_release_branch = @options[:release_branch] || 'master'
|
|
106
|
-
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc]
|
|
107
|
-
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type]
|
|
106
|
+
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
|
|
107
|
+
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
|
|
108
108
|
@args_tag_pre = @options[:tag_pre] || 'v'
|
|
109
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
109
110
|
|
|
110
111
|
if !@args_cert_id.nil? && !@args_cert_id.empty?
|
|
111
112
|
@args_resign_flag = true
|
|
@@ -169,7 +170,8 @@ module Pindo
|
|
|
169
170
|
# 1.0 提前询问用户如何处理未提交的文件
|
|
170
171
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
171
172
|
project_dir: project_dir,
|
|
172
|
-
interactive:
|
|
173
|
+
interactive: @args_git_commit.nil?,
|
|
174
|
+
default_process_type: @args_git_commit
|
|
173
175
|
)
|
|
174
176
|
|
|
175
177
|
git_options_with_process = git_options.merge({
|
|
@@ -14,72 +14,150 @@ module Pindo
|
|
|
14
14
|
self.summary = '下载仓库到本地'
|
|
15
15
|
|
|
16
16
|
self.description = <<-DESC
|
|
17
|
-
|
|
17
|
+
下载仓库到本地,支持从配置文件自动获取仓库信息或手动指定仓库 URL 进行下载。
|
|
18
18
|
|
|
19
19
|
支持功能:
|
|
20
|
-
•
|
|
21
|
-
• 自动从当前目录config.json文件读取仓库信息
|
|
22
|
-
•
|
|
20
|
+
• 手动指定仓库 URL 进行下载
|
|
21
|
+
• 自动从当前目录 config.json 文件读取仓库信息
|
|
22
|
+
• 支持指定分支或标签下载
|
|
23
|
+
• 自动初始化子模块
|
|
23
24
|
• 下载到当前工作目录
|
|
24
25
|
|
|
25
26
|
使用示例:
|
|
26
|
-
pindo repo clone
|
|
27
|
-
pindo repo clone
|
|
27
|
+
pindo repo clone https://gitee.com/xxx/repo.git # 下载 master 分支
|
|
28
|
+
pindo repo clone https://gitee.com/xxx/repo.git --branch=dev # 指定分支
|
|
29
|
+
pindo repo clone https://gitee.com/xxx/repo.git --tag=1.0.0 # 指定标签
|
|
30
|
+
pindo repo clone # 从 config.json 自动获取
|
|
28
31
|
DESC
|
|
29
32
|
|
|
30
33
|
self.arguments = [
|
|
31
|
-
CLAide::Argument.new('
|
|
34
|
+
CLAide::Argument.new('仓库URL', false),
|
|
32
35
|
]
|
|
33
36
|
|
|
34
37
|
def self.options
|
|
35
38
|
[
|
|
36
|
-
|
|
39
|
+
['--branch=NAME', '指定分支名称(默认:master)'],
|
|
40
|
+
['--tag=NAME', '指定标签名称(与 --branch 互斥)'],
|
|
37
41
|
].concat(super)
|
|
38
42
|
end
|
|
39
43
|
|
|
40
44
|
|
|
41
45
|
def initialize(argv)
|
|
42
|
-
|
|
43
|
-
@
|
|
46
|
+
@args_repo_url = argv.shift_argument
|
|
47
|
+
@args_branch = argv.option('branch')
|
|
48
|
+
@args_tag = argv.option('tag')
|
|
44
49
|
super(argv)
|
|
45
50
|
@additional_args = argv.remainder!
|
|
46
|
-
|
|
47
51
|
end
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
51
53
|
def validate!
|
|
52
54
|
super
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if @
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
|
|
56
|
+
# 验证 --branch 和 --tag 互斥
|
|
57
|
+
if @args_branch && @args_tag
|
|
58
|
+
raise Informative, "--branch 和 --tag 参数不能同时使用!\n" \
|
|
59
|
+
"请选择其中一个参数。"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# 设置默认值
|
|
63
|
+
# 注意:即使使用 --tag,也需要一个默认分支用于 getcode_to_dir 的逻辑
|
|
64
|
+
@args_branch = 'master' if @args_branch.nil?
|
|
65
|
+
|
|
66
|
+
# 1. 优先使用命令行参数
|
|
67
|
+
if @args_repo_url
|
|
68
|
+
@code_git_url = @args_repo_url
|
|
69
|
+
@repo_name = extract_repo_name(@code_git_url)
|
|
70
|
+
# 2. 否则从 config.json 读取
|
|
71
|
+
else
|
|
72
|
+
temp_config_file = "./config.json"
|
|
73
|
+
if File.exist?(temp_config_file)
|
|
74
|
+
temp_config_file_fullname = File.expand_path(temp_config_file)
|
|
75
|
+
temp_config_json = JSON.parse(File.read(temp_config_file_fullname))
|
|
76
|
+
if temp_config_json['project_info'] &&
|
|
77
|
+
temp_config_json['project_info']['launch_project'] &&
|
|
78
|
+
temp_config_json['project_info']['launch_project']['project_git_url']
|
|
60
79
|
@code_git_url = temp_config_json['project_info']['launch_project']['project_git_url']
|
|
61
|
-
|
|
62
|
-
index = temp_url.rindex('/')
|
|
63
|
-
temp_url = temp_url.slice(index + 1, temp_url.length)
|
|
64
|
-
@repo_name = temp_url.gsub!(/\.git/, "")
|
|
80
|
+
@repo_name = extract_repo_name(@code_git_url)
|
|
65
81
|
end
|
|
66
82
|
end
|
|
67
83
|
end
|
|
84
|
+
|
|
85
|
+
# 验证是否获取到仓库 URL
|
|
86
|
+
if @code_git_url.nil? || @repo_name.nil?
|
|
87
|
+
raise Informative, "请提供仓库 URL 或在当前目录创建 config.json 文件!\n" \
|
|
88
|
+
"使用示例:pindo repo clone https://gitee.com/xxx/repo.git"
|
|
89
|
+
end
|
|
68
90
|
end
|
|
69
91
|
|
|
92
|
+
# 从 Git URL 提取仓库名称
|
|
93
|
+
def extract_repo_name(git_url)
|
|
94
|
+
return nil if git_url.nil? || git_url.empty?
|
|
70
95
|
|
|
71
|
-
|
|
96
|
+
# 提取最后一个 / 后面的部分
|
|
97
|
+
temp_url = git_url.dup
|
|
98
|
+
index = temp_url.rindex('/')
|
|
99
|
+
return nil unless index
|
|
72
100
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
puts "Repo Url: #{@code_git_url}"
|
|
78
|
-
puts "New Branch: #{new_branch}"
|
|
101
|
+
repo_name = temp_url.slice(index + 1, temp_url.length)
|
|
102
|
+
# 移除 .git 后缀
|
|
103
|
+
repo_name.gsub(/\.git$/, '')
|
|
104
|
+
end
|
|
79
105
|
|
|
80
|
-
Pindo::GitHandler.getcode_to_dir(reponame:@repo_name, remote_url:@code_git_url, path:Dir.pwd, new_branch:new_branch, new_tag:nil)
|
|
81
106
|
|
|
107
|
+
def run
|
|
108
|
+
puts "\n"
|
|
109
|
+
puts "=" * 60
|
|
110
|
+
puts "克隆仓库".center(60)
|
|
111
|
+
puts "=" * 60
|
|
112
|
+
puts "仓库名称: #{@repo_name}"
|
|
113
|
+
puts "仓库 URL: #{@code_git_url}"
|
|
114
|
+
if @args_tag
|
|
115
|
+
puts "目标标签: #{@args_tag}"
|
|
116
|
+
else
|
|
117
|
+
puts "目标分支: #{@args_branch}"
|
|
118
|
+
end
|
|
119
|
+
puts "目标目录: #{Dir.pwd}/#{@repo_name}"
|
|
120
|
+
puts "=" * 60
|
|
121
|
+
puts "\n"
|
|
122
|
+
|
|
123
|
+
# 1. 克隆仓库
|
|
124
|
+
Pindo::GitHandler.getcode_to_dir(
|
|
125
|
+
reponame: @repo_name,
|
|
126
|
+
remote_url: @code_git_url,
|
|
127
|
+
path: Dir.pwd,
|
|
128
|
+
new_branch: @args_branch,
|
|
129
|
+
new_tag: @args_tag
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
# 2. 检查是否有子模块
|
|
133
|
+
repo_path = File.join(Dir.pwd, @repo_name)
|
|
134
|
+
gitmodules_path = File.join(repo_path, '.gitmodules')
|
|
135
|
+
|
|
136
|
+
if File.exist?(gitmodules_path)
|
|
137
|
+
puts "\n"
|
|
138
|
+
Funlog.instance.fancyinfo_start("检测到子模块配置,正在初始化...")
|
|
139
|
+
|
|
140
|
+
begin
|
|
141
|
+
# 调用 update_submodules 方法初始化子模块
|
|
142
|
+
Pindo::GitHandler.update_submodules(
|
|
143
|
+
local_repo_dir: repo_path,
|
|
144
|
+
force: false
|
|
145
|
+
)
|
|
146
|
+
Funlog.instance.fancyinfo_success("子模块初始化完成!")
|
|
147
|
+
rescue => e
|
|
148
|
+
Funlog.instance.fancyinfo_warning("子模块初始化失败: #{e.message}")
|
|
149
|
+
puts "你可以手动执行以下命令初始化子模块:".yellow
|
|
150
|
+
puts " cd #{@repo_name}".yellow
|
|
151
|
+
puts " pindo repo subgit".yellow
|
|
152
|
+
end
|
|
153
|
+
else
|
|
154
|
+
puts "\n"
|
|
155
|
+
Funlog.instance.fancyinfo_success("仓库克隆完成!(无子模块)")
|
|
82
156
|
end
|
|
157
|
+
|
|
158
|
+
puts "\n"
|
|
159
|
+
puts "✅ 完成!仓库已克隆到: #{repo_path}".green
|
|
160
|
+
puts "\n"
|
|
83
161
|
end
|
|
84
162
|
|
|
85
163
|
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
require 'highline/import'
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
require 'json'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
module Pindo
|
|
9
|
+
class Command
|
|
10
|
+
class Repo < Command
|
|
11
|
+
|
|
12
|
+
class Subgit < Repo
|
|
13
|
+
|
|
14
|
+
self.summary = '初始化和更新所有 Git 子模块'
|
|
15
|
+
|
|
16
|
+
self.description = <<-DESC
|
|
17
|
+
初始化并递归更新当前仓库的所有 Git 子模块。
|
|
18
|
+
|
|
19
|
+
支持功能:
|
|
20
|
+
• 自动读取 .gitmodules 配置文件
|
|
21
|
+
• 递归初始化和更新所有层级的子模块
|
|
22
|
+
• 支持强制重新初始化(清除现有子模块状态)
|
|
23
|
+
• 显示详细的子模块状态信息
|
|
24
|
+
|
|
25
|
+
使用示例:
|
|
26
|
+
pindo repo subgit # 基本用法
|
|
27
|
+
pindo repo subgit --force # 强制重新初始化子模块
|
|
28
|
+
DESC
|
|
29
|
+
|
|
30
|
+
self.arguments = [
|
|
31
|
+
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
def self.options
|
|
35
|
+
[
|
|
36
|
+
['--force', '强制重新初始化子模块(覆盖本地修改)'],
|
|
37
|
+
].concat(super)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def initialize(argv)
|
|
43
|
+
|
|
44
|
+
@force = argv.flag?('force', false)
|
|
45
|
+
|
|
46
|
+
super(argv)
|
|
47
|
+
@additional_args = argv.remainder!
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def validate!
|
|
51
|
+
super
|
|
52
|
+
|
|
53
|
+
# 验证当前目录是否是 Git 仓库
|
|
54
|
+
unless Pindo::GitHandler.is_git_directory?(local_repo_dir: Dir.pwd)
|
|
55
|
+
raise Informative, "当前目录不是有效的 Git 仓库!请在 Git 仓库根目录下执行此命令。"
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def run
|
|
60
|
+
|
|
61
|
+
puts "\n"
|
|
62
|
+
puts "=" * 60
|
|
63
|
+
puts "Git 子模块更新".center(60)
|
|
64
|
+
puts "=" * 60
|
|
65
|
+
puts "当前目录: #{Dir.pwd}"
|
|
66
|
+
puts "强制模式: #{@force ? '是' : '否'}"
|
|
67
|
+
puts "=" * 60
|
|
68
|
+
puts "\n"
|
|
69
|
+
|
|
70
|
+
# 调用 GitHandler 的子模块更新方法
|
|
71
|
+
result = Pindo::GitHandler.update_submodules(
|
|
72
|
+
local_repo_dir: Dir.pwd,
|
|
73
|
+
force: @force
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
if result
|
|
77
|
+
puts "\n"
|
|
78
|
+
puts "✅ 子模块更新成功完成!".green
|
|
79
|
+
puts "\n"
|
|
80
|
+
else
|
|
81
|
+
puts "\n"
|
|
82
|
+
puts "⚠️ 当前仓库没有配置子模块".yellow
|
|
83
|
+
puts "\n"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
data/lib/pindo/command/repo.rb
CHANGED
|
@@ -150,9 +150,10 @@ module Pindo
|
|
|
150
150
|
|
|
151
151
|
# Git 参数
|
|
152
152
|
@args_release_branch = @options[:release_branch] || 'master'
|
|
153
|
-
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc]
|
|
154
|
-
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type]
|
|
153
|
+
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
|
|
154
|
+
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
|
|
155
155
|
@args_tag_pre = @options[:tag_pre] || 'v'
|
|
156
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
156
157
|
|
|
157
158
|
super
|
|
158
159
|
end
|
|
@@ -242,7 +243,8 @@ module Pindo
|
|
|
242
243
|
# 提前询问用户如何处理未提交的文件
|
|
243
244
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
244
245
|
project_dir: Dir.pwd,
|
|
245
|
-
interactive:
|
|
246
|
+
interactive: @args_git_commit.nil?,
|
|
247
|
+
default_process_type: @args_git_commit
|
|
246
248
|
)
|
|
247
249
|
|
|
248
250
|
git_commit_task = Pindo::TaskSystem::GitCommitTask.new(
|
|
@@ -359,7 +361,7 @@ module Pindo
|
|
|
359
361
|
git_app_info_obj, git_workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
360
362
|
working_directory: Dir.pwd,
|
|
361
363
|
proj_name: all_platform_configs["project_name"],
|
|
362
|
-
package_type:
|
|
364
|
+
package_type: nil, # package_type 在 manage_type=git 时会被忽略
|
|
363
365
|
manage_type: "git"
|
|
364
366
|
)
|
|
365
367
|
end
|
|
@@ -8,6 +8,7 @@ require 'pindo/module/task/model/git/git_commit_task'
|
|
|
8
8
|
require 'pindo/module/task/model/git/git_tag_task'
|
|
9
9
|
require 'pindo/module/task/model/nuget/nuget_build_task'
|
|
10
10
|
require 'pindo/options/options'
|
|
11
|
+
require 'pindo/options/helpers/git_constants'
|
|
11
12
|
|
|
12
13
|
module Pindo
|
|
13
14
|
class Command
|
|
@@ -57,8 +58,8 @@ module Pindo
|
|
|
57
58
|
|
|
58
59
|
# Git 参数
|
|
59
60
|
@args_release_branch = @options[:release_branch] || 'master'
|
|
60
|
-
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc]
|
|
61
|
-
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type]
|
|
61
|
+
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
|
|
62
|
+
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
|
|
62
63
|
@args_tag_pre = @options[:tag_pre] || 'v'
|
|
63
64
|
|
|
64
65
|
super
|
|
@@ -67,13 +68,19 @@ module Pindo
|
|
|
67
68
|
def run
|
|
68
69
|
package_dir = Dir.pwd
|
|
69
70
|
# 1. Git 提交任务 (确保工作区干净,或提交预构建更改)
|
|
70
|
-
#
|
|
71
|
+
# 默认自动提交(packbuild 场景需要确保代码已提交)
|
|
72
|
+
git_commit_opt = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit]) || Pindo::UncommittedFilesProcessType::COMMIT
|
|
73
|
+
|
|
71
74
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
project_dir: package_dir,
|
|
76
|
+
interactive: false,
|
|
77
|
+
default_process_type: git_commit_opt
|
|
75
78
|
)
|
|
76
|
-
|
|
79
|
+
|
|
80
|
+
# packbuild 场景强制提交:如果返回 NONE(无未提交文件),改为 COMMIT 以确保执行提交流程
|
|
81
|
+
if process_type == Pindo::UncommittedFilesProcessType::NONE
|
|
82
|
+
process_type = Pindo::UncommittedFilesProcessType::COMMIT
|
|
83
|
+
end
|
|
77
84
|
|
|
78
85
|
Funlog.instance.fancyinfo_start("Unity Package 打包流程")
|
|
79
86
|
|
|
@@ -57,9 +57,10 @@ module Pindo
|
|
|
57
57
|
|
|
58
58
|
# Git 参数
|
|
59
59
|
@args_release_branch = @options[:release_branch] || 'master'
|
|
60
|
-
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc]
|
|
61
|
-
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type]
|
|
60
|
+
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
|
|
61
|
+
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
|
|
62
62
|
@args_tag_pre = @options[:tag_pre] || 'v'
|
|
63
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
63
64
|
|
|
64
65
|
super
|
|
65
66
|
@additional_args = argv.remainder!
|
|
@@ -79,7 +80,8 @@ module Pindo
|
|
|
79
80
|
# 0. 提前询问用户如何处理未提交的文件
|
|
80
81
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
81
82
|
project_dir: pindo_project_dir,
|
|
82
|
-
interactive:
|
|
83
|
+
interactive: @args_git_commit.nil?,
|
|
84
|
+
default_process_type: @args_git_commit
|
|
83
85
|
)
|
|
84
86
|
|
|
85
87
|
# 1. Git 提交任务
|
|
@@ -137,9 +137,10 @@ module Pindo
|
|
|
137
137
|
|
|
138
138
|
# Git 参数
|
|
139
139
|
@args_release_branch = @options[:release_branch] || 'master'
|
|
140
|
-
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc]
|
|
141
|
-
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type]
|
|
140
|
+
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
|
|
141
|
+
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
|
|
142
142
|
@args_tag_pre = @options[:tag_pre] || 'v'
|
|
143
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
143
144
|
|
|
144
145
|
super
|
|
145
146
|
@additional_args = argv.remainder!
|
|
@@ -254,7 +255,8 @@ module Pindo
|
|
|
254
255
|
# 提前询问用户如何处理未提交的文件
|
|
255
256
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
256
257
|
project_dir: config[:project_path],
|
|
257
|
-
interactive:
|
|
258
|
+
interactive: @args_git_commit.nil?,
|
|
259
|
+
default_process_type: @args_git_commit
|
|
258
260
|
)
|
|
259
261
|
|
|
260
262
|
git_commit_task = Pindo::TaskSystem::GitCommitTask.new(
|
|
@@ -363,7 +365,7 @@ module Pindo
|
|
|
363
365
|
git_app_info_obj, git_workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
364
366
|
working_directory: config[:project_path],
|
|
365
367
|
proj_name: @args_proj_name,
|
|
366
|
-
package_type:
|
|
368
|
+
package_type: nil, # package_type 在 manage_type=git 时会被忽略
|
|
367
369
|
manage_type: "git"
|
|
368
370
|
)
|
|
369
371
|
|
|
@@ -401,7 +403,7 @@ module Pindo
|
|
|
401
403
|
git_app_info_obj, git_workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
402
404
|
working_directory: config[:project_path],
|
|
403
405
|
proj_name: @args_proj_name,
|
|
404
|
-
package_type:
|
|
406
|
+
package_type: nil,
|
|
405
407
|
manage_type: "git"
|
|
406
408
|
)
|
|
407
409
|
|
data/lib/pindo/command.rb
CHANGED
|
@@ -46,7 +46,7 @@ module Pindo
|
|
|
46
46
|
require 'pindo/command/utils'
|
|
47
47
|
require 'pindo/command/jps'
|
|
48
48
|
require 'pindo/command/setup'
|
|
49
|
-
|
|
49
|
+
require 'pindo/command/repo'
|
|
50
50
|
require 'pindo/command/appstore'
|
|
51
51
|
require 'pindo/command/gplay'
|
|
52
52
|
require 'pindo/command/unity'
|