pindo 5.14.2 → 5.14.4

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pindo/base/aeshelper.rb +1 -0
  3. data/lib/pindo/base/executable.rb +2 -0
  4. data/lib/pindo/base/git_handler.rb +45 -7
  5. data/lib/pindo/base/informative.rb +11 -0
  6. data/lib/pindo/base/plistbuddyexecutable.rb +2 -0
  7. data/lib/pindo/client/feishuclient.rb +1 -1
  8. data/lib/pindo/command/android/autobuild.rb +3 -7
  9. data/lib/pindo/command/appstore/autobuild.rb +8 -18
  10. data/lib/pindo/command/gplay/pullconfig.rb +3 -2
  11. data/lib/pindo/command/ios/autobuild.rb +3 -7
  12. data/lib/pindo/command/repo/clone.rb +1 -1
  13. data/lib/pindo/command/unity/autobuild.rb +5 -14
  14. data/lib/pindo/command/unity/packbuild.rb +3 -8
  15. data/lib/pindo/command/utils/tag.rb +2 -7
  16. data/lib/pindo/command/utils/updateconfig.rb +3 -2
  17. data/lib/pindo/command/web/autobuild.rb +23 -33
  18. data/lib/pindo/command.rb +1 -8
  19. data/lib/pindo/config/ios_config_parser.rb +26 -25
  20. data/lib/pindo/module/android/android_build_helper.rb +1 -1
  21. data/lib/pindo/module/android/android_config_helper.rb +1 -1
  22. data/lib/pindo/module/android/android_res_helper.rb +1 -1
  23. data/lib/pindo/module/cert/xcode_cert_helper.rb +1 -1
  24. data/lib/pindo/module/task/model/build/android_build_dev_task.rb +29 -15
  25. data/lib/pindo/module/task/model/build/ios_build_adhoc_task.rb +2 -3
  26. data/lib/pindo/module/task/model/build/ios_build_dev_task.rb +30 -16
  27. data/lib/pindo/module/task/model/git/git_commit_task.rb +50 -13
  28. data/lib/pindo/module/task/model/git/git_tag_task.rb +16 -7
  29. data/lib/pindo/module/task/model/jps/jps_message_task.rb +3 -2
  30. data/lib/pindo/module/task/model/jps/jps_upload_media_task.rb +148 -28
  31. data/lib/pindo/module/task/model/unity/unity_config_task.rb +4 -0
  32. data/lib/pindo/module/task/pindo_task.rb +1 -0
  33. data/lib/pindo/module/xcode/xcode_app_config.rb +26 -16
  34. data/lib/pindo/module/xcode/xcode_build_config.rb +2 -2
  35. data/lib/pindo/module/xcode/xcode_swark_helper.rb +5 -5
  36. data/lib/pindo/version.rb +1 -1
  37. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73a15faac4b09101141fbe0171f2e02a65da002bd1762c35bf63e94fa097ba95
4
- data.tar.gz: d4c540cda86db3508754c8077911ca590f79b467323849b6f82de64188ec98d7
3
+ metadata.gz: cb15b2496f39d434ab25b2609b651779fc38187e56990a40f66aeee02411da83
4
+ data.tar.gz: c0abb252891099cf6c45bda365737415d662b1d165bb027064779db171c0fbe0
5
5
  SHA512:
6
- metadata.gz: b254d7dc053a1d2714f1bf4c42fc85f21e49cca9e49215444b337543449442e5a92a8232ccb89283738366397bb487d28307dadca23c3e91a515b75ca7e53b3f
7
- data.tar.gz: fd2c8fb44d319093d8fe7eed45f64842d6a2bfe037d7d657e28a65b9e1f3b3dca607d4b6f596c52febfd342fd830066cadea157d61a791011d2173ef4166148e
6
+ metadata.gz: 3271d2f0516402ea4ee3f8716fe6d1fd4c1d0c1bc46e39ac65ed9c2fb00cb9f707dc44485acafb3e26a28b03b9069681f8a8d31c891534d144de614b53befb42
7
+ data.tar.gz: 170f1753ee18dd359dea8a8f918625f82a4cdbaf34ce0f4dcfc342492b5b3086296589ef650f942ca000772a033d796f7f7e949b20cc52c45deda55ae56cafe6
@@ -1,6 +1,7 @@
1
1
 
2
2
  require 'openssl'
3
3
  require 'match'
4
+ require 'pindo/base/informative'
4
5
 
5
6
  module Pindo
6
7
 
@@ -1,3 +1,5 @@
1
+ require 'pindo/base/informative'
2
+
1
3
  module Pindo
2
4
  # Module which provides support for running executables.
3
5
  #
@@ -1,5 +1,6 @@
1
1
  require 'fileutils'
2
2
  require 'pindo/base/executable'
3
+ require 'pindo/base/informative'
3
4
  require 'etc'
4
5
  require 'claide'
5
6
  require 'highline/import'
@@ -460,11 +461,21 @@ module Pindo
460
461
  raise ArgumentError, "项目目录不能为空" if project_dir.nil?
461
462
 
462
463
  begin
464
+ # 1. 检查是否是 Git 仓库,并获取 Git 根目录
465
+ git_root = git_root_directory(local_repo_dir: project_dir)
466
+
467
+ # 2. 如果不是 Git 仓库,返回 nil
468
+ unless git_root
469
+ Funlog.instance.fancyinfo_warning("当前目录不是Git仓库,跳过Git操作")
470
+ return nil
471
+ end
472
+
473
+ # 3. 使用 Git 根目录执行 Git 命令
463
474
  # 重置暂存区
464
- git!(%W(-C #{project_dir} restore --staged #{project_dir}))
475
+ git!(%W(-C #{git_root} restore --staged #{git_root}))
465
476
 
466
477
  # 获取未跟踪和已修改的文件
467
- files_list = git!(%W(-C #{project_dir} ls-files --other --modified --exclude-standard)) || []
478
+ files_list = git!(%W(-C #{git_root} ls-files --other --modified --exclude-standard)) || []
468
479
 
469
480
  # 返回文件列表(如果为空则返回 nil)
470
481
  if files_list.nil? || files_list.empty?
@@ -488,7 +499,14 @@ module Pindo
488
499
  raise ArgumentError, "项目目录不能为空" if project_dir.nil?
489
500
  raise ArgumentError, "处理方式不能为空" if process_type.nil?
490
501
 
491
- current_project_dir = project_dir
502
+ # 获取 Git 根目录
503
+ git_root = git_root_directory(local_repo_dir: project_dir)
504
+ unless git_root
505
+ Funlog.instance.fancyinfo_warning("当前目录不是Git仓库,跳过处理未提交文件")
506
+ return
507
+ end
508
+
509
+ current_project_dir = git_root
492
510
  origin_path = Dir.pwd
493
511
 
494
512
  begin
@@ -555,9 +573,23 @@ module Pindo
555
573
 
556
574
  Funlog.instance.fancyinfo_start("开始提交文件...")
557
575
  git! ['add', '-A']
558
- git! ['commit', '-m', message]
576
+
577
+ # 检查是否有文件需要提交
578
+ begin
579
+ git! ['commit', '-m', message]
580
+ Funlog.instance.fancyinfo_success("commit文件完成!")
581
+ rescue => e
582
+ # 如果是 "nothing to commit" 错误,说明没有变更,这是正常情况
583
+ if e.message.include?("nothing to commit") || e.message.include?("working tree clean")
584
+ Funlog.instance.fancyinfo_warning("没有需要提交的变更")
585
+ return # 直接返回,不需要 push
586
+ else
587
+ # 其他错误则继续抛出
588
+ raise e
589
+ end
590
+ end
591
+
559
592
  git!(%W(-C #{project_dir} fetch origin))
560
- Funlog.instance.fancyinfo_success("commit文件完成!")
561
593
  Funlog.instance.fancyinfo_start("正在push...")
562
594
  if remote_branch_exists?(local_repo_dir: project_dir, branch: branch)
563
595
  git!(%W(-C #{project_dir} branch --set-upstream-to=origin/#{branch} #{branch}))
@@ -802,8 +834,14 @@ module Pindo
802
834
  return 'skip'
803
835
  end
804
836
 
805
- # 4. 获取当前分支名并显示状态
806
- current_branch = git!(%W(-C #{project_dir} rev-parse --abbrev-ref HEAD)).strip
837
+ # 4. 获取 Git 根目录并获取当前分支名
838
+ git_root = git_root_directory(local_repo_dir: project_dir)
839
+ unless git_root
840
+ Funlog.instance.fancyinfo_warning("当前目录不是Git仓库")
841
+ return 'skip'
842
+ end
843
+
844
+ current_branch = git!(%W(-C #{git_root} rev-parse --abbrev-ref HEAD)).strip
807
845
  display_file_status(current_branch, uncommitted_files)
808
846
 
809
847
  # 5. 交互式选择
@@ -0,0 +1,11 @@
1
+ require 'pindo/base/plaininformative'
2
+
3
+ module Pindo
4
+ # Pindo 的标准异常类,带有红色错误消息格式
5
+ # 用于所有需要向用户显示错误信息的场景
6
+ class Informative < PlainInformative
7
+ def message
8
+ "[!] #{super}".red
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,5 @@
1
+ require 'pindo/base/informative'
2
+
1
3
  module Pindo
2
4
 
3
5
  module Plistbuddyexecutable
@@ -85,7 +85,7 @@ module Pindo
85
85
  result
86
86
  rescue => e
87
87
  puts "请求发送失败: #{e.message}"
88
- puts e.backtrace
88
+ puts e.backtrace.join("\n") if ENV['PINDO_DEBUG']
89
89
  raise
90
90
  end
91
91
 
@@ -276,14 +276,10 @@ module Pindo
276
276
  tasks << build_task
277
277
 
278
278
  # 4. Git 标签任务(依赖第一个编译任务)
279
- git_tag_task = Pindo::TaskSystem::GitTagTask.new(
280
- config[:project_path],
281
- release_branch: @args_release_branch,
282
- ver_inc: @args_ver_inc,
283
- tag_type: @args_tag_type,
284
- tag_pre: @args_tag_pre
285
- )
279
+ # 所有参数都从 GitCommitTask 获取
280
+ git_tag_task = Pindo::TaskSystem::GitTagTask.new(config[:project_path])
286
281
  git_tag_task.dependencies << build_task.id
282
+ git_tag_task.dependencies << git_commit_task.id
287
283
  tasks << git_tag_task
288
284
 
289
285
  # 5. 上传和消息发送任务(如果需要)
@@ -280,33 +280,23 @@ module Pindo
280
280
  build_task.dependencies << last_task.id
281
281
  tasks << build_task
282
282
 
283
- # 3. Git 标签任务 - 项目仓库(使用 IosConfigParser 的版本号)
284
- fixed_version = Pindo::IosConfigParser.instance.app_version
285
- git_tag_task = Pindo::TaskSystem::GitTagTask.new(
286
- project_path,
287
- release_branch: @args_release_branch,
288
- tag_type: @args_tag_type,
289
- tag_pre: @args_tag_pre,
290
- fixed_version: fixed_version
291
- )
283
+ # 3. Git 标签任务 - 项目仓库
284
+ # 所有参数(版本号、tag_pre、release_branch 等)都从 GitCommitTask 获取
285
+ git_tag_task = Pindo::TaskSystem::GitTagTask.new(project_path)
292
286
  git_tag_task.dependencies << build_task.id
287
+ git_tag_task.dependencies << git_commit_task.id
293
288
  tasks << git_tag_task
294
289
 
295
- # 4. Git 标签任务 - 配置仓库(使用 IosConfigParser 的版本号)
290
+ # 4. Git 标签任务 - 配置仓库
291
+ # 所有参数都从 GitCommitTask 获取
296
292
  app_repo_name = Pindo::IosConfigParser.instance.app_repo_name
297
293
  if app_repo_name && !app_repo_name.empty?
298
294
  pindo_dir = File.expand_path(Pindoconfig.instance.pindo_dir)
299
295
  config_repo_path = File.join(pindo_dir, app_repo_name)
300
296
 
301
297
  if File.exist?(config_repo_path)
302
- config_git_tag_task = Pindo::TaskSystem::GitTagTask.new(
303
- config_repo_path,
304
- release_branch: @args_release_branch,
305
- tag_type: @args_tag_type,
306
- tag_pre: @args_tag_pre,
307
- fixed_version: fixed_version
308
- )
309
- config_git_tag_task.dependencies << git_tag_task.id
298
+ config_git_tag_task = Pindo::TaskSystem::GitTagTask.new(config_repo_path)
299
+ config_git_tag_task.dependencies << git_commit_task.id
310
300
  tasks << config_git_tag_task
311
301
  end
312
302
  end
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'pindo/base/git_handler'
2
3
 
3
4
  module Pindo
4
5
  class Command
@@ -35,8 +36,8 @@ module Pindo
35
36
  end
36
37
 
37
38
  def run
38
- # 克隆配置仓库(使用继承的方法)
39
- app_config_dir = clong_buildconfig_repo(repo_name: @bundle_name)
39
+ # 克隆配置仓库
40
+ app_config_dir = Pindo::GitHandler.clong_buildconfig_repo(repo_name: @bundle_name)
40
41
 
41
42
  # 返回配置仓库路径
42
43
  app_config_dir
@@ -295,14 +295,10 @@ module Pindo
295
295
  tasks << build_task
296
296
 
297
297
  # 4. Git 标签任务(依赖第一个编译任务)
298
- git_tag_task = Pindo::TaskSystem::GitTagTask.new(
299
- config[:project_path],
300
- release_branch: @args_release_branch,
301
- ver_inc: @args_ver_inc,
302
- tag_type: @args_tag_type,
303
- tag_pre: @args_tag_pre
304
- )
298
+ # 所有参数都从 GitCommitTask 获取
299
+ git_tag_task = Pindo::TaskSystem::GitTagTask.new(config[:project_path])
305
300
  git_tag_task.dependencies << build_task.id
301
+ git_tag_task.dependencies << git_commit_task.id
306
302
  tasks << git_tag_task
307
303
 
308
304
  # 5. 上传和消息发送任务(如果需要)
@@ -77,7 +77,7 @@ module Pindo
77
77
  puts "Repo Url: #{@code_git_url}"
78
78
  puts "New Branch: #{new_branch}"
79
79
 
80
- getcode_to_dir(reponame:@repo_name, remote_url:@code_git_url, path:Dir.pwd, new_branch:new_branch, new_tag:nil)
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
81
 
82
82
  end
83
83
  end
@@ -243,14 +243,9 @@ module Pindo
243
243
  only_web_platform = selected_platforms == ['web']
244
244
 
245
245
  # 如果只有 web 平台,在 Unity 导出之前创建 Git 标签任务
246
+ # 所有参数都从 GitCommitTask 获取
246
247
  if only_web_platform
247
- git_tag_task = Pindo::TaskSystem::GitTagTask.new(
248
- Dir.pwd,
249
- release_branch: @args_release_branch,
250
- ver_inc: @args_ver_inc,
251
- tag_type: @args_tag_type,
252
- tag_pre: @args_tag_pre
253
- )
248
+ git_tag_task = Pindo::TaskSystem::GitTagTask.new(Dir.pwd)
254
249
  git_tag_task.dependencies << git_commit_task.id
255
250
  all_tasks << git_tag_task
256
251
  common_dependency_task = git_tag_task
@@ -301,17 +296,13 @@ module Pindo
301
296
 
302
297
  # 第三步:创建 Git 标签任务(依赖第一个平台的构建任务)
303
298
  # 注意:如果只有 web 平台,GitTagTask 已在前面创建,这里跳过
299
+ # 所有参数都从 GitCommitTask 获取
304
300
  unless only_web_platform
305
301
  first_build_task = platform_build_tasks[selected_platforms.first]
306
302
  if first_build_task
307
- git_tag_task = Pindo::TaskSystem::GitTagTask.new(
308
- Dir.pwd,
309
- release_branch: @args_release_branch,
310
- ver_inc: @args_ver_inc,
311
- tag_type: @args_tag_type,
312
- tag_pre: @args_tag_pre
313
- )
303
+ git_tag_task = Pindo::TaskSystem::GitTagTask.new(Dir.pwd)
314
304
  git_tag_task.dependencies << first_build_task.id
305
+ git_tag_task.dependencies << git_commit_task.id
315
306
  all_tasks << git_tag_task
316
307
  end
317
308
  end
@@ -179,15 +179,10 @@ module Pindo
179
179
  tasks << nuget_build_task
180
180
 
181
181
  # 3. Git Tag 任务 (依赖构建成功)
182
- git_tag_task = Pindo::TaskSystem::GitTagTask.new(
183
- package_dir,
184
- release_branch: @args_release_branch,
185
- ver_inc: @args_ver_inc,
186
- tag_type: @args_tag_type,
187
- tag_pre: @args_tag_pre,
188
- fixed_version: confirmed_version # 传入确认后的版本号
189
- )
182
+ # 所有参数都从 GitCommitTask 获取
183
+ git_tag_task = Pindo::TaskSystem::GitTagTask.new(package_dir)
190
184
  git_tag_task.dependencies << nuget_build_task.id
185
+ git_tag_task.dependencies << git_commit_task.id
191
186
  tasks << git_tag_task
192
187
 
193
188
  # 添加并执行任务
@@ -95,13 +95,8 @@ module Pindo
95
95
  tasks << git_commit_task
96
96
 
97
97
  # 2. Git 标签任务(依赖提交任务)
98
- git_tag_task = Pindo::TaskSystem::GitTagTask.new(
99
- pindo_project_dir,
100
- release_branch: @args_release_branch,
101
- ver_inc: @args_ver_inc,
102
- tag_type: @args_tag_type,
103
- tag_pre: @args_tag_pre
104
- )
98
+ # 所有参数都从 GitCommitTask 获取
99
+ git_tag_task = Pindo::TaskSystem::GitTagTask.new(pindo_project_dir)
105
100
  git_tag_task.dependencies << git_commit_task.id
106
101
  tasks << git_tag_task
107
102
 
@@ -2,6 +2,7 @@ require 'highline/import'
2
2
  require 'fileutils'
3
3
  require 'json'
4
4
  require 'highline'
5
+ require 'pindo/base/git_handler'
5
6
 
6
7
  module Pindo
7
8
  class Command
@@ -39,7 +40,7 @@ module Pindo
39
40
 
40
41
 
41
42
  def update_common_struct
42
- app_default_config_dir = clong_buildconfig_repo(repo_name: pindo_single_config.demo_bundle_id)
43
+ app_default_config_dir = Pindo::GitHandler.clong_buildconfig_repo(repo_name: pindo_single_config.demo_bundle_id)
43
44
  default_config_file = File.join(app_default_config_dir, "config.json")
44
45
  default_config_json = nil
45
46
  if !default_config_file.empty? && File::file?(default_config_file)
@@ -88,7 +89,7 @@ module Pindo
88
89
  deploy_repo_name = get_deploy_setting_repo(tagname:menu_choice)
89
90
  puts "deploy_repo_name: #{deploy_repo_name}"
90
91
 
91
- mainapp_config_dir = clong_buildconfig_repo(repo_name: deploy_repo_name)
92
+ mainapp_config_dir = Pindo::GitHandler.clong_buildconfig_repo(repo_name: deploy_repo_name)
92
93
  mainapp_config_file = File.join(mainapp_config_dir, "config.json")
93
94
  mainapp_config_json = nil
94
95
  if !mainapp_config_file.empty? && File::file?(mainapp_config_file)
@@ -222,40 +222,30 @@ module Pindo
222
222
  # Web 只支持 Unity 工程
223
223
  tasks = []
224
224
 
225
- # 1. Git 提交任务(如果需要上传)
226
- if @args_upload_flag
227
- # 提前询问用户如何处理未提交的文件
228
- process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
229
- project_dir: config[:project_path],
230
- interactive: true
231
- )
225
+ # 1. Git 提交任务(总是创建)
226
+ # 提前询问用户如何处理未提交的文件
227
+ process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
228
+ project_dir: config[:project_path],
229
+ interactive: true
230
+ )
232
231
 
233
- git_commit_task = Pindo::TaskSystem::GitCommitTask.new(
234
- config[:project_path],
235
- release_branch: @args_release_branch,
236
- ver_inc: @args_ver_inc,
237
- tag_type: @args_tag_type,
238
- tag_pre: @args_tag_pre,
239
- process_type: process_type,
240
- commit_message: "feat: web autobuild 构建前提交"
241
- )
242
- tasks << git_commit_task
243
- last_task = git_commit_task
244
-
245
- # 2. Git 标签任务(依赖提交任务,在 Unity 导出之前创建)
246
- git_tag_task = Pindo::TaskSystem::GitTagTask.new(
247
- config[:project_path],
248
- release_branch: @args_release_branch,
249
- ver_inc: @args_ver_inc,
250
- tag_type: @args_tag_type,
251
- tag_pre: @args_tag_pre
252
- )
253
- git_tag_task.dependencies << git_commit_task.id
254
- tasks << git_tag_task
255
- last_task = git_tag_task
256
- else
257
- last_task = nil
258
- end
232
+ git_commit_task = Pindo::TaskSystem::GitCommitTask.new(
233
+ config[:project_path],
234
+ release_branch: @args_release_branch,
235
+ ver_inc: @args_ver_inc,
236
+ tag_type: @args_tag_type,
237
+ tag_pre: @args_tag_pre,
238
+ process_type: process_type,
239
+ commit_message: "feat: web autobuild 构建前提交"
240
+ )
241
+ tasks << git_commit_task
242
+
243
+ # 2. Git 标签任务(总是创建,依赖提交任务,在 Unity 导出之前创建)
244
+ # 所有参数都从 GitCommitTask 获取
245
+ git_tag_task = Pindo::TaskSystem::GitTagTask.new(config[:project_path])
246
+ git_tag_task.dependencies << git_commit_task.id
247
+ tasks << git_tag_task
248
+ last_task = git_tag_task
259
249
 
260
250
  # 3. Unity 更新必备库任务(可选)
261
251
  unless @args_skip_lib
data/lib/pindo/command.rb CHANGED
@@ -6,18 +6,11 @@ require 'pindo/version'
6
6
  require 'pindo/base/funlog'
7
7
  require 'pindo/base/hashhelper'
8
8
  require 'pindo/base/plaininformative'
9
+ require 'pindo/base/informative'
9
10
  require 'pindo/client/giteeclient'
10
11
  require 'pindo/config/pindoconfig'
11
12
 
12
-
13
-
14
13
  module Pindo
15
- class Informative < PlainInformative
16
- def message
17
- "[!] #{super}".red
18
- end
19
- end
20
-
21
14
  class Command < CLAide::Command
22
15
 
23
16
  include Pindoconfig::Mixin
@@ -318,10 +318,10 @@ module Pindo
318
318
 
319
319
  # 1.5 替换 Apple ID(使用 AdHoc 配置的 Apple ID)
320
320
  if adhoc_config_json.dig('account_info', 'apple_acount_id')
321
- original_apple_id = @config_json.dig('account_info', 'apple_acount_id')
322
- adhoc_apple_id = adhoc_config_json['account_info']['apple_acount_id']
321
+ original_apple_id = @config_json.dig('account_info', 'apple_acount_id')&.strip # 去除前后空格
322
+ adhoc_apple_id = adhoc_config_json['account_info']['apple_acount_id']&.strip # 去除前后空格
323
323
 
324
- if original_apple_id && adhoc_apple_id && original_apple_id != adhoc_apple_id
324
+ if original_apple_id && adhoc_apple_id && !adhoc_apple_id.empty? && original_apple_id != adhoc_apple_id
325
325
  @config_json['account_info']['apple_acount_id'] = adhoc_apple_id
326
326
  puts " 替换 Apple ID:"
327
327
  puts " 原始 Apple ID: #{original_apple_id}"
@@ -330,7 +330,8 @@ module Pindo
330
330
 
331
331
  # 如果 AdHoc 配置包含 company_name,也一并替换
332
332
  if adhoc_config_json.dig('account_info', 'acount_company_name')
333
- @config_json['account_info']['acount_company_name'] = adhoc_config_json['account_info']['acount_company_name']
333
+ company_name = adhoc_config_json['account_info']['acount_company_name']&.strip # 去除前后空格
334
+ @config_json['account_info']['acount_company_name'] = company_name if company_name && !company_name.empty?
334
335
  end
335
336
  end
336
337
 
@@ -438,7 +439,7 @@ module Pindo
438
439
  true
439
440
  rescue => e
440
441
  puts "合并发布配置失败: #{e.message}"
441
- puts e.backtrace.join("\n")
442
+ puts e.backtrace.join("\n") if ENV['PINDO_DEBUG']
442
443
  false
443
444
  end
444
445
  end
@@ -489,40 +490,40 @@ module Pindo
489
490
  # 解析账号信息
490
491
  if @config_json['account_info']
491
492
  account_info = @config_json['account_info']
492
- @config_data[:apple_id] = account_info['apple_acount_id']
493
- @config_data[:company_name] = account_info['acount_company_name']
493
+ @config_data[:apple_id] = account_info['apple_acount_id']&.strip # 去除前后空格
494
+ @config_data[:company_name] = account_info['acount_company_name']&.strip # 去除前后空格
494
495
  end
495
496
 
496
497
  # 解析应用信息
497
498
  if @config_json['app_info']
498
499
  app_info = @config_json['app_info']
499
- @config_data[:bundle_id] = app_info['app_identifier']
500
+ @config_data[:bundle_id] = app_info['app_identifier']&.strip # 去除前后空格
500
501
 
501
502
  # 保存原始 Bundle ID 作为配置仓库名称(只在第一次设置,后续不覆盖)
502
503
  if @app_repo_name.nil? && app_info['app_identifier']
503
- repo_name = app_info['app_identifier']
504
+ repo_name = app_info['app_identifier']&.strip # 去除前后空格
504
505
  # 如果是通配符 Bundle ID(以 .* 结尾),去除通配符后缀
505
- if repo_name.end_with?('.*')
506
+ if repo_name && repo_name.end_with?('.*')
506
507
  repo_name = repo_name[0...-2] # 去除最后的 .*
507
508
  end
508
509
  @app_repo_name = repo_name
509
510
  end
510
511
 
511
- @config_data[:bundle_id_pushcontent] = app_info['app_identifier_pushcontent']
512
- @config_data[:bundle_id_pushservice] = app_info['app_identifier_pushservice']
513
- @config_data[:bundle_id_keyboard] = app_info['app_identifier_keyboard']
514
- @config_data[:bundle_id_imessage] = app_info['app_identifier_imessage']
515
- @config_data[:bundle_id_extension] = app_info['app_identifier_extension']
516
- @config_data[:bundle_id_siri] = app_info['app_identifier_siri']
517
- @config_data[:bundle_id_siriui] = app_info['app_identifier_siriui']
518
- @config_data[:bundle_id_widget] = app_info['app_identifier_widget']
519
- @config_data[:bundle_id_extensionad] = app_info['app_identifier_extensionad']
520
- @config_data[:bundle_id_extensionporn] = app_info['app_identifier_extensionporn']
521
- @config_data[:bundle_id_watchapp] = app_info['app_identifier_watchapp']
522
- @config_data[:bundle_id_watchapp_extension] = app_info['app_identifier_watchapp_extension']
523
-
524
- @config_data[:app_name] = app_info['app_name']
525
- @config_data[:app_version] = app_info['app_version']
512
+ @config_data[:bundle_id_pushcontent] = app_info['app_identifier_pushcontent']&.strip
513
+ @config_data[:bundle_id_pushservice] = app_info['app_identifier_pushservice']&.strip
514
+ @config_data[:bundle_id_keyboard] = app_info['app_identifier_keyboard']&.strip
515
+ @config_data[:bundle_id_imessage] = app_info['app_identifier_imessage']&.strip
516
+ @config_data[:bundle_id_extension] = app_info['app_identifier_extension']&.strip
517
+ @config_data[:bundle_id_siri] = app_info['app_identifier_siri']&.strip
518
+ @config_data[:bundle_id_siriui] = app_info['app_identifier_siriui']&.strip
519
+ @config_data[:bundle_id_widget] = app_info['app_identifier_widget']&.strip
520
+ @config_data[:bundle_id_extensionad] = app_info['app_identifier_extensionad']&.strip
521
+ @config_data[:bundle_id_extensionporn] = app_info['app_identifier_extensionporn']&.strip
522
+ @config_data[:bundle_id_watchapp] = app_info['app_identifier_watchapp']&.strip
523
+ @config_data[:bundle_id_watchapp_extension] = app_info['app_identifier_watchapp_extension']&.strip
524
+
525
+ @config_data[:app_name] = app_info['app_name']&.strip
526
+ @config_data[:app_version] = app_info['app_version']&.strip
526
527
  @config_data[:app_id_ios] = app_info['app_id_ios']
527
528
  end
528
529
 
@@ -397,7 +397,7 @@ module Pindo
397
397
  end
398
398
  rescue => e
399
399
  puts "警告:设置 Play Asset Delivery 失败: #{e.message}"
400
- puts e.backtrace.first(5).join("\n")
400
+ puts e.backtrace.first(5).join("\n") if ENV['PINDO_DEBUG']
401
401
  end
402
402
  end
403
403
 
@@ -955,7 +955,7 @@ module Pindo
955
955
 
956
956
  rescue => e
957
957
  Funlog.instance.fancyinfo_error("Icon 处理失败: #{e.message}")
958
- puts e.backtrace
958
+ puts e.backtrace.join("\n") if ENV['PINDO_DEBUG']
959
959
  replace_success = false
960
960
  ensure
961
961
  # 清理临时文件(无论成功失败都清理)
@@ -287,7 +287,7 @@ module Pindo
287
287
 
288
288
  rescue => e
289
289
  Funlog.instance.fancyinfo_error("安装icon时出错: #{e.message}")
290
- puts e.backtrace
290
+ puts e.backtrace.join("\n") if ENV['PINDO_DEBUG']
291
291
  return false
292
292
  end
293
293
  end
@@ -501,7 +501,7 @@ module Pindo
501
501
  cert_git_url = pindo_single_config.dev_cert_giturl
502
502
  end
503
503
  cert_reponame = cert_git_url.split("/").last.chomp(".git")
504
- certs_dir = getcode_to_dir(reponame:cert_reponame, remote_url:cert_git_url, path: pindo_single_config.pindo_dir, new_branch:apple_id)
504
+ certs_dir = Pindo::GitHandler.getcode_to_dir(reponame:cert_reponame, remote_url:cert_git_url, path: pindo_single_config.pindo_dir, new_branch:apple_id)
505
505
 
506
506
 
507
507
  keys = Dir[File.join(certs_dir, "certs", cert_sub_dir, "*.p12")]
@@ -129,25 +129,39 @@ module Pindo
129
129
  # 更新版本号
130
130
  def update_version_info
131
131
  git_repo_helper = Pindo::GitRepoHelper.share_instance
132
+ build_version = nil
133
+ build_number = nil
132
134
 
133
- # 检查是否是 Git 仓库
134
- git_root = Pindo::GitHandler.git_root_directory(local_repo_dir: @project_path)
135
- unless git_root
136
- Funlog.warning("非Git仓库,保持工程原有版本号")
137
- return
138
- end
135
+ # 优先级 1: 从 GitCommitTask 获取版本号(无论当前目录是否为 Git 仓库)
136
+ git_commit_data = get_data_param_by_key(:git_commit)
137
+ if git_commit_data && git_commit_data[:task_param] &&
138
+ git_commit_data[:task_param][:build_version] && git_commit_data[:task_param][:build_number]
139
+ build_version = git_commit_data[:task_param][:build_version]
140
+ build_number = git_commit_data[:task_param][:build_number]
141
+ Funlog.instance.fancyinfo_success("使用 GitCommitTask 的版本号: #{build_version}, Build: #{build_number}")
139
142
 
140
- # 获取 build_number(从 commit hash 计算)
141
- build_number = git_repo_helper.get_build_number_from_commit(project_dir: @project_path)
143
+ else
144
+ # 优先级 2: 检查当前目录是否是 Git 仓库
145
+ git_root = Pindo::GitHandler.git_root_directory(local_repo_dir: @project_path)
142
146
 
143
- # 计算 build_version
144
- build_version = git_repo_helper.calculate_build_version(
145
- project_dir: @project_path,
146
- tag_prefix: @tag_pre,
147
- create_tag_type: @tag_type,
148
- version_increase_type: @ver_inc
149
- )
147
+ if git_root
148
+ # Git 仓库,自己计算版本号
149
+ build_number = git_repo_helper.get_build_number_from_commit(project_dir: @project_path)
150
+ build_version = git_repo_helper.calculate_build_version(
151
+ project_dir: @project_path,
152
+ tag_prefix: @tag_pre,
153
+ create_tag_type: @tag_type,
154
+ version_increase_type: @ver_inc
155
+ )
156
+ Funlog.instance.fancyinfo_success("自己计算版本号: #{build_version}, Build: #{build_number}")
157
+ else
158
+ # 不是 Git 仓库且没有从 GitCommitTask 获取到版本号,跳过版本更新
159
+ Funlog.warning("非Git仓库且未从 GitCommitTask 获取到版本号,保持工程原有版本号")
160
+ return
161
+ end
162
+ end
150
163
 
164
+ # 更新版本号
151
165
  Pindo::AndroidConfigHelper.update_android_project_version(
152
166
  project_dir: @project_path,
153
167
  version_name: build_version,