pindo 4.6.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +7 -0
  2. data/bin/pindo +35 -0
  3. data/lib/pindo/base/aeshelper.rb +31 -0
  4. data/lib/pindo/base/deviceinfo.rb +90 -0
  5. data/lib/pindo/base/executable.rb +224 -0
  6. data/lib/pindo/base/githelper.rb +489 -0
  7. data/lib/pindo/base/hashhelper.rb +134 -0
  8. data/lib/pindo/base/plaininformative.rb +15 -0
  9. data/lib/pindo/base/plistbuddyexecutable.rb +121 -0
  10. data/lib/pindo/base/standarderror.rb +14 -0
  11. data/lib/pindo/client/applovinclient.rb +156 -0
  12. data/lib/pindo/client/aws3sclient.rb +183 -0
  13. data/lib/pindo/client/bossclient.rb +229 -0
  14. data/lib/pindo/client/bossconfigclient.rb +175 -0
  15. data/lib/pindo/client/giteeclient.rb +65 -0
  16. data/lib/pindo/client/httpclient.rb +40 -0
  17. data/lib/pindo/client/pgyerclient.rb +439 -0
  18. data/lib/pindo/client/tgateclient.rb +103 -0
  19. data/lib/pindo/command.rb +101 -0
  20. data/lib/pindo/config/pindoconfig.rb +439 -0
  21. data/lib/pindo/config/pindouserlocalconfig.rb +81 -0
  22. data/lib/pindo/deploy/Fastfile +233 -0
  23. data/lib/pindo/deploy/build.rb +167 -0
  24. data/lib/pindo/deploy/bundleid.rb +245 -0
  25. data/lib/pindo/deploy/cert.rb +508 -0
  26. data/lib/pindo/deploy/check.rb +79 -0
  27. data/lib/pindo/deploy/configproj.rb +89 -0
  28. data/lib/pindo/deploy/confusecode.rb +248 -0
  29. data/lib/pindo/deploy/confuseproj.rb +112 -0
  30. data/lib/pindo/deploy/fabric.rb +58 -0
  31. data/lib/pindo/deploy/getitcinfo.rb +248 -0
  32. data/lib/pindo/deploy/iap.rb +796 -0
  33. data/lib/pindo/deploy/initconfig.rb +128 -0
  34. data/lib/pindo/deploy/itcapp.rb +147 -0
  35. data/lib/pindo/deploy/itcinfo.rb +369 -0
  36. data/lib/pindo/deploy/pem.rb +55 -0
  37. data/lib/pindo/deploy/pullconfig.rb +46 -0
  38. data/lib/pindo/deploy/pushconfig.rb +83 -0
  39. data/lib/pindo/deploy/quswark.rb +146 -0
  40. data/lib/pindo/deploy/quswauth.rb +67 -0
  41. data/lib/pindo/deploy/reportbug.rb +135 -0
  42. data/lib/pindo/deploy/resign.rb +338 -0
  43. data/lib/pindo/deploy/tag.rb +108 -0
  44. data/lib/pindo/deploy/updateconfig.rb +129 -0
  45. data/lib/pindo/deploy/uploadipa.rb +63 -0
  46. data/lib/pindo/deploy.rb +44 -0
  47. data/lib/pindo/dev/autobuild.rb +204 -0
  48. data/lib/pindo/dev/autoresign.rb +186 -0
  49. data/lib/pindo/dev/confusecode.rb +127 -0
  50. data/lib/pindo/dev/confuseproj.rb +111 -0
  51. data/lib/pindo/dev/createbuild.rb +159 -0
  52. data/lib/pindo/dev/debug.rb +141 -0
  53. data/lib/pindo/dev/pub.rb +171 -0
  54. data/lib/pindo/dev/renewcert.rb +142 -0
  55. data/lib/pindo/dev.rb +23 -0
  56. data/lib/pindo/env/dreamstudio.rb +53 -0
  57. data/lib/pindo/env/flutter.rb +59 -0
  58. data/lib/pindo/env/flutter.sh +116 -0
  59. data/lib/pindo/env/quarkenv.rb +58 -0
  60. data/lib/pindo/env/swarkenv.rb +62 -0
  61. data/lib/pindo/env/workhard.rb +56 -0
  62. data/lib/pindo/env.rb +17 -0
  63. data/lib/pindo/ipa/autoresign.rb +188 -0
  64. data/lib/pindo/ipa/import.rb +261 -0
  65. data/lib/pindo/ipa/output.rb +396 -0
  66. data/lib/pindo/ipa.rb +22 -0
  67. data/lib/pindo/lib/forcepush.rb +159 -0
  68. data/lib/pindo/lib/lint.rb +115 -0
  69. data/lib/pindo/lib/push.rb +143 -0
  70. data/lib/pindo/lib/update.rb +75 -0
  71. data/lib/pindo/lib.rb +18 -0
  72. data/lib/pindo/module/appselect.rb +200 -0
  73. data/lib/pindo/module/appstore_in_app_purchase.rb +1803 -0
  74. data/lib/pindo/module/appstore_metadata_connect_api_helper.rb +12 -0
  75. data/lib/pindo/module/appstore_metadata_fastlane_helper.rb +922 -0
  76. data/lib/pindo/module/buildconfighelper.rb +13 -0
  77. data/lib/pindo/module/buildhelper.rb +76 -0
  78. data/lib/pindo/module/commonconfuseproj.rb +271 -0
  79. data/lib/pindo/module/config_project.sh +143 -0
  80. data/lib/pindo/module/configprojhelper.rb +631 -0
  81. data/lib/pindo/module/iap_tier.json +813 -0
  82. data/lib/pindo/module/icon_contents.json +116 -0
  83. data/lib/pindo/module/imessage_icon.json +91 -0
  84. data/lib/pindo/module/imgset_contents.json +21 -0
  85. data/lib/pindo/module/launchimg_contents.json +21 -0
  86. data/lib/pindo/module/pemcreate.rb +63 -0
  87. data/lib/pindo/module/pgyerhelper.rb +339 -0
  88. data/lib/pindo/module/xcodebuildpre.rb +258 -0
  89. data/lib/pindo/module/xcodehelper.rb +521 -0
  90. data/lib/pindo/options/appconfigoptions.rb +23 -0
  91. data/lib/pindo/options/deployoptions.rb +363 -0
  92. data/lib/pindo/pgyer/apptest.rb +104 -0
  93. data/lib/pindo/pgyer/comment.rb +95 -0
  94. data/lib/pindo/pgyer/download.rb +105 -0
  95. data/lib/pindo/pgyer/login.rb +61 -0
  96. data/lib/pindo/pgyer/upload.rb +234 -0
  97. data/lib/pindo/pgyer.rb +17 -0
  98. data/lib/pindo/repo/clone.rb +78 -0
  99. data/lib/pindo/repo/create.rb +55 -0
  100. data/lib/pindo/repo/login.rb +64 -0
  101. data/lib/pindo/repo/search.rb +60 -0
  102. data/lib/pindo/repo.rb +16 -0
  103. data/lib/pindo/setup.rb +60 -0
  104. data/lib/pindo/upgrade.rb +56 -0
  105. data/lib/pindo/utils/applovin.rb +213 -0
  106. data/lib/pindo/utils/boss.rb +209 -0
  107. data/lib/pindo/utils/clearcert.rb +60 -0
  108. data/lib/pindo/utils/device.rb +279 -0
  109. data/lib/pindo/utils/icon.rb +91 -0
  110. data/lib/pindo/utils/icon.sh +133 -0
  111. data/lib/pindo/utils/podindex.rb +56 -0
  112. data/lib/pindo/utils/podindex.sh +30 -0
  113. data/lib/pindo/utils/renewproj.rb +146 -0
  114. data/lib/pindo/utils/tgate.rb +159 -0
  115. data/lib/pindo/utils/xcassets.rb +46 -0
  116. data/lib/pindo/utils/xcassets.sh +88 -0
  117. data/lib/pindo/utils.rb +29 -0
  118. data/lib/pindo/version.rb +110 -0
  119. data/lib/pindo.rb +34 -0
  120. metadata +364 -0
@@ -0,0 +1,508 @@
1
+ require 'fileutils'
2
+ require 'match'
3
+
4
+
5
+ module Pindo
6
+ class Command
7
+ class Deploy < Command
8
+ class Cert < Deploy
9
+
10
+ include Command::DeployOptions
11
+
12
+ include Xcodebuildpre
13
+
14
+ self.summary = '创建证书并使用设置工程的证书'
15
+
16
+ self.description = <<-DESC
17
+ 根据config.json中的bundle id获取最新证书,默认不创建证书。如果在工程目录下,会自动设置工程证书。用法 pindo deploy cert
18
+ 默认创建appstore证书。 如果需要重新创建dev 证书, 用法:pindo deploy cert --dev --renew
19
+ DESC
20
+
21
+ self.arguments = [
22
+ CLAide::Argument.new('path/to/config.json', true),
23
+ ]
24
+
25
+ def self.options
26
+
27
+ [
28
+ ['--dev', '操作dev证书'],
29
+ ['--adhoc', '操作adhoc证书'],
30
+ ['--clean', '删除本地缓存的证书'],
31
+ ['--cleangit', '删除远程仓库中的证书'],
32
+ ['--renew', '重新生成证书']
33
+ ].concat(super)
34
+ end
35
+
36
+ def initialize(argv)
37
+ @clean_flag = argv.flag?('clean', false)
38
+ @clean_git_flag = argv.flag?('cleangit', false)
39
+ @renew_cert_flag = argv.flag?('renew', false)
40
+
41
+ super
42
+
43
+ @build_type = "appstore"
44
+ if @args_adhoc_flag
45
+ @build_type = "adhoc"
46
+ end
47
+ if @args_dev_flag
48
+ @build_type = "development"
49
+ end
50
+
51
+ end
52
+
53
+ def run
54
+ # prepare_env
55
+ if @clean_flag
56
+ puts "Clear cert at local ..."
57
+ Pindo::Command::Utils::Clearcert::run([])
58
+ end
59
+
60
+ if @renew_cert_flag && @clean_git_flag
61
+ pindo_dir = pindo_single_config.pindo_dir
62
+ git_url = pindo_single_config.deploy_cert_giturl
63
+ if @apple_id.eql?(pindo_single_config.demo_apple_id)
64
+ git_url = pindo_single_config.dev_cert_giturl
65
+ end
66
+ cert_repo_dir = getcode_to_dir(reponame:get_repo_base_name(repo_url:git_url), remote_url:git_url, path:pindo_dir, new_branch:@apple_id)
67
+ FileUtils.rm_rf(File.join(cert_repo_dir, "certs"))
68
+ FileUtils.rm_rf(File.join(cert_repo_dir, "profiles"))
69
+ git_addpush_repo(path:cert_repo_dir, message:"remove #{@apple_id} certs")
70
+ end
71
+
72
+
73
+ bundle_id_array = get_bundld_id_array
74
+ values = get_match_values(apple_id:@apple_id, bundle_id_array:bundle_id_array, build_type:@build_type, renew_flag:@renew_cert_flag)
75
+
76
+ config = FastlaneCore::Configuration.create(Match::Options.available_options, values)
77
+ Match::Runner.new.run(config)
78
+
79
+ team_id_key = Match::Utils.environment_variable_name_team_id(app_identifier: @bundle_id,type:@build_type)
80
+
81
+ @team_id_vaule = ENV[team_id_key]
82
+
83
+ #发布机需要给swark注册bundle id
84
+ add_swark_authorize_json
85
+
86
+ bundle_id_dict = get_cert_values
87
+
88
+ current_dir = Dir.pwd
89
+ new_project_dir = current_dir
90
+ new_project_fullname = ""
91
+ Dir.foreach(new_project_dir) do |file|
92
+ if file =~ /(.*).xcodeproj/
93
+ new_project_fullname = file
94
+ break;
95
+ end
96
+ end
97
+
98
+ if !new_project_fullname.nil? && File.exist?(new_project_fullname)
99
+ # prepare_env(project_dir:new_project_dir, apple_id:@apple_id, bundle_id:@bundle_id, config_json:@config_json)
100
+ new_proj_name = File.basename(new_project_fullname, ".xcodeproj")
101
+ config_project_cert(new_proj_name:new_proj_name, new_project_dir:new_project_dir, cert_type:@build_type, team_id_vaule:@team_id_vaule, bundle_id_dict:bundle_id_dict)
102
+ end
103
+
104
+ if File.exist?(new_project_fullname)
105
+
106
+ new_proj_name = File.basename(new_project_fullname, ".xcodeproj")
107
+ project_obj = Xcodeproj::Project.open(new_project_fullname)
108
+ entitlements_plist_path = File.join(new_project_dir, new_proj_name + ".entitlements")
109
+
110
+ project_obj.targets.each do |target|
111
+
112
+ temp_entitlements_file = target.build_configurations.first.build_settings['CODE_SIGN_ENTITLEMENTS']
113
+ if !temp_entitlements_file.nil? && !temp_entitlements_file.empty?
114
+ entitlements_plist_path = File.join(new_project_dir, temp_entitlements_file)
115
+ if !File.exist?(entitlements_plist_path)
116
+ raise Informative, "Target: #{target.name.to_s} 找不到文件 #{entitlements_plist_path}"
117
+ end
118
+ end
119
+
120
+ temp_info = target.build_configurations.first.build_settings['INFOPLIST_FILE']
121
+ info_plist_path = File.join(new_project_dir, temp_info)
122
+
123
+ if target.product_type.to_s.eql?("com.apple.product-type.application") && !File.exist?(info_plist_path)
124
+ raise Informative, "Missing Target #{target.name.to_s} Info.plist!!! #{info_plist_path} Modify Info.plist Error !!!"
125
+ end
126
+
127
+ # target.product_type = Constants::PRODUCT_TYPE_UTI[type]
128
+
129
+ if target.product_type.to_s.eql?("com.apple.product-type.application") then
130
+ add_swark_entitlement(entitlements_plist_path:entitlements_plist_path, bundle_id_dict:bundle_id_dict)
131
+ if !@deploy_icloud_id.nil?
132
+ modify_entitlements_plist(entitlements_plist_path:entitlements_plist_path, icloud_id:@icloud_id)
133
+ modify_info_plist_icloud(plist_file_name:info_plist_path, icloud_id:@icloud_id)
134
+ else
135
+ modify_info_plist_icloud(plist_file_name:info_plist_path, icloud_id:nil)
136
+ end
137
+ end
138
+
139
+ if !@deploy_group_id.nil?
140
+ modify_entitlements_plist(entitlements_plist_path:entitlements_plist_path, group_id:@group_id)
141
+ end
142
+ end
143
+
144
+ end
145
+
146
+ end
147
+ end
148
+
149
+
150
+ def modify_info_plist_icloud(plist_file_name:nil, icloud_id:nil)
151
+ if ! File.exist? (plist_file_name)
152
+ raise Informative, "修改Info.list 路径错误!!! #{plist_file_name}"
153
+ end
154
+ if File.exist?(plist_file_name)
155
+ info_plist_dict = Xcodeproj::Plist.read_from_path(plist_file_name)
156
+
157
+ if !icloud_id.nil?
158
+
159
+ temp_value = {}
160
+ if !info_plist_dict['NSUbiquitousContainers'].nil? && info_plist_dict['NSUbiquitousContainers'].is_a?(Hash)
161
+ info_plist_dict['NSUbiquitousContainers'].each do |key, value|
162
+ if key.include?("iCloud.")
163
+ temp_value = value
164
+ break;
165
+ end
166
+ end
167
+ end
168
+ info_plist_dict['NSUbiquitousContainers'] = {}
169
+ info_plist_dict['NSUbiquitousContainers'][icloud_id] = temp_value || {}
170
+ else
171
+ info_plist_dict['NSUbiquitousContainers'] = nil
172
+ end
173
+
174
+ Xcodeproj::Plist.write_to_path(info_plist_dict, plist_file_name)
175
+
176
+ end
177
+ end
178
+
179
+ def get_bundld_id_array
180
+
181
+ bundle_id_array = []
182
+ bundle_id_array << @bundle_id
183
+
184
+ unless @deploy_identifier_pushservice.nil?
185
+ bundle_id_array << @bundle_id_pushservice
186
+ end
187
+
188
+ unless @deploy_identifier_pushcontent.nil?
189
+ bundle_id_array << @bundle_id_pushcontent
190
+ end
191
+
192
+ unless @deploy_identifier_keyboard.nil?
193
+ bundle_id_array << @bundle_id_keyboard
194
+ end
195
+
196
+ unless @deploy_identifier_imessage.nil?
197
+ bundle_id_array << @bundle_id_imessage
198
+ end
199
+
200
+ unless @deploy_identifier_siri.nil?
201
+ bundle_id_array << @bundle_id_siri
202
+ end
203
+
204
+ unless @deploy_identifier_siriui.nil?
205
+ bundle_id_array << @bundle_id_siriui
206
+ end
207
+
208
+ unless @deploy_identifier_widget.nil?
209
+ bundle_id_array << @bundle_id_widget
210
+ end
211
+
212
+ unless @deploy_identifier_extension.nil?
213
+ bundle_id_array << @bundle_id_extension
214
+ end
215
+
216
+ unless @deploy_identifier_extensionad.nil?
217
+ bundle_id_array << @bundle_id_extensionad
218
+ end
219
+
220
+ unless @deploy_identifier_extensionporn.nil?
221
+ bundle_id_array << @bundle_id_extensionporn
222
+ end
223
+
224
+ unless @deploy_identifier_watchapp.nil?
225
+ bundle_id_array << @deploy_identifier_watchapp
226
+ end
227
+
228
+ unless @deploy_identifier_watchapp_extension.nil?
229
+ bundle_id_array << @deploy_identifier_watchapp_extension
230
+ end
231
+
232
+
233
+ return bundle_id_array
234
+ end
235
+
236
+ def get_cert_values
237
+
238
+ bundle_id_dict = {}
239
+ bundleid_name_key=Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id,type: @build_type)
240
+ @bundleid_name_value=ENV[bundleid_name_key]
241
+ bundle_id_dict['bundle_id'] = {}
242
+ bundle_id_dict['bundle_id']['bundle_id'] = @bundle_id
243
+ bundle_id_dict['bundle_id']['bundle_id_key'] = bundleid_name_key
244
+ bundle_id_dict['bundle_id']['bundle_id_value'] = @bundleid_name_value
245
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id,type: @build_type)
246
+ bundle_id_dict['bundle_id']['bundle_id_profile_path'] = ENV[path_temp]
247
+
248
+
249
+
250
+ unless @deploy_identifier_pushcontent.nil?
251
+ bundleid_content_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_pushcontent, type: @build_type)
252
+ @bundleid_content_name_value=ENV[bundleid_content_name_key]
253
+ bundle_id_dict['bundle_id_pushcontent'] = {}
254
+ bundle_id_dict['bundle_id_pushcontent']['bundle_id'] = @bundle_id_pushcontent
255
+ bundle_id_dict['bundle_id_pushcontent']['bundle_id_pushcontent_key'] = bundleid_content_name_key
256
+ bundle_id_dict['bundle_id_pushcontent']['bundle_id_pushcontent_value'] = @bundleid_content_name_value
257
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_pushcontent,type: @build_type)
258
+ bundle_id_dict['bundle_id_pushcontent']['bundle_id_pushcontent_profile_path'] = ENV[path_temp]
259
+ end
260
+
261
+ unless @deploy_identifier_pushservice.nil?
262
+ bundleid_service_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_pushservice, type: @build_type)
263
+ @bundleid_service_name_value=ENV[bundleid_service_name_key]
264
+ bundle_id_dict['bundle_id_pushservice'] = {}
265
+ bundle_id_dict['bundle_id_pushservice']['bundle_id'] = @bundle_id_pushservice
266
+ bundle_id_dict['bundle_id_pushservice']['bundle_id_pushservice_key'] = bundleid_service_name_key
267
+ bundle_id_dict['bundle_id_pushservice']['bundle_id_pushservice_value'] = @bundleid_service_name_value
268
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_pushservice,type: @build_type)
269
+ bundle_id_dict['bundle_id_pushservice']['bundle_id_pushservice_profile_path'] = ENV[path_temp]
270
+ end
271
+
272
+ unless @deploy_identifier_keyboard.nil?
273
+ bundleid_keyboard_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_keyboard, type: @build_type)
274
+ @bundleid_keyboard_name_value=ENV[bundleid_keyboard_name_key]
275
+ bundle_id_dict['bundle_id_keyboard'] = {}
276
+ bundle_id_dict['bundle_id_keyboard']['bundle_id'] = @bundle_id_keyboard
277
+ bundle_id_dict['bundle_id_keyboard']['bundle_id_keyboard_key'] = bundleid_keyboard_name_key
278
+ bundle_id_dict['bundle_id_keyboard']['bundle_id_keyboard_value'] = @bundleid_keyboard_name_value
279
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_keyboard,type: @build_type)
280
+ bundle_id_dict['bundle_id_keyboard']['bundle_id_keyboard_profile_path'] = ENV[path_temp]
281
+ end
282
+
283
+ unless @deploy_identifier_imessage.nil?
284
+ bundleid_imessage_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_imessage, type: @build_type)
285
+ @bundleid_imessage_name_value=ENV[bundleid_imessage_name_key]
286
+ bundle_id_dict['bundle_id_imessage'] = {}
287
+ bundle_id_dict['bundle_id_imessage']['bundle_id'] = @bundle_id_imessage
288
+ bundle_id_dict['bundle_id_imessage']['bundle_id_imessage_key'] = bundleid_imessage_name_key
289
+ bundle_id_dict['bundle_id_imessage']['bundle_id_imessage_value'] = @bundleid_imessage_name_value
290
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_imessage,type: @build_type)
291
+ bundle_id_dict['bundle_id_imessage']['bundle_id_imessage_profile_path'] = ENV[path_temp]
292
+ end
293
+
294
+ unless @deploy_identifier_siri.nil?
295
+ bundleid_siri_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_siri, type: @build_type)
296
+ @bundleid_siri_name_value=ENV[bundleid_siri_name_key]
297
+ bundle_id_dict['bundle_id_siri'] = {}
298
+ bundle_id_dict['bundle_id_siri']['bundle_id'] = @bundle_id_siri
299
+ bundle_id_dict['bundle_id_siri']['bundle_id_siri_key'] = bundleid_siri_name_key
300
+ bundle_id_dict['bundle_id_siri']['bundle_id_siri_value'] = @bundleid_siri_name_value
301
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_siri,type: @build_type)
302
+ bundle_id_dict['bundle_id_siri']['bundle_id_siri_profile_path'] = ENV[path_temp]
303
+ end
304
+
305
+ unless @deploy_identifier_siriui.nil?
306
+ bundleid_siriui_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_siriui, type: @build_type)
307
+ @bundleid_siriui_name_value=ENV[bundleid_siriui_name_key]
308
+ bundle_id_dict['bundle_id_siriui'] = {}
309
+ bundle_id_dict['bundle_id_siriui']['bundle_id'] = @bundle_id_siriui
310
+ bundle_id_dict['bundle_id_siriui']['bundle_id_siriui_key'] = bundleid_siriui_name_key
311
+ bundle_id_dict['bundle_id_siriui']['bundle_id_siriui_value'] = @bundleid_siriui_name_value
312
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_siriui,type: @build_type)
313
+ bundle_id_dict['bundle_id_siriui']['bundle_id_siriui_profile_path'] = ENV[path_temp]
314
+ end
315
+
316
+ unless @deploy_identifier_widget.nil?
317
+ bundleid_widget_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_widget, type: @build_type)
318
+ @bundleid_widget_name_value=ENV[bundleid_widget_name_key]
319
+ bundle_id_dict['bundle_id_widget'] = {}
320
+ bundle_id_dict['bundle_id_widget']['bundle_id'] = @bundle_id_widget
321
+ bundle_id_dict['bundle_id_widget']['bundle_id_widget_key'] = bundleid_widget_name_key
322
+ bundle_id_dict['bundle_id_widget']['bundle_id_widget_value'] = @bundleid_widget_name_value
323
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_widget,type: @build_type)
324
+ bundle_id_dict['bundle_id_widget']['bundle_id_widget_profile_path'] = ENV[path_temp]
325
+ end
326
+
327
+ unless @deploy_identifier_extension.nil?
328
+ bundleid_extension_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_extension, type: @build_type)
329
+ @bundleid_extension_name_value=ENV[bundleid_extension_name_key]
330
+ bundle_id_dict['bundle_id_extension'] = {}
331
+ bundle_id_dict['bundle_id_extension']['bundle_id'] = @bundle_id_extension
332
+ bundle_id_dict['bundle_id_extension']['bundle_id_extension_key'] = bundleid_extension_name_key
333
+ bundle_id_dict['bundle_id_extension']['bundle_id_extension_value'] = @bundleid_extension_name_value
334
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_extension,type: @build_type)
335
+ bundle_id_dict['bundle_id_extension']['bundle_id_extension_profile_path'] = ENV[path_temp]
336
+ end
337
+
338
+ unless @deploy_identifier_extensionad.nil?
339
+ bundleid_extensionad_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_extensionad, type: @build_type)
340
+ @bundleid_extensionad_name_value=ENV[bundleid_extensionad_name_key]
341
+ bundle_id_dict['bundle_id_extensionad'] = {}
342
+ bundle_id_dict['bundle_id_extensionad']['bundle_id'] = @bundle_id_extensionad
343
+ bundle_id_dict['bundle_id_extensionad']['bundle_id_extensionad_key'] = bundleid_extensionad_name_key
344
+ bundle_id_dict['bundle_id_extensionad']['bundle_id_extensionad_value'] = @bundleid_extensionad_name_value
345
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_extensionad,type: @build_type)
346
+ bundle_id_dict['bundle_id_extensionad']['bundle_id_extensionad_profile_path'] = ENV[path_temp]
347
+ end
348
+
349
+ unless @deploy_identifier_extensionporn.nil?
350
+ bundleid_extensionporn_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_extensionporn, type: @build_type)
351
+ @bundleid_extensionporn_name_value=ENV[bundleid_extensionporn_name_key]
352
+ bundle_id_dict['bundle_id_extensionporn'] = {}
353
+ bundle_id_dict['bundle_id_extensionporn']['bundle_id'] = @bundle_id_extensionporn
354
+ bundle_id_dict['bundle_id_extensionporn']['bundle_id_extensionporn_key'] = bundleid_extensionporn_name_key
355
+ bundle_id_dict['bundle_id_extensionporn']['bundle_id_extensionporn_value'] = @bundleid_extensionporn_name_value
356
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_extensionporn,type: @build_type)
357
+ bundle_id_dict['bundle_id_extensionporn']['bundle_id_extensionporn_profile_path'] = ENV[path_temp]
358
+ end
359
+
360
+ unless @deploy_identifier_watchapp.nil?
361
+ bundleid_watchapp_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_watchapp, type: @build_type)
362
+ @bundleid_watchapp_name_value=ENV[bundleid_watchapp_name_key]
363
+ bundle_id_dict['bundle_id_watchapp'] = {}
364
+ bundle_id_dict['bundle_id_watchapp']['bundle_id'] = @bundle_id_watchapp
365
+ bundle_id_dict['bundle_id_watchapp']['bundle_id_watchapp_key'] = bundleid_watchapp_name_key
366
+ bundle_id_dict['bundle_id_watchapp']['bundle_id_watchapp_value'] = @bundleid_watchapp_name_value
367
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_watchapp,type: @build_type)
368
+ bundle_id_dict['bundle_id_watchapp']['bundle_id_watchapp_profile_path'] = ENV[path_temp]
369
+ end
370
+
371
+ unless @deploy_identifier_watchapp_extension.nil?
372
+ bundleid_watchapp_extension_name_key = Match::Utils.environment_variable_name_profile_name(app_identifier: @bundle_id_watchapp_extension, type: @build_type)
373
+ @bundleid_watchapp_extension_name_value=ENV[bundleid_watchapp_extension_name_key]
374
+ bundle_id_dict['bundle_id_watchapp_extension'] = {}
375
+ bundle_id_dict['bundle_id_watchapp_extension']['bundle_id'] = @bundle_id_watchapp_extension
376
+ bundle_id_dict['bundle_id_watchapp_extension']['bundle_id_watchapp_extension_key'] = bundleid_watchapp_extension_name_key
377
+ bundle_id_dict['bundle_id_watchapp_extension']['bundle_id_watchapp_extension_value'] = @bundleid_watchapp_extension_name_value
378
+ path_temp = Match::Utils.environment_variable_name_profile_path(app_identifier: @bundle_id_watchapp_extension,type: @build_type)
379
+ bundle_id_dict['bundle_id_watchapp_extension']['bundle_id_watchapp_extension_profile_path'] = ENV[path_temp]
380
+ end
381
+
382
+
383
+ bundle_id_signing_key=Match::Utils.environment_variable_name_certificate_name(app_identifier: @bundle_id,type: @build_type)
384
+ bundle_id_signing_identity = ENV[bundle_id_signing_key]
385
+ bundle_id_dict["bundle_id_cert_common_name"] = bundle_id_signing_identity
386
+ puts "team_name: #{bundle_id_signing_identity}"
387
+ puts "team_id_vaule: #{@team_id_vaule}"
388
+ puts "bundleid_name_value: #{@bundleid_name_value}"
389
+ puts "bundleid_content_name_value: #{@bundleid_content_name_value}"
390
+ puts "bundleid_service_name_value: #{@bundleid_service_name_value}"
391
+ puts "bundleid_keyboard_name_value: #{@bundleid_keyboard_name_value}"
392
+ puts "bundleid_imessage_name_value: #{@bundleid_imessage_name_value}"
393
+ puts "bundleid_siri_name_value: #{@bundleid_siri_name_value}"
394
+ puts "bundleid_siriui_name_value: #{@bundleid_siriui_name_value}"
395
+ puts "bundleid_widget_name_value: #{@bundleid_widget_name_value}"
396
+ puts "bundleid_extension_name_value: #{@bundleid_extension_name_value}"
397
+ puts "bundleid_extensionad_name_value: #{@bundleid_extensionad_name_value}"
398
+ puts "bundleid_extensionporn_name_value: #{@bundleid_extensionporn_name_value}"
399
+ puts "bundleid_watchapp_name_value: #{@bundleid_watchapp_name_value}"
400
+ puts "bundleid_watchapp_extension_name_value: #{@bundleid_watchapp_extension_name_value}"
401
+
402
+ pindo_single_config.set_cert_info(dict: bundle_id_dict)
403
+ return bundle_id_dict
404
+
405
+ end
406
+
407
+ def get_match_values(apple_id:nil, bundle_id_array:nil, build_type:nil, renew_flag:false)
408
+
409
+ if build_type.eql?("appstore") && (apple_id.eql?(pindo_single_config.demo_apple_id))
410
+ raise Informative, "#{apple_id} 是测试账号,不能创建appstore证书!!!"
411
+ end
412
+ if !build_type.eql?("appstore") && !apple_id.eql?(pindo_single_config.demo_apple_id)
413
+ raise Informative, "账号#{apple_id} 不能创建dev或者adhoc证书!!!"
414
+ end
415
+
416
+ git_url = pindo_single_config.deploy_cert_giturl
417
+ if @apple_id.eql?(pindo_single_config.demo_apple_id)
418
+ git_url = pindo_single_config.dev_cert_giturl
419
+ end
420
+
421
+ force_for_new_devices_flag = true
422
+ if build_type.eql?("appstore")
423
+ force_for_new_devices_flag = false
424
+ end
425
+
426
+ if build_type.eql?("development")
427
+ force_for_new_devices_flag = true
428
+ end
429
+ if build_type.eql?("adhoc")
430
+ force_for_new_devices_flag = true
431
+ end
432
+
433
+ platform_type = "ios"
434
+ if @config_json && @config_json['project_info'] && @config_json['project_info']['build_type'].include?("MacOS")
435
+ platform_type = "macos"
436
+ end
437
+
438
+ values = {
439
+ username:apple_id,
440
+ app_identifier: bundle_id_array,
441
+ type: build_type,
442
+ keychain_password:"goodcert1",
443
+ git_url: git_url,
444
+ readonly:!renew_flag,
445
+ force:renew_flag,
446
+ clone_branch_directly:!renew_flag,
447
+ include_mac_in_profiles:true,
448
+ include_all_certificates:true,
449
+ generate_apple_certs:true,
450
+ shallow_clone:!renew_flag,
451
+ git_branch: apple_id,
452
+ platform:platform_type,
453
+ force_for_new_devices:force_for_new_devices_flag
454
+ }
455
+ return values
456
+ end
457
+
458
+ def add_swark_entitlement(entitlements_plist_path:nil, bundle_id_dict:nil)
459
+ if @config_json['project_info']['xcode_build_type'] && @config_json["project_info"]["xcode_build_type"].include?("swark")
460
+ if File.exist?(entitlements_plist_path)
461
+ entitlements_plist_dict = Xcodeproj::Plist.read_from_path(entitlements_plist_path)
462
+
463
+ key_value = @team_id_vaule
464
+ key_value = key_value + "." + @bundle_id
465
+ entitlements_plist_dict['keychain-access-groups'] = [key_value]
466
+
467
+ Xcodeproj::Plist.write_to_path(entitlements_plist_dict, entitlements_plist_path)
468
+ end
469
+ end
470
+ end
471
+
472
+ def add_swark_authorize_json
473
+ if @build_type == "appstore" && @config_json['project_info']['xcode_build_type'] && @config_json["project_info"]["xcode_build_type"].include?("swark")
474
+
475
+ app_config_dir = clong_buildconfig_repo(repo_name: @deploy_repo_name)
476
+ swark_authorize_file = File.join(app_config_dir, "swark_authorize.json")
477
+ if File.exist?(swark_authorize_file)
478
+ swark_authorize_json=JSON.parse(File.read(swark_authorize_file))
479
+ if swark_authorize_json && swark_authorize_json['swark_authorize_status']
480
+ puts "swark already authorize success !!! "
481
+ else
482
+ swark_authorize_json = swark_authorize_json || {}
483
+ swark_authorize_json['swark_authorize_teamid'] = @team_id_vaule
484
+ swark_authorize_json['swark_authorize_bundleid'] = @bundle_id
485
+ swark_authorize_json['swark_authorize_status'] = false
486
+ File.open(swark_authorize_file, "w") do |f|
487
+ f.write(JSON.pretty_generate(swark_authorize_json))
488
+ end
489
+ git_addpush_repo(path:app_config_dir, message:"add swark authorize json")
490
+ end
491
+ else
492
+ swark_authorize_json = swark_authorize_json || {}
493
+ swark_authorize_json['swark_authorize_teamid'] = @team_id_vaule
494
+ swark_authorize_json['swark_authorize_bundleid'] = @bundle_id
495
+ swark_authorize_json['swark_authorize_status'] = false
496
+ File.open(swark_authorize_file, "w") do |f|
497
+ f.write(JSON.pretty_generate(swark_authorize_json))
498
+ end
499
+ git_addpush_repo(path:app_config_dir, message:"add swark authorize json")
500
+ end
501
+
502
+ end
503
+ end
504
+
505
+ end
506
+ end
507
+ end
508
+
@@ -0,0 +1,79 @@
1
+ require 'highline/import'
2
+ require 'fileutils'
3
+ require 'json'
4
+ require 'pindo/client/bossclient'
5
+ require 'pindo/client/bossconfigclient'
6
+
7
+ module Pindo
8
+ class Command
9
+ class Deploy < Command
10
+ class Check < Deploy
11
+
12
+
13
+ include Command::DeployOptions
14
+
15
+ self.summary = '检查发布工作'
16
+
17
+ self.description = <<-DESC
18
+ 检查发布工作工作状态
19
+ DESC
20
+
21
+ self.arguments = [
22
+ CLAide::Argument.new('path/to/config.json', true),
23
+ ]
24
+
25
+ def run
26
+ puts "check"
27
+ # @boss_config_client = BossConfigClient.new
28
+ # @boss_config_client.do_login()
29
+
30
+ set_ip_device_tgate_normal()
31
+
32
+ boss_app_config = get_boss_config()
33
+
34
+ end
35
+
36
+ def get_boss_config
37
+
38
+ app_version = @config_json["app_info"]["app_version"]
39
+ bundle_id = @deploy_identifier
40
+ platform = @config_json["app_setting"]["kGUKeyAppPlatform"] || @config_json["app_setting"]["app_platform"]
41
+ apptype = @config_json["project_info"]["app_type"]
42
+
43
+ boss_client = BossClient.new(app_type:apptype, is_dev:false)
44
+ data_json = Pindo::Command::Utils::Boss::get_config(boss_client:boss_client, app_version:app_version, bundle_id:bundle_id, platform:platform)
45
+ is_in_review_status = BossClient::is_in_review_status_with_confirm_key(confirm_key:data_json["data"]["confirm_key"])
46
+
47
+ if is_in_review_status
48
+ puts " 当前设备,当前参数是审核状态".bold.blue
49
+ else
50
+ puts " 当前设备,当前参数是非审核状态".bold.red
51
+ end
52
+
53
+ return data_json["data"]
54
+ end
55
+
56
+
57
+ def set_ip_device_tgate_normal
58
+ @tgate_client = TgateClient.new(base_usrl:pindo_single_config.tgate_base_url, req_config:pindo_single_config.tgate_req_config)
59
+ current_device_info = Pindo::DeviceInfo.new
60
+
61
+ @tgate_client.post_update_gate_status(env_mode:"prod", type:"ip", to_status:"normal", device_info:current_device_info)
62
+ @tgate_client.post_update_gate_status(env_mode:"prod", type:"device", to_status:"normal", device_info:current_device_info)
63
+
64
+ response_data = @tgate_client.get_gate_status(device_info:current_device_info)
65
+
66
+ # puts JSON.pretty_generate(response_data)
67
+ end
68
+
69
+
70
+ def check_iap_status
71
+
72
+ end
73
+
74
+
75
+ end
76
+ end
77
+ end
78
+ end
79
+
@@ -0,0 +1,89 @@
1
+
2
+ require 'find'
3
+ require 'cocoapods-core'
4
+
5
+ module Pindo
6
+ class Command
7
+ class Deploy < Command
8
+ class Configproj < Deploy
9
+
10
+ include Command::DeployOptions
11
+
12
+ include Xcodebuildpre
13
+
14
+ include Configprojhelper
15
+
16
+ self.summary = '修改Xcode工程编译参数'
17
+
18
+ self.description = <<-DESC
19
+ 根据config.json修改Xcode工程编译参数, 用法:工程目录下执行pindo deploy configproj
20
+ DESC
21
+
22
+ self.arguments = [
23
+ CLAide::Argument.new('path/to/config.json', true),
24
+ ]
25
+
26
+ def run
27
+
28
+ check_config_version
29
+
30
+ current_dir = Dir.pwd
31
+ app_config_dir = clong_buildconfig_repo(repo_name: @deploy_repo_name)
32
+
33
+ project_fullname = ""
34
+ Dir.chdir(current_dir)
35
+ Dir.foreach(current_dir) do |file|
36
+ if file =~ /(.*).xcodeproj/
37
+ project_fullname = file
38
+ break;
39
+ end
40
+ end
41
+ project_root_dir = current_dir
42
+ @proj_name = File.basename(project_fullname, ".xcodeproj")
43
+
44
+ google_info_config_dir = clong_buildconfig_repo(repo_name: @bundle_id)
45
+
46
+ modify_google_plist(project_dir:current_dir, app_config_dir:google_info_config_dir)
47
+ modify_icon_res(project_dir:current_dir, app_config_dir:app_config_dir, proj_name:@proj_name, config_json:@config_json)
48
+ modify_launch_image_res(project_dir:current_dir, app_config_dir:app_config_dir, proj_name:@proj_name, config_json:@config_json)
49
+ add_project_modue(project_dir:current_dir, proj_name:@proj_name, config_json:@config_json)
50
+ modify_info_plist(project_dir:current_dir, proj_name:@proj_name, config_json:@config_json)
51
+ modify_project_config(project_dir:current_dir, proj_name:@proj_name, config_json:@config_json)
52
+
53
+ appprefix_file = "AppPrefix.plist"
54
+ if config_json && config_json['project_info']['appprefix_plist'] then
55
+ appprefix_file = config_json['project_info']['appprefix_plist']
56
+ end
57
+ modify_appprefix_plist(project_dir:current_dir, appprefix_file:appprefix_file, config_json:@config_json)
58
+ # prepare_env(project_dir:current_dir, apple_id:@apple_id, bundle_id:@bundle_id, config_json:@config_json)
59
+
60
+ end
61
+
62
+
63
+
64
+ def add_project_modue(project_dir:nil, proj_name:nil, config_json:nil)
65
+ puts ""
66
+ puts "Add Module: "
67
+
68
+ module_dict = config_json['project_info']['project_module']
69
+ if !module_dict.nil?
70
+ module_dict.each do |key, module_item|
71
+ puts module_item
72
+ puts module_item['module_type']
73
+ if module_item && module_item['module_type'] = 'pod'
74
+ add_pod_modue(project_dir:project_dir, pod_name:key, pod_version:module_item['module_git_tag'])
75
+ elsif module_item && module_item['module_type'] = 'sub_git'
76
+
77
+ elsif module_item && module_item['module_type'] = 'package'
78
+
79
+ end
80
+ end
81
+ end
82
+
83
+ end
84
+
85
+ end
86
+
87
+ end
88
+ end
89
+ end