pindo 4.7.0 → 4.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pindo/base/aeshelper.rb +30 -2
  3. data/lib/pindo/base/githelper.rb +7 -9
  4. data/lib/pindo/client/aws3sclient.rb +1 -1
  5. data/lib/pindo/client/bossconfigclient.rb +3 -3
  6. data/lib/pindo/client/giteeclient.rb +2 -2
  7. data/lib/pindo/client/pgyerclient.rb +97 -102
  8. data/lib/pindo/command/appstore/iap.rb +1 -1
  9. data/lib/pindo/command/deploy/build.rb +70 -4
  10. data/lib/pindo/command/deploy/cert.rb +68 -67
  11. data/lib/pindo/command/{utils → dev}/applovin.rb +2 -2
  12. data/lib/pindo/command/dev/autobuild.rb +19 -7
  13. data/lib/pindo/command/dev/autoresign.rb +10 -6
  14. data/lib/pindo/command/dev/build.rb +94 -0
  15. data/lib/pindo/command/dev.rb +3 -6
  16. data/lib/pindo/command/ipa/autoresign.rb +4 -1
  17. data/lib/pindo/command/ipa/import.rb +45 -9
  18. data/lib/pindo/command/ipa/output.rb +7 -2
  19. data/lib/pindo/command/lib/update.rb +8 -8
  20. data/lib/pindo/command/pgyer/resign.rb +21 -19
  21. data/lib/pindo/command/pgyer/upload.rb +34 -6
  22. data/lib/pindo/command/utils/renewcert.rb +158 -0
  23. data/lib/pindo/command/utils.rb +1 -1
  24. data/lib/pindo/config/pindoconfig.rb +27 -0
  25. data/lib/pindo/module/appselect.rb +9 -8
  26. data/lib/pindo/module/cert/certhelper.rb +42 -36
  27. data/lib/pindo/module/cert/keychainhelper.rb +25 -13
  28. data/lib/pindo/module/cert/provisioninghelper.rb +1 -1
  29. data/lib/pindo/module/cert/xcodecerthelper.rb +98 -39
  30. data/lib/pindo/module/pgyer/pgyerhelper.rb +50 -28
  31. data/lib/pindo/module/xcode/xcodeappconfig.rb +2 -3
  32. data/lib/pindo/module/xcode/xcodereshandler.rb +41 -13
  33. data/lib/pindo/module/xcode/xcodereshelper.rb +2 -3
  34. data/lib/pindo/options/deployoptions.rb +1 -2
  35. data/lib/pindo/version.rb +1 -1
  36. metadata +5 -4
  37. data/lib/pindo/command/dev/renewcert.rb +0 -142
@@ -53,22 +53,22 @@ module Pindo
53
53
 
54
54
  private_source = sources.select { |s| s.git? && s.url.to_s.eql?(pod_index_url)}.first
55
55
  if !private_source.nil?
56
-
57
- puts "地址:#{private_source.url}"
58
- puts "目录:#{private_source.repo}"
56
+
57
+ puts "私有Pod地址:#{pod_index_url}"
58
+ puts "私有Pod目录:~/.cocoapods"
59
59
  getcode_to_dir(reponame:File.basename(private_source.repo), remote_url: pod_index_url, path:repos_path)
60
60
  else
61
- puts "地址:#{pod_index_url}"
62
- puts "目录:~/.cocoapods"
61
+ puts "私有Pod地址:#{pod_index_url}"
62
+ puts "私有Pod目录:~/.cocoapods"
63
63
  repository_name = pod_index_url.split("/").last.chomp(".git")
64
64
  getcode_to_dir(reponame:repository_name, remote_url: pod_index_url, path:repos_path)
65
65
  end
66
-
66
+
67
67
 
68
68
  if @args_install_flag
69
69
  begin
70
- if File.exist?("#{working_dir}/Podfile")
71
- Pod::Command::Install::run(['--clean-install'])
70
+ if File.exist?("#{working_dir}/Podfile")
71
+ Pod::Command::Install::run(['--clean-install'])
72
72
  end
73
73
  rescue => e
74
74
  puts e.message
@@ -13,7 +13,7 @@ module Pindo
13
13
  self.summary = '获取pgyer中指定app的测试链接和二维码'
14
14
 
15
15
  self.description = <<-DESC
16
- 获取pgyer中指定app的测试链接和二维码,终端运行:pindo pgyer apptest
16
+ 获取pgyer中指定app的测试链接和二维码,终端运行:pindo pgyer resign
17
17
  DESC
18
18
 
19
19
  self.arguments = [
@@ -23,10 +23,10 @@ module Pindo
23
23
  def self.options
24
24
  [
25
25
  ['--login', '强制再次登录pgyer网站'],
26
- ['--proj', '指定哪个项目(忽略大小写空格等等字符),用法:pindo pgyer apptest --proj=prancksoundv4'],
27
- ['--list', '列出上传记录并选择,用法:pindo pgyer apptest --list'],
28
- ['--send', '上传到之后是否发送测试信息,用法:pindo pgyer apptest --send'],
29
- ['--bundleid', '上传到之后是否发送测试信息,用法:pindo pgyer apptest --bundleid=xxxx'],
26
+ ['--proj', '指定哪个项目(忽略大小写空格等等字符),用法:pindo pgyer resign --proj=prancksoundv4'],
27
+ ['--list', '列出上传记录并选择,用法:pindo pgyer resign --list'],
28
+ ['--send', '上传到之后是否发送测试信息,用法:pindo pgyer resign --send'],
29
+ ['--certid', '设置重签名的正式id,用法:pindo pgyer resign --resignid=com.test.bundleid'],
30
30
  ].concat(super)
31
31
  end
32
32
 
@@ -37,7 +37,8 @@ module Pindo
37
37
  @args_list_flag = argv.flag?('list', false)
38
38
  @args_send_flag = argv.flag?('send', false)
39
39
  @args_proj_name = argv.option('proj')
40
- @args_bundle_id = argv.option('bundleid')
40
+
41
+ @args_cert_id = argv.option('certid')
41
42
 
42
43
  super(argv)
43
44
  @additional_args = argv.remainder!
@@ -56,34 +57,34 @@ module Pindo
56
57
  raise Informative, "#{proj_name} 错误, 请输入正确的App代号名称, pgyer网站没有该App"
57
58
  end
58
59
 
59
-
60
+
60
61
  version_item_obj = PgyerHelper.share_instace.get_versioon_history_item(app_info_obj:app_info_obj, list_select_flat:@args_list_flag)
61
62
 
62
63
  if version_item_obj.nil?
63
64
  raise Informative, "没有找到上传记录"
64
65
  end
65
-
66
+
66
67
  cert_List = PgyerHelper.share_instace.get_cert_list()
67
-
68
+
68
69
  if cert_List.nil? || cert_List.empty?
69
70
  raise Informative, "没有找到上传记录"
70
71
  end
71
72
 
72
- if @args_bundle_id.nil? && cert_List.size > 0
73
+ if @args_cert_id.nil? && cert_List.size > 0
73
74
 
74
75
  bundle_id_list = cert_List.map { |cert| [cert["certType"],cert["mainBundleId"]].join("_") }
75
76
  cli = HighLine.new
76
- @args_bundle_id = cli.choose do |menu|
77
- menu.prompt = "请选择Pyger上的App代号:"
77
+ @args_cert_id = cli.choose do |menu|
78
+ menu.prompt = "请选择重签名的证书:"
78
79
  menu.choices(*bundle_id_list)
79
80
  end
80
-
81
- cert_item = cert_List.select{|cert| [cert["certType"],cert["mainBundleId"]].join("_") == @args_bundle_id}.first
81
+
82
+ cert_item = cert_List.select{|certitem| [certitem["certType"],certitem["mainBundleId"]].join("_") == @args_cert_id}.first
82
83
  else
83
- cert_item = cert_List.select{|item| item["mainBundleId"] == @args_bundle_id}.first
84
+ cert_item = cert_List.select{|certitem| certitem["mainBundleId"] == @args_cert_id && certitem["certType"].downcase.include?("adhoc")}.first
84
85
  end
85
86
 
86
-
87
+
87
88
 
88
89
  result = PgyerHelper.share_instace.resign(version_id:version_item_obj["id"], cert_id:cert_item["id"])
89
90
 
@@ -95,12 +96,13 @@ module Pindo
95
96
  end
96
97
  msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:version_item_obj)
97
98
  PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
98
- if @args_send_flag
99
- PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
99
+
100
+ if @args_send_flag
101
+ PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data, wechat_url:app_info_obj["prodWeComUrl"])
100
102
  end
101
103
  end
102
104
 
103
-
105
+
104
106
 
105
107
  end
106
108
 
@@ -16,7 +16,7 @@ module Pindo
16
16
  self.summary = '上传ipa包到pgyer测试网站'
17
17
 
18
18
  self.description = <<-DESC
19
- 上传ipa包到pgyer。用法:例如:pindo pgyer upload path/to/demo.ipa
19
+ 上传ipa包到pgyer。用法:例如:pindo pgyer upload path/to/demo.ipa
20
20
  DESC
21
21
 
22
22
  self.arguments = [
@@ -31,6 +31,8 @@ module Pindo
31
31
  ['--attach', '指定需要和ipa一起上传的附件: pindo pgyer upload --attach=path/to/attach.zip'],
32
32
  ['--send', '上传到之后是否发送测试信息,用法:pindo pgyer upload --send'],
33
33
  ['--desc', '指定上传的备注信息: -pindo pgyer upload -desc="1.upload message"'],
34
+ ['--resign', '上传到之后是否重签名,用法:pindo pgyer upload --resign'],
35
+ ['--certid', '设置重签名的正式id,用法:pindo pgyer upload --certid=com.test.bundleid'],
34
36
 
35
37
  ].concat(super)
36
38
  end
@@ -50,14 +52,26 @@ module Pindo
50
52
 
51
53
  @args_login_flag = argv.flag?('login', false)
52
54
  @args_send_flag = argv.flag?('send', false)
55
+ @args_resign_flag = argv.flag?('resign', false)
56
+
53
57
  @args_proj_name = argv.option('proj')
54
58
  @args_attach_name = argv.option('attach')
55
59
  @args_upload_desc = argv.option('desc')
60
+ @args_cert_id = argv.option('certid')
61
+
62
+
63
+
56
64
  if @args_upload_desc && !@args_upload_desc.empty?
57
65
  @args_upload_desc = @args_upload_desc.strip.gsub(/\"/, '')
58
66
  end
59
67
 
60
-
68
+
69
+ if !@args_cert_id.nil? && !@args_cert_id.empty?
70
+ @args_resign_flag = true
71
+ end
72
+ if @args_resign_flag
73
+ @args_send_flag = true
74
+ end
61
75
 
62
76
  super(argv)
63
77
  @additional_args = argv.remainder!
@@ -79,7 +93,7 @@ module Pindo
79
93
  @args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
80
94
  end
81
95
  if !@args_ipa_file.nil?
82
- answer = agree("需要上传的ipa文件是: #{@args_ipa_file} ?(Y/n)")
96
+ answer = agree("需要上传的ipa文件是: #{@args_ipa_file} ?(Y/n)")
83
97
  if !answer
84
98
  @args_ipa_file = nil
85
99
  end
@@ -91,7 +105,7 @@ module Pindo
91
105
  @args_ipa_file = @args_ipa_file.strip.gsub(/\\ /, ' ')
92
106
  end
93
107
  end
94
-
108
+
95
109
  if !File.exist?(@args_ipa_file)
96
110
  raise Informative, "#{@args_ipa_file} 文件不存在"
97
111
  end
@@ -107,12 +121,26 @@ module Pindo
107
121
  if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
108
122
  msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
109
123
  PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
124
+
125
+
110
126
  if @args_send_flag
111
- PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
127
+ if @args_resign_flag
128
+ args = []
129
+ args << "--send"
130
+ if !@args_cert_id.nil? && !@args_cert_id.empty?
131
+ args << "--certid=#{@args_cert_id}"
132
+ end
133
+ if !@args_proj_name.nil? && !@args_proj_name.empty?
134
+ args << "--proj=#{@args_proj_name}"
135
+ end
136
+ Pindo::Command::Pgyer::Resign::run(args)
137
+ else
138
+ PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
139
+ end
112
140
  end
113
141
  end
114
142
 
115
-
143
+
116
144
 
117
145
 
118
146
  end
@@ -0,0 +1,158 @@
1
+ require 'fileutils'
2
+ require 'pindo/module/cert/xcodecerthelper'
3
+ require 'pindo/module/cert/certhelper'
4
+
5
+ module Pindo
6
+ class Command
7
+ class Utils < Command
8
+ class Renewcert < Utils
9
+
10
+ include Appselect
11
+ include XcodeCertHelper
12
+ include CertHelper
13
+
14
+ self.summary = '更新当前账号下所有的Provisioning Profile文件'
15
+
16
+ self.description = <<-DESC
17
+ 如果不存在证书,会自动生成新证书,重新生成当前账号下所有的Provisioning Profile文件. 添加新设备或者证书过期时使用, 一般情况请勿操作!!!
18
+ 用法:pindo dev renewcert
19
+ DESC
20
+
21
+ self.arguments = [
22
+
23
+ ]
24
+
25
+ def self.options
26
+ [
27
+
28
+ ['--fast', '快速更新证书,开发用bundle id只更新dev证书,发布bundle id只更新adhoc证书'],
29
+ ['--upload', '生成上传pgyer的证书'],
30
+ ['--fixedid', '重新更新bundle id的功能,检查bundle id的功能是否更新'],
31
+ ['--renew', '重新生成证书']
32
+ ].concat(super)
33
+ end
34
+
35
+
36
+ def initialize(argv)
37
+
38
+ @fast_flag = argv.flag?('fast', false)
39
+ @fixedid_flag = argv.flag?('fixedid', false)
40
+ @upload_flag = argv.flag?('upload', false)
41
+ @renew_cert_flag = argv.flag?('renew', false)
42
+ super
43
+
44
+ end
45
+
46
+
47
+ def run
48
+
49
+ @dev_bundle_id_array = all_dev_bundleid()
50
+ @tool_bundle_id_array = all_tool_bundleid()
51
+ @deploy_bundle_id_array = all_release_bundleid()
52
+ fixed_bundleid_array = @dev_bundle_id_array + @deploy_bundle_id_array + @tool_bundle_id_array
53
+
54
+ puts fixed_bundleid_array
55
+
56
+ fixed_bundleid_array.each do |bundle_id|
57
+ # begin
58
+ fixed_cert(bundle_id:bundle_id, renew_flag:@renew_cert_flag, upload_flag:@upload_flag, fixed_bundleid_flag:@fixedid_flag)
59
+ # rescue => err
60
+ # puts
61
+ # puts
62
+ # puts "Fixed #{bundle_id} cert---------Error-------!!!"
63
+ # puts
64
+ # puts
65
+ # end
66
+
67
+ end
68
+
69
+ end
70
+
71
+
72
+ def fixed_cert(bundle_id:nil, renew_flag:false, upload_flag:false, fixed_bundleid_flag: false)
73
+
74
+ args_temp = []
75
+ args_temp << "#{bundle_id}"
76
+
77
+ Pindo::Command::Deploy::Pullconfig::run(args_temp)
78
+
79
+ if fixed_bundleid_flag
80
+ Pindo::Command::Deploy::Bundleid::run([])
81
+ end
82
+
83
+ if @fast_flag
84
+
85
+ if @dev_bundle_id_array.include?(bundle_id) || @tool_bundle_id_array.include?(bundle_id)
86
+ args_temp = []
87
+ args_temp << "--a=#{bundle_id}"
88
+ args_temp << "--dev"
89
+ if renew_flag
90
+ args_temp << "--renew"
91
+ end
92
+ if upload_flag
93
+ args_temp << "--upload"
94
+ end
95
+ Pindo::Command::Deploy::Cert::run(args_temp)
96
+ end
97
+
98
+ if @deploy_bundle_id_array.include?(bundle_id)
99
+ args_temp = []
100
+ args_temp << "--a=#{bundle_id}"
101
+ args_temp << "--adhoc"
102
+ if renew_flag
103
+ args_temp << "--renew"
104
+ end
105
+ if upload_flag
106
+ args_temp << "--upload"
107
+ end
108
+ Pindo::Command::Deploy::Cert::run(args_temp)
109
+ end
110
+
111
+ else
112
+
113
+ args_temp = []
114
+ args_temp << "--a=#{bundle_id}"
115
+ args_temp << "--dev"
116
+ if renew_flag
117
+ args_temp << "--renew"
118
+ end
119
+ if upload_flag
120
+ args_temp << "--upload"
121
+ end
122
+ Pindo::Command::Deploy::Cert::run(args_temp)
123
+
124
+ args_temp = []
125
+ args_temp << "--a=#{bundle_id}"
126
+ args_temp << "--adhoc"
127
+ if renew_flag
128
+ args_temp << "--renew"
129
+ end
130
+ if upload_flag
131
+ args_temp << "--upload"
132
+ end
133
+ Pindo::Command::Deploy::Cert::run(args_temp)
134
+ end
135
+ end
136
+
137
+
138
+ def fixed_push(bundle_id:nil, fixed_bundleid: false)
139
+
140
+ Pindo::Command::Deploy::Pullconfig::run(args_temp)
141
+
142
+ args_temp = []
143
+ args_temp << "--a=#{bundle_id}"
144
+ args_temp << "--dev"
145
+ Pindo::Command::Deploy::Pem::run(args_temp)
146
+
147
+ args_temp = []
148
+ args_temp << "--a=#{bundle_id}"
149
+ args_temp << "--adhoc"
150
+ Pindo::Command::Deploy::Pem::run(args_temp)
151
+
152
+ end
153
+
154
+ end
155
+ end
156
+ end
157
+ end
158
+
@@ -4,9 +4,9 @@ require 'pindo/command/utils/renewproj'
4
4
  require 'pindo/command/utils/clearcert'
5
5
  require 'pindo/command/utils/xcassets'
6
6
  require 'pindo/command/utils/device'
7
- require 'pindo/command/utils/applovin'
8
7
  require 'pindo/command/utils/tgate'
9
8
  require 'pindo/command/utils/boss'
9
+ require 'pindo/command/utils/renewcert'
10
10
 
11
11
 
12
12
  module Pindo
@@ -281,6 +281,14 @@ module Pindo
281
281
  return url
282
282
  end
283
283
 
284
+ def cert_key_password
285
+ cert_key_password = ''
286
+ if !@pindo_user_config_json.nil? && !@pindo_user_config_json["develop_accout_info"].nil?
287
+ cert_key_password = @pindo_user_config_json["develop_accout_info"]["cert_key_password"]
288
+ end
289
+ return cert_key_password
290
+ end
291
+
284
292
  def deploy_cert_giturl
285
293
  url = ''
286
294
  if !@pindo_user_config_json.nil? && !@pindo_user_config_json["develop_accout_info"].nil?
@@ -288,6 +296,16 @@ module Pindo
288
296
  end
289
297
  return url
290
298
  end
299
+
300
+ def deploy_cert_decrypt_password
301
+ pass = ''
302
+ if !@pindo_user_config_json.nil? && !@pindo_user_config_json["develop_accout_info"].nil?
303
+ pass = @pindo_user_config_json["develop_accout_info"]["deploy_cert_decrypt_password"]
304
+ end
305
+ return pass
306
+ end
307
+
308
+
291
309
 
292
310
  def dev_cert_giturl
293
311
  url = ''
@@ -297,6 +315,15 @@ module Pindo
297
315
  return url
298
316
  end
299
317
 
318
+
319
+ def dev_cert_decrypt_password
320
+ pass = ''
321
+ if !@pindo_user_config_json.nil? && !@pindo_user_config_json["develop_accout_info"].nil?
322
+ pass = @pindo_user_config_json["develop_accout_info"]["dev_cert_decrypt_password"]
323
+ end
324
+ return pass
325
+ end
326
+
300
327
  def demo_apple_id
301
328
  url = ''
302
329
  if !@pindo_user_config_json.nil? && !@pindo_user_config_json["develop_accout_info"].nil?
@@ -45,7 +45,6 @@ module Pindo
45
45
 
46
46
  def all_tool_bundleid
47
47
  setting_file = File.join(pindo_single_config.pindo_env_configdir,'bundleid_config.json')
48
- puts setting_file
49
48
  setting_json = load_setting(setting_file:setting_file)
50
49
  sub_json = []
51
50
  if !setting_json.nil? && !setting_json['all_tool_bundleid'].nil?
@@ -86,10 +85,10 @@ module Pindo
86
85
  puts "具体参考文档: https://tower.im/teams/851356/repository_documents/714/"
87
86
  puts ""
88
87
  puts "App Type:"
89
-
88
+ puts
90
89
  cli.choose do |menu| # you can also use constants like :blue
91
- menu.header = "选用哪个bundle id?"
92
- menu.prompt = "请选择使用的bundle id,请输入选项(1/2/3...):"
90
+ menu.header = "可用的Bundle Id如下:"
91
+ menu.prompt = "请选择使用的Bundle Id,请输入选项(1/2/3...):"
93
92
  menu.index_suffix = ") "
94
93
  if !sub_setting_json.nil?
95
94
  sub_setting_json.each do |key, items|
@@ -115,9 +114,10 @@ module Pindo
115
114
 
116
115
  cli = HighLine.new
117
116
  menu_choice="None"
117
+ puts
118
118
  cli.choose do |menu| # you can also use constants like :blue
119
- menu.header = "选用哪个bundle id?"
120
- menu.prompt = "请选择使用的bundle id,请输入选项(1/2/3...):"
119
+ menu.header = "可用的Bundle Id如下:"
120
+ menu.prompt = "请选择使用的Bundle Id,请输入选项(1/2/3...):"
121
121
  if !all_bundleid.nil? && all_bundleid.length > 0
122
122
  for bunld_id in all_bundleid do
123
123
  menu.choice(bunld_id) do |details|
@@ -140,10 +140,11 @@ module Pindo
140
140
 
141
141
  cli = HighLine.new
142
142
  menu_choice="None"
143
+ puts
143
144
  cli.choose do |menu| # you can also use constants like :blue
144
145
 
145
- menu.header = "选用哪个bundle id?"
146
- menu.prompt = "请选择使用的bundle id,请输入选项(1/2/3...):"
146
+ menu.header = "可用的Bundle Id如下:"
147
+ menu.prompt = "请选择使用的Bundle Id,请输入选项(1/2/3...):"
147
148
  if !all_bundleid.nil? && all_bundleid.length > 0
148
149
  for bunld_id in all_bundleid do
149
150
  menu.choice(bunld_id) do |details|
@@ -9,11 +9,7 @@ require 'pindo/module/cert/provisioninghelper'
9
9
  module Pindo
10
10
 
11
11
  module CertHelper
12
-
13
- def server_name(keychain_name)
14
- ["match", keychain_name].join("_")
15
- end
16
-
12
+
17
13
  def get_cert_info(cer_certificate)
18
14
  # can receive a certificate path or the file data
19
15
  begin
@@ -65,81 +61,88 @@ module Pindo
65
61
  (/darwin/ =~ RUBY_PLATFORM) != nil
66
62
  end
67
63
 
68
- def install_certs(certs_dir:nil, cert_type:nil)
64
+ def install_certs(cert_url:nil, certs_dir:nil, cert_type:nil)
69
65
 
70
-
66
+ cert_git_dir = cert_type.downcase
71
67
  if !cert_type.downcase.include?("development")
72
- cert_type = "distribution"
68
+ cert_git_dir = "distribution"
73
69
  end
74
70
 
75
- certs = Dir[File.join(certs_dir, "certs", cert_type.to_s, "*.cer")]
76
- keys = Dir[File.join(certs_dir, "certs", cert_type.to_s, "*.p12")]
71
+ certs = Dir[File.join(certs_dir, "certs", cert_git_dir.to_s, "*.cer")]
72
+ keys = Dir[File.join(certs_dir, "certs", cert_git_dir.to_s, "*.p12")]
77
73
 
78
74
  if certs.count == 0 || keys.count == 0
79
75
  raise Informative, "No certificates found in #{certs_dir}"
80
76
  else
81
77
  output_dir = Dir.mktmpdir
82
- decrypt_password = "Gxtest#1"
83
-
78
+
79
+ decrypt_password = AESHelper.fetch_password(keychain_name:cert_url)
84
80
  Funlog.instance.fancyinfo_start("正在安装证书...")
85
81
 
86
82
  cert_path = AESHelper.decrypt_specific_file(src_file: certs.first, password:decrypt_password, output_dir: output_dir)
83
+ if cert_path.nil? || cert_path.empty? || !File.exist?(cert_path)
84
+ AESHelper.delete_password(keychain_name:cert_url)
85
+ raise Informative, "证书解析失败,密码错误!"
86
+ end
87
+
87
88
  key_path = AESHelper.decrypt_specific_file(src_file: keys.first, password:decrypt_password, output_dir: output_dir)
89
+ if key_path.nil? || key_path.empty? || !File.exist?(key_path)
90
+ AESHelper.delete_password(keychain_name:cert_url)
91
+ raise Informative, "证书解析失败,密码错误!"
92
+ end
88
93
 
89
94
  unless is_cert_valid?(cert_path)
90
- raise Informative, "Your certificate '#{File.basename(cert_path)}' is not valid, please check end date and renew it if necessary"
95
+ raise Informative, "证书已经过期,请重新生产新证书!"
91
96
  end
92
97
 
98
+
93
99
  if isMac?
94
100
 
95
101
  keychain_name = "login.keychain"
96
-
97
102
  if FastlaneCore::CertChecker.installed?(cert_path, in_keychain: nil)
98
103
  Funlog.instance.fancyinfo_success("证书#{File.basename(cert_path)}已安装,无需重复安装!")
99
104
  else
100
- cert_password = "goodcert1"
105
+
106
+ cert_password = Pindoconfig.instance.cert_key_password
101
107
  keychain = 'login.keychain'
102
108
  keychain_path = FastlaneCore::Helper.keychain_path(keychain)
103
109
 
104
- KeychainHelper.import_file(cert_path, keychain_path, keychain_password: cert_password, certificate_password: "", skip_set_partition_list: false, output: false)
105
- KeychainHelper.import_file(key_path, keychain_path, keychain_password: cert_password, certificate_password: "", skip_set_partition_list: false, output: false)
106
-
110
+ KeychainHelper.import_file(cert_path, keychain_path, keychain_password: cert_password, certificate_password:'' )
111
+ KeychainHelper.import_file(key_path, keychain_path, keychain_password: cert_password, certificate_password: '')
107
112
 
108
113
  Funlog.instance.fancyinfo_success("证书'#{File.basename(cert_path)}'安装完成!")
114
+
109
115
  end
110
116
  else
111
- puts "非Mac电脑不支持安装证书."
117
+ Funlog.instance.fancyinfo_error("非Mac电脑不支持安装证书!")
112
118
  end
113
119
 
114
120
  end
115
121
 
116
- def install_provisionfiles(certs_dir:nil, bundle_id_map:nil, cert_type:nil)
122
+ def install_provisionfiles(cert_url:nil, certs_dir:nil, bundle_id_map:nil, cert_type:nil)
117
123
 
118
- if cert_type.downcase.include?("development")
119
- cert_type = "Development"
120
- elsif cert_type.downcase.include?("Adhoc")
121
- cert_type = "Adhoc"
122
- else
123
- cert_type = "AppStore"
124
- end
125
-
126
- un_exist_files = []
127
-
128
- provisioning_info_array = []
129
124
 
125
+ if cert_type.downcase.include?("development")
126
+ cert_type = "Development"
127
+ elsif cert_type.downcase.include?("adhoc")
128
+ cert_type = "Adhoc"
129
+ else
130
+ cert_type = "AppStore"
131
+ end
130
132
 
133
+ Funlog.instance.fancyinfo_start("正在安装#{cert_type} Provisioning Profiles...")
131
134
 
135
+ un_exist_files = []
132
136
  provisioning_info_array = []
133
137
 
134
138
  bundle_id_map.each do |type, bundle_id_temp|
135
139
  profile_filename = File.join(certs_dir, "profiles", cert_type.downcase.to_s,[cert_type.to_s, bundle_id_temp].join('_') + '.mobileprovision')
136
-
137
140
  unless File.exist?(profile_filename)
138
141
  un_exist_files << profile_filename
139
142
  next
140
143
  end
141
- puts "正在安装 #{profile_filename}..."
142
- decrypt_password = "Gxtest#1"
144
+ # puts "正在安装 #{bundle_id_temp}..."
145
+ decrypt_password = AESHelper.fetch_password(keychain_name:cert_url)
143
146
  output_dir = Dir.mktmpdir
144
147
  file_decrypt = AESHelper.decrypt_specific_file(src_file: profile_filename, password:decrypt_password, output_dir: output_dir)
145
148
  destpath = Provisioninghelper.install(file_decrypt)
@@ -151,21 +154,24 @@ module Pindo
151
154
  provisioning_info['profile_name'] = parsed_data['Name']
152
155
  provisioning_info['profile_path'] = destpath
153
156
 
157
+
154
158
  cert_info = get_cert_info(parsed_data["DeveloperCertificates"].first.string).to_h
155
159
  provisioning_info['signing_identity'] = cert_info["Common Name"]
156
160
  provisioning_info['team_id'] = parsed_data["TeamIdentifier"].first
157
161
 
158
- puts JSON.pretty_generate(provisioning_info)
162
+ # puts JSON.pretty_generate(provisioning_info)
159
163
  provisioning_info_array << provisioning_info
160
164
  end
161
165
 
162
-
166
+ Funlog.instance.fancyinfo_success("#{cert_type} Provisioning Profiles文件安装完成!")
163
167
 
164
168
  if un_exist_files.size > 0
169
+ Funlog.instance.fancyinfo_error("证书 #{cert_type} Provisioning Profiles文件不存在!")
165
170
  raise Informative, "The following profiles do not exist: #{un_exist_files.join(', ')}"
166
171
  end
167
172
 
168
173
  return provisioning_info_array
174
+
169
175
  end
170
176
 
171
177