pindo 5.5.8 → 5.6.2

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.
@@ -1,6 +1,8 @@
1
1
  require 'open3'
2
2
  require 'json'
3
3
  require 'singleton'
4
+ require 'pindo/base/funlog'
5
+ require 'pindo/config/pindoconfig'
4
6
 
5
7
  # 定义Informative异常类
6
8
  class Informative < StandardError; end
@@ -380,17 +382,95 @@ module Pindo
380
382
  end
381
383
  end
382
384
 
385
+ # 比较版本号 (语义化版本比较)
386
+ # 返回: true 如果 v1 < v2, false 否则
387
+ def version_less_than?(v1, v2)
388
+ return false if v1.nil? || v2.nil?
389
+
390
+ Gem::Version.new(v1) < Gem::Version.new(v2)
391
+ rescue ArgumentError
392
+ # 版本格式无效时的降级处理
393
+ v1.to_s < v2.to_s
394
+ end
395
+
396
+ # 检查 GoodUnityBuild 版本是否满足要求
397
+ def check_goodunitybuild_version(unity_exe_full_path, project_path)
398
+ library_version = get_library_version(unity_exe_full_path: unity_exe_full_path, project_path: project_path)
399
+
400
+ return unless library_version
401
+
402
+ required_version = Pindoconfig.instance.pindo_user_config_json["goodunitybuild_version"]
403
+
404
+ puts "当前使用的 GoodUnityBuild 版本: #{library_version}"
405
+ puts "要求的 GoodUnityBuild 最底版本: #{required_version}"
406
+
407
+ return unless required_version
408
+
409
+ if version_less_than?(library_version, required_version)
410
+ raise Informative, <<~MSG
411
+ GoodUnityBuild 版本过低!
412
+ 当前版本: #{library_version}
413
+ 要求版本: #{required_version}
414
+ 请更新 GoodUnityBuild 库到 #{required_version} 或更高版本
415
+ MSG
416
+ end
417
+ rescue Informative
418
+ raise
419
+ rescue => e
420
+ puts "GoodUnityBuild 库版本检查失败: #{e.message}"
421
+ end
422
+
423
+ # 获取 GoodUnityBuild 库版本
424
+ def get_library_version(unity_exe_full_path:, project_path:)
425
+ cmd_args = [
426
+ unity_exe_full_path,
427
+ "-batchmode",
428
+ "-quit",
429
+ "-projectPath",
430
+ project_path.to_s,
431
+ "-executeMethod",
432
+ "GoodUnityBuild.BuildManager.PrintLibraryVersion"
433
+ ]
434
+
435
+ stdout_str, _, _ = Open3.capture3(*cmd_args)
436
+
437
+ # 尝试多种模式匹配版本号
438
+ patterns = [
439
+ /GoodUnityBuild Version:\s*(\d+\.\d+\.\d+)/i,
440
+ /\[GoodUnityBuild\]\s+Version\s+(\d+\.\d+\.\d+)/i
441
+ ]
442
+
443
+ patterns.each do |pattern|
444
+ if match = stdout_str.match(pattern)
445
+ return match[1]
446
+ end
447
+ end
448
+
449
+ # 从文件读取作为备用方案
450
+ version_file = File.join(project_path, "Logs", "GoodUnityBuild_version.txt")
451
+ if File.exist?(version_file)
452
+ content = File.read(version_file).strip
453
+ return content[/(\d+\.\d+\.\d+)/, 1]
454
+ end
455
+
456
+ nil
457
+ rescue => e
458
+ nil
459
+ end
383
460
 
384
461
  def build_project(unity_exe_full_path:nil, project_path:nil, platform: nil, isLibrary: false)
385
462
 
386
463
  # 检查是否有Unity进程在运行,传入Unity路径和项目路径以精确匹配
387
464
  check_unity_processes(unity_exe_full_path: unity_exe_full_path, project_path: project_path)
388
465
 
466
+ # 检查 GoodUnityBuild 库版本
467
+ check_goodunitybuild_version(unity_exe_full_path, project_path)
468
+
389
469
  additional_args = {}
390
470
  additional_args[:platform] = platform if platform
391
471
  additional_args[:buildtype] = 'library' if isLibrary
392
472
 
393
- # 首先尝试使用GoodUnityBuild.BuildManager.BatchBuild
473
+ # 使用GoodUnityBuild.BuildManager.BatchBuild进行构建
394
474
  result = execute_unity_command(unity_exe_full_path, project_path, additional_args)
395
475
 
396
476
  if result[:success]
@@ -56,6 +56,14 @@ module Pindo
56
56
  upload_proj_name = @proj_name
57
57
  end
58
58
 
59
+ # 检查环境变量
60
+ env_project_name = ENV['PINDO_PROJECT_NAME']
61
+ if env_project_name && !env_project_name.empty?
62
+ upload_proj_name = env_project_name
63
+ puts "\n使用环境变量指定的项目名称: #{upload_proj_name}"
64
+ puts
65
+ end
66
+
59
67
  app_info_obj = nil
60
68
  if login
61
69
 
@@ -64,6 +72,12 @@ module Pindo
64
72
  end
65
73
 
66
74
  if !app_info_obj.nil?
75
+ # 如果使用环境变量找到了项目,保存到缓存
76
+ if env_project_name && !env_project_name.empty?
77
+ require_relative '../../base/pindocontext'
78
+ context = Pindo::PindoContext.instance
79
+ context.set_selection(Pindo::PindoContext::SelectionKey::PROJECT_NAME, upload_proj_name)
80
+ end
67
81
  return app_info_obj
68
82
  end
69
83
 
@@ -110,18 +124,21 @@ module Pindo
110
124
  proj_name_array.uniq
111
125
  proj_name_array << "自定义输入Pyger上的App代号"
112
126
 
113
- # 检查缓存的 App Key
114
- require_relative '../../base/pindocontext'
115
- context = Pindo::PindoContext.instance
116
- cached_app_key = context.get_selection(Pindo::PindoContext::SelectionKey::PROJECT_NAME)
117
-
118
- if cached_app_key && proj_name_array.include?(cached_app_key)
119
- puts "\n使用之前选择的App代号: #{cached_app_key}"
120
- upload_proj_name = cached_app_key
121
- # 直接使用缓存的选择,跳过后续选择逻辑
127
+ # 如果环境变量已经设置了项目名,跳过选择逻辑
128
+ if !(env_project_name && !env_project_name.empty?)
129
+ # 检查缓存的 App Key
130
+ require_relative '../../base/pindocontext'
131
+ context = Pindo::PindoContext.instance
132
+ cached_app_key = context.get_selection(Pindo::PindoContext::SelectionKey::PROJECT_NAME)
133
+
134
+ if cached_app_key && proj_name_array.include?(cached_app_key)
135
+ puts "\n使用之前选择的App代号: #{cached_app_key}"
136
+ upload_proj_name = cached_app_key
137
+ # 直接使用缓存的选择,跳过后续选择逻辑
138
+ end
122
139
  end
123
140
 
124
- # 只有在没有缓存或缓存无效时才显示选择菜单
141
+ # 只有在没有缓存或缓存无效,且没有环境变量时才显示选择菜单
125
142
  if upload_proj_name.nil? || upload_proj_name.empty?
126
143
  if proj_name_array.size > 1
127
144
  cli = HighLine.new
@@ -283,7 +300,6 @@ module Pindo
283
300
  # aws_client = AWSS3Client.new
284
301
  aws_client = JPSClient::UploadClient.new(@pgyer_client)
285
302
  upload_res = aws_client.upload_file(binary_file:ipa_file_upload)
286
- puts upload_res
287
303
  attach_key_url = nil
288
304
  attachFileUrls = []
289
305
 
data/lib/pindo/version.rb CHANGED
@@ -6,7 +6,7 @@ require 'time'
6
6
 
7
7
  module Pindo
8
8
 
9
- VERSION = "5.5.8"
9
+ VERSION = "5.6.2"
10
10
 
11
11
  class VersionCheck
12
12
  RUBYGEMS_API = 'https://rubygems.org/api/v1/gems/pindo.json'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pindo
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.8
4
+ version: 5.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - wade
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-09-29 00:00:00.000000000 Z
10
+ date: 2025-10-05 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: claide
@@ -115,20 +115,20 @@ dependencies:
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 1.0.0
118
+ version: '1.2'
119
119
  - - ">="
120
120
  - !ruby/object:Gem::Version
121
- version: 1.0.0
121
+ version: 1.2.0
122
122
  type: :runtime
123
123
  prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
125
125
  requirements:
126
126
  - - "~>"
127
127
  - !ruby/object:Gem::Version
128
- version: 1.0.0
128
+ version: '1.2'
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: 1.0.0
131
+ version: 1.2.0
132
132
  - !ruby/object:Gem::Dependency
133
133
  name: rqrcode
134
134
  requirement: !ruby/object:Gem::Requirement