Class: Pindo::Command::Deploy::Itcinfo
Constant Summary
Pindo::Command::DEFAULT_OPTIONS, Pindo::Command::DEFAULT_ROOT_OPTIONS
Instance Attribute Summary
#additional_args, #apple_id, #args_adhoc_flag, #args_appconfig, #args_appconfig_dir, #args_appconfig_fullname, #args_apple_id, #args_appstore_flag, #args_array, #args_bundle_id, #args_dev_flag, #args_macos_flag, #args_repo_name, #argv_temp, #bundle_id, #bundle_id_extension, #bundle_id_extensionad, #bundle_id_extensionporn, #bundle_id_imessage, #bundle_id_keyboard, #bundle_id_pushcontent, #bundle_id_pushservice, #bundle_id_siri, #bundle_id_siriui, #bundle_id_watchapp, #bundle_id_watchapp_extension, #bundle_id_widget, #config_json, #deploy_acount_id, #deploy_group_id, #deploy_icloud_id, #deploy_identifier, #deploy_identifier_extension, #deploy_identifier_extensionad, #deploy_identifier_extensionporn, #deploy_identifier_imessage, #deploy_identifier_keyboard, #deploy_identifier_pushcontent, #deploy_identifier_pushservice, #deploy_identifier_siri, #deploy_identifier_siriui, #deploy_identifier_watchapp, #deploy_identifier_watchapp_extension, #deploy_identifier_widget, #deploy_repo_name, #group_id, #icloud_id, #newconfuse_flag, #oldconfuse_flag
#args_help_flag
Class Method Summary
collapse
Instance Method Summary
collapse
#all_languages, #camel_case_lower, #change_img_sort, #check_attributes, #display_type_dir_name, #download_screenshots_exe, #fastlane_download_app_info, #fastlane_download_app_screenshot_exe, #fastlane_download_app_screenshots, #fastlane_download_app_version_info, #fastlane_login, #fastlane_process_lang_screenshots, #fastlane_update_app_info_localizations, #fastlane_update_app_info_metadata, #fastlane_update_app_metadata, #fastlane_update_app_version_info_metadata, #update_age_rating, #update_app_categories, #update_app_info_localizations, #update_privacy_useagedata, #update_review_info, #update_version_info_localizations, #verify_app_info_localizations, #verify_app_version_info_localizations, #write_app_version_info_localization_to_txt
#config_infoplist_cert, #config_project_cert, #create_provisioning_info_array, #create_upload_cert_info, #create_upload_provisioning_info, #get_target_name_map, #modify_entitlements_plist, #modify_info_plist_icloud
#check_config_version, #get_build_type_args, #get_bundle_id_map, #get_confuse_type_args, #init_deploy_params, #init_develop_params, #print_params_info, #validate!
run, #validate!
#pindo_log_instance
#pindo_single_config
Methods included from Githelper
#add_branch, #add_tag, #add_tag_with_check, #clone_clang_repo, #clone_devclang_repo, #clone_pindo_common_config_repo, #clone_pindo_env_config_repo, #clong_buildconfig_repo, #get_repo_base_name, #getcode_to_dir, #git_addpush_repo, #git_latest_commit_id, #local_branch_exists?, #local_tag_exists?, #prepare_gitenv, #process_need_add_files, #remote_branch_exists?, #remote_tag_exists?, #remove_branch, #remove_tag
Methods included from Executable
capture_command, #executable, execute_command, which, which!
Constructor Details
#initialize(argv) ⇒ Itcinfo
Returns a new instance of Itcinfo.
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/pindo/command/deploy/itcinfo.rb', line 41
def initialize(argv)
@upload_metadata_flag = argv.flag?('metadata', false)
@upload_screenshots_flag = argv.flag?('screenshots', false)
@overwrite_flag = argv.flag?('overwrite', false)
@sync_flag = argv.flag?('sync', false)
@upload_ipa_flag = argv.flag?('ipa', false)
super
end
|
Class Method Details
.options ⇒ Object
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/pindo/command/deploy/itcinfo.rb', line 30
def self.options
[
['--metadata', 'Upload metadata to iTunes Connect.'],
['--screenshots', 'Upload screenshots to iTunes Connect.'],
['--overwrite', 'overwrite screenshots to iTunes Connect.'],
['--sync', 'sync screenshots to iTunes Connect.'],
['--ipa', 'Upload ipa to iTunes Connect.'],
].concat(super)
end
|
Instance Method Details
#check_app_info_localization(lang: nil, localization_json: nil) ⇒ Object
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
# File 'lib/pindo/command/deploy/itcinfo.rb', line 176
def check_app_info_localization(lang:nil, localization_json:nil)
if !localization_json.nil?
localization_json.each do |key, value|
if !value.nil? && value.to_s.length > 0
localization_json[key] = value.to_s.strip
end
if ( key.eql?("name") || key.eql?("subtitle") ) && !localization_json[key].nil? && localization_json[key].length > 30 && localization_json[key].length <2
puts
puts
puts localization_json[key]
puts "长度: #{localization_json[key].length}"
raise Informative, "#{lang} : #{key} 超出限定的30个字符 !!!"
end
end
end
end
|
#fastlane_process_screenshots(app_screenshots_dir: nil) ⇒ Object
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
|
# File 'lib/pindo/command/deploy/itcinfo.rb', line 290
def fastlane_process_screenshots(app_screenshots_dir:nil)
if File.exist?(app_screenshots_dir)
platforms = ["IOS", "MAC_OS", "TV_OS", "XR_OS"]
platforms.each do | platform|
platform_screenshots_path = File.join(app_screenshots_dir, platform.downcase)
if File.exist?(platform_screenshots_path)
Dir.glob(File.join(platform_screenshots_path, "*")).each do |lang_screenshots_path|
if File.directory?(lang_screenshots_path) && ![".", "..","iMessage", "imessage"].include?(File.basename(lang_screenshots_path))
fastlane_process_lang_screenshots(lang_screenshots_path:lang_screenshots_path)
elsif File.directory?(lang_screenshots_path) && ["iMessage", "imessage", "IMESSAGE"].include?(File.basename(lang_screenshots_path))
imessage_screenshots_path = lang_screenshots_path
Dir.glob(File.join(imessage_screenshots_path, "*")).each do |imessage_lane_screenshots_path|
if File.directory?(lang_screenshots_path) && ![".", ".."].include?(File.basename(imessage_lane_screenshots_path))
fastlane_process_lang_screenshots(lang_screenshots_path:imessage_lane_screenshots_path)
end
end
end
end
end
end
end
end
|
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
# File 'lib/pindo/command/deploy/itcinfo.rb', line 226
def fastlane_upload_metadata(temp_bundle_id:nil)
app_itunes_dir = File.join(@app_config_dir, "fastlane")
app_itunes_file = File.join(app_itunes_dir, "app_itunes.json")
app_itunes_json = JSON.parse(File.read(app_itunes_file))
app = Spaceship::ConnectAPI::App.find(temp_bundle_id)
fastlane_update_app_metadata(app: app, app_itunes_json:app_itunes_json)
if !app_itunes_json["app_info"].nil?
fastlane_update_app_info_metadata(app: app, app_itunes_json:app_itunes_json)
end
if !app_itunes_json["app_edit_version_info"].nil?
app_itunes_json["app_edit_version_info"].each do |platform, platform_info_data|
puts
puts
puts "===========正在处理平台: #{platform}"
app_edit_version_info = app.get_edit_app_store_version(platform: platform)
if !app_edit_version_info.nil? && !app_itunes_json["app_edit_version_info"].nil? && !app_itunes_json["app_edit_version_info"][platform].nil?
fastlane_update_app_version_info_metadata(app: app, platform:platform, app_itunes_json:app_itunes_json)
end
end
end
fastlane_update_app_info_localizations(app: app, app_itunes_json:app_itunes_json)
end
|
#fastlane_upload_screenshots(apple_id: nil, bundle_id: nil, app_screenshots_dir: nil) ⇒ Object
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
|
# File 'lib/pindo/command/deploy/itcinfo.rb', line 318
def fastlane_upload_screenshots(apple_id:nil, bundle_id:nil, app_screenshots_dir:nil)
if !File.exist?(app_screenshots_dir)
return
end
platform_screenshots_path = File.join(app_screenshots_dir, "ios")
if !File.exist?(platform_screenshots_path)
puts "!!! Screenshots Path is not exist !!!"
return
end
app_metadata_dir = File.join(@app_config_dir, "fastlane")
app_metadata_path = File.join(app_metadata_dir, "ios")
if @overwrite_flag
@sync_flag = false
end
if @sync_flag
@overwrite_flag = false
end
values = {
username:apple_id,
app_identifier: bundle_id,
skip_metadata: true,
skip_binary_upload:true,
skip_app_version_update:true,
precheck_include_in_app_purchases:false,
metadata_path:app_metadata_dir,
screenshots_path:platform_screenshots_path,
overwrite_screenshots: @overwrite_flag,
ignore_language_directory_validation:true,
sync_screenshots: @sync_flag
}
config = FastlaneCore::Configuration.create(Deliver::Options.available_options, values)
Deliver::Runner.new(config).run
end
|
#print_info(project_dir: nil, apple_id: nil, bundle_id: nil, config_json: nil) ⇒ Object
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
# File 'lib/pindo/command/deploy/itcinfo.rb', line 262
def print_info(project_dir:nil, apple_id:nil, bundle_id:nil, config_json:nil)
pindo_dir = File::expand_path(pindo_single_config.pindo_dir)
config_repo_dir = File.join(pindo_dir, bundle_id)
apple_id = @config_json['app_info']['app_id_ios']
puts
puts "++++++ App Store Download Url: ++++++"
puts ""
puts ""
puts ""
puts "下载链接: " + "https://itunes.apple.com/us/app/id" + "#{apple_id}"
puts ""
puts "版本: " + @config_json['app_info']['app_version']
puts ""
if @config_json['app_setting']['app_platform']
puts "平台号: " + @config_json['app_setting']['app_platform']
end
puts
puts "Bundle Id: " + @config_json['app_info']['app_identifier']
puts
end
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
# File 'lib/pindo/command/deploy/itcinfo.rb', line 89
def process_itunes_metadata( )
app_itunes_dir = File.join(@app_config_dir, "fastlane")
app_itunes_file = File.join(app_itunes_dir, "app_itunes.json")
app_itunes_json = JSON.parse(File.read(app_itunes_file))
app_itunes_json = app_itunes_json || {}
app_itunes_json["app_info"] = app_itunes_json["app_info"] || {}
app_itunes_json["app_info"]["app_info_localization"] = app_itunes_json["app_info"]["app_info_localization"] || {}
if !app_itunes_json["app_info"]["app_info_localization"].nil?
app_itunes_json["app_info"]["app_info_localization"].each do |lang , app_info_localization|
check_app_info_localization(lang:lang, localization_json:app_info_localization)
end
end
app_itunes_json["app_edit_version_info"] = app_itunes_json["app_edit_version_info"] || {}
app_itunes_json["app_edit_version_info"].each do |platform, value|
platform_metadata_path = File.join(app_itunes_dir, platform.downcase)
if !File.exist?(platform_metadata_path)
FileUtils.mkdir_p(platform_metadata_path)
end
app_itunes_json["app_edit_version_info"][platform] = app_itunes_json["app_edit_version_info"][platform] || {}
app_itunes_json["app_edit_version_info"][platform]["app_review_info"] = app_itunes_json["app_edit_version_info"][platform]["app_review_info"] || {}
app_version = @config_json['app_info']['app_version']
app_itunes_json["app_edit_version_info"][platform]["version_string"] = app_version
app_itunes_json["app_edit_version_info"][platform]["app_review_info"] = app_itunes_json["app_edit_version_info"][platform]["app_review_info"] || {}
app_itunes_json["app_edit_version_info"][platform]["app_review_info"]["contact_email"] = @config_json['account_info']['apple_acount_id']
app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"] = app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"] || {}
app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"]["en-US"] = app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"]["en-US"] || {}
notes_file = File.join(platform_metadata_path, "review_notes.txt")
if File.exist?(notes_file)
notes_file_txt = File.read(notes_file)
app_itunes_json["app_edit_version_info"][platform]["app_review_info"]["notes"] = notes_file_txt.to_s.strip
end
if !app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"].nil?
app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"].each do |lang , value|
app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang] = app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang] || {}
lang_metadata_path = File.join(platform_metadata_path, lang)
if !File.exist?(lang_metadata_path)
FileUtils.mkdir_p(lang_metadata_path)
end
read_app_version_info_localization(lang:lang, localization_json:app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang], lang_metadata_path:lang_metadata_path, key_name:"description")
read_app_version_info_localization(lang:lang, localization_json:app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang], lang_metadata_path:lang_metadata_path, key_name:"keywords")
read_app_version_info_localization(lang:lang, localization_json:app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang], lang_metadata_path:lang_metadata_path, key_name:"support_url")
read_app_version_info_localization(lang:lang, localization_json:app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang], lang_metadata_path:lang_metadata_path, key_name:"marketing_url")
read_app_version_info_localization(lang:lang, localization_json:app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang], lang_metadata_path:lang_metadata_path, key_name:"promotional_text")
read_app_version_info_localization(lang:lang, localization_json:app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang], lang_metadata_path:lang_metadata_path, key_name:"whats_new")
end
end
end
File.open(app_itunes_file, "w") do |file|
file.write(JSON.pretty_generate(app_itunes_json))
file.close
end
end
|
#read_app_version_info_localization(lang: nil, localization_json: nil, lang_metadata_path: nil, key_name: nil) ⇒ Object
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
# File 'lib/pindo/command/deploy/itcinfo.rb', line 198
def read_app_version_info_localization(lang:nil, localization_json:nil, lang_metadata_path:nil, key_name:nil)
key_name_file = File.join(lang_metadata_path, key_name + ".txt")
if File.exist?(key_name_file)
localization_json = localization_json || {}
key_name_txt = File.read(key_name_file)
localization_json[key_name] = key_name_txt.to_s.strip
if key_name.eql?("keywords") && !localization_json[key_name].nil? && localization_json[key_name].length > 100
puts localization_json[key_name]
puts "长度: #{localization_json[key_name].length}"
raise Informative, "#{lang} : keywords 超出限定的100个字符 !!!"
end
if key_name.eql?("description") && !localization_json[key_name].nil? && localization_json[key_name].length > 4000
puts localization_json[key_name]
puts "长度: #{localization_json[key_name].length}"
raise Informative, "#{lang} : description 超出限定的4000个字符 !!!"
end
end
end
|
#run ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/pindo/command/deploy/itcinfo.rb', line 55
def run
current_project_dir = Dir.pwd
pindo_dir = File::expand_path(pindo_single_config.pindo_dir)
@app_config_dir = File.join(pindo_dir, @deploy_repo_name)
print_info(project_dir:current_project_dir, apple_id:@apple_id, bundle_id:@bundle_id, config_json:@config_json)
if @upload_metadata_flag
process_itunes_metadata()
fastlane_login(apple_id:@apple_id)
fastlane_upload_metadata(temp_bundle_id:@bundle_id)
end
if @upload_screenshots_flag
ENV["FASTLANE_ENABLE_BETA_DELIVER_SYNC_SCREENSHOTS"] = "YES"
app_screenshots_dir = File.join(@app_config_dir, "fastlane/screenshots")
fastlane_process_screenshots(app_screenshots_dir:app_screenshots_dir)
fastlane_login(apple_id:@apple_id)
fastlane_upload_screenshots(apple_id:@apple_id, bundle_id:@bundle_id, app_screenshots_dir:app_screenshots_dir)
end
if @upload_ipa_flag
command = "fastlane uploadipa"
system command
end
puts "Done !!!"
end
|