pindo 5.13.4 → 5.13.6

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: 7b8f4e3397e7d22aee8dd0011d92a8eec9c7cfb8b51b3676a78e518b27c71b25
4
- data.tar.gz: e8eca26bbd129b1f561d09462f5dde5bedf5059172c711ec01da98427a19f446
3
+ metadata.gz: bdf43dd4c0b65e41d7ae75cfaafa4bb9446dbf0ab735e6179e03f09ff25e96d8
4
+ data.tar.gz: 781f6bc039fe30f66f9d024f5a0ffe498c969687ffb0053113d45464e13621f9
5
5
  SHA512:
6
- metadata.gz: 2b6e7699071cd70dff2f482105dd93dd3168a962a59b7b477ad4a359f191c0021612ae993d00a024dcf7f38dcd6875a39ef4670131a3c8948038d81d38dbc56c
7
- data.tar.gz: 20fa09db784a2894e3bc9119f9917a4431031e68fc365b3e77dff1e650b599bfcac8fc5b4914f2e3e87add02ffeec4319c815855fe9e0f77aa1da10288513e87
6
+ metadata.gz: ee0911513edf4360270825cf5ee938736b0aba41a0b89d0ad9fd6b1062c590b7594edd8258d3c245eee8f36f565c48056dc6e8119d7dcf84ce616751db76b705
7
+ data.tar.gz: 82d6558b35038c5f97ee2595947ad0afa080a184d079b0d86cea3590830b2d3d5ebd21d0c5be61f724474c853f5aa08073a45c8eec7c5dc84a844f5614b411a9
@@ -20,23 +20,25 @@ module Pindo
20
20
  unless password
21
21
  puts "\e[33m[DEBUG] Keychain中未找到密码,需要用户输入: #{server_name}\e[0m" if ENV['PINDO_DEBUG']
22
22
  password = FastlaneCore::Helper.ask_password(message: "请输入证书仓库的加密密码: ", confirm: true)
23
- # 尝试添加密码到Keychain,如果已存在则先删除再添加
23
+
24
+ # 尝试添加密码到Keychain
24
25
  begin
25
- # 先检查是否已存在,如果存在则删除
26
- existing_item = Security::InternetPassword.find(server: server_name)
27
- if existing_item
28
- # 重定向stderr到/dev/null来隐藏Keychain的详细输出
29
- system("security delete-internet-password -s '#{server_name}' 2>/dev/null")
26
+ # 先尝试删除旧密码(如果存在)
27
+ begin
28
+ Security::InternetPassword.delete(server: server_name)
30
29
  puts "\e[33m[DEBUG] 删除Keychain中的旧密码项: #{server_name}\e[0m" if ENV['PINDO_DEBUG']
30
+ rescue => delete_error
31
+ # 如果不存在就忽略删除错误
32
+ puts "\e[33m[DEBUG] 旧密码项不存在或删除失败: #{delete_error.message}\e[0m" if ENV['PINDO_DEBUG']
31
33
  end
32
-
33
- # 添加新密码,重定向stderr到/dev/null来隐藏Keychain的详细输出
34
- system("security add-internet-password -s '#{server_name}' -w '#{password}' 2>/dev/null")
35
- puts "\e[32m[DEBUG] 密码已保存到Keychain: #{server_name}\e[0m" if ENV['PINDO_DEBUG']
34
+
35
+ # 添加新密码到Keychain
36
+ Security::InternetPassword.add(server_name, "", password)
37
+ puts "\e[32m 密码已保存到Keychain: #{server_name}\e[0m"
36
38
  rescue => e
37
- # 忽略Keychain错误,继续使用密码
38
- # 错误信息可能包含 "already exists" 等,但不影响功能
39
- puts "\e[31m[DEBUG] Keychain操作错误: #{e.message}\e[0m" if ENV['PINDO_DEBUG']
39
+ # 如果保存失败,警告用户但不影响继续使用
40
+ puts "\e[31m⚠ 密码保存到Keychain失败: #{e.message}\e[0m"
41
+ puts "\e[31m 下次使用时需要重新输入密码\e[0m"
40
42
  end
41
43
  else
42
44
  puts "\e[32m[DEBUG] 从Keychain获取密码成功: #{server_name}\e[0m" if ENV['PINDO_DEBUG']
@@ -48,9 +48,15 @@ module Pindo
48
48
 
49
49
  * 支持自动增加版本号
50
50
 
51
+ * 支持位置参数(向后兼容)和选项参数两种格式
52
+
51
53
  使用示例:
52
54
 
53
- $ pindo appstore adhocbuild # 编译 AdHoc 包
55
+ $ pindo appstore adhocbuild # 使用当前目录的 config.json
56
+
57
+ $ pindo appstore adhocbuild com.example.app # 位置参数指定 Bundle ID(向后兼容)
58
+
59
+ $ pindo appstore adhocbuild --bundleid=com.example.app # 选项参数指定 Bundle ID
54
60
 
55
61
  $ pindo appstore adhocbuild --upload # 编译并上传到JPS
56
62
 
@@ -59,13 +65,11 @@ module Pindo
59
65
  $ pindo appstore adhocbuild --increase # 自动增加版本号
60
66
 
61
67
  $ pindo appstore adhocbuild --proj="My App" # 指定项目名称
62
-
63
- $ pindo appstore adhocbuild --bundleid=com.example.app # 指定 Bundle ID
64
68
  DESC
65
69
 
66
- # 命令的参数列表
70
+ # 定义位置参数(向后兼容)
67
71
  self.arguments = [
68
- # 暂无参数
72
+ CLAide::Argument.new('bundleid', true)
69
73
  ]
70
74
 
71
75
  # 定义此命令使用的参数项(类方法,避免重复定义)
@@ -96,11 +100,15 @@ module Pindo
96
100
  end
97
101
 
98
102
  def initialize(argv)
103
+ # 首先获取位置参数(向后兼容)
104
+ positional_bundleid = argv.shift_argument
105
+
99
106
  # 一行代码完成参数初始化(自动推导命令名、自动启用缓存)
100
107
  @options = initialize_options(argv)
101
108
 
102
109
  # 保存参数到实例变量
103
- @args_bundle_id = @options[:bundleid]
110
+ # 优先使用选项参数,如果没有则使用位置参数
111
+ @args_bundle_id = @options[:bundleid] || positional_bundleid
104
112
  @args_send_flag = @options[:send]
105
113
  # send 依赖 upload:如果指定了 send,自动启用 upload
106
114
  @args_upload_flag = @options[:send] || @options[:upload]
@@ -182,7 +190,9 @@ module Pindo
182
190
  puts "\n使用当前目录配置文件: #{config_file}"
183
191
  Pindo::IosConfigParser.instance.load_config(config_file: config_file)
184
192
  else
185
- raise Informative, "当前目录未找到 config.json 文件,请使用 --bundleid 参数指定 Bundle ID"
193
+ raise Informative, "当前目录未找到 config.json 文件,请使用以下方式指定 Bundle ID:\n" \
194
+ " 方式1: pindo appstore adhocbuild com.example.app\n" \
195
+ " 方式2: pindo appstore adhocbuild --bundleid=com.example.app"
186
196
  end
187
197
  end
188
198
  end
@@ -236,9 +246,7 @@ module Pindo
236
246
  project_path: ios_project_path,
237
247
  proj_name: @args_proj_name,
238
248
  upload: @args_upload_flag,
239
- send: @args_send_flag,
240
- app_info_obj: config[:app_info_obj],
241
- workflow_info: config[:workflow_info]
249
+ send: @args_send_flag
242
250
  }
243
251
  build_options[:bundle_id] = @args_bundle_id if @args_bundle_id
244
252
  build_options[:unity_root_path] = config[:project_path] if is_unity
@@ -251,20 +259,23 @@ module Pindo
251
259
  build_task.dependencies << tasks.last.id if tasks.any?
252
260
  tasks << build_task
253
261
 
254
- # 3. 上传任务(总是添加)
255
- upload_task = Pindo::TaskSystem::JPSUploadTask.new(
256
- 'ipa',
257
- File.join(ios_project_path, 'build'),
258
- nil,
259
- app_info_obj: config[:app_info_obj],
260
- workflow_info: config[:workflow_info],
261
- project_name: @args_proj_name,
262
- context: {
263
- send_to_chat: @args_send_flag
264
- },
265
- dependencies: [build_task.id]
266
- )
267
- tasks << upload_task
262
+ # 3. 上传任务(仅在需要时添加)
263
+ if @args_upload_flag
264
+ upload_task = Pindo::TaskSystem::JPSUploadTask.new(
265
+ 'ipa',
266
+ File.join(ios_project_path, 'build'),
267
+ nil,
268
+ app_info_obj: config[:app_info_obj],
269
+ workflow_info: config[:workflow_info],
270
+ project_name: @args_proj_name,
271
+ upload_desc: "AdHoc 包",
272
+ context: {
273
+ send_to_chat: @args_send_flag
274
+ },
275
+ dependencies: [build_task.id]
276
+ )
277
+ tasks << upload_task
278
+ end
268
279
 
269
280
  tasks
270
281
  else
@@ -274,12 +285,32 @@ module Pindo
274
285
 
275
286
  # 准备 iOS 配置
276
287
  def prepare_ios_config(pindo_project_dir)
277
- # 获取 JPS 配置
278
- app_info_obj, workflow_info = PgyerHelper.share_instace.prepare_upload(
279
- working_directory: pindo_project_dir,
280
- proj_name: @args_proj_name,
281
- package_type: 'ipa'
282
- )
288
+ # IosConfigParser 获取项目名称
289
+ proj_name = nil
290
+ begin
291
+ require 'pindo/config/ios_config_parser'
292
+ config_parser = Pindo::IosConfigParser.instance
293
+ if config_parser.config_json
294
+ proj_name = config_parser.config_json.dig("project_info", "project_name")
295
+ end
296
+ rescue => e
297
+ # 忽略错误,proj_name 保持为 nil
298
+ end
299
+
300
+ # 如果有命令行参数的 proj_name,优先使用
301
+ proj_name = @args_proj_name if @args_proj_name && !@args_proj_name.empty?
302
+
303
+ # 只在需要上传时获取 JPS 配置
304
+ if @args_upload_flag
305
+ app_info_obj, workflow_info = PgyerHelper.share_instace.get_adhoc_upload_info(
306
+ working_directory: pindo_project_dir,
307
+ package_type: 'ipa',
308
+ proj_name: proj_name
309
+ )
310
+ else
311
+ app_info_obj = nil
312
+ workflow_info = nil
313
+ end
283
314
 
284
315
  {
285
316
  project_path: pindo_project_dir,
@@ -40,14 +40,21 @@ module Pindo
40
40
 
41
41
  * 处理 Applovin(如果使用)
42
42
 
43
+ * 支持位置参数(向后兼容)和选项参数两种格式
44
+
43
45
  使用示例:
44
46
 
45
- $ pindo appstore autobuild # 编译 App Store 提交包
47
+ $ pindo appstore autobuild # 使用当前目录的 config.json
48
+
49
+ $ pindo appstore autobuild com.example.app # 位置参数指定 Bundle ID(向后兼容)
46
50
 
47
- $ pindo appstore autobuild --bundleid=com.example.app # 指定 Bundle ID
51
+ $ pindo appstore autobuild --bundleid=com.example.app # 选项参数指定 Bundle ID
48
52
  DESC
49
53
 
50
- self.arguments = []
54
+ # 定义位置参数(向后兼容)
55
+ self.arguments = [
56
+ CLAide::Argument.new('bundleid', true)
57
+ ]
51
58
 
52
59
  # 定义此命令使用的参数项
53
60
  def self.option_items
@@ -61,11 +68,15 @@ module Pindo
61
68
  end
62
69
 
63
70
  def initialize(argv)
71
+ # 首先获取位置参数(向后兼容)
72
+ positional_bundleid = argv.shift_argument
73
+
64
74
  # 使用 Options 模块初始化参数
65
75
  @options = initialize_options(argv)
66
76
 
67
77
  # 保存参数到实例变量
68
- @args_bundle_id = @options[:bundleid]
78
+ # 优先使用选项参数,如果没有则使用位置参数
79
+ @args_bundle_id = @options[:bundleid] || positional_bundleid
69
80
 
70
81
  super(argv)
71
82
  end
@@ -133,7 +144,9 @@ module Pindo
133
144
  puts "\n使用当前目录配置文件: #{config_file}"
134
145
  Pindo::IosConfigParser.instance.load_config(config_file: config_file)
135
146
  else
136
- raise Informative, "当前目录未找到 config.json 文件,请使用 --bundleid 参数指定 Bundle ID"
147
+ raise Informative, "当前目录未找到 config.json 文件,请使用以下方式指定 Bundle ID:\n" \
148
+ " 方式1: pindo appstore autobuild com.example.app\n" \
149
+ " 方式2: pindo appstore autobuild --bundleid=com.example.app"
137
150
  end
138
151
  end
139
152
  end