pindo 4.8.3 → 4.8.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bf8d058f67c7ff8510ff7fd81a253bb1c5017ff9e7b6e4081e3b8e480157110
4
- data.tar.gz: ce4d42bab74ac5284ea3c40376a4b819bbf14b3fefa9d0fcd318b82b4112b75e
3
+ metadata.gz: 16ce8b8ae92b406194afa919044296d0f7801fc4146c4d89b27c792414694607
4
+ data.tar.gz: '0914b0e1e63700cef9e63d6404b7ea765a34b038777c629ebd6caa254b143b32'
5
5
  SHA512:
6
- metadata.gz: 7fe9c6a4869e27a3a2a1f3e2d2c91fe3ac350717b48c86c8835c0d617812cfc11734d00b1b52a16ad2672faa4043ee97f853f3acc6926eda30e3fd639cac29f5
7
- data.tar.gz: aaa3eeb667284e47265ebacbad633494142e98879684b862f2e2ec5704cdeb7c775d1f51af5a3bd3ee35af0eedee6540bceb56cdc3d52c1af70fa6add4a21312
6
+ metadata.gz: 681c6548cab3d378f7962d3f8d2cb67dedb7ad5bc69e5ed128075cf8e0fecf246e8c5a52f6f4fc356d7d03addcb6ff35ee2151f461716c6f9f48af638aa276c8
7
+ data.tar.gz: 6712a01b81509487ac6d62f80f870edd1abaf8abe874ebad8228efacd3d1e8a7aa9c2ad53268eae12a99e87563322749a4be7115602fc6a7ee273e98bd7384b3
@@ -32,6 +32,7 @@ module Pindo
32
32
  [
33
33
  ['--dev', '操作dev证书'],
34
34
  ['--adhoc', '操作adhoc证书'],
35
+ ['--macos', 'macos平台证书'],
35
36
  ['--clean', '删除本地缓存的证书'],
36
37
  ['--cleangit', '删除远程仓库中的证书'],
37
38
  ['--upload', '生成上传pgyer的证书'],
@@ -57,6 +58,11 @@ module Pindo
57
58
  @build_type = "development"
58
59
  end
59
60
 
61
+ @args_platform = "ios"
62
+ if @args_macos_flag
63
+ @args_platform = "macos"
64
+ end
65
+
60
66
  end
61
67
 
62
68
  def run
@@ -81,11 +87,22 @@ module Pindo
81
87
  bundle_id_array = get_bundle_id_map.values
82
88
  provisioning_info_array = nil
83
89
 
90
+
91
+ platform_type = "ios"
92
+ if @args_macos_flag
93
+ platform_type = "macos"
94
+ else
95
+ if @config_json && @config_json['project_info'] && @config_json['project_info']['build_type'].include?("MacOS")
96
+ platform_type = "macos"
97
+ end
98
+ end
99
+
100
+
84
101
  if @renew_cert_flag || @match_flag
85
- values = get_create_cert_match_values(apple_id:@apple_id, bundle_id_array:bundle_id_array, build_type:@build_type, renew_flag:@renew_cert_flag)
102
+ values = get_create_cert_match_values(apple_id:@apple_id, bundle_id_array:bundle_id_array, build_type:@build_type, platform_type:platform_type, renew_flag:@renew_cert_flag)
86
103
  config = FastlaneCore::Configuration.create(Match::Options.available_options, values)
87
104
  Match::Runner.new.run(config)
88
- provisioning_info_array = create_provisioning_info_array(build_type:@build_type)
105
+ provisioning_info_array = create_provisioning_info_array(build_type:@build_type, platform_type:platform_type)
89
106
  pindo_single_config.set_cert_info(dict: provisioning_info_array)
90
107
 
91
108
  else
@@ -96,10 +113,9 @@ module Pindo
96
113
  cert_reponame = cert_git_url.split("/").last.chomp(".git")
97
114
  certs_dir = getcode_to_dir(reponame:cert_reponame, remote_url:cert_git_url, path: pindo_single_config.pindo_dir, new_branch:@apple_id)
98
115
 
99
- install_certs(cert_url:cert_git_url, certs_dir:certs_dir, cert_type:@build_type)
116
+ install_certs(cert_url:cert_git_url, certs_dir:certs_dir, cert_type:@build_type, platform_type:platform_type)
100
117
  bundle_id_map = get_bundle_id_map
101
-
102
- provisioning_info_array = install_provisionfiles(cert_url:cert_git_url, certs_dir:certs_dir, bundle_id_map:bundle_id_map, cert_type:@build_type)
118
+ provisioning_info_array = install_provisionfiles(cert_url:cert_git_url, certs_dir:certs_dir, bundle_id_map:bundle_id_map, cert_type:@build_type, platform_type:platform_type)
103
119
  pindo_single_config.set_cert_info(dict: provisioning_info_array)
104
120
  end
105
121
 
@@ -124,12 +140,12 @@ module Pindo
124
140
  end
125
141
 
126
142
  if @upload_flag
127
- create_upload_cert_info(apple_id:@apple_id, cert_type:@build_type)
128
- create_upload_provisioning_info(apple_id:@apple_id, cert_type:@build_type, provisioning_info_array:provisioning_info_array)
143
+ create_upload_cert_info(apple_id:@apple_id, cert_type:@build_type, platform_type:platform_type)
144
+ create_upload_provisioning_info(apple_id:@apple_id, cert_type:@build_type, platform_type:platform_type, provisioning_info_array:provisioning_info_array)
129
145
  end
130
146
  end
131
147
 
132
- def get_create_cert_match_values(apple_id:nil, bundle_id_array:nil, build_type:nil, renew_flag:false)
148
+ def get_create_cert_match_values(apple_id:nil, bundle_id_array:nil, build_type:nil, platform_type:nil, renew_flag:false)
133
149
 
134
150
  if build_type.eql?("appstore") && (apple_id.eql?(pindo_single_config.demo_apple_id))
135
151
  raise Informative, "#{apple_id} 是测试账号,不能创建appstore证书!!!"
@@ -148,11 +164,6 @@ module Pindo
148
164
  force_for_new_devices_flag = false
149
165
  end
150
166
 
151
- platform_type = "ios"
152
- if @config_json && @config_json['project_info'] && @config_json['project_info']['build_type'].include?("MacOS")
153
- platform_type = "macos"
154
- end
155
-
156
167
  values = {
157
168
  username:apple_id,
158
169
  app_identifier: bundle_id_array,
@@ -69,8 +69,9 @@ module Pindo
69
69
  end
70
70
 
71
71
  Funlog.instance.fancyinfo_start("正在替换启动页...")
72
- launchimg_filename = File.join(app_config_dir,"launch","w768_h1024@2x.png")
73
- XcodeResHelper.install_launchimg(proj_dir:current_dir, launchimg_filename:launchimg_filename)
72
+
73
+ launchimg_pub_path = File.join(app_config_dir,"launch")
74
+ XcodeResHelper.install_launchimg(proj_dir:current_dir, launchimg_pub_path:launchimg_pub_path)
74
75
  Funlog.instance.fancyinfo_success("启动页处理完成!")
75
76
 
76
77
  add_project_modue(project_dir:current_dir, proj_name:@proj_name, config_json:@config_json)
@@ -26,6 +26,7 @@ module Pindo
26
26
  [
27
27
  ['--deploy', '默认用开发的bundle id,使用--deploy设置使用发布bundle id'],
28
28
  ['--adhoc', '默认用dev证书,使用--adhoc设置使用adhoc证书'],
29
+ ['--macos', 'macos平台证书'],
29
30
  ['--upload', '生成上传pgyer的证书'],
30
31
  ].concat(super)
31
32
  end
@@ -33,6 +34,7 @@ module Pindo
33
34
  def initialize(argv)
34
35
  @args_adhoc_flag = argv.flag?('adhoc', false)
35
36
  @args_deploy_flag = argv.flag?('deploy', false)
37
+ @args_macos_flag = argv.flag?('macos', false)
36
38
  @upload_flag = argv.flag?('upload', false)
37
39
  super
38
40
  end
@@ -64,9 +66,14 @@ module Pindo
64
66
  args_temp << "--dev"
65
67
  end
66
68
 
69
+ if @args_macos_flag
70
+ args_temp << "--macos"
71
+ end
72
+
67
73
  if @upload_flag
68
74
  args_temp << "--upload"
69
75
  end
76
+
70
77
  Pindo::Command::Deploy::Cert::run(args_temp)
71
78
 
72
79
  end
@@ -56,7 +56,45 @@ module Pindo
56
56
  end
57
57
  end
58
58
 
59
-
59
+
60
+ def get_last_work_project_array()
61
+ last_work_project_array = nil
62
+ if !@pindo_user_local_config_json.nil?
63
+ last_work_project_array = @pindo_user_local_config_json["last_work_project_array"] || []
64
+ end
65
+ last_work_project_array = last_work_project_array || []
66
+ return last_work_project_array;
67
+ end
68
+
69
+
70
+ def write_last_work_project(proj_name:nil)
71
+ if proj_name.nil?
72
+ return
73
+ end
74
+ if proj_name.length < 1
75
+ return
76
+ end
77
+
78
+ @pindo_user_local_config_json = @pindo_user_local_config_json || {}
79
+
80
+ last_work_project_array = @pindo_user_local_config_json["last_work_project_array"] || []
81
+
82
+
83
+ # 从数组中删除目标字符串
84
+ last_work_project_array.delete(proj_name)
85
+ # 将目标字符串插入到数组末尾
86
+ last_work_project_array.unshift(proj_name)
87
+ # 如果数组长度超过5,删除第一个元素
88
+ last_work_project_array.pop if last_work_project_array.length > 6
89
+ last_work_project_array.pop if last_work_project_array.length > 6
90
+
91
+ @pindo_user_local_config_json["last_work_project_array"] = last_work_project_array
92
+ File.open(@pindo_user_local_config_file, "w") do |file|
93
+ file.write(JSON.pretty_generate(@pindo_user_local_config_json))
94
+ file.close
95
+ end
96
+ end
97
+
60
98
 
61
99
 
62
100
  def self.reload_instance
@@ -62,11 +62,19 @@ module Pindo
62
62
  (/darwin/ =~ RUBY_PLATFORM) != nil
63
63
  end
64
64
 
65
- def install_certs(cert_url:nil, certs_dir:nil, cert_type:nil)
65
+ def install_certs(cert_url:nil, certs_dir:nil, cert_type:nil, platform_type:nil)
66
66
 
67
67
  cert_git_dir = cert_type.downcase
68
- if !cert_type.downcase.include?("development")
69
- cert_git_dir = "distribution"
68
+ if platform_type.downcase.eql?("macos")
69
+ if !cert_type.downcase.include?("development")
70
+ cert_git_dir = "developer_id_application"
71
+ else
72
+ cert_git_dir = "development"
73
+ end
74
+ else
75
+ if !cert_type.downcase.include?("development")
76
+ cert_git_dir = "distribution"
77
+ end
70
78
  end
71
79
 
72
80
  certs = Dir[File.join(certs_dir, "certs", cert_git_dir.to_s, "*.cer")]
@@ -120,24 +128,40 @@ module Pindo
120
128
 
121
129
  end
122
130
 
123
- def install_provisionfiles(cert_url:nil, certs_dir:nil, bundle_id_map:nil, cert_type:nil)
124
-
125
-
126
- if cert_type.downcase.include?("development")
127
- cert_type = "Development"
128
- elsif cert_type.downcase.include?("adhoc")
129
- cert_type = "Adhoc"
131
+ def install_provisionfiles(cert_url:nil, certs_dir:nil, bundle_id_map:nil, cert_type:nil, platform_type:nil)
132
+
133
+ cert_sub_dir = cert_type.downcase
134
+ provision_start_name = "Development"
135
+ provision_extension_name = ".mobileprovision"
136
+ if platform_type.downcase.include?("macos")
137
+ provision_extension_name = ".provisionprofile"
138
+ if cert_type.downcase.include?("development")
139
+ provision_start_name = "Development"
140
+ cert_sub_dir = cert_type.downcase
141
+ else
142
+ provision_start_name = "Direct"
143
+ cert_sub_dir = "developer_id"
144
+ end
130
145
  else
131
- cert_type = "AppStore"
146
+ if cert_type.downcase.include?("development")
147
+ provision_start_name = "Development"
148
+ cert_sub_dir = cert_type.downcase
149
+ elsif cert_type.downcase.include?("adhoc")
150
+ provision_start_name = "Adhoc"
151
+ cert_sub_dir = "adhoc"
152
+ else
153
+ provision_start_name = "AppStore"
154
+ cert_sub_dir = "appstore"
155
+ end
132
156
  end
133
157
 
134
- Funlog.instance.fancyinfo_start("正在安装#{cert_type} Provisioning Profiles...")
158
+
159
+ Funlog.instance.fancyinfo_start("正在安装#{provision_start_name} #{platform_type} Provisioning Profiles...")
135
160
 
136
161
  un_exist_files = []
137
162
  provisioning_info_array = []
138
-
139
163
  bundle_id_map.each do |type, bundle_id_temp|
140
- profile_filename = File.join(certs_dir, "profiles", cert_type.downcase.to_s,[cert_type.to_s, bundle_id_temp].join('_') + '.mobileprovision')
164
+ profile_filename = File.join(certs_dir, "profiles", cert_sub_dir, [provision_start_name.to_s, bundle_id_temp].join('_') + provision_extension_name)
141
165
  unless File.exist?(profile_filename)
142
166
  un_exist_files << profile_filename
143
167
  next
@@ -164,10 +188,10 @@ module Pindo
164
188
  provisioning_info_array << provisioning_info
165
189
  end
166
190
 
167
- Funlog.instance.fancyinfo_success("#{cert_type} Provisioning Profiles文件安装完成!")
191
+ Funlog.instance.fancyinfo_success("#{provision_start_name} #{platform_type} Provisioning Profiles文件安装完成!")
168
192
 
169
193
  if un_exist_files.size > 0
170
- Funlog.instance.fancyinfo_error("证书 #{cert_type} Provisioning Profiles文件不存在!")
194
+ Funlog.instance.fancyinfo_error("证书 #{provision_start_name} #{platform_type} Provisioning Profiles文件不存在!")
171
195
  raise Informative, "The following profiles do not exist: #{un_exist_files.join(', ')}"
172
196
  end
173
197
 
@@ -24,7 +24,7 @@ module Pindo
24
24
  }
25
25
  end
26
26
 
27
- def create_provisioning_info_array(build_type:nil)
27
+ def create_provisioning_info_array(build_type:nil, platform_type:nil)
28
28
 
29
29
  provisioning_info_array = []
30
30
 
@@ -34,13 +34,13 @@ module Pindo
34
34
  provisioning_info = {}
35
35
  provisioning_info['type'] = type
36
36
  provisioning_info['bundle_id'] = bundle_id_temp
37
- name_temp = Match::Utils.environment_variable_name_profile_name(app_identifier: bundle_id_temp, type: build_type)
37
+ name_temp = Match::Utils.environment_variable_name_profile_name(app_identifier: bundle_id_temp, type: build_type, platform:platform_type)
38
38
  provisioning_info['profile_name'] = ENV[name_temp]
39
- path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier:bundle_id_temp,type: build_type)
39
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier:bundle_id_temp,type: build_type, platform:platform_type)
40
40
  provisioning_info['profile_path'] = ENV[path_temp]
41
- signing_identity_key=Match::Utils.environment_variable_name_certificate_name(app_identifier: bundle_id_temp,type: build_type)
41
+ signing_identity_key=Match::Utils.environment_variable_name_certificate_name(app_identifier: bundle_id_temp,type: build_type, platform:platform_type)
42
42
  provisioning_info["signing_identity"] = ENV[signing_identity_key]
43
- team_id_key = Match::Utils.environment_variable_name_team_id(app_identifier: bundle_id_temp,type:build_type)
43
+ team_id_key = Match::Utils.environment_variable_name_team_id(app_identifier: bundle_id_temp,type:build_type, platform:platform_type)
44
44
  provisioning_info["team_id"] = ENV[team_id_key]
45
45
  provisioning_info_array << provisioning_info
46
46
  end
@@ -226,13 +226,25 @@ module Pindo
226
226
  end
227
227
  end
228
228
 
229
- def create_upload_cert_info(apple_id:nil, cert_type:nil)
229
+ def create_upload_cert_info(apple_id:nil, cert_type:nil, platform_type:nil)
230
230
 
231
231
  cert_dest_dir = File.join(Dir.pwd, "cert")
232
232
  if !File.exist?(cert_dest_dir)
233
233
  FileUtils.mkdir_p(cert_dest_dir)
234
234
  end
235
235
 
236
+ cert_sub_dir = cert_type.downcase
237
+ if platform_type.downcase.eql?("macos")
238
+ if !cert_type.downcase.include?("development")
239
+ cert_sub_dir = "developer_id_application"
240
+ else
241
+ cert_sub_dir = "development"
242
+ end
243
+ else
244
+ if !cert_type.downcase.include?("development")
245
+ cert_sub_dir = "distribution"
246
+ end
247
+ end
236
248
 
237
249
  cert_git_url = pindo_single_config.deploy_cert_giturl
238
250
  if apple_id.eql?(pindo_single_config.demo_apple_id)
@@ -241,12 +253,8 @@ module Pindo
241
253
  cert_reponame = cert_git_url.split("/").last.chomp(".git")
242
254
  certs_dir = getcode_to_dir(reponame:cert_reponame, remote_url:cert_git_url, path: pindo_single_config.pindo_dir, new_branch:apple_id)
243
255
 
244
- cert_git_dir = cert_type.downcase
245
- if !cert_type.downcase.include?("development")
246
- cert_git_dir = "distribution"
247
- end
248
256
 
249
- keys = Dir[File.join(certs_dir, "certs", cert_git_dir.to_s, "*.p12")]
257
+ keys = Dir[File.join(certs_dir, "certs", cert_sub_dir, "*.p12")]
250
258
  decrypt_password = AESHelper.fetch_password(keychain_name:cert_git_url)
251
259
  output_dir = Dir.mktmpdir
252
260
  key_path = AESHelper.decrypt_specific_file(src_file: keys.first, password:decrypt_password, output_dir: output_dir)
@@ -259,7 +267,7 @@ module Pindo
259
267
 
260
268
  end
261
269
 
262
- def create_upload_provisioning_info(apple_id:nil, cert_type:nil, provisioning_info_array:nil)
270
+ def create_upload_provisioning_info(apple_id:nil, cert_type:nil, platform_type:nil, provisioning_info_array:nil)
263
271
 
264
272
  cert_dir = File.join(Dir.pwd, "cert")
265
273
  cert_json_file = File.join(cert_dir, "certs.json")
@@ -311,37 +319,57 @@ module Pindo
311
319
  cert_item["cert_provisioning_group"] = cert_item["cert_provisioning_group"] || []
312
320
 
313
321
 
322
+ provision_start_name = "Development"
323
+ if platform_type.downcase.include?("macos")
324
+ if cert_type.downcase.include?("development")
325
+ provision_start_name = "development"
326
+ else
327
+ provision_start_name = "direct"
328
+ end
329
+ else
330
+ if cert_type.downcase.include?("development")
331
+ provision_start_name = "development"
332
+ elsif cert_type.downcase.include?("adhoc")
333
+ provision_start_name = "adhoc"
334
+ else
335
+ provision_start_name = "appstore"
336
+ end
337
+ end
314
338
 
315
339
  cert_provisioning_group_item = {}
316
- provisioning_group_id = [cert_type, "group", bundle_id].join("_")
340
+ provisioning_group_id = [provision_start_name, platform_type, bundle_id].join("_")
317
341
 
318
342
  provisioning_group_result = cert_item["cert_provisioning_group"].select { |x| x["provisioning_group_id"].eql?(provisioning_group_id)}.first
319
343
  if provisioning_group_result.nil?
320
- cert_provisioning_group_item = {}
344
+ cert_provisioning_group_item = {}
321
345
  else
322
- cert_provisioning_group_item = provisioning_group_result
323
- cert_item["cert_provisioning_group"].delete_if { |x| x["provisioning_group_id"].eql?(provisioning_group_id)}
346
+ cert_provisioning_group_item = provisioning_group_result
347
+ cert_item["cert_provisioning_group"].delete_if { |x| x["provisioning_group_id"].eql?(provisioning_group_id)}
324
348
  end
325
349
 
326
350
 
327
351
 
328
352
  cert_provisioning_group_item["provisioning_group_id"] = provisioning_group_id
353
+ cert_provisioning_group_item["platform_type"] = platform_type
329
354
  cert_provisioning_group_item["provisioning_main_bundle_id"] = bundle_id
330
355
  cert_provisioning_group_item["provisioning_items"] = []
331
356
 
332
- group_id = [cert_type, "group", bundle_id].join("_")
357
+ group_id = [provision_start_name, platform_type, bundle_id].join("_")
358
+
359
+
333
360
  provisioning_info_array.each do |provisioning_info|
334
361
  bundle_id_temp = provisioning_info['bundle_id']
335
- provisioning_id = [cert_type, bundle_id_temp].join("_")
336
-
362
+ provisioning_id = [provision_start_name, bundle_id_temp].join("_")
363
+ real_path = provisioning_info["profile_path"]
364
+ extname = File.extname(real_path)
337
365
  cert_provisioning_group_item["provisioning_items"] << {
338
366
  "bundle_id" => bundle_id_temp,
339
367
  "provisioning_id" => provisioning_id,
340
368
  "group_id" => group_id,
341
- "provisioning_file" => provisioning_id + ".mobileprovision"
369
+ "provisioning_file" => provisioning_id + extname
342
370
  }
343
- real_path = provisioning_info["profile_path"]
344
- FileUtils.cp_r(real_path, File.join(cert_dir, provisioning_id + ".mobileprovision"))
371
+
372
+ FileUtils.cp_r(real_path, File.join(cert_dir, provisioning_id + extname))
345
373
 
346
374
  end
347
375
 
@@ -63,23 +63,46 @@ module Pindo
63
63
  end
64
64
 
65
65
  proj_name_array = []
66
+
67
+ proj_name_array = proj_name_array + PindoUserLocalConfig.instance.get_last_work_project_array()
68
+
69
+
70
+ proj_name_array_append = []
71
+
66
72
  if File.exist?(File.join(working_directory, "config.json"))
67
73
  config_json = JSON.parse(File.read(File.join(working_directory, "config.json")))
68
- proj_name_array << config_json["project_info"]["project_name"]
74
+ new_proj_string = config_json["project_info"]["project_name"]
75
+ if !new_proj_string.nil? && !new_proj_string.empty?
76
+ proj_name_array_append << config_json["project_info"]["project_name"]
77
+ end
69
78
  end
70
79
 
71
80
  xcodeproj_file_name = Dir.glob(File.join(Dir.pwd, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
72
- upload_proj_name = File.basename(xcodeproj_file_name, ".xcodeproj") if xcodeproj_file_name
73
- if !upload_proj_name.nil? && !upload_proj_name.empty?
74
- proj_name_array << upload_proj_name
81
+ new_proj_string = File.basename(xcodeproj_file_name, ".xcodeproj") if xcodeproj_file_name
82
+ if !new_proj_string.nil? && !new_proj_string.empty?
83
+ proj_name_array_append << new_proj_string
75
84
  end
76
85
 
77
- puts
78
86
  dir_base_name = File.basename(working_directory)
79
87
  unless ["Desktop", "Documents", "Downloads"].include?(dir_base_name)
80
- proj_name_array << dir_base_name
88
+ proj_name_array_append << dir_base_name
81
89
  end
82
90
 
91
+ proj_name_array_append.each do |new_string|
92
+ if !new_string.nil? && !new_string.empty?
93
+ if proj_name_array.size > 0
94
+ new_fromat_string = new_string.gsub(/[\s_]/, "")
95
+ unless proj_name_array.any? { |s| s.gsub(/[\s_]/, "") == new_fromat_string }
96
+ # 如果不存在相同字符串,插入到第一位
97
+ proj_name_array.push(new_string)
98
+ end
99
+ else
100
+ proj_name_array.push(new_string)
101
+ end
102
+ end
103
+ end
104
+
105
+ proj_name_array.uniq
83
106
  proj_name_array << "自定义输入Pyger上的App代号"
84
107
 
85
108
  if proj_name_array.size > 1
@@ -108,7 +131,12 @@ module Pindo
108
131
 
109
132
  if app_info_obj.nil?
110
133
  raise Informative, "#{upload_proj_name} 名称错误, 请输入正确的App代号,Pgyer网站没有该App!!!"
134
+ else
135
+ # 记录上次上传的项目
136
+ PindoUserLocalConfig.instance.write_last_work_project(proj_name:app_info_obj["appName"])
111
137
  end
138
+
139
+
112
140
  else
113
141
  raise Informative, "请先登录Pgyer网站"
114
142
  end
@@ -137,15 +137,39 @@ module Pindo
137
137
 
138
138
  project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
139
139
  project_obj = Xcodeproj::Project.open(project_fullname)
140
+ presources_path = nil
141
+
140
142
  presources_group = find_group(group:project_obj.main_group, group_name:"PResources")
141
143
  if presources_group.nil?
142
144
  presources_group = find_group(group:project_obj.main_group, group_name:"PResource")
143
145
  end
144
- if presources_group.nil?
145
- raise Informative, "没有找到资源目录PResources!!!!"
146
+ if !presources_group.nil?
147
+ presources_path = presources_group.real_path
146
148
  end
147
149
 
148
- presources_path = presources_group.real_path
150
+ if presources_path.nil?
151
+ presources_path_array = Dir.glob(File.join(project_dir, "**", "PResources"))
152
+ if presources_path_array.size > 1
153
+ presources_path = presources_path_array.select{ |filename| File.directory?(filename) && filename.end_with?("PResources")}
154
+ elsif presources_path_array.size == 1
155
+ presources_path = presources_path_array.first
156
+ end
157
+ end
158
+
159
+ if presources_path.nil?
160
+ presources_path_array = Dir.glob(File.join(project_dir, "**", "PResource"))
161
+ if presources_path_array.size > 1
162
+ presources_path = presources_path_array.select{ |filename| File.directory?(filename) && filename.end_with?("PResource")}
163
+ elsif presources_path_array.size == 1
164
+ presources_path = presources_path_array.first
165
+ end
166
+ end
167
+
168
+
169
+ if presources_path.nil? || !File.exist?(presources_path)
170
+ raise Informative, "没有找到资源目录PResources !!!!"
171
+ end
172
+
149
173
 
150
174
  config_file = Dir.glob(File.join(presources_path, "**", appprefix_file)).first
151
175
  if config_file.nil? || config_file.empty? || !File.exist?(config_file)
@@ -290,14 +290,24 @@ module Pindo
290
290
  proj_fullname = File.join(project_dir, proj_name) + ".xcodeproj"
291
291
  project_obj = Xcodeproj::Project.open(proj_fullname)
292
292
 
293
- info_plist_path = File.join(project_dir, "AppEntry", "Info.plist")
293
+ info_plist_path = nil
294
294
  project_obj.targets.each do |target|
295
-
296
295
  temp_info = target.build_configurations.first.build_settings['INFOPLIST_FILE']
297
- info_plist_path = File.join(project_dir, temp_info)
296
+ if !temp_info.nil?
297
+ info_plist_path = File.join(project_dir, temp_info)
298
+ end
298
299
 
299
- if target.product_type.to_s.eql?("com.apple.product-type.application") && !File.exist?(info_plist_path)
300
- raise Informative, "Missing Target #{target.name.to_s} Info.plist !!! Modify Info.plist Error !!!"
300
+ # if target.product_type.to_s.eql?("com.apple.product-type.application") && !File.exist?(info_plist_path)
301
+ # info_plist_array = Dir.glob(File.join(project_dir, target.name, "**", "Info.plist"))
302
+ # if info_plist_array.size == 1
303
+ # info_plist_path = info_plist_array.first
304
+ # else
305
+ # raise Informative, "Missing Target #{target.name.to_s} Info.plist !!! Modify Info.plist Error !!!"
306
+ # end
307
+ # end
308
+
309
+ if target.product_type.to_s.eql?("com.apple.product-type.application") && (info_plist_path.nil? || !File.exist?(info_plist_path))
310
+ raise Informative, "Target #{target.name.to_s} 没有找到Info.plist, 修改Info.plist出错了!!"
301
311
  end
302
312
 
303
313
  if target.product_type.to_s.eql?("com.apple.product-type.application") then
@@ -2,126 +2,179 @@
2
2
  module Pindo
3
3
 
4
4
  module XcodoeResConst
5
-
6
5
  def self.xcode_ios_icon_json
7
- model_data = {
8
- "images" => [
9
- {
10
- "size" => "20x20",
11
- "idiom" => "iphone",
12
- "filename" => "icon20@2x.png",
13
- "scale" => "2x"
14
- },
15
- {
16
- "size" => "20x20",
17
- "idiom" => "iphone",
18
- "filename" => "icon20@3x.png",
19
- "scale" => "3x"
20
- },
21
- {
22
- "size" => "29x29",
23
- "idiom" => "iphone",
24
- "filename" => "icon29@2x.png",
25
- "scale" => "2x"
26
- },
27
- {
28
- "size" => "29x29",
29
- "idiom" => "iphone",
30
- "filename" => "icon29@3x.png",
31
- "scale" => "3x"
32
- },
33
- {
34
- "size" => "40x40",
35
- "idiom" => "iphone",
36
- "filename" => "icon40@2x.png",
37
- "scale" => "2x"
38
- },
39
- {
40
- "size" => "40x40",
41
- "idiom" => "iphone",
42
- "filename" => "icon40@3x.png",
43
- "scale" => "3x"
44
- },
45
- {
46
- "size" => "60x60",
47
- "idiom" => "iphone",
48
- "filename" => "icon60@2x.png",
49
- "scale" => "2x"
50
- },
51
- {
52
- "size" => "60x60",
53
- "idiom" => "iphone",
54
- "filename" => "icon60@3x.png",
55
- "scale" => "3x"
56
- },
57
- {
58
- "size" => "20x20",
59
- "idiom" => "ipad",
60
- "filename" => "icon20@1x.png",
61
- "scale" => "1x"
62
- },
63
- {
64
- "size" => "20x20",
65
- "idiom" => "ipad",
66
- "filename" => "icon20@2x.png",
67
- "scale" => "2x"
68
- },
69
- {
70
- "size" => "29x29",
71
- "idiom" => "ipad",
72
- "filename" => "icon29@1x.png",
73
- "scale" => "1x"
74
- },
75
- {
76
- "size" => "29x29",
77
- "idiom" => "ipad",
78
- "filename" => "icon29@2x.png",
79
- "scale" => "2x"
80
- },
81
- {
82
- "size" => "40x40",
83
- "idiom" => "ipad",
84
- "filename" => "icon40@1x.png",
85
- "scale" => "1x"
86
- },
87
- {
88
- "size" => "40x40",
89
- "idiom" => "ipad",
90
- "filename" => "icon40@2x.png",
91
- "scale" => "2x"
92
- },
93
- {
94
- "size" => "76x76",
95
- "idiom" => "ipad",
96
- "filename" => "icon76@1x.png",
97
- "scale" => "1x"
98
- },
99
- {
100
- "size" => "76x76",
101
- "idiom" => "ipad",
102
- "filename" => "icon76@2x.png",
103
- "scale" => "2x"
104
- },
105
- {
106
- "size" => "83.5x83.5",
107
- "idiom" => "ipad",
108
- "filename" => "icon83_5@2x.png",
109
- "scale" => "2x"
110
- },
111
- {
112
- "size" => "1024x1024",
113
- "idiom" => "ios-marketing",
114
- "filename" => "icon1024@1x.png",
115
- "scale" => "1x"
6
+ model_data ={
7
+ "images" => [
8
+ {
9
+ "filename" => "icon1024@1x.png",
10
+ "idiom" => "universal",
11
+ "platform" => "ios",
12
+ "size" => "1024x1024"
13
+ }
14
+ ],
15
+ "info" => {
16
+ "author" => "xcode",
17
+ "version" => 1
18
+ }
116
19
  }
117
- ],
118
- "info" => {
119
- "version" => 1,
120
- "author" => "xcode"
121
- }
122
- }
123
20
  return model_data
21
+ # model_data ={
22
+ # "images" => [
23
+ # {
24
+ # "filename" => "icon0.png",
25
+ # "idiom" => "universal",
26
+ # "platform" => "ios",
27
+ # "size" => "1024x1024"
28
+ # },
29
+ # {
30
+ # "appearances" => [
31
+ # {
32
+ # "appearance" => "luminosity",
33
+ # "value" => "dark"
34
+ # }
35
+ # ],
36
+ # "idiom" => "universal",
37
+ # "platform" => "ios",
38
+ # "size" => "1024x1024"
39
+ # },
40
+ # {
41
+ # "appearances" => [
42
+ # {
43
+ # "appearance" => "luminosity",
44
+ # "value" => "tinted"
45
+ # }
46
+ # ],
47
+ # "idiom" => "universal",
48
+ # "platform" => "ios",
49
+ # "size" => "1024x1024"
50
+ # }
51
+ # ],
52
+ # "info" => {
53
+ # "author" => "xcode",
54
+ # "version" => 1
55
+ # }
56
+ # }
57
+ # return model_data
124
58
  end
59
+ # def self.xcode_ios_icon_json
60
+ # model_data = {
61
+ # "images" => [
62
+ # {
63
+ # "size" => "20x20",
64
+ # "idiom" => "iphone",
65
+ # "filename" => "icon20@2x.png",
66
+ # "scale" => "2x"
67
+ # },
68
+ # {
69
+ # "size" => "20x20",
70
+ # "idiom" => "iphone",
71
+ # "filename" => "icon20@3x.png",
72
+ # "scale" => "3x"
73
+ # },
74
+ # {
75
+ # "size" => "29x29",
76
+ # "idiom" => "iphone",
77
+ # "filename" => "icon29@2x.png",
78
+ # "scale" => "2x"
79
+ # },
80
+ # {
81
+ # "size" => "29x29",
82
+ # "idiom" => "iphone",
83
+ # "filename" => "icon29@3x.png",
84
+ # "scale" => "3x"
85
+ # },
86
+ # {
87
+ # "size" => "40x40",
88
+ # "idiom" => "iphone",
89
+ # "filename" => "icon40@2x.png",
90
+ # "scale" => "2x"
91
+ # },
92
+ # {
93
+ # "size" => "40x40",
94
+ # "idiom" => "iphone",
95
+ # "filename" => "icon40@3x.png",
96
+ # "scale" => "3x"
97
+ # },
98
+ # {
99
+ # "size" => "60x60",
100
+ # "idiom" => "iphone",
101
+ # "filename" => "icon60@2x.png",
102
+ # "scale" => "2x"
103
+ # },
104
+ # {
105
+ # "size" => "60x60",
106
+ # "idiom" => "iphone",
107
+ # "filename" => "icon60@3x.png",
108
+ # "scale" => "3x"
109
+ # },
110
+ # {
111
+ # "size" => "20x20",
112
+ # "idiom" => "ipad",
113
+ # "filename" => "icon20@1x.png",
114
+ # "scale" => "1x"
115
+ # },
116
+ # {
117
+ # "size" => "20x20",
118
+ # "idiom" => "ipad",
119
+ # "filename" => "icon20@2x.png",
120
+ # "scale" => "2x"
121
+ # },
122
+ # {
123
+ # "size" => "29x29",
124
+ # "idiom" => "ipad",
125
+ # "filename" => "icon29@1x.png",
126
+ # "scale" => "1x"
127
+ # },
128
+ # {
129
+ # "size" => "29x29",
130
+ # "idiom" => "ipad",
131
+ # "filename" => "icon29@2x.png",
132
+ # "scale" => "2x"
133
+ # },
134
+ # {
135
+ # "size" => "40x40",
136
+ # "idiom" => "ipad",
137
+ # "filename" => "icon40@1x.png",
138
+ # "scale" => "1x"
139
+ # },
140
+ # {
141
+ # "size" => "40x40",
142
+ # "idiom" => "ipad",
143
+ # "filename" => "icon40@2x.png",
144
+ # "scale" => "2x"
145
+ # },
146
+ # {
147
+ # "size" => "76x76",
148
+ # "idiom" => "ipad",
149
+ # "filename" => "icon76@1x.png",
150
+ # "scale" => "1x"
151
+ # },
152
+ # {
153
+ # "size" => "76x76",
154
+ # "idiom" => "ipad",
155
+ # "filename" => "icon76@2x.png",
156
+ # "scale" => "2x"
157
+ # },
158
+ # {
159
+ # "size" => "83.5x83.5",
160
+ # "idiom" => "ipad",
161
+ # "filename" => "icon83_5@2x.png",
162
+ # "scale" => "2x"
163
+ # },
164
+ # {
165
+ # "size" => "1024x1024",
166
+ # "idiom" => "ios-marketing",
167
+ # "filename" => "icon1024@1x.png",
168
+ # "scale" => "1x"
169
+ # }
170
+ # ],
171
+ # "info" => {
172
+ # "version" => 1,
173
+ # "author" => "xcode"
174
+ # }
175
+ # }
176
+ # return model_data
177
+ # end
125
178
 
126
179
  def self.xcode_ios_imessage_icon_json
127
180
  model_data = {
@@ -8,77 +8,18 @@ module Pindo
8
8
  class XcodeResHandler
9
9
 
10
10
 
11
- def self.create_icon(icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
12
- xcode_icon_json["images"].each do |image_data|
13
- width,height = image_data["size"].split("x")
14
- image_name = image_data["filename"]
15
- iNum = image_name.split("@").last.chomp(".png").chomp("x").to_f
16
- width = width.to_f * iNum
17
- height = height.to_f * iNum
18
-
19
- width = width.to_i
20
- height = height.to_i
21
-
22
- command = [
23
- 'sips',
24
- '--matchTo', '/System/Library/ColorSync/Profiles/sRGB Profile.icc',
25
- '-z', width.to_s, height.to_s,
26
- icon_name,
27
- '--out', File.join(new_icon_dir, image_name)
28
- ]
29
- Executable.capture_command('sips', command, capture: :out)
30
-
31
- # if !File.exist?(File.join(new_icon_dir, image_name))
32
- # raise Informative, "生成icon失败!"
33
- # end
34
- # system("sips --matchTo '/System/Library/ColorSync/Profiles/sRGB Profile.icc' -z #{width} #{height} #{icon_name} --out #{new_icon_dir}/#{image_name}")
35
- end
36
- File.open(File.join(new_icon_dir, "Contents.json"), "w") do |f|
37
- f.write(JSON.pretty_generate(xcode_icon_json))
38
- end
39
- end
40
-
41
-
42
- def self.create_imessage_icon(icon_name:nil, image_icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
43
- xcode_icon_json["images"].each do |image_data|
44
-
45
- height, width = image_data["size"].split("x")
46
- image_name = image_data["filename"]
47
- iNum = image_name.split("@").last.chomp(".png").chomp("x").to_f
48
- width = width.to_f * iNum
49
- height = height.to_f * iNum
50
- width = width.to_i
51
- height = height.to_i
52
-
53
- icon_ori_name = image_icon_name
54
- if width.to_s.eql?(height.to_s)
55
- icon_ori_name = icon_name
56
- end
57
-
58
- command = [
59
- 'sips',
60
- '--matchTo', '/System/Library/ColorSync/Profiles/sRGB Profile.icc',
61
- '-z', width.to_s, height.to_s,
62
- icon_name,
63
- '--out', File.join(new_icon_dir, image_name)
64
- ]
65
- Executable.capture_command('sips', command, capture: :out)
66
- end
67
-
68
- File.open(File.join(new_icon_dir, "Contents.json"), "w") do |f|
69
- f.write(JSON.pretty_generate(xcode_icon_json))
70
- end
71
- end
72
-
73
11
  def initialize(proj_fullname:nil)
74
12
  @proj_fullname = proj_fullname
75
13
  @project_obj = Xcodeproj::Project.open(proj_fullname)
76
14
  end
77
15
 
78
- def get_xcodeproj_icon_path
16
+ def get_xcodeproj_icon_path()
79
17
 
80
18
  icon_path = nil
81
19
  select_target = @project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]) }.first
20
+
21
+ project_dir = @project_obj.project_dir
22
+
82
23
  if !select_target.nil?
83
24
  file_refs = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") } || []
84
25
  file_refs.each do |file_ref|
@@ -90,6 +31,14 @@ module Pindo
90
31
  end
91
32
  end
92
33
  end
34
+ if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
35
+ icon_path_array = Dir.glob(File.join(project_dir, "**", "AppIcon.appiconset"))
36
+ if icon_path_array.size > 1
37
+ icon_path = icon_path_array.select{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/AppIcon.appiconset")}
38
+ elsif icon_path_array.size == 1
39
+ icon_path = icon_path_array.first
40
+ end
41
+ end
93
42
 
94
43
  if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
95
44
  raise Informative, "没有找到Xcode icon 目录"
@@ -99,7 +48,7 @@ module Pindo
99
48
  end
100
49
 
101
50
  def install_icon_res(new_icon_dir:nil)
102
- icon_path = get_xcodeproj_icon_path
51
+ icon_path = get_xcodeproj_icon_path()
103
52
  begin
104
53
  FileUtils.rm_rf(icon_path)
105
54
  FileUtils.mkdir_p(icon_path)
@@ -112,7 +61,7 @@ module Pindo
112
61
  end
113
62
 
114
63
  def validate_icon_res()
115
- icon_path = get_xcodeproj_icon_path
64
+ icon_path = get_xcodeproj_icon_path()
116
65
  xcode_ios_icon_json = XcodoeResConst.xcode_ios_icon_json
117
66
  xcode_ios_icon_json["images"].each do |image_data|
118
67
  image_name = image_data["filename"]
@@ -125,6 +74,7 @@ module Pindo
125
74
  def get_xcodeproj_imessage_icon_path
126
75
  icon_path = nil
127
76
  select_target = @project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:messages_extension]) }.first
77
+ project_dir = @project_obj.project_dir
128
78
  if !select_target.nil?
129
79
  file_refs = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") } || []
130
80
  file_refs.each do |file_ref|
@@ -136,6 +86,15 @@ module Pindo
136
86
  end
137
87
  end
138
88
 
89
+ if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
90
+ icon_path_array = Dir.glob(File.join(project_dir, "**", "iMessage App Icon.stickersiconset"))
91
+ if icon_path_array.size > 1
92
+ icon_path = icon_path_array.select{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/iMessage App Icon.stickersiconset")}
93
+ elsif icon_path_array.size == 1
94
+ icon_path = icon_path_array.first
95
+ end
96
+ end
97
+
139
98
  if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
140
99
  raise Informative, "没有找到Xcode iMessage icon 目录"
141
100
  end
@@ -173,50 +132,76 @@ module Pindo
173
132
  def get_xcodeproj_launchimg_path
174
133
 
175
134
  launchimg_path = nil
135
+ assets_path = nil
176
136
  select_target = @project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]) }.first
177
- file_ref = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") }.first
137
+ project_dir = @project_obj.project_dir
138
+ if !select_target.nil?
139
+ assets_objs = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") } || []
140
+ if assets_objs.size > 0
141
+ assets_path = assets_objs.first.real_path
142
+ if File.exist?(assets_path) && File.exist?(File.join(assets_path, "LaunchImage.imageset"))
143
+ launchimg_path = File.join(assets_path, "LaunchImage.imageset")
144
+ elsif File.exist?(assets_path) && File.exist?(File.join(assets_path, "LaunchImage.launchimage"))
145
+ launchimg_path = File.join(assets_path, "LaunchImage.launchimage")
146
+ end
147
+ end
148
+ end
178
149
 
179
- assets_path = file_ref.real_path
180
- if File.exist?(File.join(assets_path, "LaunchImage.imageset"))
181
- launchimg_path = File.join(assets_path, "LaunchImage.imageset")
182
- else
183
- launchimg_path = File.join(assets_path, "LaunchImage.launchimage")
150
+ if launchimg_path.nil? || launchimg_path.empty? || !File.exist?(launchimg_path)
151
+ launchimg_path_array = Dir.glob(File.join(project_dir, "**", "LaunchImage.imageset"))
152
+ if launchimg_path_array.size > 1
153
+ launchimg_path = launchimg_path_array.select{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/LaunchImage.imageset")}
154
+ elsif launchimg_path_array.size == 1
155
+ launchimg_path = launchimg_path_array.first
156
+ end
157
+ end
158
+
159
+ if launchimg_path.nil? || launchimg_path.empty? || !File.exist?(launchimg_path)
160
+ launchimg_path_array = Dir.glob(File.join(project_dir, "**", "LaunchImage.launchimage"))
161
+ if launchimg_path_array.size > 1
162
+ launchimg_path = launchimg_path_array.select{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/LaunchImage.launchimage")}
163
+ elsif launchimg_path_array.size == 1
164
+ launchimg_path = launchimg_path_array.first
165
+ end
184
166
  end
185
167
 
186
168
  return launchimg_path
187
169
  end
188
170
 
189
- def install_launchimg(launchimg_file:nil)
190
-
171
+ def install_launchimg(launchimg_pub_path:nil)
191
172
 
192
173
  xcodeproj_launchimg_path = get_xcodeproj_launchimg_path
193
- if xcodeproj_launchimg_path.nil? || !File.exist?(xcodeproj_launchimg_path)
194
- return
195
- end
196
-
197
- project_origin_launchimg = Dir.glob(File.join(xcodeproj_launchimg_path, "/*.png")).max_by {|f| File.mtime(f)}
174
+ pub_launchimg_files = Dir.glob(File.join(launchimg_pub_path, "*.{png,jpg}"))
198
175
 
199
- if project_origin_launchimg.nil? || !File.exist?(project_origin_launchimg)
176
+ if xcodeproj_launchimg_path.nil? || !File.exist?(xcodeproj_launchimg_path)
177
+ if !pub_launchimg_files.nil? && pub_launchimg_files.size > 0
178
+ raise Informative, "有需要替换的资源,但是未找到工程启动图目录,替换启动图失败!"
179
+ end
200
180
  return
201
181
  end
202
182
 
203
- if File.exist?(project_origin_launchimg) && !File.exist?(launchimg_file)
204
- raise Informative, "缺少启动文件:#{launchimg_file}"
205
- end
183
+ # if pub_launchimg_files.nil? || pub_launchimg_files.size == 0
184
+ # raise Informative, "有需要替换的资源,但是配置中未放置替换的启动图!"
185
+ # end
206
186
 
207
- begin
208
- FileUtils.rm_rf(xcodeproj_launchimg_path)
209
- FileUtils.mkdir_p(xcodeproj_launchimg_path)
210
- rescue StandardError => e
187
+ xcodeproj_launchimg_json_file = File.join(xcodeproj_launchimg_path, "Contents.json")
188
+ if !File.exist?(xcodeproj_launchimg_json_file)
189
+ raise Informative, "工程启动图目录缺少Contents.json,替换启动图失败!"
211
190
  end
212
191
 
213
- launch_json = XcodoeResConst.xcode_ios_launchimg_json
214
- file_name = launch_json["images"].select { |image| image["scale"].include?("2x") }.first["filename"]
215
- xcode_launchimg_name = File.join(xcodeproj_launchimg_path, file_name)
216
- FileUtils.cp(launchimg_file, xcode_launchimg_name)
217
-
218
- File.open(File.join(xcodeproj_launchimg_path, "Contents.json"), "w") do |f|
219
- f.write(JSON.pretty_generate(launch_json))
192
+ xcodeproj_launchimg_json = JSON.parse(File.read(xcodeproj_launchimg_json_file))
193
+ image_array = xcodeproj_launchimg_json["images"].select { |image| !image["filename"].nil? && !image["filename"].empty? }
194
+
195
+ if pub_launchimg_files.size == image_array.size
196
+ if image_array.size == 1
197
+ launchimg_filename = image_array.first["filename"]
198
+ launchimg_full_filename = File.join(xcodeproj_launchimg_path, launchimg_filename)
199
+ FileUtils.cp(pub_launchimg_files.first, launchimg_full_filename)
200
+ else
201
+ raise Informative, "启动图有多张,替换异常,遇到这种情况再处理!"
202
+ end
203
+ else
204
+ raise Informative, "工程中启动图数目和配置仓库的图片数目不一致"
220
205
  end
221
206
 
222
207
  end
@@ -108,10 +108,10 @@ module Pindo
108
108
  end
109
109
  end
110
110
 
111
- def self.install_launchimg(proj_dir:nil, launchimg_filename:nil)
111
+ def self.install_launchimg(proj_dir:nil, launchimg_pub_path:nil)
112
112
  xcodeproj_file_name = Dir.glob(File.join(proj_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
113
113
  xcodereshandler = XcodeResHandler.new(proj_fullname: xcodeproj_file_name)
114
- xcodereshandler.install_launchimg(launchimg_file:launchimg_filename)
114
+ xcodereshandler.install_launchimg(launchimg_pub_path:launchimg_pub_path)
115
115
  end
116
116
 
117
117
  end
@@ -53,6 +53,7 @@ module Pindo
53
53
  attr_accessor :args_dev_flag
54
54
  attr_accessor :args_adhoc_flag
55
55
  attr_accessor :args_appstore_flag
56
+ attr_accessor :args_macos_flag
56
57
 
57
58
  attr_accessor :newconfuse_flag
58
59
  attr_accessor :oldconfuse_flag
@@ -69,6 +70,7 @@ module Pindo
69
70
  ['--dev', 'use dev build mode'],
70
71
  ['--adhoc', 'use adhoc build mode'],
71
72
  ['--appstore', 'use appstore build mode'],
73
+ ['--macos', 'use platform macos'],
72
74
 
73
75
  ['--nocreate', 'no create xcode project'],
74
76
 
@@ -92,6 +94,7 @@ module Pindo
92
94
  @args_dev_flag = argv.flag?('dev', false)
93
95
  @args_adhoc_flag = argv.flag?('adhoc', false)
94
96
  @args_appstore_flag = argv.flag?('appstore', false)
97
+ @args_macos_flag = argv.flag?('macos', false)
95
98
 
96
99
  @newconfuse_flag = argv.flag?('newconfuse', true)
97
100
  @oldconfuse_flag = argv.flag?('oldconfuse', false)
@@ -142,6 +145,11 @@ module Pindo
142
145
  mode_flag = "--appstore"
143
146
  end
144
147
  args_temp << mode_flag
148
+
149
+ if @args_macos_flag
150
+ args_temp << "--macos"
151
+ end
152
+ return args_temp
145
153
  end
146
154
 
147
155
  def get_confuse_type_args()
@@ -348,6 +356,7 @@ module Pindo
348
356
  puts "args_dev_flag = #{@args_dev_flag}"
349
357
  puts "args_adhoc_flag = #{@args_adhoc_flag}"
350
358
  puts "args_appstore_flag = #{@args_appstore_flag}"
359
+ puts "args_macos_flag = #{@args_macos_flag}"
351
360
 
352
361
  puts "\n***************************************************************************************"
353
362
  puts "=======================================================================================\n\n"
data/lib/pindo/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Pindo
2
2
 
3
- VERSION = "4.8.3"
3
+ VERSION = "4.8.5"
4
4
 
5
5
  class VersionCheck
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pindo
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.3
4
+ version: 4.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - wade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-08 00:00:00.000000000 Z
11
+ date: 2024-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -365,7 +365,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
365
365
  - !ruby/object:Gem::Version
366
366
  version: '0'
367
367
  requirements: []
368
- rubygems_version: 3.5.11
368
+ rubygems_version: 3.5.23
369
369
  signing_key:
370
370
  specification_version: 3
371
371
  summary: easy work