pindo 5.14.1 → 5.14.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fd889646d73c13ab0b424a1c13d6b902a3ceefb0a2fd74e7d435af8ca3d7a62
4
- data.tar.gz: 2c43d4e6ece3b7d8597c55b34a72c6d9268031194bf6a7de6cc4b59ee59791d1
3
+ metadata.gz: e97032afdd7d590fd621e5c599145d5396eb0467621d0f495f9066607b71099c
4
+ data.tar.gz: e91776711d62b11a4c2b93476a982dae863345165eaa686f5fbd218d757a6e25
5
5
  SHA512:
6
- metadata.gz: a935ffba48d488c04b601db1e19cbe77c9f0653c5b9c9bf3ca7f6505a45e1b103f95f96e276d0697c9bbc0dae42344b820eb26a8a6108ee00ea33b45a70ce416
7
- data.tar.gz: 552010fc0badbe0072bc3262a57b7387e2b1640429cbd1fa3c0f1273d2ac219926f2b0c25b6e0cfc0d940ebf8b76bb4f573a36cd02abc266b9d1447c1a91132b
6
+ metadata.gz: 2d1ed6b1532c44638f7e257fb38f4bb73474d9abebe20c3ccb31b8ac1d4ae6bfd018ff6c42cf7df78127e3ca0e8493f6eecb0480a4ba4e86c52c3b6050a3a9a6
7
+ data.tar.gz: 18b0f536893c80cf362bb8f583e74f1bde122dc77a8da80e4e2c202187b8932dbc378c8bb6d5138e5a8e6068efb91235a515d1e5a313b4956467a9f9da115b11
@@ -787,13 +787,14 @@ module Pindo
787
787
  # 获取未提交文件的处理方式
788
788
  # @param project_dir [String] 项目目录路径
789
789
  # @param interactive [Boolean] 是否允许交互,默认为 true
790
+ # @param default_process_type [String] 当没有未提交文件时的默认处理方式,默认为 'skip'
790
791
  # @return [String] 处理方式 ('commit', 'skip', 'reset', 'stash', 'exit')
791
- def get_uncommitted_files_process_type(project_dir:, interactive: true)
792
+ def get_uncommitted_files_process_type(project_dir:, interactive: true, default_process_type: 'skip')
792
793
  # 1. 检查是否有未提交的文件
793
794
  uncommitted_files = get_uncommitted_files(project_dir: project_dir)
794
795
 
795
- # 2. 如果没有未提交的文件,默认跳过
796
- return 'skip' if uncommitted_files.nil? || uncommitted_files.empty?
796
+ # 2. 如果没有未提交的文件,返回默认处理方式
797
+ return default_process_type if uncommitted_files.nil? || uncommitted_files.empty?
797
798
 
798
799
  # 3. 如果非交互模式,默认跳过
799
800
  unless interactive
@@ -7,6 +7,7 @@ require 'pindo/module/build/git_repo_helper'
7
7
  require 'pindo/module/build/build_helper'
8
8
  require 'pindo/module/task/task_manager'
9
9
  require 'pindo/module/task/model/jps/jps_upload_task'
10
+ require 'pindo/module/task/model/jps/jps_message_task'
10
11
  require 'pindo/module/task/model/git/git_commit_task'
11
12
  require 'pindo/options/options'
12
13
 
@@ -186,6 +187,18 @@ module Pindo
186
187
  end
187
188
  tasks.concat(upload_tasks)
188
189
 
190
+ # 3. 为每个上传任务创建对应的消息任务
191
+ upload_tasks.each do |upload_task|
192
+ message_task = Pindo::TaskSystem::JPSMessageTask.new(
193
+ nil, # app_version_info 为 nil,从 upload_task 依赖任务获取
194
+ app_info_obj: upload_task.app_info_obj,
195
+ project_name: @args_proj_name,
196
+ send_message_type: @args_send_flag ? 'group' : 'self',
197
+ dependencies: [upload_task.id] # 依赖对应的上传任务
198
+ )
199
+ tasks << message_task
200
+ end
201
+
189
202
  tasks
190
203
  end
191
204
 
@@ -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
@@ -66,6 +66,14 @@ module Pindo
66
66
 
67
67
  def run
68
68
  package_dir = Dir.pwd
69
+ # 1. Git 提交任务 (确保工作区干净,或提交预构建更改)
70
+ # 交互式询问用户如何处理未提交文件
71
+ process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
72
+ project_dir: package_dir,
73
+ interactive: true,
74
+ default_process_type: 'commit'
75
+ )
76
+
69
77
 
70
78
  Funlog.instance.fancyinfo_start("Unity Package 打包流程")
71
79
 
@@ -75,6 +83,7 @@ module Pindo
75
83
 
76
84
  tasks = []
77
85
 
86
+
78
87
  # 0. 预检查:获取并确认版本号
79
88
  # 先执行初始化检查以确保文件存在
80
89
  Pindo::Unity::NugetHelper.nuget_init(package_dir)
@@ -85,23 +94,36 @@ module Pindo
85
94
  end
86
95
 
87
96
  nuspec_info = Pindo::Unity::NugetHelper.parse_nuspec(nuspec_file)
88
- current_version = nuspec_info['version']
97
+ q = nuspec_info['version']
89
98
 
90
- puts ""
91
- puts "即将编译 NuGet Package 的版本是 #{current_version.yellow}"
92
- if agree("确认是否继续? (Y/n)")
93
- confirmed_version = current_version
99
+ # 检查 tag 是否已存在且指向当前 HEAD
100
+ tag_name = "#{@args_tag_pre}#{q}"
101
+ tag_at_head = Pindo::GitHandler.local_tag_exists?(local_repo_dir: package_dir, tag_name: tag_name) &&
102
+ Pindo::GitHandler.is_tag_at_head?(git_root_dir: package_dir, tag_name: tag_name)
103
+
104
+ if tag_at_head
105
+ # Tag 已存在且指向 HEAD,直接使用该版本号,不需要确认
106
+ confirmed_version = q
107
+ puts ""
108
+ Funlog.instance.fancyinfo_update("检测到 tag #{tag_name} 已存在并指向当前 HEAD,直接使用版本号: #{q.yellow}")
94
109
  else
110
+ # Tag 不存在或不在 HEAD,需要用户确认
95
111
  puts ""
96
- confirmed_version = ask("请输入新的打包版本号: ") { |q| q.required = true }.to_s.strip
97
- end
98
-
99
- if confirmed_version.empty?
100
- raise Informative, "版本号不能为空"
112
+ puts "即将编译 NuGet Package 的版本是 #{q.yellow}"
113
+ if agree("确认是否继续? (Y/n)")
114
+ confirmed_version = q
115
+ else
116
+ puts ""
117
+ confirmed_version = ask("请输入新的打包版本号: ") { |q| q.required = true }.to_s.strip
118
+ end
119
+
120
+ if confirmed_version.empty?
121
+ raise Informative, "版本号不能为空"
122
+ end
101
123
  end
102
124
 
103
125
  # 更新 .nuspec 和 package.json 中的版本号(如果用户修改了)
104
- if confirmed_version != current_version
126
+ if confirmed_version != q
105
127
  Funlog.instance.fancyinfo_update("更新配置文件版本号: #{confirmed_version}")
106
128
  # 这里我们需要手动更新一下,因为 GitCommitTask 只是提交,不负责改文件内容
107
129
  # update_package_json_from_nuspec 会用到 nuspec_info,我们先更新 nuspec_info
@@ -124,13 +146,19 @@ module Pindo
124
146
  Funlog.instance.fancyinfo_success("版本号已更新")
125
147
  end
126
148
 
127
- # 1. Git 提交任务 (确保工作区干净,或提交预构建更改)
128
- # 交互式询问用户如何处理未提交文件
129
- process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
130
- project_dir: package_dir,
131
- interactive: true
132
- )
133
-
149
+ # 生成 Release Notes (在 Git 提交之前,以便自动提交生成的文件)
150
+ puts ""
151
+ Funlog.instance.fancyinfo_start("生成 #{confirmed_version} 版本 Release Notes")
152
+ release_notes = Pindo::Unity::NugetHelper.generate_release_notes_from_git(package_dir, nuspec_version: confirmed_version)
153
+
154
+ if release_notes && !release_notes.empty?
155
+ Pindo::Unity::NugetHelper.update_nuspec_release_notes(nuspec_file, release_notes)
156
+ Funlog.instance.fancyinfo_success("已更新 .nuspec 的 releaseNotes 字段")
157
+ else
158
+ Funlog.instance.fancyinfo_update("未生成 Release Notes,将使用 .nuspec 中已有的内容")
159
+ end
160
+
161
+
134
162
  git_commit_task = Pindo::TaskSystem::GitCommitTask.new(
135
163
  package_dir,
136
164
  release_branch: @args_release_branch,
@@ -138,7 +166,7 @@ module Pindo
138
166
  tag_type: @args_tag_type,
139
167
  tag_pre: @args_tag_pre,
140
168
  process_type: process_type,
141
- commit_message: "chore: nuget packbuild v#{confirmed_version}",
169
+ commit_message: "chore: packbuild 更新 v#{confirmed_version} Release Notes",
142
170
  fixed_version: confirmed_version # 传入确认后的版本号
143
171
  )
144
172
  tasks << git_commit_task
@@ -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")]
@@ -16,34 +16,17 @@ module Pindo
16
16
  def do_work
17
17
  puts
18
18
  puts "📦 [Task] 开始执行 Nuget 打包..."
19
-
20
- # 1. 初始化检查 (同步 package.json 和 .nuspec)
21
- puts "🔍 执行初始化检查..."
22
- Pindo::Unity::NugetHelper.nuget_init(@project_path)
23
- puts
24
19
 
25
- # 2. 获取 nuspec 文件
20
+ # 1. 获取 nuspec 文件 (初始化已在 packbuild 命令中完成)
26
21
  nuspec_file = Pindo::Unity::NugetHelper.find_nuspec_file(@project_path)
27
22
  unless nuspec_file
28
23
  raise Informative, "未找到 .nuspec 文件,打包无法继续"
29
24
  end
30
25
 
31
- # 3. 生成 Release Notes
32
- puts "📝 生成 Release Notes..."
33
- release_notes = Pindo::Unity::NugetHelper.generate_release_notes_from_git(@project_path)
34
-
35
- if release_notes && !release_notes.empty?
36
- Pindo::Unity::NugetHelper.update_nuspec_release_notes(nuspec_file, release_notes)
37
- puts "✅ 已更新 .nuspec 的 releaseNotes 字段"
38
- else
39
- puts "⚠️ 未生成 Release Notes,将使用 .nuspec 中已有的内容"
40
- end
41
- puts
42
-
43
- # 4. 执行打包
26
+ # 2. 执行打包 (Release Notes 已在 packbuild 命令中预先生成)
44
27
  nupkg_file = Pindo::Unity::NugetHelper.pack_nupkg(@project_path)
45
-
46
- # 5. 返回结果 (生成的 nupkg 文件路径)
28
+
29
+ # 3. 返回结果 (生成的 nupkg 文件路径)
47
30
  {
48
31
  nupkg_file: nupkg_file
49
32
  }
@@ -553,13 +553,8 @@ module Pindo
553
553
  # 生成 Release Notes(从 Git 提交历史)
554
554
  # ============================================
555
555
 
556
- def self.generate_release_notes_from_git(package_dir)
557
- # 获取 .nuspec 文件并解析版本(用于默认消息)
558
- nuspec_file = find_nuspec_file(package_dir)
559
- return nil if nuspec_file.nil?
560
-
561
- nuspec_info = parse_nuspec(nuspec_file)
562
- nuspec_version = nuspec_info['version']
556
+ def self.generate_release_notes_from_git(package_dir, nuspec_version:)
557
+ # 验证版本号参数
563
558
  return nil if nuspec_version.nil? || nuspec_version.empty?
564
559
 
565
560
  # 默认消息(带 feat: 标签)
@@ -664,8 +659,11 @@ module Pindo
664
659
  return default_message
665
660
  end
666
661
 
662
+ # 去重(避免重复的提交消息)
663
+ unique_commits = filtered_commits.uniq
664
+
667
665
  # 返回每条 commit,用换行分隔(不添加空行)
668
- filtered_commits.join("\n")
666
+ unique_commits.join("\n")
669
667
 
670
668
  rescue => e
671
669
  puts "⚠️ 生成 release notes 失败: #{e.message}"
data/lib/pindo/version.rb CHANGED
@@ -6,7 +6,7 @@ require 'time'
6
6
 
7
7
  module Pindo
8
8
 
9
- VERSION = "5.14.1"
9
+ VERSION = "5.14.3"
10
10
 
11
11
  class VersionCheck
12
12
  RUBYGEMS_API = 'https://rubygems.org/api/v1/gems/pindo.json'
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.14.1
4
+ version: 5.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - wade