pindo 5.10.0 → 5.10.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0db013721ed33d91504f227eaa4ae585c648808c9091fa1f7e7cb8fecb5042b9
4
- data.tar.gz: 775da05eca99d6b0bc3a11a8ae1e5be5756879c8c88d5404f637f7cad8c9afdf
3
+ metadata.gz: b1acebdcb2327ba06f7567ae9a828d226c8fb1043d35ce7932b586771076ca5d
4
+ data.tar.gz: fb56eea718bb1209b67b4713c56a9840001cef9b4e0c1265bafcb63a5c493fcc
5
5
  SHA512:
6
- metadata.gz: eadd395d931c0bb6993efd6085de67c7ea6e3a71a2904c2cbf32ff11b028d5064cb857f15c6ef7a385a8478b0eea4475cd1594c079da53765157fed98ff1f972
7
- data.tar.gz: b3423e1e6498b5a526bffcbb6faf009d855bece2f0b91e01ce7bb51bdfb98c48fd29d1af34dc9b41d421147662787ee65d5d1d0c17d3d3dae457abc0f1c535e0
6
+ metadata.gz: 9f3bd9c5c37ed3898494766c6b7cec6f12788df1041f1bbfe20c99b16eee452415754df66baf237e0b0a23f8186a4da6622b0f0f6175d457ccfad57e8bb9d295
7
+ data.tar.gz: 241e23be7488b4365da652ce198ddb86a046b0b9defa1c4b58158ab78a63fc4e5e642eb28b5a9af861c0b0f430f11ce50680aa40fa0a5cab50b98a6f5ff3c947
@@ -177,6 +177,15 @@ module Pindo
177
177
 
178
178
  Pindo::Command::Deploy::Cert::run(args_temp)
179
179
 
180
+ # 根据证书配置后的实际 Bundle ID 重新更新 URL Schemes
181
+ # 因为 Cert::run 可能会修改 PRODUCT_BUNDLE_IDENTIFIER
182
+ if @args_upload_flag && workflow_info && workflow_info[:package_name]
183
+ Pindo::XcodeBuildConfig.update_url_schemes_with_bundleid(
184
+ project_dir: project_dir,
185
+ package_name: workflow_info[:package_name]
186
+ )
187
+ end
188
+
180
189
  Dir.chdir(project_dir)
181
190
  Pindo::Command::Deploy::Build::run(args_temp)
182
191
 
@@ -268,6 +268,13 @@ module Pindo
268
268
 
269
269
  Pindo::Command::Deploy::Cert::run(args_temp)
270
270
 
271
+ # 根据证书配置后的实际 Bundle ID 重新更新 URL Schemes
272
+ # 因为 Cert::run 可能会修改 PRODUCT_BUNDLE_IDENTIFIER
273
+ Pindo::XcodeBuildConfig.update_url_schemes_with_bundleid(
274
+ project_dir: pindo_project_dir,
275
+ package_name: package_name
276
+ )
277
+
271
278
  Dir.chdir(pindo_project_dir)
272
279
  Pindo::Command::Deploy::Build::run(args_temp)
273
280
 
@@ -135,6 +135,12 @@ module Pindo
135
135
  package_name: package_name,
136
136
  project_id: project_id
137
137
  )
138
+
139
+ # 根据实际的 Bundle ID 更新 URL Schemes
140
+ Pindo::XcodeBuildConfig.update_url_schemes_with_bundleid(
141
+ project_dir: pindo_project_dir,
142
+ package_name: package_name
143
+ )
138
144
  else
139
145
  raise Informative, "未获取到工作流信息"
140
146
  end
@@ -1,8 +1,6 @@
1
1
 
2
2
  require 'pindo/command/ios/debug'
3
- require 'pindo/command/ios/build'
4
3
  require 'pindo/command/ios/autobuild'
5
- require 'pindo/command/ios/adhoc'
6
4
  require 'pindo/command/ios/autoresign'
7
5
  require 'pindo/command/ios/applovin'
8
6
 
@@ -8,8 +8,10 @@ module Pindo
8
8
 
9
9
  class XcodeBuildConfig
10
10
 
11
- # 使用package_name一次性更新Display Name、Bundle ID和URL Schemes
11
+ # 使用package_name一次性更新Display Name、Bundle ID和URL Schemes(基于package_name)
12
12
  # 优化版本:只读写一次plist文件,提高性能
13
+ # 注意:此函数只添加基于package_name的URL Scheme,基于实际Bundle ID的URL Scheme
14
+ # 将在update_url_schemes_with_bundleid函数中统一添加(在证书配置之后)
13
15
  # @param project_dir [String] iOS项目目录路径
14
16
  # @param package_name [String] 工作流的package_name(如:"Test Demo")
15
17
  # @param project_id [String] JPS项目ID(可选,用于添加快捷操作)
@@ -23,7 +25,6 @@ module Pindo
23
25
  bundle_id_suffix = package_name.gsub(/[^a-zA-Z0-9]/, '').downcase
24
26
  final_bundle_id = "com.heroneverdie101.#{bundle_id_suffix}"
25
27
  package_scheme = package_name.gsub(/[^a-zA-Z0-9]/, '').downcase
26
- bundle_scheme = final_bundle_id.gsub(/[^a-zA-Z0-9]/, '').downcase
27
28
 
28
29
  project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
29
30
  return false if project_fullname.nil?
@@ -48,9 +49,10 @@ module Pindo
48
49
  # 一次性读取plist
49
50
  info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
50
51
 
51
- # 1. 更新 Display Name
52
+ # 1. 更新Info Plist Display Name
52
53
  info_plist_dict["CFBundleDisplayName"] = display_name
53
54
 
55
+
54
56
  # 2. 更新 Bundle ID(plist)
55
57
  info_plist_dict["CFBundleIdentifier"] = final_bundle_id
56
58
 
@@ -58,15 +60,11 @@ module Pindo
58
60
  info_plist_dict["CFBundleURLTypes"] ||= []
59
61
 
60
62
  # 添加基于 package_name 的 URL Scheme
63
+ # 注意:基于 Bundle ID 的 URL Scheme 将在 update_url_schemes_with_bundleid 函数中统一添加
61
64
  if add_single_scheme(info_plist_dict, package_scheme)
62
65
  puts " ✓ 已添加URL Scheme: #{package_scheme} (基于 Package Name)"
63
66
  end
64
67
 
65
- # 添加基于 Bundle ID 的 URL Scheme
66
- if add_single_scheme(info_plist_dict, bundle_scheme)
67
- puts " ✓ 已添加URL Scheme: #{bundle_scheme} (基于 Bundle ID)"
68
- end
69
-
70
68
  # 4. 添加 JPS 快捷操作(UIApplicationShortcutItems)
71
69
  if project_id && !project_id.to_s.empty?
72
70
  # 创建或获取 UIApplicationShortcutItems 数组
@@ -74,22 +72,33 @@ module Pindo
74
72
 
75
73
  # 构建快捷操作类型
76
74
  shortcut_type = "jps_project?#{project_id}"
75
+ jps_title = "访问 JPS 详情"
77
76
 
78
- # 检查是否已存在相同的快捷操作
77
+ # 先查找是否存在标题为"访问 JPS 详情"的快捷操作(无论其 type 是什么)
79
78
  existing_shortcut = info_plist_dict["UIApplicationShortcutItems"].find do |item|
80
- item["UIApplicationShortcutItemType"] == shortcut_type
79
+ item["UIApplicationShortcutItemTitle"] == jps_title
81
80
  end
82
81
 
83
- unless existing_shortcut
82
+ if existing_shortcut
83
+ # 如果存在,检查 type 是否一致
84
+ if existing_shortcut["UIApplicationShortcutItemType"] == shortcut_type
85
+ puts " ✓ JPS 快捷操作已存在: #{shortcut_type}"
86
+ else
87
+ # type 不一致,更新为新的 type
88
+ old_type = existing_shortcut["UIApplicationShortcutItemType"]
89
+ existing_shortcut["UIApplicationShortcutItemType"] = shortcut_type
90
+ existing_shortcut["UIApplicationShortcutItemIconType"] = "UIApplicationShortcutIconTypeBookmark"
91
+ puts " ✓ 已更新 JPS 快捷操作: #{old_type} -> #{shortcut_type}"
92
+ end
93
+ else
94
+ # 不存在,添加新的快捷操作
84
95
  jps_shortcut = {
85
96
  "UIApplicationShortcutItemType" => shortcut_type,
86
- "UIApplicationShortcutItemTitle" => "访问 JPS 详情",
97
+ "UIApplicationShortcutItemTitle" => jps_title,
87
98
  "UIApplicationShortcutItemIconType" => "UIApplicationShortcutIconTypeBookmark"
88
99
  }
89
100
  info_plist_dict["UIApplicationShortcutItems"] << jps_shortcut
90
101
  puts " ✓ 已添加 JPS 快捷操作: #{shortcut_type}"
91
- else
92
- puts " ✓ JPS 快捷操作已存在: #{shortcut_type}"
93
102
  end
94
103
  end
95
104
 
@@ -99,6 +108,7 @@ module Pindo
99
108
  # 5. 更新 Xcode 项目中的 PRODUCT_BUNDLE_IDENTIFIER
100
109
  if app_target
101
110
  app_target.build_configurations.each do |config|
111
+ config.build_settings['INFOPLIST_KEY_CFBundleDisplayName'] = display_name
102
112
  config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = final_bundle_id
103
113
  end
104
114
  project_obj.save
@@ -109,6 +119,76 @@ module Pindo
109
119
  return true
110
120
  end
111
121
 
122
+ # 根据当前项目中的实际 Bundle ID 重新更新 URL Schemes
123
+ # 此函数用于在证书配置后更新 URL Schemes,确保与最终的 Bundle ID 匹配
124
+ # @param project_dir [String] iOS项目目录路径
125
+ # @param package_name [String] 工作流的package_name(如:"Test Demo")
126
+ # @return [Boolean] 是否成功更新
127
+ def self.update_url_schemes_with_bundleid(project_dir: nil, package_name: nil)
128
+ raise ArgumentError, "项目目录不能为空" if project_dir.nil?
129
+
130
+ project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
131
+ return false if project_fullname.nil?
132
+
133
+ info_plist_path = nil
134
+ current_bundle_id = nil
135
+
136
+ project_obj = Xcodeproj::Project.open(project_fullname)
137
+ project_obj.targets.each do |target|
138
+ if target.product_type.to_s.eql?("com.apple.product-type.application")
139
+ temp_info_file = target.build_configurations.first.build_settings['INFOPLIST_FILE']
140
+ if temp_info_file && !temp_info_file.empty?
141
+ info_plist_path = File.join(project_dir, temp_info_file)
142
+ end
143
+ # 获取当前实际的 Bundle ID
144
+ current_bundle_id = target.build_configurations.first.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
145
+ break # 找到第一个application target即可
146
+ end
147
+ end
148
+
149
+ return false unless info_plist_path && File.exist?(info_plist_path)
150
+ return false unless current_bundle_id && !current_bundle_id.empty?
151
+
152
+ puts "\n根据更新后的 Bundle ID 重新配置 URL Schemes:"
153
+ puts " 当前 Bundle ID: #{current_bundle_id}"
154
+
155
+ # 读取 plist
156
+ info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
157
+ info_plist_dict["CFBundleURLTypes"] ||= []
158
+
159
+ # 生成 schemes
160
+ package_scheme = package_name ? package_name.gsub(/[^a-zA-Z0-9]/, '').downcase : nil
161
+ bundle_scheme = current_bundle_id.gsub(/[^a-zA-Z0-9]/, '').downcase
162
+
163
+ schemes_updated = []
164
+
165
+ # 添加基于 package_name 的 URL Scheme(如果提供了 package_name)
166
+ if package_scheme && !package_scheme.empty?
167
+ if add_single_scheme(info_plist_dict, package_scheme)
168
+ schemes_updated << package_scheme
169
+ puts " ✓ 已更新 URL Scheme: #{package_scheme} (基于 Package Name)"
170
+ else
171
+ puts " ✓ URL Scheme 已存在: #{package_scheme} (基于 Package Name)"
172
+ end
173
+ end
174
+
175
+ # 添加基于实际 Bundle ID 的 URL Scheme
176
+ if add_single_scheme(info_plist_dict, bundle_scheme)
177
+ schemes_updated << bundle_scheme
178
+ puts " ✓ 已更新 URL Scheme: #{bundle_scheme} (基于更新后的 Bundle ID)"
179
+ else
180
+ puts " ✓ URL Scheme 已存在: #{bundle_scheme} (基于更新后的 Bundle ID)"
181
+ end
182
+
183
+ # 写入 plist
184
+ if schemes_updated.any?
185
+ Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
186
+ puts " ✓ URL Schemes 更新完成"
187
+ end
188
+
189
+ return true
190
+ end
191
+
112
192
  # 添加URL Schemes到iOS工程的Info.plist
113
193
  # @param project_dir [String] iOS项目目录路径
114
194
  # @param scheme_name [String] 要添加的scheme名称(可选)
data/lib/pindo/version.rb CHANGED
@@ -6,7 +6,7 @@ require 'time'
6
6
 
7
7
  module Pindo
8
8
 
9
- VERSION = "5.10.0"
9
+ VERSION = "5.10.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.10.0
4
+ version: 5.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - wade
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2025-11-07 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: claide
@@ -479,7 +479,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
479
479
  - !ruby/object:Gem::Version
480
480
  version: '0'
481
481
  requirements: []
482
- rubygems_version: 3.6.9
482
+ rubygems_version: 3.6.3
483
483
  specification_version: 3
484
484
  summary: easy work
485
485
  test_files: []