pindo 5.10.4 → 5.10.8

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pindo/base/funlog.rb +12 -1
  3. data/lib/pindo/base/pindocontext.rb +3 -0
  4. data/lib/pindo/command/android/autobuild.rb +62 -9
  5. data/lib/pindo/command/android/build.rb +6 -6
  6. data/lib/pindo/command/android/debug.rb +9 -9
  7. data/lib/pindo/command/deploy/build.rb +5 -2
  8. data/lib/pindo/command/deploy/cert.rb +6 -7
  9. data/lib/pindo/command/deploy/configproj.rb +3 -3
  10. data/lib/pindo/command/deploy/confusecode.rb +1 -1
  11. data/lib/pindo/command/deploy/confuseproj.rb +1 -1
  12. data/lib/pindo/command/deploy/pem.rb +3 -4
  13. data/lib/pindo/command/dev/autobuild.rb +2 -2
  14. data/lib/pindo/command/dev/build.rb +2 -2
  15. data/lib/pindo/command/dev/feishu.rb +1 -1
  16. data/lib/pindo/command/gplay/pullconfig.rb +48 -0
  17. data/lib/pindo/command/gplay.rb +6 -5
  18. data/lib/pindo/command/ios/adhoc.rb +7 -6
  19. data/lib/pindo/command/ios/autobuild.rb +25 -25
  20. data/lib/pindo/command/ios/build.rb +7 -6
  21. data/lib/pindo/command/ios/debug.rb +2 -1
  22. data/lib/pindo/command/ipa/autoresign.rb +2 -2
  23. data/lib/pindo/command/ipa/import.rb +3 -4
  24. data/lib/pindo/command/ipa/output.rb +3 -4
  25. data/lib/pindo/command/jps/upload.rb +6 -5
  26. data/lib/pindo/command/repo/login.rb +1 -1
  27. data/lib/pindo/command/unity/apk.rb +19 -2
  28. data/lib/pindo/command/unity/autobuild.rb +58 -63
  29. data/lib/pindo/command/unity/initpack.rb +1 -1
  30. data/lib/pindo/command/unity/ipa.rb +17 -14
  31. data/lib/pindo/command/unity/pack.rb +1 -1
  32. data/lib/pindo/command/unity/upload.rb +1 -1
  33. data/lib/pindo/command/unity/web.rb +2 -2
  34. data/lib/pindo/command/utils/device.rb +4 -4
  35. data/lib/pindo/command/utils/icon.rb +1 -1
  36. data/lib/pindo/command/utils/renewcert.rb +2 -3
  37. data/lib/pindo/command/utils/renewproj.rb +9 -10
  38. data/lib/pindo/command/web/autobuild.rb +3 -3
  39. data/lib/pindo/command/web/run.rb +1 -1
  40. data/lib/pindo/command.rb +2 -1
  41. data/lib/pindo/module/android/android_build_config_helper.rb +267 -35
  42. data/lib/pindo/module/android/android_build_helper.rb +300 -0
  43. data/lib/pindo/module/android/android_project_helper.rb +279 -0
  44. data/lib/pindo/module/android/gp_compliance_helper.rb +33 -87
  45. data/lib/pindo/module/android/gradle_helper.rb +524 -255
  46. data/lib/pindo/module/android/java_env_helper.rb +633 -0
  47. data/lib/pindo/module/android/keystore_helper.rb +1118 -0
  48. data/lib/pindo/module/appselect.rb +109 -0
  49. data/lib/pindo/module/appstore/appstore_in_app_purchase.rb +1 -1
  50. data/lib/pindo/module/build/{buildhelper.rb → build_helper.rb} +1 -2
  51. data/lib/pindo/module/build/{commonconfuseproj.rb → confuse_xcodeproj.rb} +2 -2
  52. data/lib/pindo/module/cert/cert_helper.rb +245 -0
  53. data/lib/pindo/module/cert/keychain_helper.rb +152 -0
  54. data/lib/pindo/module/cert/pem_helper.rb +67 -0
  55. data/lib/pindo/module/cert/xcodecerthelper.rb +6 -5
  56. data/lib/pindo/module/pgyer/pgyerhelper.rb +5 -5
  57. data/lib/pindo/module/{build/unityhelper.rb → unity/unity_helper.rb} +0 -17
  58. data/lib/pindo/module/xcode/{xcodereshandler.rb → res/xcode_res_handler.rb} +1 -1
  59. data/lib/pindo/module/xcode/{xcodebuildconfig.rb → xcode_build_config.rb} +7 -6
  60. data/lib/pindo/module/xcode/{xcodebuildhelper.rb → xcode_build_helper.rb} +84 -2
  61. data/lib/pindo/module/xcode/{xcodehelper.rb → xcode_project_helper.rb} +4 -2
  62. data/lib/pindo/module/xcode/{xcodereshelper.rb → xcode_res_helper.rb} +12 -9
  63. data/lib/pindo/version.rb +185 -7
  64. data/lib/pindo.rb +14 -9
  65. metadata +24 -23
  66. data/lib/pindo/module/android/apk_helper.rb +0 -138
  67. data/lib/pindo/module/android/base_helper.rb +0 -964
  68. data/lib/pindo/module/android/build_helper.rb +0 -128
  69. data/lib/pindo/module/android/so_helper.rb +0 -18
  70. data/lib/pindo/module/cert/certhelper.rb +0 -246
  71. data/lib/pindo/module/cert/keychainhelper.rb +0 -150
  72. data/lib/pindo/module/cert/pemhelper.rb +0 -65
  73. /data/lib/pindo/module/android/{androidreshelper.rb → android_res_helper.rb} +0 -0
  74. /data/lib/pindo/module/appstore/{iap_tier.json → appstore_iap_tier.json} +0 -0
  75. /data/lib/pindo/module/build/{swarkhelper.rb → swark_helper.rb} +0 -0
  76. /data/lib/pindo/module/build/{versionhelper.rb → version_helper.rb} +0 -0
  77. /data/lib/pindo/module/cert/{provisioninghelper.rb → provisioning_helper.rb} +0 -0
  78. /data/lib/pindo/module/unity/{nugethelper.rb → nuget_helper.rb} +0 -0
  79. /data/lib/pindo/module/xcode/{xcoderesconstant.rb → res/xcode_res_constant.rb} +0 -0
@@ -424,7 +424,7 @@ module Pindo
424
424
 
425
425
 
426
426
  else
427
- raise Informative, "请先登录Pgyer网站"
427
+ raise Informative, "请先登录JPS网站"
428
428
  end
429
429
  @proj_name = upload_proj_name
430
430
  app_info_obj
@@ -893,7 +893,7 @@ module Pindo
893
893
 
894
894
  if app_info_list.nil?
895
895
  Funlog.instance.fancyinfo_error("拉取app信息列表失败!")
896
- raise Informative, "Pgyer网络数据异常!!!"
896
+ raise Informative, "JPS网络数据异常!!!"
897
897
  end
898
898
 
899
899
 
@@ -1061,11 +1061,11 @@ module Pindo
1061
1061
  puts
1062
1062
 
1063
1063
  if comment_str.nil? || comment_str.empty?
1064
- Funlog.instance.fancyinfo_error("没有找到git备注信息,无法修改pgyer备注!")
1064
+ Funlog.instance.fancyinfo_error("没有找到git备注信息,无法修改JPS备注!")
1065
1065
  else
1066
- Funlog.instance.fancyinfo_start("开始修复pgyer备注...")
1066
+ Funlog.instance.fancyinfo_start("开始修复JPS备注...")
1067
1067
  @pgyer_client.update_project_package(projectId:app_info_obj["id"], id:version_item_obj["id"], comment:comment_str.strip)
1068
- Funlog.instance.fancyinfo_start("pgyer备注已经修改!")
1068
+ Funlog.instance.fancyinfo_start("JPS备注已经修改!")
1069
1069
  end
1070
1070
 
1071
1071
 
@@ -192,11 +192,6 @@ module Pindo
192
192
 
193
193
  # 如果是 Android 平台,检查 Java 版本
194
194
  platform = additional_args[:platform]
195
- if platform == 'Android'
196
- unless ensure_java_version_for_android
197
- raise Informative, "Java 版本不符合要求,无法继续构建 Android 项目"
198
- end
199
- end
200
195
 
201
196
  cmd_args = [
202
197
  unity_exe_full_path,
@@ -887,18 +882,6 @@ module Pindo
887
882
  File.exist?(File.join(project_settings_path, "ProjectSettings.asset"))
888
883
  end
889
884
 
890
- # 确保 Android 构建所需的 Java 版本
891
- def ensure_java_version_for_android
892
- # 动态加载 BaseAndroidHelper 模块
893
- require_relative '../android/base_helper'
894
-
895
- # 创建一个临时对象来调用方法
896
- helper = Object.new
897
- helper.extend(Pindo::BaseAndroidHelper)
898
-
899
- # 调用 Java 版本检测方法
900
- helper.ensure_java_version_compliance
901
- end
902
885
  end
903
886
  end
904
887
  end
@@ -33,7 +33,7 @@ module Pindo
33
33
  if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
34
34
  icon_path_array = Dir.glob(File.join(project_dir, "**", "AppIcon.appiconset"))
35
35
  if icon_path_array.size > 1
36
- icon_path = icon_path_array.select{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/AppIcon.appiconset")}
36
+ icon_path = icon_path_array.find{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/AppIcon.appiconset")}
37
37
  elsif icon_path_array.size == 1
38
38
  icon_path = icon_path_array.first
39
39
  end
@@ -1,6 +1,7 @@
1
1
  require 'fileutils'
2
2
  require 'xcodeproj'
3
3
  require 'json'
4
+ require 'pindo/module/xcode/xcode_res_helper'
4
5
  require 'open-uri'
5
6
  require_relative '../../base/funlog'
6
7
 
@@ -13,18 +14,18 @@ module Pindo
13
14
  # 注意:此函数只添加基于package_name的URL Scheme,基于实际Bundle ID的URL Scheme
14
15
  # 将在update_url_schemes_with_bundleid函数中统一添加(在证书配置之后)
15
16
  # @param project_dir [String] iOS项目目录路径
16
- # @param package_name [String] 工作流的package_name(如:"Test Demo")
17
+ # @param workflow_packname [String] 工作流的名称(如:"Test Demo")
17
18
  # @param project_id [String] JPS项目ID(可选,用于添加快捷操作)
18
19
  # @return [Boolean] 是否成功更新
19
- def self.update_project_with_packagename(project_dir: nil, package_name: nil, project_id: nil)
20
+ def self.update_project_with_workflow(project_dir: nil, workflow_packname: nil, project_id: nil)
20
21
  raise ArgumentError, "项目目录不能为空" if project_dir.nil?
21
- raise ArgumentError, "Package Name不能为空" if package_name.nil?
22
+ raise ArgumentError, "Workflow Package Name不能为空" if workflow_packname.nil?
22
23
 
23
24
  # 生成各种值
24
- display_name = package_name.gsub(/[^a-zA-Z0-9\s]/, '').gsub(/\s+/, '')
25
- bundle_id_suffix = package_name.gsub(/[^a-zA-Z0-9]/, '').downcase
25
+ display_name = workflow_packname.gsub(/[^a-zA-Z0-9\s]/, '').gsub(/\s+/, '')
26
+ bundle_id_suffix = workflow_packname.gsub(/[^a-zA-Z0-9]/, '').downcase
26
27
  final_bundle_id = "com.heroneverdie101.#{bundle_id_suffix}"
27
- package_scheme = package_name.gsub(/[^a-zA-Z0-9]/, '').downcase
28
+ package_scheme = workflow_packname.gsub(/[^a-zA-Z0-9]/, '').downcase
28
29
 
29
30
  project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
30
31
  return false if project_fullname.nil?
@@ -5,9 +5,10 @@ require 'pindo/module/cert/xcodecerthelper'
5
5
 
6
6
  module Pindo
7
7
 
8
- module XcodeBuildHelper
8
+ class XcodeBuildHelper
9
+ class << self
9
10
 
10
- def pull_podfile_lock(project_dir:nil, app_config_dir:nil)
11
+ def pull_podfile_lock(project_dir:nil, app_config_dir:nil)
11
12
  begin
12
13
  src_pod_file = File.join(app_config_dir, "Podfile.lock")
13
14
  build_verify_file = File.join(app_config_dir, "build_verify.json")
@@ -318,7 +319,88 @@ module Pindo
318
319
 
319
320
  end
320
321
 
322
+ # 修复 Xcode 16 链接器兼容性问题
323
+ # 自动移除 -ld_classic 和 -ld64 标志
324
+ def fix_xcode16_linker_flags(project_dir: nil)
325
+ begin
326
+ # 查找所有 xcodeproj 文件
327
+ workspace_file = Dir.glob(File.join(project_dir, "*.xcworkspace")).first
328
+ project_files = []
329
+
330
+ if workspace_file && File.exist?(workspace_file)
331
+ # 如果存在 workspace,从中提取所有项目
332
+ workspace_data_file = File.join(workspace_file, "contents.xcworkspacedata")
333
+ if File.exist?(workspace_data_file)
334
+ require 'rexml/document'
335
+ doc = REXML::Document.new(File.read(workspace_data_file))
336
+ doc.elements.each('Workspace/FileRef') do |file_ref|
337
+ location = file_ref.attributes['location']
338
+ if location && location.start_with?('group:')
339
+ relative_path = location.sub('group:', '')
340
+ if relative_path.end_with?('.xcodeproj')
341
+ full_path = File.join(project_dir, relative_path)
342
+ project_files << full_path if File.exist?(full_path)
343
+ end
344
+ end
345
+ end
346
+ end
347
+ else
348
+ # 直接查找项目文件
349
+ project_files = Dir.glob(File.join(project_dir, "**/*.xcodeproj"))
350
+ end
351
+
352
+ return if project_files.empty?
353
+
354
+ fixed_count = 0
355
+
356
+ project_files.each do |project_path|
357
+ begin
358
+ project = Xcodeproj::Project.open(project_path)
359
+ project_modified = false
360
+
361
+ project.targets.each do |target|
362
+ target.build_configurations.each do |config|
363
+ ldflags = config.build_settings['OTHER_LDFLAGS']
364
+ next unless ldflags
365
+
366
+ original_flags = ldflags.dup
367
+
368
+ # 移除过时的链接器标志
369
+ if ldflags.is_a?(Array)
370
+ ldflags.delete('-ld_classic')
371
+ ldflags.delete('-ld64')
372
+ elsif ldflags.is_a?(String)
373
+ ldflags = ldflags.gsub(/-ld_classic|-ld64/, '').strip
374
+ end
375
+
376
+ if original_flags != ldflags
377
+ config.build_settings['OTHER_LDFLAGS'] = ldflags
378
+ project_modified = true
379
+ end
380
+ end
381
+ end
321
382
 
383
+ if project_modified
384
+ project.save
385
+ fixed_count += 1
386
+ end
387
+
388
+ rescue => e
389
+ # 静默处理错误,不中断构建
390
+ end
391
+ end
392
+
393
+ if fixed_count > 0
394
+ puts "✅ 修复 Xcode 16 链接器兼容性配置".green
395
+ end
396
+
397
+ rescue => error
398
+ puts "⚠️ 修复链接器标志时出现错误: #{error.message}".yellow
399
+ # 不中断构建流程
400
+ end
401
+ end
402
+
403
+ end
322
404
  end
323
405
 
324
406
  end
@@ -3,9 +3,10 @@ require 'xcodeproj'
3
3
 
4
4
  module Pindo
5
5
 
6
- module XcodeHelper
6
+ class XcodeProjectHelper
7
+ class << self
7
8
 
8
- def get_target_by_name(proj_obj:nil, name:nil)
9
+ def get_target_by_name(proj_obj:nil, name:nil)
9
10
  new_target = nil
10
11
  proj_obj.targets.each do |target|
11
12
  if target.name.to_s.eql?(name)
@@ -516,6 +517,7 @@ module Pindo
516
517
 
517
518
  end
518
519
 
520
+ end
519
521
  end
520
522
 
521
523
  end
@@ -1,13 +1,15 @@
1
1
  require 'fileutils'
2
2
  require 'xcodeproj'
3
3
  require 'json'
4
- require 'pindo/module/xcode/xcodereshandler'
5
- require 'pindo/module/xcode/xcoderesconstant'
4
+ require 'pindo/module/xcode/res/xcode_res_handler'
5
+ require 'pindo/module/xcode/res/xcode_res_constant'
6
6
 
7
7
  module Pindo
8
8
 
9
- module XcodeResHelper
10
- def self.create_icon(icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
9
+ class XcodeResHelper
10
+ class << self
11
+
12
+ def create_icon(icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
11
13
  if !File.exist?(icon_name)
12
14
  raise Informative, "文件不存在:#{icon_name}"
13
15
  end
@@ -41,7 +43,7 @@ module Pindo
41
43
  end
42
44
 
43
45
 
44
- def self.create_imessage_icon(icon_name:nil, image_icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
46
+ def create_imessage_icon(icon_name:nil, image_icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
45
47
  if !File.exist?(icon_name) || !File.exist?(image_icon_name)
46
48
  raise Informative, "文件不存在:#{image_icon_name} or #{icon_name}"
47
49
  end
@@ -75,7 +77,7 @@ module Pindo
75
77
  end
76
78
  end
77
79
 
78
- def self.create_icons(icon_name:nil, new_icon_dir:nil)
80
+ def create_icons(icon_name:nil, new_icon_dir:nil)
79
81
  begin
80
82
  FileUtils.mkdir_p(new_icon_dir)
81
83
  rescue => e
@@ -95,8 +97,8 @@ module Pindo
95
97
  create_imessage_icon(icon_name: icon_name, image_icon_name:imessage_icon, new_icon_dir: new_imessage_icon_dir, xcode_icon_json: XcodoeResConst.xcode_ios_imessage_icon_json)
96
98
  end
97
99
  end
98
-
99
- def self.install_icon(proj_dir:nil, new_icon_dir:nil)
100
+
101
+ def install_icon(proj_dir:nil, new_icon_dir:nil)
100
102
  xcodeproj_file_name = Dir.glob(File.join(proj_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
101
103
  xcodereshandler = XcodeResHandler.new(proj_fullname: xcodeproj_file_name)
102
104
  xcodereshandler.install_icon_res(new_icon_dir: new_icon_dir)
@@ -109,12 +111,13 @@ module Pindo
109
111
  end
110
112
  end
111
113
 
112
- def self.install_launchimg(proj_dir:nil, launchimg_pub_path:nil)
114
+ def install_launchimg(proj_dir:nil, launchimg_pub_path:nil)
113
115
  xcodeproj_file_name = Dir.glob(File.join(proj_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
114
116
  xcodereshandler = XcodeResHandler.new(proj_fullname: xcodeproj_file_name)
115
117
  xcodereshandler.install_launchimg(launchimg_pub_path:launchimg_pub_path)
116
118
  end
117
119
 
120
+ end
118
121
  end
119
122
 
120
123
  end
data/lib/pindo/version.rb CHANGED
@@ -6,17 +6,50 @@ require 'time'
6
6
 
7
7
  module Pindo
8
8
 
9
- VERSION = "5.10.4"
9
+ VERSION = "5.10.8"
10
10
 
11
11
  class VersionCheck
12
12
  RUBYGEMS_API = 'https://rubygems.org/api/v1/gems/pindo.json'
13
13
  VERSION_INFO_FILE = File.expand_path('~/.pindo/version_info.yml')
14
14
  CHECK_INTERVAL = 5 * 60 * 60 # 5小时检查一次
15
+ CONFIG_MIN_VERSION = '1.0.0' # 硬编码的配置版本要求
15
16
 
16
17
  class << self
17
18
  # 主版本检查方法(保持向后兼容)
18
- def check_pindo_new_version
19
+
20
+ def check_pindo_config
21
+ return if ENV['PINDO_SKIP_CONFIG_CHECK']
22
+
23
+ puts " 📋 检查配置版本...".green if ENV['PINDO_DEBUG']
24
+
19
25
  begin
26
+ pindo_dir = File.expand_path(ENV['PINDO_DIR'] || '~/.pindo')
27
+ config_file = File.join(pindo_dir, "pindo_common_config", "pindo_config.json")
28
+
29
+ # 检查是否需要更新
30
+ need_update = config_needs_update?(config_file)
31
+
32
+ if need_update
33
+ puts "\n⚠️ 配置版本需要更新".yellow
34
+ puts "正在更新配置...".green
35
+ update_config_repos(pindo_dir)
36
+ puts "✅ 配置更新完成\n".green
37
+
38
+ # 触发配置重载
39
+ Pindoconfig.reload_instance
40
+ else
41
+ puts " ✅ 配置版本符合要求".green if ENV['PINDO_DEBUG']
42
+ end
43
+
44
+ rescue => e
45
+ puts "⚠️ 配置版本检查失败: #{e.message}".yellow
46
+ puts e.backtrace.join("\n") if ENV['PINDO_DEBUG']
47
+ # 不影响程序继续运行
48
+ end
49
+ end
50
+
51
+ def check_pindo_new_version
52
+ # begin
20
53
  return if ENV['PINDO_NO_UPDATE_CHECK'] # 允许用户禁用
21
54
 
22
55
  puts " 🔄 执行版本检查...".green if ENV['PINDO_DEBUG']
@@ -36,11 +69,11 @@ module Pindo
36
69
  check_from_config_file
37
70
  end
38
71
 
39
- rescue => e
40
- puts " ❌ 版本检查出错: #{e.message}".red if ENV['PINDO_DEBUG']
41
- puts e.backtrace.join("\n") if ENV['PINDO_DEBUG']
42
- # 静默失败,不影响主程序
43
- end
72
+ # rescue => e
73
+ # puts " ❌ 版本检查出错: #{e.message}".red if ENV['PINDO_DEBUG']
74
+ # puts e.backtrace.join("\n") if ENV['PINDO_DEBUG']
75
+ # # 静默失败,不影响主程序
76
+ # end
44
77
  end
45
78
 
46
79
  # 强制更新检查
@@ -376,6 +409,151 @@ module Pindo
376
409
  puts "\n"
377
410
  puts "程序将退出,请更新后重试。".red
378
411
  end
412
+
413
+
414
+ private
415
+
416
+ # 检查配置是否需要更新
417
+ def config_needs_update?(config_file)
418
+ # 文件不存在
419
+ unless File.exist?(config_file)
420
+ puts " ⚠️ 配置文件不存在: #{config_file}".yellow if ENV['PINDO_DEBUG']
421
+ return true
422
+ end
423
+
424
+ # 检查版本
425
+ begin
426
+ config = JSON.parse(File.read(config_file))
427
+ current_version = config['pindo_config_version']
428
+
429
+ puts " 📌 当前配置版本: #{current_version || 'nil'}".cyan if ENV['PINDO_DEBUG']
430
+ puts " 📌 要求最低版本: #{CONFIG_MIN_VERSION}".cyan if ENV['PINDO_DEBUG']
431
+
432
+ # 没有版本号
433
+ if current_version.nil?
434
+ puts " ⚠️ 配置文件缺少版本信息".yellow if ENV['PINDO_DEBUG']
435
+ return true
436
+ end
437
+
438
+ # 版本过低
439
+ if Gem::Version.new(current_version) < Gem::Version.new(CONFIG_MIN_VERSION)
440
+ puts " ⚠️ 配置版本过低 (#{current_version} < #{CONFIG_MIN_VERSION})".yellow if ENV['PINDO_DEBUG']
441
+ return true
442
+ end
443
+
444
+ false
445
+ rescue => e
446
+ # JSON 解析错误等情况
447
+ puts " ⚠️ 配置文件解析失败: #{e.message}".yellow if ENV['PINDO_DEBUG']
448
+ true
449
+ end
450
+ end
451
+
452
+ # 更新配置仓库
453
+ def update_config_repos(pindo_dir)
454
+ # 1. 更新 pindo_common_config
455
+ common_config_url = "https://gitee.com/goodbuildtest/pindo_common_config.git"
456
+ update_git_repo(
457
+ dir: File.join(pindo_dir, "pindo_common_config"),
458
+ url: common_config_url
459
+ )
460
+
461
+ # 2. 重新读取配置文件,获取环境仓库 URL
462
+ config_file = File.join(pindo_dir, "pindo_common_config", "pindo_config.json")
463
+ env_urls = {}
464
+ begin
465
+ if File.exist?(config_file)
466
+ config = JSON.parse(File.read(config_file))
467
+ if config['pindo_config_env']
468
+ env_urls = config['pindo_config_env']
469
+ end
470
+ end
471
+ rescue => e
472
+ puts " ⚠️ 读取环境配置 URL 失败: #{e.message}".yellow if ENV['PINDO_DEBUG']
473
+ end
474
+
475
+ # 3. 判断环境并更新对应配置
476
+ env_name = get_current_env(pindo_dir)
477
+ if env_name && env_urls[env_name]
478
+ # 根据环境名称确定目录名
479
+ env_dir_name = case env_name
480
+ when "dreamstudio_config"
481
+ "pindo_dreamstudio_config"
482
+ when "workhard_config"
483
+ "pindo_workhard_config"
484
+ else
485
+ "pindo_#{env_name.sub('_config', '')}_config"
486
+ end
487
+
488
+ update_git_repo(
489
+ dir: File.join(pindo_dir, env_dir_name),
490
+ url: env_urls[env_name]
491
+ )
492
+ elsif env_name
493
+ # 使用默认 URL 作为后备方案
494
+ default_urls = {
495
+ "dreamstudio_config" => "https://gitee.com/goodbuildtest/pindo_dreamstudio_config.git",
496
+ "workhard_config" => "https://gitee.com/goodbuildtest/pindo_workhard_config.git"
497
+ }
498
+
499
+ if default_urls[env_name]
500
+ env_dir_name = env_name == "dreamstudio_config" ? "pindo_dreamstudio_config" : "pindo_workhard_config"
501
+ update_git_repo(
502
+ dir: File.join(pindo_dir, env_dir_name),
503
+ url: default_urls[env_name]
504
+ )
505
+ end
506
+ end
507
+ end
508
+
509
+ # 获取当前环境
510
+ def get_current_env(pindo_dir)
511
+ env_file = File.join(pindo_dir, '.pindo_env')
512
+ return nil unless File.exist?(env_file)
513
+
514
+ begin
515
+ json = JSON.parse(File.read(env_file))
516
+ json['pindo_env']
517
+ rescue
518
+ nil
519
+ end
520
+ end
521
+
522
+ # 更新单个 Git 仓库
523
+ def update_git_repo(dir:, url:)
524
+ require 'fileutils'
525
+
526
+ # 从 URL 提取仓库名称
527
+ repo_name = url.split('/').last.gsub(/\.git$/, '')
528
+
529
+ if File.exist?(dir)
530
+ # 仓库已存在,执行强制更新
531
+ puts " 📦 更新: #{repo_name}".cyan if ENV['PINDO_DEBUG']
532
+ Dir.chdir(dir) do
533
+ # 获取当前分支
534
+ current_branch = `git rev-parse --abbrev-ref HEAD`.strip
535
+ current_branch = 'master' if current_branch.empty?
536
+
537
+ # 获取远程更新
538
+ system("git fetch origin --quiet")
539
+
540
+ # 强制重置到远程分支最新状态(覆盖本地修改)
541
+ system("git reset --hard origin/#{current_branch} --quiet")
542
+
543
+ # 设置上游分支
544
+ system("git branch --set-upstream-to=origin/#{current_branch} #{current_branch} --quiet 2>/dev/null")
545
+
546
+ # 拉取最新更新
547
+ system("git pull --quiet")
548
+ end
549
+ else
550
+ # 仓库不存在,执行 git clone
551
+ puts " 📦 克隆: #{repo_name}".cyan if ENV['PINDO_DEBUG']
552
+ parent_dir = File.dirname(dir)
553
+ FileUtils.mkdir_p(parent_dir) unless File.exist?(parent_dir)
554
+ system("git clone #{url} #{dir} --quiet")
555
+ end
556
+ end
379
557
  end
380
558
  end
381
559
  end
data/lib/pindo.rb CHANGED
@@ -17,21 +17,26 @@ module Pindo
17
17
  class PindoApp
18
18
 
19
19
  def run(argv)
20
- begin
20
+ # begin
21
21
  # 解析参数以确定是否是 help 或 version 命令
22
22
  coerced_argv = CLAide::ARGV.coerce(argv)
23
23
 
24
24
  # 显示欢迎界面(除了 help/version 命令和特定情况)
25
25
  show_welcome_banner(argv, coerced_argv)
26
26
 
27
- # 跳过 help/version 命令的版本检查
28
- unless coerced_argv.flag?('help') || coerced_argv.flag?('version')
27
+ # 跳过 help/version/setup 命令的版本检查
28
+ unless coerced_argv.flag?('help') ||
29
+ coerced_argv.flag?('version') ||
30
+ (coerced_argv.arguments.first == 'setup')
29
31
  # 执行版本检查
30
32
  begin
31
- # 1. 强制更新检查(可能会退出程序)
33
+ # 1. 配置版本检查(新增)- 必须在其他检查之前
34
+ Pindo::VersionCheck.check_pindo_config
35
+
36
+ # 2. 强制更新检查(可能会退出程序)
32
37
  Pindo::VersionCheck.check_force_update!
33
38
 
34
- # 2. 常规版本检查
39
+ # 3. 常规版本检查
35
40
  Pindo::VersionCheck.check_pindo_new_version
36
41
  rescue => e
37
42
  puts "⚠️ 版本检查出错: #{e.message}".yellow if ENV['PINDO_DEBUG']
@@ -39,10 +44,10 @@ module Pindo
39
44
  end
40
45
  end
41
46
 
42
- rescue => e
43
- # 参数解析失败,继续执行原有逻辑
44
- puts "⚠️ 参数解析失败: #{e.message}".yellow if ENV['PINDO_DEBUG']
45
- end
47
+ # rescue => e
48
+ # # 参数解析失败,继续执行原有逻辑
49
+ # puts "⚠️ 参数解析失败: #{e.message}".yellow if ENV['PINDO_DEBUG']
50
+ # end
46
51
 
47
52
  # 运行命令
48
53
  Pindo::Command.run(argv)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pindo
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.10.4
4
+ version: 5.10.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - wade
@@ -364,6 +364,7 @@ files:
364
364
  - lib/pindo/command/gplay/iap.rb
365
365
  - lib/pindo/command/gplay/itcapp.rb
366
366
  - lib/pindo/command/gplay/metadata.rb
367
+ - lib/pindo/command/gplay/pullconfig.rb
367
368
  - lib/pindo/command/gplay/screenshots.rb
368
369
  - lib/pindo/command/gplay/upload.rb
369
370
  - lib/pindo/command/ios.rb
@@ -420,30 +421,30 @@ files:
420
421
  - lib/pindo/config/pindoconfig.rb
421
422
  - lib/pindo/config/pindouserlocalconfig.rb
422
423
  - lib/pindo/module/android/android_build_config_helper.rb
423
- - lib/pindo/module/android/androidreshelper.rb
424
- - lib/pindo/module/android/apk_helper.rb
425
- - lib/pindo/module/android/base_helper.rb
426
- - lib/pindo/module/android/build_helper.rb
424
+ - lib/pindo/module/android/android_build_helper.rb
425
+ - lib/pindo/module/android/android_project_helper.rb
426
+ - lib/pindo/module/android/android_res_helper.rb
427
427
  - lib/pindo/module/android/gp_compliance_helper.rb
428
428
  - lib/pindo/module/android/gradle_helper.rb
429
- - lib/pindo/module/android/so_helper.rb
429
+ - lib/pindo/module/android/java_env_helper.rb
430
+ - lib/pindo/module/android/keystore_helper.rb
430
431
  - lib/pindo/module/appselect.rb
432
+ - lib/pindo/module/appstore/appstore_iap_tier.json
431
433
  - lib/pindo/module/appstore/appstore_in_app_purchase.rb
432
434
  - lib/pindo/module/appstore/appstore_metadata_connect_api_helper.rb
433
435
  - lib/pindo/module/appstore/appstore_metadata_fastlane_helper.rb
434
- - lib/pindo/module/appstore/iap_tier.json
435
- - lib/pindo/module/build/buildhelper.rb
436
- - lib/pindo/module/build/commonconfuseproj.rb
437
- - lib/pindo/module/build/swarkhelper.rb
438
- - lib/pindo/module/build/unityhelper.rb
439
- - lib/pindo/module/build/versionhelper.rb
440
- - lib/pindo/module/cert/certhelper.rb
441
- - lib/pindo/module/cert/keychainhelper.rb
442
- - lib/pindo/module/cert/pemhelper.rb
443
- - lib/pindo/module/cert/provisioninghelper.rb
436
+ - lib/pindo/module/build/build_helper.rb
437
+ - lib/pindo/module/build/confuse_xcodeproj.rb
438
+ - lib/pindo/module/build/swark_helper.rb
439
+ - lib/pindo/module/build/version_helper.rb
440
+ - lib/pindo/module/cert/cert_helper.rb
441
+ - lib/pindo/module/cert/keychain_helper.rb
442
+ - lib/pindo/module/cert/pem_helper.rb
443
+ - lib/pindo/module/cert/provisioning_helper.rb
444
444
  - lib/pindo/module/cert/xcodecerthelper.rb
445
445
  - lib/pindo/module/pgyer/pgyerhelper.rb
446
- - lib/pindo/module/unity/nugethelper.rb
446
+ - lib/pindo/module/unity/nuget_helper.rb
447
+ - lib/pindo/module/unity/unity_helper.rb
447
448
  - lib/pindo/module/webserver/brotli_file_handler.rb
448
449
  - lib/pindo/module/webserver/preview/preview.css
449
450
  - lib/pindo/module/webserver/preview/preview.html
@@ -451,13 +452,13 @@ files:
451
452
  - lib/pindo/module/webserver/responsive_preview_handler.rb
452
453
  - lib/pindo/module/webserver/webgl_page_handler.rb
453
454
  - lib/pindo/module/webserver/webgl_server_helper.rb
455
+ - lib/pindo/module/xcode/res/xcode_res_constant.rb
456
+ - lib/pindo/module/xcode/res/xcode_res_handler.rb
457
+ - lib/pindo/module/xcode/xcode_build_config.rb
458
+ - lib/pindo/module/xcode/xcode_build_helper.rb
459
+ - lib/pindo/module/xcode/xcode_project_helper.rb
460
+ - lib/pindo/module/xcode/xcode_res_helper.rb
454
461
  - lib/pindo/module/xcode/xcodeappconfig.rb
455
- - lib/pindo/module/xcode/xcodebuildconfig.rb
456
- - lib/pindo/module/xcode/xcodebuildhelper.rb
457
- - lib/pindo/module/xcode/xcodehelper.rb
458
- - lib/pindo/module/xcode/xcoderesconstant.rb
459
- - lib/pindo/module/xcode/xcodereshandler.rb
460
- - lib/pindo/module/xcode/xcodereshelper.rb
461
462
  - lib/pindo/options/appconfigoptions.rb
462
463
  - lib/pindo/options/deployoptions.rb
463
464
  - lib/pindo/version.rb