pindo 4.7.1 → 4.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,13 +63,13 @@ module Pindo
63
63
 
64
64
  def install_certs(cert_url:nil, certs_dir:nil, cert_type:nil)
65
65
 
66
-
66
+ cert_git_dir = cert_type.downcase
67
67
  if !cert_type.downcase.include?("development")
68
- cert_type = "distribution"
68
+ cert_git_dir = "distribution"
69
69
  end
70
70
 
71
- certs = Dir[File.join(certs_dir, "certs", cert_type.to_s, "*.cer")]
72
- keys = Dir[File.join(certs_dir, "certs", cert_type.to_s, "*.p12")]
71
+ certs = Dir[File.join(certs_dir, "certs", cert_git_dir.to_s, "*.cer")]
72
+ keys = Dir[File.join(certs_dir, "certs", cert_git_dir.to_s, "*.p12")]
73
73
 
74
74
  if certs.count == 0 || keys.count == 0
75
75
  raise Informative, "No certificates found in #{certs_dir}"
@@ -80,13 +80,13 @@ module Pindo
80
80
  Funlog.instance.fancyinfo_start("正在安装证书...")
81
81
 
82
82
  cert_path = AESHelper.decrypt_specific_file(src_file: certs.first, password:decrypt_password, output_dir: output_dir)
83
- unless cert_path.nil? || File.exist?(cert_path)
83
+ if cert_path.nil? || cert_path.empty? || !File.exist?(cert_path)
84
84
  AESHelper.delete_password(keychain_name:cert_url)
85
85
  raise Informative, "证书解析失败,密码错误!"
86
86
  end
87
87
 
88
88
  key_path = AESHelper.decrypt_specific_file(src_file: keys.first, password:decrypt_password, output_dir: output_dir)
89
- unless key_path.nil? || File.exist?(key_path)
89
+ if key_path.nil? || key_path.empty? || !File.exist?(key_path)
90
90
  AESHelper.delete_password(keychain_name:cert_url)
91
91
  raise Informative, "证书解析失败,密码错误!"
92
92
  end
@@ -110,8 +110,8 @@ module Pindo
110
110
  KeychainHelper.import_file(cert_path, keychain_path, keychain_password: cert_password, certificate_password:'' )
111
111
  KeychainHelper.import_file(key_path, keychain_path, keychain_password: cert_password, certificate_password: '')
112
112
 
113
-
114
113
  Funlog.instance.fancyinfo_success("证书'#{File.basename(cert_path)}'安装完成!")
114
+
115
115
  end
116
116
  else
117
117
  Funlog.instance.fancyinfo_error("非Mac电脑不支持安装证书!")
@@ -122,23 +122,17 @@ module Pindo
122
122
  def install_provisionfiles(cert_url:nil, certs_dir:nil, bundle_id_map:nil, cert_type:nil)
123
123
 
124
124
 
125
- Funlog.instance.fancyinfo_start("正在安装Provisioning Profiles文件...")
125
+ if cert_type.downcase.include?("development")
126
+ cert_type = "Development"
127
+ elsif cert_type.downcase.include?("adhoc")
128
+ cert_type = "Adhoc"
129
+ else
130
+ cert_type = "AppStore"
131
+ end
126
132
 
127
-
128
- if cert_type.downcase.include?("development")
129
- cert_type = "Development"
130
- elsif cert_type.downcase.include?("adhoc")
131
- cert_type = "Adhoc"
132
- else
133
- cert_type = "AppStore"
134
- end
133
+ Funlog.instance.fancyinfo_start("正在安装#{cert_type} Provisioning Profiles...")
135
134
 
136
135
  un_exist_files = []
137
-
138
- provisioning_info_array = []
139
-
140
-
141
-
142
136
  provisioning_info_array = []
143
137
 
144
138
  bundle_id_map.each do |type, bundle_id_temp|
@@ -169,14 +163,15 @@ module Pindo
169
163
  provisioning_info_array << provisioning_info
170
164
  end
171
165
 
172
- Funlog.instance.fancyinfo_success("Provisioning Profiles文件安装完成!")
166
+ Funlog.instance.fancyinfo_success("#{cert_type} Provisioning Profiles文件安装完成!")
173
167
 
174
168
  if un_exist_files.size > 0
175
- Funlog.instance.fancyinfo_error("证书Provisioning Profiles文件不存在!")
169
+ Funlog.instance.fancyinfo_error("证书 #{cert_type} Provisioning Profiles文件不存在!")
176
170
  raise Informative, "The following profiles do not exist: #{un_exist_files.join(', ')}"
177
171
  end
178
172
 
179
173
  return provisioning_info_array
174
+
180
175
  end
181
176
 
182
177
 
@@ -1,5 +1,6 @@
1
1
 
2
2
  require 'fileutils'
3
+ require 'pindo/base/aeshelper'
3
4
 
4
5
  module Pindo
5
6
 
@@ -225,7 +226,40 @@ module Pindo
225
226
  end
226
227
  end
227
228
 
228
- def create_upload_cert_info(apple_id:nil, cert_type:nil, provisioning_info_array:nil)
229
+ def create_upload_cert_info(apple_id:nil, cert_type:nil)
230
+
231
+ cert_dest_dir = File.join(Dir.pwd, "cert")
232
+ if !File.exist?(cert_dest_dir)
233
+ FileUtils.mkdir_p(cert_dest_dir)
234
+ end
235
+
236
+
237
+ cert_git_url = pindo_single_config.deploy_cert_giturl
238
+ if apple_id.eql?(pindo_single_config.demo_apple_id)
239
+ cert_git_url = pindo_single_config.dev_cert_giturl
240
+ end
241
+ cert_reponame = cert_git_url.split("/").last.chomp(".git")
242
+ certs_dir = getcode_to_dir(reponame:cert_reponame, remote_url:cert_git_url, path: pindo_single_config.pindo_dir, new_branch:apple_id)
243
+
244
+ cert_git_dir = cert_type.downcase
245
+ if !cert_type.downcase.include?("development")
246
+ cert_git_dir = "distribution"
247
+ end
248
+
249
+ keys = Dir[File.join(certs_dir, "certs", cert_git_dir.to_s, "*.p12")]
250
+ decrypt_password = AESHelper.fetch_password(keychain_name:cert_git_url)
251
+ output_dir = Dir.mktmpdir
252
+ key_path = AESHelper.decrypt_specific_file(src_file: keys.first, password:decrypt_password, output_dir: output_dir)
253
+ if key_path.nil? || key_path.empty? || !File.exist?(key_path)
254
+ AESHelper.delete_password(keychain_name:cert_git_url)
255
+ raise Informative, "证书解析失败,密码错误!"
256
+ end
257
+
258
+ FileUtils.copy(key_path, File.join(cert_dest_dir, "#{cert_type}.p12"))
259
+
260
+ end
261
+
262
+ def create_upload_provisioning_info(apple_id:nil, cert_type:nil, provisioning_info_array:nil)
229
263
 
230
264
  cert_dir = File.join(Dir.pwd, "cert")
231
265
  cert_json_file = File.join(cert_dir, "certs.json")
@@ -272,8 +306,8 @@ module Pindo
272
306
 
273
307
  cert_item["cert_id"] = cert_item["cert_id"] || bundle_id_signing_identity
274
308
  cert_item["password"] = "goodcert1"
275
- cert_item["cert_file"] = "#{cert_type}.p12".downcase
276
- cert_item["cert_type"] = cert_type.downcase
309
+ cert_item["cert_file"] = "#{cert_type}.p12"
310
+ cert_item["cert_type"] = cert_type
277
311
  cert_item["cert_provisioning_group"] = cert_item["cert_provisioning_group"] || []
278
312
 
279
313
 
@@ -38,16 +38,22 @@ module Pindo
38
38
  if @force_login || !@has_login
39
39
  @has_login = @pgyer_client.do_login(force_login:@force_login)
40
40
  @force_login = false
41
+ else
42
+ @has_login = @pgyer_client.do_login(force_login:false)
41
43
  end
42
44
  return @has_login
43
45
  end
44
46
 
45
47
  def prepare_upload(working_directory:nil, proj_name:nil)
46
48
  upload_proj_name = proj_name
49
+ if upload_proj_name.nil? || upload_proj_name.empty?
50
+ upload_proj_name = @proj_name
51
+ end
52
+
47
53
  app_info_obj = nil
48
54
  if login
49
55
 
50
- if !proj_name.nil?
56
+ if !upload_proj_name.nil?
51
57
  app_info_obj = PgyerHelper.share_instace.find_app_info_with_obj_list(proj_name:upload_proj_name)
52
58
  end
53
59
 
@@ -105,6 +111,7 @@ module Pindo
105
111
  else
106
112
  raise Informative, "请先登录Pgyer网站"
107
113
  end
114
+ @proj_name = upload_proj_name
108
115
  app_info_obj
109
116
  end
110
117
 
@@ -112,17 +119,28 @@ module Pindo
112
119
 
113
120
  args_ipa_file_dir = File.expand_path(File::dirname(ipa_file_upload))
114
121
  ipa_file_upload=File.join(args_ipa_file_dir, File.basename(ipa_file_upload))
115
-
116
122
  current_project_dir = Dir.pwd
117
123
  if description.nil? && File.exist?(File.join(current_project_dir, ".git"))
118
- commit_id_info = git_latest_commit_id(local_repo_dir:current_project_dir)
119
- if commit_id_info
120
- description = "commit " + commit_id_info
124
+ description = git!(%W(-C #{current_project_dir} show -s --format=commit::%H)).strip
125
+ xcodeproj_file_name = Dir.glob(File.join(current_project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
126
+ if !xcodeproj_file_name.nil? && !xcodeproj_file_name.empty? && File.exist?(xcodeproj_file_name)
127
+ project_obj = Xcodeproj::Project.open(xcodeproj_file_name)
128
+ main_target = project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]) }.first
129
+ provisioning_profile_name = main_target.build_configurations.first.build_settings['PROVISIONING_PROFILE_SPECIFIER'].downcase.split(" ")
130
+ if provisioning_profile_name.include?("adhoc")
131
+ description = git!(%W(-C #{current_project_dir} show -s --format=commit::%H)).strip
132
+ elsif provisioning_profile_name.include?("development")
133
+ if File.exist?(File.join(current_project_dir, ".release_info"))
134
+ description = File.read(File.join(current_project_dir, ".release_info"))
135
+ else
136
+ description = git!(%W(-C #{current_project_dir} show -s --format=%h::%s)).strip
137
+ end
138
+ elsif provisioning_profile_name.include?("appstore")
139
+ description = "提交包重签名"
140
+ end
121
141
  end
122
142
  end
123
143
 
124
- puts "description : #{description}"
125
-
126
144
  addtach_file = nil
127
145
  if ipa_file_upload.include?(File.join(current_project_dir, "build")) && File.exist?(File.join(current_project_dir, "VMData"))
128
146
 
@@ -149,7 +167,8 @@ module Pindo
149
167
 
150
168
  puts
151
169
  puts "上传项目: #{app_info_obj["appName"]}"
152
- puts "上传备注: #{description}"
170
+ print "上传备注: "
171
+ puts description
153
172
 
154
173
 
155
174
  aws_client = AWSS3Client.new
@@ -205,9 +224,12 @@ module Pindo
205
224
  end
206
225
 
207
226
 
208
- def send_apptest_wechat_msg(msg_data:nil)
227
+ def send_apptest_wechat_msg(msg_data:nil, wechat_url:nil)
209
228
 
210
- wechat_msg_url = get_user_local_wechat_url()
229
+ wechat_msg_url = wechat_url
230
+ if wechat_msg_url.nil? || wechat_msg_url.empty?
231
+ wechat_msg_url = get_user_local_wechat_url()
232
+ end
211
233
 
212
234
  if !wechat_msg_url.nil? && wechat_msg_url.length >1
213
235
 
@@ -396,8 +418,11 @@ module Pindo
396
418
  Funlog.instance.fancyinfo_start("正在拉取app上传记录...")
397
419
 
398
420
  appId = app_info_obj["appId"]
421
+ # puts "appId #{appId}"
399
422
  version_data = @pgyer_client.get_app_version_list_req(appId:appId) || {}
400
423
 
424
+ Funlog.instance.fancyinfo_success("拉取app上传记录完成!")
425
+
401
426
  if version_data["data"].nil? || version_data["data"].size <=0
402
427
  raise Informative, "#{proj_name} 错误, 没有找到上传记录"
403
428
  end
@@ -424,7 +449,7 @@ module Pindo
424
449
 
425
450
  end
426
451
 
427
- Funlog.instance.fancyinfo_success("拉取app上传记录完成!")
452
+
428
453
 
429
454
  version_item_obj = nil
430
455
  if !app_incId_index.nil?
@@ -7,8 +7,7 @@ module Pindo
7
7
  module XcodeAppConfig
8
8
 
9
9
  def auto_increase_buildnumber(app_config_file:nil)
10
-
11
- if !File.exist?(app_config_file)
10
+ if File.exist?(app_config_file)
12
11
  config_json = JSON.parse(File.read(app_config_file))
13
12
  app_version = config_json['app_info']['app_version']
14
13
  app_build_version = config_json['app_info']['app_build_version']
@@ -26,7 +25,7 @@ module Pindo
26
25
  app_build_version = app_build_version_array.join(".")
27
26
 
28
27
  config_json['app_info']['app_build_version'] = app_build_version
29
- File.open(app_origin_config, "w") do |file|
28
+ File.open(app_config_file, "w") do |file|
30
29
  file.write(JSON.pretty_generate(config_json))
31
30
  file.close
32
31
  end
@@ -139,7 +138,9 @@ module Pindo
139
138
  project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
140
139
  project_obj = Xcodeproj::Project.open(project_fullname)
141
140
  presources_group = find_group(group:project_obj.main_group, group_name:"PResources")
142
-
141
+ if presources_group.nil?
142
+ presources_group = find_group(group:project_obj.main_group, group_name:"PResource")
143
+ end
143
144
  if presources_group.nil?
144
145
  raise Informative, "没有找到资源目录PResources!!!!"
145
146
  end
@@ -7,13 +7,13 @@ require 'pindo/module/cert/xcodecerthelper'
7
7
  module Pindo
8
8
 
9
9
  module XcodeBuildHelper
10
-
10
+
11
11
  def pull_podfile_lock(project_dir:nil, app_config_dir:nil)
12
12
  begin
13
13
  src_pod_file = File.join(app_config_dir, "Podfile.lock")
14
14
  build_verify_file = File.join(app_config_dir, "build_verify.json")
15
15
  build_verify_json = nil
16
- begin
16
+ begin
17
17
  build_verify_json = JSON.parse(File.read(build_verify_file))
18
18
  rescue => error
19
19
  end
@@ -37,7 +37,7 @@ module Pindo
37
37
  end
38
38
  rescue => error
39
39
  raise Informative, "获取Podfile.lock 文件失败!!!"
40
- end
40
+ end
41
41
  end
42
42
 
43
43
 
@@ -52,7 +52,7 @@ module Pindo
52
52
  checksum = Digest::MD5.hexdigest(bytes)
53
53
  build_verify_file = File.join(app_config_dir, "build_verify.json")
54
54
  build_verify_json = nil
55
- begin
55
+ begin
56
56
  build_verify_json = JSON.parse(File.read(build_verify_file))
57
57
  rescue => error
58
58
  end
@@ -61,7 +61,7 @@ module Pindo
61
61
  build_verify_json["output_config_commit"] = git_latest_commit_id(local_repo_dir:app_config_dir)
62
62
  build_verify_json["output_podfile_checksum"] = checksum
63
63
  build_verify_json["output_time"] = Time.now.strftime('%y/%m/%d %H:%M:%S')
64
-
64
+
65
65
  File.open(build_verify_file, "w") do |file|
66
66
  file.write(JSON.pretty_generate(build_verify_json))
67
67
  file.close
@@ -70,26 +70,26 @@ module Pindo
70
70
 
71
71
  rescue => error
72
72
  raise Informative, "保存Podfile.lock 文件失败!!!"
73
- end
73
+ end
74
74
  end
75
75
 
76
76
  def install_google_plist(project_dir:nil, app_config_dir:nil)
77
77
 
78
78
  project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
79
- project_obj = Xcodeproj::Project.open(project_fullname)
79
+ project_obj = Xcodeproj::Project.open(project_fullname)
80
80
  select_target = project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]) }.first
81
81
  file_ref = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("GoogleService-Info.plist") }.first
82
-
82
+
83
83
  if !file_ref.nil?
84
84
  xcode_googleinfo_path = file_ref.real_path
85
-
86
- if !File.exist?(File.join(app_config_dir, "GoogleService-Info.plist"))
85
+
86
+ if !File.exist?(File.join(app_config_dir, "GoogleService-Info.plist"))
87
87
  raise Informative, "缺少 GoogleService-Info.plist ==> #{app_config_dir}!!!"
88
88
  else
89
89
  FileUtils.cp(File.join(app_config_dir, "GoogleService-Info.plist"), xcode_googleinfo_path)
90
90
  end
91
-
92
- if !File.exist?(xcode_googleinfo_path)
91
+
92
+ if !File.exist?(xcode_googleinfo_path)
93
93
  raise Informative, "拷贝 GoogleService-Info.plist 失败!!==> #{xcode_googleinfo_path}!!!"
94
94
  end
95
95
  end
@@ -120,7 +120,7 @@ module Pindo
120
120
  target_name_map = get_target_name_map
121
121
  if target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application])
122
122
  target.build_configurations.each do |config|
123
- config.build_settings['PRODUCT_NAME'] = exe_binary_name
123
+ config.build_settings['PRODUCT_NAME'] = exe_binary_name
124
124
  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ios_deployment_targe
125
125
  end
126
126
  elsif
@@ -151,64 +151,67 @@ module Pindo
151
151
  if !info_plist_dict["CFBundleName"].nil?
152
152
  info_plist_dict["CFBundleName"] = exe_binary_name
153
153
  end
154
-
155
- if config_json['app_info']["imessage_display_name"] && target_name && target_name.end_with?("iMessage")
154
+
155
+ if config_json['app_info']["imessage_display_name"] && target_name && target_name.end_with?("iMessage")
156
156
  info_plist_dict["CFBundleDisplayName"] = config_json['app_info']["imessage_display_name"]
157
157
  end
158
- if config_json['app_info']["extension_display_name"] && target_name && target_name.end_with?("Extension")
158
+ if config_json['app_info']["extension_display_name"] && target_name && target_name.end_with?("Extension")
159
159
  info_plist_dict["CFBundleDisplayName"] = config_json['app_info']["extension_display_name"]
160
160
  end
161
161
 
162
162
 
163
- if config_json['app_info']["extensionad_display_name"] && target_name && target_name.end_with?("ExtensionAd")
163
+ if config_json['app_info']["extensionad_display_name"] && target_name && target_name.end_with?("ExtensionAd")
164
164
  info_plist_dict["CFBundleDisplayName"] = config_json['app_info']["extensionad_display_name"]
165
165
  end
166
166
 
167
- if config_json['app_info']["extensionporn_display_name"] && target_name && target_name.end_with?("ExtensionPorn")
167
+ if config_json['app_info']["extensionporn_display_name"] && target_name && target_name.end_with?("ExtensionPorn")
168
168
  info_plist_dict["CFBundleDisplayName"] = config_json['app_info']["extensionporn_display_name"]
169
169
  end
170
-
171
- if config_json['app_info']["keyboard_display_name"] && target_name && target_name.end_with?("Keyboard")
170
+
171
+ if config_json['app_info']["keyboard_display_name"] && target_name && target_name.end_with?("Keyboard")
172
172
  info_plist_dict["CFBundleDisplayName"] = config_json['app_info']["keyboard_display_name"]
173
173
  end
174
-
175
174
 
176
- if config_json['app_info']["siri_display_name"] && target_name && target_name.end_with?("Keyboard")
175
+
176
+ if config_json['app_info']["siri_display_name"] && target_name && target_name.end_with?("Keyboard")
177
177
  info_plist_dict["CFBundleDisplayName"] = config_json['app_info']["siri_display_name"]
178
178
  end
179
179
 
180
- if config_json['app_info']["siriui_display_name"] && target_name && target_name.end_with?("iMessage")
180
+ if config_json['app_info']["siriui_display_name"] && target_name && target_name.end_with?("iMessage")
181
181
  info_plist_dict["CFBundleDisplayName"] = config_json['app_info']["siriui_display_name"]
182
182
  end
183
-
183
+
184
184
 
185
185
 
186
186
  unless config_json['app_info']["app_version"]
187
187
  raise Informative, "config.json Missing app_info app_version !!!"
188
- end
188
+ end
189
189
 
190
190
  info_plist_dict["CFBundleShortVersionString"] = config_json['app_info']["app_version"]
191
191
 
192
192
  unless config_json['app_info']["app_build_version"]
193
193
  raise Informative, "config.json Missing app_info app_build_version !!!"
194
- end
194
+ end
195
195
  info_plist_dict["CFBundleVersion"] = config_json['app_info']["app_build_version"]
196
196
  Xcodeproj::Plist.write_to_path(info_plist_dict, plist_file_name)
197
197
  end
198
198
  end
199
199
 
200
-
200
+
201
201
  def modify_maintarget_info_plist(plist_file_name:nil, config_json:nil, target_name:nil)
202
202
  if File.exist?(plist_file_name)
203
203
  info_plist_dict = Xcodeproj::Plist.read_from_path(plist_file_name)
204
204
 
205
205
  info_plist_dict.delete("AccountKitClientToken")
206
-
207
- if info_plist_dict["Fabric"]
206
+
207
+ if info_plist_dict["Fabric"]
208
208
  info_plist_dict.delete('Fabric')
209
209
  end
210
210
 
211
-
211
+ if info_plist_dict["UIRequiredDeviceCapabilities"] && !info_plist_dict["UIRequiredDeviceCapabilities"].first.nil? && info_plist_dict["UIRequiredDeviceCapabilities"].first == "armv7"
212
+ raise Informative, "Info.plist里面有多余的Key UIRequiredDeviceCapabilities armv7"
213
+ end
214
+
212
215
  if !config_json['app_info']['admob_app_id'].nil? && config_json['app_info']['admob_app_id'].include?("__________config")
213
216
  raise Informative, "config.json 配置文件key :admob_app_id 包含初始值未修改, 配置正确的值或者删除!!!"
214
217
  end
@@ -217,7 +220,7 @@ module Pindo
217
220
  raise Informative, "工程Info.plist中有 Admob 配置,config.json缺少 Admob 配置参数!!!"
218
221
  end
219
222
 
220
- if !config_json['app_info']['admob_app_id'].nil?
223
+ if !config_json['app_info']['admob_app_id'].nil?
221
224
  info_plist_dict["GADApplicationIdentifier"] = config_json['app_info']['admob_app_id']
222
225
  end
223
226
 
@@ -227,7 +230,7 @@ module Pindo
227
230
  if !config_json['app_info']['applovin_app_id'].nil? && config_json['app_info']['applovin_app_id'].include?("__________config")
228
231
  raise Informative, "config.json 配置文件key :applovin_app_id 包含初始值未修改, 配置正确的值或者删除!!!"
229
232
  end
230
-
233
+
231
234
  if !info_plist_dict["AppLovinSdkKey"].nil? && config_json['app_info']['applovin_app_id'].nil?
232
235
  raise Informative, "工程Info.plist中有 AppLovin 配置,config.json缺少 AppLovin 配置参数!!!"
233
236
  end
@@ -246,10 +249,10 @@ module Pindo
246
249
  # info_plist_dict.delete('AppLovinSdkKey')
247
250
  # end
248
251
 
249
-
250
252
 
251
-
252
-
253
+
254
+
255
+
253
256
  info_plist_dict["CFBundleURLTypes"] = []
254
257
  item0 = {}
255
258
  item0["CFBundleTypeRole"] = "Editor"
@@ -257,7 +260,7 @@ module Pindo
257
260
  item0["CFBundleURLSchemes"] = []
258
261
  item0["CFBundleURLSchemes"] << "$(PRODUCT_BUNDLE_IDENTIFIER)"
259
262
  info_plist_dict["CFBundleURLTypes"] << item0
260
-
263
+
261
264
  if config_json['app_info'] && config_json['app_info']['facebook_app_id']
262
265
  info_plist_dict["FacebookAppID"] = config_json['app_info']['facebook_app_id']
263
266
  if config_json['app_info']['facebook_client_token'].nil?
@@ -294,7 +297,7 @@ module Pindo
294
297
  info_plist_path = File.join(project_dir, temp_info)
295
298
 
296
299
  if target.product_type.to_s.eql?("com.apple.product-type.application") && !File.exist?(info_plist_path)
297
- raise Informative, "Missing Target #{target.name.to_s} Info.plist !!! Modify Info.plist Error !!!"
300
+ raise Informative, "Missing Target #{target.name.to_s} Info.plist !!! Modify Info.plist Error !!!"
298
301
  end
299
302
 
300
303
  if target.product_type.to_s.eql?("com.apple.product-type.application") then
@@ -72,20 +72,36 @@ module Pindo
72
72
 
73
73
  def initialize(proj_fullname:nil)
74
74
  @proj_fullname = proj_fullname
75
- @project_obj = Xcodeproj::Project.open(proj_fullname)
75
+ @project_obj = Xcodeproj::Project.open(proj_fullname)
76
76
  end
77
77
 
78
78
  def get_xcodeproj_icon_path
79
+
80
+ icon_path = nil
79
81
  select_target = @project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]) }.first
80
- file_ref = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") }.first
81
- icon_path = File.join(file_ref.real_path,"AppIcon.appiconset")
82
+ if !select_target.nil?
83
+ file_refs = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") } || []
84
+ file_refs.each do |file_ref|
85
+ icon_path = File.join(file_ref.real_path,"AppIcon.appiconset")
86
+ if File.exist?(icon_path)
87
+ break
88
+ else
89
+ next
90
+ end
91
+ end
92
+ end
93
+
94
+ if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
95
+ raise Informative, "没有找到Xcode icon 目录"
96
+ end
97
+
82
98
  return icon_path
83
99
  end
84
100
 
85
101
  def install_icon_res(new_icon_dir:nil)
86
102
  icon_path = get_xcodeproj_icon_path
87
103
  begin
88
- FileUtils.rm_rf(icon_path)
104
+ FileUtils.rm_rf(icon_path)
89
105
  FileUtils.mkdir_p(icon_path)
90
106
  rescue StandardError => e
91
107
  end
@@ -110,16 +126,28 @@ module Pindo
110
126
  icon_path = nil
111
127
  select_target = @project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:messages_extension]) }.first
112
128
  if !select_target.nil?
113
- file_ref = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") }.first
114
- icon_path = File.join(file_ref.real_path,"iMessage App Icon.stickersiconset")
129
+ file_refs = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") } || []
130
+ file_refs.each do |file_ref|
131
+ icon_path = File.join(file_ref.real_path,"iMessage App Icon.stickersiconset")
132
+ if File.exist?(icon_path)
133
+ break
134
+ else
135
+ next
136
+ end
137
+ end
138
+
139
+ if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
140
+ raise Informative, "没有找到Xcode iMessage icon 目录"
141
+ end
115
142
  end
143
+
116
144
  return icon_path
117
145
  end
118
146
 
119
147
  def install_imessage_icon_res(new_icon_dir:nil)
120
148
  icon_path = get_xcodeproj_imessage_icon_path
121
149
  begin
122
- FileUtils.rm_rf(icon_path)
150
+ FileUtils.rm_rf(icon_path)
123
151
  FileUtils.mkdir_p(icon_path)
124
152
  rescue StandardError => e
125
153
  end
@@ -147,7 +175,7 @@ module Pindo
147
175
  launchimg_path = nil
148
176
  select_target = @project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]) }.first
149
177
  file_ref = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") }.first
150
-
178
+
151
179
  assets_path = file_ref.real_path
152
180
  if File.exist?(File.join(assets_path, "LaunchImage.imageset"))
153
181
  launchimg_path = File.join(assets_path, "LaunchImage.imageset")
@@ -167,9 +195,9 @@ module Pindo
167
195
  end
168
196
 
169
197
  project_origin_launchimg = Dir.glob(File.join(xcodeproj_launchimg_path, "/*.png")).max_by {|f| File.mtime(f)}
170
-
198
+
171
199
  if project_origin_launchimg.nil? || !File.exist?(project_origin_launchimg)
172
- return
200
+ return
173
201
  end
174
202
 
175
203
  if File.exist?(project_origin_launchimg) && !File.exist?(launchimg_file)
@@ -177,7 +205,7 @@ module Pindo
177
205
  end
178
206
 
179
207
  begin
180
- FileUtils.rm_rf(xcodeproj_launchimg_path)
208
+ FileUtils.rm_rf(xcodeproj_launchimg_path)
181
209
  FileUtils.mkdir_p(xcodeproj_launchimg_path)
182
210
  rescue StandardError => e
183
211
  end
@@ -190,7 +218,7 @@ module Pindo
190
218
  File.open(File.join(xcodeproj_launchimg_path, "Contents.json"), "w") do |f|
191
219
  f.write(JSON.pretty_generate(launch_json))
192
220
  end
193
-
221
+
194
222
  end
195
223
 
196
224
  end
data/lib/pindo/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Pindo
2
2
 
3
- VERSION = "4.7.1"
3
+ VERSION = "4.7.3"
4
4
 
5
5
  class VersionCheck
6
6