pindo 5.5.1 → 5.5.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: e7216e7a8f2c6ecb513af66ce6c9af8243a0bf44bb8c30da88f72cf54071c045
4
- data.tar.gz: 851f40c6daea10f4e900ff7e284d375841d9526ce62244bb5620eda7be188239
3
+ metadata.gz: 698722ba7d446bce8be6df5d15039b7c1528349d6d43ab95db8224a0baf2743c
4
+ data.tar.gz: 56f32768dfdde34bf203c2529a31bb2454e2612a29e2e9a1a165634d586157db
5
5
  SHA512:
6
- metadata.gz: bf176d3955cf177f0e587792d12aaf48d886d4febf59a87fa194f01c07ebaece91834b3aece211eca8dde2351a354371dff2a0f1bf976060213b8153d1ecfb55
7
- data.tar.gz: b57c2269d259384cccffd35be8b728e17bb52f8221b807148bbb3dfa29e4e381fdbd5c3caca3e3d68b3e512488c74d0566619421de2a689036028e6fe9a3f7ea
6
+ metadata.gz: 81add8a3f5b1fd16f6746bcea99e3ca2a7d6bb65c7d0f58b7eca0c03a9fc88a42adc8401dda0ffd7200a7daafab28aa4065c4e14447016861ae94f99da341e14
7
+ data.tar.gz: 20228ff9d9c68f846c442d35e7fc96e011f3e9c501ad95db2130c7212a624fe082c395a7f282b007eed88fcd5a9ee4300566fbbf579b1d6ecf3d451e1c679ce6
@@ -217,6 +217,20 @@ module Pindo
217
217
 
218
218
  private
219
219
 
220
+ # 递归将Hash的键从字符串转换为符号
221
+ def symbolize_keys(obj)
222
+ case obj
223
+ when Hash
224
+ obj.each_with_object({}) do |(key, value), result|
225
+ result[key.to_sym] = symbolize_keys(value)
226
+ end
227
+ when Array
228
+ obj.map { |item| symbolize_keys(item) }
229
+ else
230
+ obj
231
+ end
232
+ end
233
+
220
234
  # 确保缓存目录存在
221
235
  def ensure_cache_dir
222
236
  cache_dir = File.expand_path('~/.pindo/cache')
@@ -306,7 +320,7 @@ module Pindo
306
320
  @memory_selections[proj_path][cmd] ||= {}
307
321
  selections.each do |key, value|
308
322
  symbol_key = key.to_sym
309
- @memory_selections[proj_path][cmd][symbol_key] = value
323
+ @memory_selections[proj_path][cmd][symbol_key] = symbolize_keys(value)
310
324
  end
311
325
  end
312
326
  end
@@ -332,7 +346,7 @@ module Pindo
332
346
  @memory_selections[proj_path][cmd] ||= {}
333
347
  selections.each do |key, value|
334
348
  symbol_key = key.to_sym
335
- @memory_selections[proj_path][cmd][symbol_key] = value
349
+ @memory_selections[proj_path][cmd][symbol_key] = symbolize_keys(value)
336
350
  end
337
351
  end
338
352
  end
@@ -133,7 +133,7 @@ module Pindo
133
133
  Funlog.instance.fancyinfo_start("开始合并到#{release_branch}分支")
134
134
  if !coding_branch.eql?(release_branch)
135
135
  coding_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{coding_branch})).strip
136
- release_branch_commit_id = "111"
136
+ release_branch_commit_id = nil
137
137
 
138
138
  if remote_branch_exists?(local_repo_dir: current_project_dir, branch: release_branch)
139
139
  Funlog.instance.fancyinfo_update("存在#{release_branch}远程分支")
@@ -141,7 +141,6 @@ module Pindo
141
141
  Funlog.instance.fancyinfo_update("存在#{release_branch}本地分支")
142
142
  git!(%W(-C #{current_project_dir} checkout #{release_branch}))
143
143
  else
144
- Funlog.instance.fancyinfo_update("存在#{release_branch}远程分支")
145
144
  Funlog.instance.fancyinfo_update("不存在#{release_branch}本地分支")
146
145
  git!(%W(-C #{current_project_dir} checkout -b #{release_branch} origin/#{release_branch}))
147
146
  end
@@ -150,8 +149,10 @@ module Pindo
150
149
  git!(%W(-C #{current_project_dir} fetch origin #{release_branch}))
151
150
  git!(%W(-C #{current_project_dir} merge origin/#{release_branch}))
152
151
 
153
- res_data = Executable.capture_command('git', %W(merge #{coding_branch}), :capture => :out)
152
+ # 执行合并操作,捕获输出以便后续检查冲突
153
+ stdout, exit_status = Executable.capture_command('git', %W(-C #{current_project_dir} merge #{coding_branch}), :capture => :out)
154
154
 
155
+ # 检查是否有冲突(git merge 在有冲突时返回非0状态)
155
156
  conflict_filelist = git!(%W(-C #{current_project_dir} diff --name-only --diff-filter=U --relative))
156
157
  if !conflict_filelist.nil? && conflict_filelist.size > 0
157
158
  puts "合并代码冲突, 冲突文件如下:"
@@ -159,7 +160,14 @@ module Pindo
159
160
  else
160
161
  git!(%W(-C #{current_project_dir} push))
161
162
  Funlog.instance.fancyinfo_success("代码已经合并到#{release_branch}分支")
162
- release_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{release_branch})).strip
163
+ # 获取 release_branch commit ID(处理空分支情况)
164
+ begin
165
+ release_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{release_branch})).strip
166
+ rescue => e
167
+ # 分支可能存在但没有提交(空分支),此时使用 coding_branch 的 commit
168
+ Funlog.instance.fancyinfo_update("#{release_branch}分支为空或获取commit失败,将使用当前分支commit")
169
+ release_branch_commit_id = coding_branch_commit_id
170
+ end
163
171
  end
164
172
 
165
173
  else
@@ -180,14 +188,22 @@ module Pindo
180
188
  git!(%W(-C #{current_project_dir} branch --set-upstream-to=origin/#{release_branch} #{release_branch}))
181
189
 
182
190
  Funlog.instance.fancyinfo_success("代码已经合并到#{release_branch}分支")
183
- release_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{release_branch})).strip
191
+ # 获取 release_branch commit ID(处理空分支情况)
192
+ begin
193
+ release_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{release_branch})).strip
194
+ rescue => e
195
+ # 新创建的分支,commit ID 应该与 coding_branch 相同
196
+ release_branch_commit_id = coding_branch_commit_id
197
+ end
184
198
  end
185
199
 
186
200
  git!(%W(-C #{current_project_dir} checkout #{coding_branch}))
187
- if !release_branch_commit_id.eql?(coding_branch_commit_id)
201
+ if release_branch_commit_id && !release_branch_commit_id.eql?(coding_branch_commit_id)
188
202
  git!(%W(-C #{current_project_dir} merge #{release_branch}))
189
203
  Funlog.instance.fancyinfo_success("已将#{release_branch}合并到#{coding_branch}")
190
204
  end
205
+ git!(%W(-C #{current_project_dir} push origin #{coding_branch}))
206
+ Funlog.instance.fancyinfo_success("已推送#{coding_branch}分支到远程")
191
207
  else
192
208
  Funlog.instance.fancyinfo_success("代码处于#{coding_branch}分支,无需合并")
193
209
  end
@@ -138,20 +138,24 @@ module Pindo
138
138
  latest_tag = get_latest_version_tag(project_dir: current_git_root_path)
139
139
 
140
140
  unless is_tag_at_head?(git_root_dir: current_git_root_path, tag_name: latest_tag)
141
- if auto_mode || !$stdin.tty?
141
+ if auto_mode
142
142
  # 在自动化模式或没有交互式终端时,默认选择新增版本号打新Tag
143
143
  puts "检测到当前代码没有打Tag,在自动模式下将自动新增版本号并打新Tag"
144
144
  tag_action_parms = []
145
- is_need_add_tag = false
145
+ is_need_add_tag = true # 自动模式下需要打tag
146
146
  else
147
147
  # 检查是否已有用户选择
148
148
  context = PindoContext.instance
149
149
  build_helper = BuildHelper.share_instance
150
150
  # 优先从持久化缓存读取,如果没有则从内存临时缓存读取
151
- cached_decision = context.get_selection(PindoContext::SelectionKey::TAG_DECISION) ||
152
- build_helper.temp_tag_decision
151
+ cached_decision = context.get_selection(PindoContext::SelectionKey::TAG_DECISION)
153
152
 
154
- if cached_decision
153
+ # 只有当持久化缓存中确实不存在该键时,才从临时缓存读取
154
+ if cached_decision.nil? && !context.has_selection?(PindoContext::SelectionKey::TAG_DECISION)
155
+ cached_decision = build_helper.temp_tag_decision
156
+ end
157
+
158
+ if cached_decision && cached_decision.is_a?(Hash)
155
159
  # 使用之前的选择
156
160
  puts "\n使用之前的选择:#{cached_decision[:description]}"
157
161
  tag_action_parms = cached_decision[:tag_action_parms]
@@ -172,6 +176,7 @@ module Pindo
172
176
  tag_action_parms = []
173
177
  selected_action = :new_tag
174
178
  selected_description = "新增版本号,打新Tag"
179
+ is_need_add_tag = true # 明确设置需要打tag
175
180
  :new_tag
176
181
  },
177
182
  "将上次的Tag删除重新打Tag" => -> {
@@ -179,17 +184,22 @@ module Pindo
179
184
  tag_action_parms << "--retag"
180
185
  selected_action = :recreate_tag
181
186
  selected_description = "将上次的Tag删除重新打Tag"
187
+ is_need_add_tag = true # 明确设置需要打tag
182
188
  :recreate_tag
183
189
  },
184
190
  "不需要Tag继续编译且上传,手动修改上传备注" => -> {
185
191
  puts ""
192
+ tag_action_parms = nil # 明确设置为nil
186
193
  selected_action = :continue_without_tag
187
194
  selected_description = "不需要Tag继续编译且上传"
195
+ is_need_add_tag = false # 明确设置不需要打tag
188
196
  :continue_without_tag
189
197
  },
190
198
  "终止退出编译" => -> {
199
+ tag_action_parms = nil # 明确设置为nil
191
200
  selected_action = :exit
192
201
  selected_description = "终止退出编译"
202
+ is_need_add_tag = false # 明确设置不需要打tag
193
203
  raise Informative, "终止退出编译!"
194
204
  :exit
195
205
  }
@@ -203,7 +213,7 @@ module Pindo
203
213
  end
204
214
  end
205
215
 
206
- is_need_add_tag = !tag_action_parms.nil?
216
+ # is_need_add_tag 已在各个选项中明确设置,无需重新计算
207
217
 
208
218
  # 保存用户选择
209
219
  build_helper = BuildHelper.share_instance
data/lib/pindo/version.rb CHANGED
@@ -6,7 +6,7 @@ require 'time'
6
6
 
7
7
  module Pindo
8
8
 
9
- VERSION = "5.5.1"
9
+ VERSION = "5.5.3"
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.1
4
+ version: 5.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - wade
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-09-23 00:00:00.000000000 Z
10
+ date: 2025-09-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: claide