pindo 5.19.2 → 5.19.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: 68c6a51d50dad94212ebaf6360ce8a9f6a196b30aaf98a98e2114875ed6c0984
4
- data.tar.gz: 34d0ca5bf09f50c5c3d2d25fa48cf761f526bd15381c57fca95c6b73567a41c1
3
+ metadata.gz: 5a77caec349df71376df7ea433567423ae745f767297fb29377e265f123b63d8
4
+ data.tar.gz: 5f8040b7e13937405b635906ad34dcd4466af83292d65b823968d22fce9f3081
5
5
  SHA512:
6
- metadata.gz: 7318ecbfadf6b0bee7febebff7f35e289984049f37b95760722abed6a59cc497b58f3fcb6786566a0f0ea71688da5434fc1c139cd68905f8b24dd326628a2187
7
- data.tar.gz: c08a9a8fc36bdbe9850bff8601c1d4da3a371466fa2c7b95c24cdcdcbe9fa4e059d12e3cd692a7491c15f6faa7d5cbaac3f73b855b0b69470790a5c72e184f56
6
+ metadata.gz: 9fb90c4d057aab583df7780e4e8880c47507da9c64f9b05dfb48b778c87ae1695cf33711c6b777ad6540284f97a101ba5c28f10e8d6a91dfc6243b6a4a25843f
7
+ data.tar.gz: 57f746e6f8a01dcebab6615d1e30de5d7b6a1eb2b221bf8db50a10c66a0aab240279064b86f89bef7e0ccace8186eaf87da42a008a2f50f2a403f0d5ee5ec593
@@ -38,6 +38,11 @@ module Pindo
38
38
 
39
39
  $ pindo unity packbuild --ver-inc=patch # 打包并增加修订版本号
40
40
 
41
+ $ pindo unity packbuild --force # 非交互:自动确认版本号(CI 用)
42
+
43
+ # 等价于 --force,便于 CI 环境变量注入
44
+ $ PINDO_AUTO_CONFIRM=1 pindo unity packbuild
45
+
41
46
  DESC
42
47
 
43
48
  def self.arguments
@@ -46,7 +51,10 @@ module Pindo
46
51
 
47
52
  # 定义此命令使用的参数项
48
53
  def self.option_items
49
- @option_items ||= Pindo::Options::GitOptions.all
54
+ @option_items ||= Pindo::Options::OptionGroup.merge(
55
+ Pindo::Options::GitOptions.all,
56
+ Pindo::Options::CommonOptions.select(:force)
57
+ )
50
58
  end
51
59
 
52
60
  def self.options
@@ -55,20 +63,24 @@ module Pindo
55
63
 
56
64
  def initialize(argv)
57
65
  @options = initialize_options(argv)
58
-
66
+
59
67
  # Git 参数
60
68
  @args_release_branch = @options[:release_branch] || 'master'
61
69
  @args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
62
70
  @args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
63
71
  @args_tag_pre = @options[:tag_pre] || 'v'
64
72
 
73
+ # 非交互:--force 或 PINDO_AUTO_CONFIRM 时自动确认版本号,不弹询问
74
+ @force_flag = @options[:force] || false
75
+
65
76
  super
66
77
  end
67
78
 
68
79
  def run
69
80
  package_dir = Dir.pwd
70
81
  # 1. Git 提交任务 (确保工作区干净,或提交预构建更改)
71
- # 默认自动提交(packbuild 场景需要确保代码已提交)
82
+ # packbuild 会自动生成 Release Notes 并需提交,因此始终非交互、默认强制提交(不弹菜单);
83
+ # 选非 commit 会导致生成的 Release Notes 不被提交、tag 与内容不一致,故不开放交互菜单。
72
84
  git_commit_opt = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit]) || Pindo::UncommittedFilesProcessType::COMMIT
73
85
 
74
86
  process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
@@ -117,7 +129,10 @@ module Pindo
117
129
  # Tag 不存在或不在 HEAD,需要用户确认
118
130
  puts ""
119
131
  puts "即将编译 NuGet Package 的版本是 #{q.yellow}"
120
- if agree("确认是否继续? (Y/n)")
132
+ if non_interactive?
133
+ puts "自动确认版本号: #{q.yellow}(--force / PINDO_AUTO_CONFIRM)"
134
+ confirmed_version = q
135
+ elsif agree("确认是否继续? (Y/n)")
121
136
  confirmed_version = q
122
137
  else
123
138
  puts ""
@@ -208,6 +223,13 @@ module Pindo
208
223
  end
209
224
  end
210
225
 
226
+ private
227
+
228
+ # 是否非交互模式:--force 参数或 PINDO_AUTO_CONFIRM 环境变量
229
+ def non_interactive?
230
+ @force_flag || (ENV['PINDO_AUTO_CONFIRM'] && !ENV['PINDO_AUTO_CONFIRM'].empty?)
231
+ end
232
+
211
233
  end
212
234
  end
213
235
  end
@@ -40,6 +40,9 @@ module Pindo
40
40
 
41
41
  # 批量上传(Shell 脚本)
42
42
  $ for file in *.nupkg; do pindo unity packpush --force "$file"; done
43
+
44
+ # 等价于 --force,便于 CI 环境变量注入
45
+ $ PINDO_AUTO_CONFIRM=1 pindo unity packpush
43
46
  DESC
44
47
 
45
48
  def self.arguments
@@ -90,7 +93,8 @@ module Pindo
90
93
  @args_nupkg_file = Pindo::Unity::NugetHelper.find_nupkg_file(package_dir)
91
94
 
92
95
  # 如果没有找到文件,让用户手动输入
93
- if @args_nupkg_file.nil? || !File.exist?(@args_nupkg_file)
96
+ # 非交互(--force / PINDO_AUTO_CONFIRM)时不询问,直接进入后续报错,避免 CI 卡住
97
+ if !non_interactive? && (@args_nupkg_file.nil? || !File.exist?(@args_nupkg_file))
94
98
  @args_nupkg_file = ask('需要上传的文件:') || nil
95
99
  if @args_nupkg_file
96
100
  @args_nupkg_file = @args_nupkg_file.strip.gsub(/\\ /, ' ')
@@ -126,14 +130,12 @@ module Pindo
126
130
  # 检查是否需要跳过确认
127
131
  # 支持两种方式:
128
132
  # 1. --force 参数
129
- # 2. NUGET_UPLOAD_FORCE 环境变量
130
- force_upload = @force_flag || (ENV['NUGET_UPLOAD_FORCE'] && !ENV['NUGET_UPLOAD_FORCE'].empty?)
131
-
132
- if force_upload
133
+ # 2. PINDO_AUTO_CONFIRM 环境变量
134
+ if non_interactive?
133
135
  if @force_flag
134
136
  puts "🚀 检测到 --force 参数,跳过确认直接上传..."
135
137
  else
136
- puts "🚀 检测到 NUGET_UPLOAD_FORCE 环境变量,跳过确认直接上传..."
138
+ puts "🚀 检测到 PINDO_AUTO_CONFIRM 环境变量,跳过确认直接上传..."
137
139
  end
138
140
  else
139
141
  # 确认上传
@@ -165,6 +167,11 @@ module Pindo
165
167
 
166
168
  private
167
169
 
170
+ # 是否非交互模式:--force 参数或 PINDO_AUTO_CONFIRM 环境变量
171
+ def non_interactive?
172
+ @force_flag || (ENV['PINDO_AUTO_CONFIRM'] && !ENV['PINDO_AUTO_CONFIRM'].empty?)
173
+ end
174
+
168
175
  # 获取包信息(用于确认显示)
169
176
  def get_package_info_for_upload(package_dir)
170
177
  # 优先从 .nuspec 文件读取
data/lib/pindo/version.rb CHANGED
@@ -6,7 +6,7 @@ require 'time'
6
6
 
7
7
  module Pindo
8
8
 
9
- VERSION = "5.19.2"
9
+ VERSION = "5.19.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.19.2
4
+ version: 5.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - wade