pindo 4.7.1 → 4.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pindo/base/aeshelper.rb +4 -5
- data/lib/pindo/base/githelper.rb +0 -1
- data/lib/pindo/client/giteeclient.rb +2 -2
- data/lib/pindo/command/appstore/iap.rb +1 -1
- data/lib/pindo/command/deploy/build.rb +70 -4
- data/lib/pindo/command/deploy/cert.rb +48 -51
- data/lib/pindo/command/{utils → dev}/applovin.rb +2 -2
- data/lib/pindo/command/dev/autobuild.rb +6 -9
- data/lib/pindo/command/dev/autoresign.rb +6 -6
- data/lib/pindo/command/dev/build.rb +5 -5
- data/lib/pindo/command/dev.rb +2 -6
- data/lib/pindo/command/ipa/autoresign.rb +0 -1
- data/lib/pindo/command/ipa/import.rb +44 -8
- data/lib/pindo/command/ipa/output.rb +2 -2
- data/lib/pindo/command/pgyer/resign.rb +21 -19
- data/lib/pindo/command/pgyer/upload.rb +34 -6
- data/lib/pindo/command/utils/renewcert.rb +158 -0
- data/lib/pindo/command/utils.rb +1 -1
- data/lib/pindo/module/cert/certhelper.rb +18 -23
- data/lib/pindo/module/cert/xcodecerthelper.rb +37 -3
- data/lib/pindo/module/pgyer/pgyerhelper.rb +33 -10
- data/lib/pindo/module/xcode/xcodeappconfig.rb +2 -3
- data/lib/pindo/module/xcode/xcodereshandler.rb +40 -12
- data/lib/pindo/version.rb +1 -1
- metadata +4 -4
- data/lib/pindo/command/dev/renewcert.rb +0 -142
@@ -13,7 +13,7 @@ module Pindo
|
|
13
13
|
self.summary = '获取pgyer中指定app的测试链接和二维码'
|
14
14
|
|
15
15
|
self.description = <<-DESC
|
16
|
-
获取pgyer中指定app的测试链接和二维码,终端运行:pindo pgyer
|
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
|
27
|
-
['--list', '列出上传记录并选择,用法:pindo pgyer
|
28
|
-
['--send', '上传到之后是否发送测试信息,用法:pindo pgyer
|
29
|
-
['--
|
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
|
-
|
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 @
|
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
|
-
@
|
77
|
-
menu.prompt = "
|
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{|
|
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{|
|
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
|
-
|
99
|
-
|
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
|
-
|
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
|
+
|
data/lib/pindo/command/utils.rb
CHANGED
@@ -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
|
@@ -63,13 +63,13 @@ module Pindo
|
|
63
63
|
|
64
64
|
def install_certs(cert_url:nil, certs_dir:nil, cert_type:nil)
|
65
65
|
|
66
|
-
|
66
|
+
cert_git_dir = cert_type.downcase
|
67
67
|
if !cert_type.downcase.include?("development")
|
68
|
-
|
68
|
+
cert_git_dir = "distribution"
|
69
69
|
end
|
70
70
|
|
71
|
-
certs = Dir[File.join(certs_dir, "certs",
|
72
|
-
keys = Dir[File.join(certs_dir, "certs",
|
71
|
+
certs = Dir[File.join(certs_dir, "certs", cert_git_dir.to_s, "*.cer")]
|
72
|
+
keys = Dir[File.join(certs_dir, "certs", cert_git_dir.to_s, "*.p12")]
|
73
73
|
|
74
74
|
if certs.count == 0 || keys.count == 0
|
75
75
|
raise Informative, "No certificates found in #{certs_dir}"
|
@@ -80,13 +80,13 @@ module Pindo
|
|
80
80
|
Funlog.instance.fancyinfo_start("正在安装证书...")
|
81
81
|
|
82
82
|
cert_path = AESHelper.decrypt_specific_file(src_file: certs.first, password:decrypt_password, output_dir: output_dir)
|
83
|
-
|
83
|
+
if cert_path.nil? || cert_path.empty? || !File.exist?(cert_path)
|
84
84
|
AESHelper.delete_password(keychain_name:cert_url)
|
85
85
|
raise Informative, "证书解析失败,密码错误!"
|
86
86
|
end
|
87
87
|
|
88
88
|
key_path = AESHelper.decrypt_specific_file(src_file: keys.first, password:decrypt_password, output_dir: output_dir)
|
89
|
-
|
89
|
+
if key_path.nil? || key_path.empty? || !File.exist?(key_path)
|
90
90
|
AESHelper.delete_password(keychain_name:cert_url)
|
91
91
|
raise Informative, "证书解析失败,密码错误!"
|
92
92
|
end
|
@@ -110,8 +110,8 @@ module Pindo
|
|
110
110
|
KeychainHelper.import_file(cert_path, keychain_path, keychain_password: cert_password, certificate_password:'' )
|
111
111
|
KeychainHelper.import_file(key_path, keychain_path, keychain_password: cert_password, certificate_password: '')
|
112
112
|
|
113
|
-
|
114
113
|
Funlog.instance.fancyinfo_success("证书'#{File.basename(cert_path)}'安装完成!")
|
114
|
+
|
115
115
|
end
|
116
116
|
else
|
117
117
|
Funlog.instance.fancyinfo_error("非Mac电脑不支持安装证书!")
|
@@ -122,23 +122,17 @@ module Pindo
|
|
122
122
|
def install_provisionfiles(cert_url:nil, certs_dir:nil, bundle_id_map:nil, cert_type:nil)
|
123
123
|
|
124
124
|
|
125
|
-
|
125
|
+
if cert_type.downcase.include?("development")
|
126
|
+
cert_type = "Development"
|
127
|
+
elsif cert_type.downcase.include?("adhoc")
|
128
|
+
cert_type = "Adhoc"
|
129
|
+
else
|
130
|
+
cert_type = "AppStore"
|
131
|
+
end
|
126
132
|
|
127
|
-
|
128
|
-
if cert_type.downcase.include?("development")
|
129
|
-
cert_type = "Development"
|
130
|
-
elsif cert_type.downcase.include?("adhoc")
|
131
|
-
cert_type = "Adhoc"
|
132
|
-
else
|
133
|
-
cert_type = "AppStore"
|
134
|
-
end
|
133
|
+
Funlog.instance.fancyinfo_start("正在安装#{cert_type} Provisioning Profiles...")
|
135
134
|
|
136
135
|
un_exist_files = []
|
137
|
-
|
138
|
-
provisioning_info_array = []
|
139
|
-
|
140
|
-
|
141
|
-
|
142
136
|
provisioning_info_array = []
|
143
137
|
|
144
138
|
bundle_id_map.each do |type, bundle_id_temp|
|
@@ -169,14 +163,15 @@ module Pindo
|
|
169
163
|
provisioning_info_array << provisioning_info
|
170
164
|
end
|
171
165
|
|
172
|
-
Funlog.instance.fancyinfo_success("Provisioning Profiles文件安装完成!")
|
166
|
+
Funlog.instance.fancyinfo_success("#{cert_type} Provisioning Profiles文件安装完成!")
|
173
167
|
|
174
168
|
if un_exist_files.size > 0
|
175
|
-
Funlog.instance.fancyinfo_error("证书Provisioning Profiles文件不存在!")
|
169
|
+
Funlog.instance.fancyinfo_error("证书 #{cert_type} Provisioning Profiles文件不存在!")
|
176
170
|
raise Informative, "The following profiles do not exist: #{un_exist_files.join(', ')}"
|
177
171
|
end
|
178
172
|
|
179
173
|
return provisioning_info_array
|
174
|
+
|
180
175
|
end
|
181
176
|
|
182
177
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
|
2
2
|
require 'fileutils'
|
3
|
+
require 'pindo/base/aeshelper'
|
3
4
|
|
4
5
|
module Pindo
|
5
6
|
|
@@ -225,7 +226,40 @@ module Pindo
|
|
225
226
|
end
|
226
227
|
end
|
227
228
|
|
228
|
-
def create_upload_cert_info(apple_id:nil, cert_type:nil
|
229
|
+
def create_upload_cert_info(apple_id:nil, cert_type:nil)
|
230
|
+
|
231
|
+
cert_dest_dir = File.join(Dir.pwd, "cert")
|
232
|
+
if !File.exist?(cert_dest_dir)
|
233
|
+
FileUtils.mkdir_p(cert_dest_dir)
|
234
|
+
end
|
235
|
+
|
236
|
+
|
237
|
+
cert_git_url = pindo_single_config.deploy_cert_giturl
|
238
|
+
if apple_id.eql?(pindo_single_config.demo_apple_id)
|
239
|
+
cert_git_url = pindo_single_config.dev_cert_giturl
|
240
|
+
end
|
241
|
+
cert_reponame = cert_git_url.split("/").last.chomp(".git")
|
242
|
+
certs_dir = getcode_to_dir(reponame:cert_reponame, remote_url:cert_git_url, path: pindo_single_config.pindo_dir, new_branch:apple_id)
|
243
|
+
|
244
|
+
cert_git_dir = cert_type.downcase
|
245
|
+
if !cert_type.downcase.include?("development")
|
246
|
+
cert_git_dir = "distribution"
|
247
|
+
end
|
248
|
+
|
249
|
+
keys = Dir[File.join(certs_dir, "certs", cert_git_dir.to_s, "*.p12")]
|
250
|
+
decrypt_password = AESHelper.fetch_password(keychain_name:cert_git_url)
|
251
|
+
output_dir = Dir.mktmpdir
|
252
|
+
key_path = AESHelper.decrypt_specific_file(src_file: keys.first, password:decrypt_password, output_dir: output_dir)
|
253
|
+
if key_path.nil? || key_path.empty? || !File.exist?(key_path)
|
254
|
+
AESHelper.delete_password(keychain_name:cert_git_url)
|
255
|
+
raise Informative, "证书解析失败,密码错误!"
|
256
|
+
end
|
257
|
+
|
258
|
+
FileUtils.copy(key_path, File.join(cert_dest_dir, "#{cert_type}.p12"))
|
259
|
+
|
260
|
+
end
|
261
|
+
|
262
|
+
def create_upload_provisioning_info(apple_id:nil, cert_type:nil, provisioning_info_array:nil)
|
229
263
|
|
230
264
|
cert_dir = File.join(Dir.pwd, "cert")
|
231
265
|
cert_json_file = File.join(cert_dir, "certs.json")
|
@@ -272,8 +306,8 @@ module Pindo
|
|
272
306
|
|
273
307
|
cert_item["cert_id"] = cert_item["cert_id"] || bundle_id_signing_identity
|
274
308
|
cert_item["password"] = "goodcert1"
|
275
|
-
cert_item["cert_file"] = "#{cert_type}.p12"
|
276
|
-
cert_item["cert_type"] = cert_type
|
309
|
+
cert_item["cert_file"] = "#{cert_type}.p12"
|
310
|
+
cert_item["cert_type"] = cert_type
|
277
311
|
cert_item["cert_provisioning_group"] = cert_item["cert_provisioning_group"] || []
|
278
312
|
|
279
313
|
|
@@ -38,16 +38,22 @@ module Pindo
|
|
38
38
|
if @force_login || !@has_login
|
39
39
|
@has_login = @pgyer_client.do_login(force_login:@force_login)
|
40
40
|
@force_login = false
|
41
|
+
else
|
42
|
+
@has_login = @pgyer_client.do_login(force_login:false)
|
41
43
|
end
|
42
44
|
return @has_login
|
43
45
|
end
|
44
46
|
|
45
47
|
def prepare_upload(working_directory:nil, proj_name:nil)
|
46
48
|
upload_proj_name = proj_name
|
49
|
+
if upload_proj_name.nil? || upload_proj_name.empty?
|
50
|
+
upload_proj_name = @proj_name
|
51
|
+
end
|
52
|
+
|
47
53
|
app_info_obj = nil
|
48
54
|
if login
|
49
55
|
|
50
|
-
if !
|
56
|
+
if !upload_proj_name.nil?
|
51
57
|
app_info_obj = PgyerHelper.share_instace.find_app_info_with_obj_list(proj_name:upload_proj_name)
|
52
58
|
end
|
53
59
|
|
@@ -105,6 +111,7 @@ module Pindo
|
|
105
111
|
else
|
106
112
|
raise Informative, "请先登录Pgyer网站"
|
107
113
|
end
|
114
|
+
@proj_name = upload_proj_name
|
108
115
|
app_info_obj
|
109
116
|
end
|
110
117
|
|
@@ -112,17 +119,28 @@ module Pindo
|
|
112
119
|
|
113
120
|
args_ipa_file_dir = File.expand_path(File::dirname(ipa_file_upload))
|
114
121
|
ipa_file_upload=File.join(args_ipa_file_dir, File.basename(ipa_file_upload))
|
115
|
-
|
116
122
|
current_project_dir = Dir.pwd
|
117
123
|
if description.nil? && File.exist?(File.join(current_project_dir, ".git"))
|
118
|
-
|
119
|
-
|
120
|
-
|
124
|
+
description = git!(%W(-C #{current_project_dir} show -s --format=commit::%H)).strip
|
125
|
+
xcodeproj_file_name = Dir.glob(File.join(current_project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
126
|
+
if !xcodeproj_file_name.nil? && !xcodeproj_file_name.empty? && File.exist?(xcodeproj_file_name)
|
127
|
+
project_obj = Xcodeproj::Project.open(xcodeproj_file_name)
|
128
|
+
main_target = project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]) }.first
|
129
|
+
provisioning_profile_name = main_target.build_configurations.first.build_settings['PROVISIONING_PROFILE_SPECIFIER'].downcase.split(" ")
|
130
|
+
if provisioning_profile_name.include?("adhoc")
|
131
|
+
description = git!(%W(-C #{current_project_dir} show -s --format=commit::%H)).strip
|
132
|
+
elsif provisioning_profile_name.include?("development")
|
133
|
+
if File.exist?(File.join(current_project_dir, ".release_info"))
|
134
|
+
description = File.read(File.join(current_project_dir, ".release_info"))
|
135
|
+
else
|
136
|
+
description = git!(%W(-C #{current_project_dir} show -s --format=%h::%s)).strip
|
137
|
+
end
|
138
|
+
elsif provisioning_profile_name.include?("appstore")
|
139
|
+
description = "提交包重签名"
|
140
|
+
end
|
121
141
|
end
|
122
142
|
end
|
123
143
|
|
124
|
-
puts "description : #{description}"
|
125
|
-
|
126
144
|
addtach_file = nil
|
127
145
|
if ipa_file_upload.include?(File.join(current_project_dir, "build")) && File.exist?(File.join(current_project_dir, "VMData"))
|
128
146
|
|
@@ -149,7 +167,8 @@ module Pindo
|
|
149
167
|
|
150
168
|
puts
|
151
169
|
puts "上传项目: #{app_info_obj["appName"]}"
|
152
|
-
|
170
|
+
print "上传备注: "
|
171
|
+
puts description
|
153
172
|
|
154
173
|
|
155
174
|
aws_client = AWSS3Client.new
|
@@ -205,9 +224,12 @@ module Pindo
|
|
205
224
|
end
|
206
225
|
|
207
226
|
|
208
|
-
def send_apptest_wechat_msg(msg_data:nil)
|
227
|
+
def send_apptest_wechat_msg(msg_data:nil, wechat_url:nil)
|
209
228
|
|
210
|
-
wechat_msg_url =
|
229
|
+
wechat_msg_url = wechat_url
|
230
|
+
if wechat_msg_url.nil? || wechat_msg_url.empty?
|
231
|
+
wechat_msg_url = get_user_local_wechat_url()
|
232
|
+
end
|
211
233
|
|
212
234
|
if !wechat_msg_url.nil? && wechat_msg_url.length >1
|
213
235
|
|
@@ -396,6 +418,7 @@ module Pindo
|
|
396
418
|
Funlog.instance.fancyinfo_start("正在拉取app上传记录...")
|
397
419
|
|
398
420
|
appId = app_info_obj["appId"]
|
421
|
+
# puts "appId #{appId}"
|
399
422
|
version_data = @pgyer_client.get_app_version_list_req(appId:appId) || {}
|
400
423
|
|
401
424
|
if version_data["data"].nil? || version_data["data"].size <=0
|
@@ -7,8 +7,7 @@ module Pindo
|
|
7
7
|
module XcodeAppConfig
|
8
8
|
|
9
9
|
def auto_increase_buildnumber(app_config_file:nil)
|
10
|
-
|
11
|
-
if !File.exist?(app_config_file)
|
10
|
+
if File.exist?(app_config_file)
|
12
11
|
config_json = JSON.parse(File.read(app_config_file))
|
13
12
|
app_version = config_json['app_info']['app_version']
|
14
13
|
app_build_version = config_json['app_info']['app_build_version']
|
@@ -26,7 +25,7 @@ module Pindo
|
|
26
25
|
app_build_version = app_build_version_array.join(".")
|
27
26
|
|
28
27
|
config_json['app_info']['app_build_version'] = app_build_version
|
29
|
-
File.open(
|
28
|
+
File.open(app_config_file, "w") do |file|
|
30
29
|
file.write(JSON.pretty_generate(config_json))
|
31
30
|
file.close
|
32
31
|
end
|