pindo 4.8.7 → 4.8.9
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/githelper.rb +21 -0
- data/lib/pindo/client/pgyerclient.rb +34 -1
- data/lib/pindo/client/unityhelper.rb +179 -0
- data/lib/pindo/command/android/debug.rb +73 -0
- data/lib/pindo/command/android.rb +14 -0
- data/lib/pindo/command/deploy/build.rb +2 -3
- data/lib/pindo/command/dev/autobuild.rb +2 -0
- data/lib/pindo/command/dev/build.rb +4 -1
- data/lib/pindo/command/dev/debug.rb +25 -15
- data/lib/pindo/command/gplay/iap.rb +43 -0
- data/lib/pindo/command/gplay/itcapp.rb +41 -0
- data/lib/pindo/command/gplay/metadata.rb +43 -0
- data/lib/pindo/command/gplay/screenshots.rb +43 -0
- data/lib/pindo/command/gplay/upload.rb +40 -0
- data/lib/pindo/command/gplay.rb +17 -0
- data/lib/pindo/command/ios/adhoc.rb +190 -0
- data/lib/pindo/command/ios/applovin.rb +241 -0
- data/lib/pindo/command/ios/autoresign.rb +164 -0
- data/lib/pindo/command/ios/build.rb +115 -0
- data/lib/pindo/command/ios/cert.rb +164 -0
- data/lib/pindo/command/ios/debug.rb +195 -0
- data/lib/pindo/command/ios.rb +18 -0
- data/lib/pindo/command/pgyer/apptest.rb +5 -1
- data/lib/pindo/command/pgyer/upload.rb +4 -4
- data/lib/pindo/command/unity/apk.rb +78 -0
- data/lib/pindo/command/unity/ipa.rb +152 -0
- data/lib/pindo/command/unity.rb +16 -0
- data/lib/pindo/command.rb +3 -1
- data/lib/pindo/module/appselect.rb +4 -0
- data/lib/pindo/module/cert/xcodecerthelper.rb +2 -2
- data/lib/pindo/module/pgyer/pgyerhelper.rb +47 -7
- data/lib/pindo/module/xcode/xcodehelper.rb +1 -1
- data/lib/pindo/options/deployoptions.rb +4 -0
- data/lib/pindo/version.rb +1 -1
- data/lib/pindo.rb +1 -0
- metadata +22 -6
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
require 'xcodeproj'
|
3
|
+
require 'find'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module Pindo
|
7
|
+
class Command
|
8
|
+
class Appstore < Command
|
9
|
+
class Upload < Appstore
|
10
|
+
|
11
|
+
self.summary = '上传ipa到appstore'
|
12
|
+
|
13
|
+
self.description = <<-DESC
|
14
|
+
上传ipa到appstore:pindo appstore upload
|
15
|
+
DESC
|
16
|
+
|
17
|
+
self.arguments = [
|
18
|
+
CLAide::Argument.new('path/to/config.json', false),
|
19
|
+
]
|
20
|
+
|
21
|
+
def self.options
|
22
|
+
[
|
23
|
+
|
24
|
+
|
25
|
+
].concat(super)
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(argv)
|
29
|
+
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def run
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
require 'pindo/command/appstore/iap'
|
3
|
+
require 'pindo/command/appstore/itcapp'
|
4
|
+
require 'pindo/command/appstore/metadata'
|
5
|
+
require 'pindo/command/appstore/screenshots'
|
6
|
+
require 'pindo/command/appstore/upload'
|
7
|
+
|
8
|
+
module Pindo
|
9
|
+
class Command
|
10
|
+
|
11
|
+
class Appstore < Command
|
12
|
+
self.abstract_command = true
|
13
|
+
self.summary = 'appstore的相关命令'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
require 'xcodeproj'
|
3
|
+
require 'find'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'pindo/base/executable'
|
6
|
+
|
7
|
+
module Pindo
|
8
|
+
class Command
|
9
|
+
class Ios < Command
|
10
|
+
class Adhoc < Ios
|
11
|
+
|
12
|
+
include Appselect
|
13
|
+
|
14
|
+
# 命令的简要说明 - 设置开发环境并编译iOS工程
|
15
|
+
self.summary = '设置开发环境并编译iOS工程'
|
16
|
+
|
17
|
+
# 命令的详细说明,包含用法示例
|
18
|
+
self.description = <<-DESC
|
19
|
+
设置开发环境并编译iOS工程。
|
20
|
+
|
21
|
+
支持功能:
|
22
|
+
|
23
|
+
* 自动设置开发环境
|
24
|
+
|
25
|
+
* 编译打包上传
|
26
|
+
|
27
|
+
* 发送测试通知
|
28
|
+
|
29
|
+
使用示例:
|
30
|
+
|
31
|
+
$ pindo ios adhoc # 设置开发环境
|
32
|
+
|
33
|
+
$ pindo ios adhoc --upload # 编译并上传
|
34
|
+
|
35
|
+
$ pindo ios adhoc --send # 编译并上传并发送通知
|
36
|
+
|
37
|
+
$ pindo ios adhoc --proj=myapp # 指定项目名称
|
38
|
+
DESC
|
39
|
+
|
40
|
+
# 命令的参数列表
|
41
|
+
self.arguments = [
|
42
|
+
|
43
|
+
]
|
44
|
+
|
45
|
+
# 命令的选项列表
|
46
|
+
def self.options
|
47
|
+
[
|
48
|
+
# 指定上传到蒲公英的项目
|
49
|
+
['--proj', '指定上传到测试平台的项目名称'],
|
50
|
+
# 上传编译包
|
51
|
+
['--upload', '上传编译后的ipa到测试平台'],
|
52
|
+
# 发送通知
|
53
|
+
['--send', '上传成功后发送测试通知']
|
54
|
+
].concat(super)
|
55
|
+
end
|
56
|
+
|
57
|
+
def initialize(argv)
|
58
|
+
|
59
|
+
@args_deploy_flag = argv.flag?('deploy', false)
|
60
|
+
@args_adhoc_flag = argv.flag?('adhoc', false)
|
61
|
+
@args_upload_flag = argv.flag?('upload', false)
|
62
|
+
@args_send_flag = argv.flag?('send', false)
|
63
|
+
@args_proj_name = argv.option('proj')
|
64
|
+
|
65
|
+
if @args_send_flag
|
66
|
+
@args_upload_flag = true
|
67
|
+
end
|
68
|
+
|
69
|
+
super
|
70
|
+
@additional_args = argv.remainder!
|
71
|
+
end
|
72
|
+
|
73
|
+
def validate!
|
74
|
+
|
75
|
+
super
|
76
|
+
end
|
77
|
+
|
78
|
+
def run
|
79
|
+
|
80
|
+
mainapp_bundleid= nil
|
81
|
+
if @args_deploy_flag
|
82
|
+
mainapp_bundleid = get_selected_deploy_bundleid()
|
83
|
+
else
|
84
|
+
mainapp_bundleid = get_selected_dev_bundleid()
|
85
|
+
end
|
86
|
+
|
87
|
+
app_info_obj = nil
|
88
|
+
if @args_upload_flag
|
89
|
+
proj_name = @args_proj_name
|
90
|
+
app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:proj_name)
|
91
|
+
end
|
92
|
+
|
93
|
+
args_temp = []
|
94
|
+
args_temp << mainapp_bundleid
|
95
|
+
Pindo::Command::Deploy::Pullconfig::run(args_temp)
|
96
|
+
|
97
|
+
project_dir = Dir.pwd
|
98
|
+
Dir.chdir(project_dir)
|
99
|
+
config_json_file = File.join(project_dir,"config.json")
|
100
|
+
Cert::modify_cert_with_project(project_dir:project_dir, config_file:config_json_file)
|
101
|
+
|
102
|
+
if File.exist?(File.join(project_dir, "Podfile"))
|
103
|
+
|
104
|
+
args_temp = []
|
105
|
+
args_temp << config_json_file
|
106
|
+
Pindo::Command::Lib::Update::run([])
|
107
|
+
|
108
|
+
begin
|
109
|
+
if File.exist?(File.join(project_dir, "Podfile.lock"))
|
110
|
+
FileUtils.rm_rf(File.join(project_dir, "Podfile.lock"))
|
111
|
+
end
|
112
|
+
if File.exist?(File.join(project_dir,"Pods"))
|
113
|
+
FileUtils.rm_rf(File.join(project_dir, "Pods"))
|
114
|
+
end
|
115
|
+
puts "正在执行pod deintegrate..."
|
116
|
+
system 'pod deintegrate'
|
117
|
+
puts "正在执行pod install..."
|
118
|
+
system 'pod install'
|
119
|
+
rescue => error
|
120
|
+
puts(error.to_s)
|
121
|
+
raise Informative, "pod install失败!!先pod install 完成后成编译 !"
|
122
|
+
end
|
123
|
+
|
124
|
+
Dir.chdir(project_dir)
|
125
|
+
pod_lock_file = File.join(project_dir, "Podfile.lock")
|
126
|
+
if !File.exist?(pod_lock_file)
|
127
|
+
raise Informative, "pod install失败!!先pod install 完成后成编译 !"
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
args_temp = []
|
134
|
+
if @args_adhoc_flag
|
135
|
+
args_temp << "--adhoc"
|
136
|
+
else
|
137
|
+
args_temp << "--dev"
|
138
|
+
end
|
139
|
+
|
140
|
+
project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
141
|
+
if !project_fullname.nil?
|
142
|
+
project_obj = Xcodeproj::Project.open(project_fullname)
|
143
|
+
project_build_platform = project_obj.root_object.build_configuration_list.get_setting("SDKROOT")["Release"]
|
144
|
+
if !project_build_platform.nil? && project_build_platform.eql?("macosx")
|
145
|
+
@args_macos_flag = true
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
if @args_macos_flag
|
150
|
+
args_temp << "--macos"
|
151
|
+
end
|
152
|
+
|
153
|
+
Pindo::Command::Deploy::Cert::run(args_temp)
|
154
|
+
|
155
|
+
Dir.chdir(project_dir)
|
156
|
+
Pindo::Command::Deploy::Build::run(args_temp)
|
157
|
+
|
158
|
+
|
159
|
+
pindo_new_project_dir = Dir.pwd
|
160
|
+
build_path = File.join(pindo_new_project_dir, "build", "*.{ipa,app}")
|
161
|
+
ipa_file_upload = Dir.glob(build_path).max_by {|f| File.mtime(f)}
|
162
|
+
|
163
|
+
if !ipa_file_upload.nil? && !app_info_obj.nil?
|
164
|
+
description = nil
|
165
|
+
if File.exist?(File.join(pindo_new_project_dir, ".release_info"))
|
166
|
+
description = File.read(File.join(pindo_new_project_dir, ".release_info"))
|
167
|
+
else
|
168
|
+
if File.exist?(File.join(pindo_new_project_dir, ".git"))
|
169
|
+
description = git!(%W(-C #{pindo_new_project_dir} show -s --format=%h::%s)).strip
|
170
|
+
end
|
171
|
+
end
|
172
|
+
result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
|
173
|
+
if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
|
174
|
+
msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
|
175
|
+
PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
|
176
|
+
if @args_send_flag
|
177
|
+
PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
system "open #{project_dir}"
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
@@ -0,0 +1,241 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'highline/import'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'json'
|
6
|
+
require 'faraday'
|
7
|
+
require 'xcodeproj'
|
8
|
+
|
9
|
+
module Pindo
|
10
|
+
class Command
|
11
|
+
class Ios < Command
|
12
|
+
class Applovin < Ios
|
13
|
+
|
14
|
+
self.summary = '接入applovin max广告平台时更新Xcode中info.plist'
|
15
|
+
|
16
|
+
self.description = <<-DESC
|
17
|
+
接入applovin max广告平台时更新Xcode中info.plist。
|
18
|
+
|
19
|
+
支持功能:
|
20
|
+
|
21
|
+
* 自动获取applovin广告平台的SKAdNetwork IDs
|
22
|
+
|
23
|
+
* 更新Xcode工程中的info.plist文件
|
24
|
+
|
25
|
+
* 支持保存SKAdNetwork IDs到本地配置
|
26
|
+
|
27
|
+
使用示例:
|
28
|
+
|
29
|
+
$ pindo ios applovin # 更新当前目录下工程的info.plist
|
30
|
+
|
31
|
+
$ pindo ios applovin --appstore # 使用AppStore模式更新
|
32
|
+
|
33
|
+
$ pindo ios applovin --install # 运行applovin安装脚本
|
34
|
+
|
35
|
+
$ pindo ios applovin --upload # 保存SKAdNetwork IDs到本地
|
36
|
+
DESC
|
37
|
+
|
38
|
+
self.arguments = [
|
39
|
+
]
|
40
|
+
|
41
|
+
def self.options
|
42
|
+
[
|
43
|
+
['--appstore', 'AppStore模式,一般不使用'],
|
44
|
+
['--install', '运行applovin安装脚本'],
|
45
|
+
['--upload', '保存SKAdNetwork IDs到本地配置'],
|
46
|
+
].concat(super)
|
47
|
+
end
|
48
|
+
|
49
|
+
def initialize(argv)
|
50
|
+
|
51
|
+
@args_appstore_flag = argv.flag?('appstore', false)
|
52
|
+
@args_install_flag = argv.flag?('install', false)
|
53
|
+
@args_upload_flag = argv.flag?('upload', false)
|
54
|
+
|
55
|
+
super(argv)
|
56
|
+
@additional_args = argv.remainder!
|
57
|
+
end
|
58
|
+
|
59
|
+
def validate!
|
60
|
+
super
|
61
|
+
end
|
62
|
+
|
63
|
+
def run
|
64
|
+
|
65
|
+
skadnetwork_id_array = []
|
66
|
+
|
67
|
+
Funlog.instance.fancyinfo_start("正在请求applovin数据...")
|
68
|
+
|
69
|
+
applovin_res_json = req_applovin_json
|
70
|
+
# puts JSON.pretty_generate(applovin_res_json)
|
71
|
+
|
72
|
+
if !applovin_res_json.nil? && !applovin_res_json["skadnetwork_ids"].nil?
|
73
|
+
applovin_res_json["skadnetwork_ids"].each do |network_id|
|
74
|
+
skadnetwork_id_array << network_id["skadnetwork_id"]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
applovin_media_res_json = req_applovin_mediia_json
|
79
|
+
# puts JSON.pretty_generate(applovin_media_res_json)
|
80
|
+
if !applovin_media_res_json.nil? && !applovin_media_res_json["mediationSKAdnetworkIdsSpecs"].nil?
|
81
|
+
applovin_media_res_json["mediationSKAdnetworkIdsSpecs"].each do |media_item|
|
82
|
+
skadnetwork_id_array = skadnetwork_id_array + media_item["skAdnetworkIds"]
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
skadnetwork_id_array = skadnetwork_id_array.uniq || []
|
87
|
+
|
88
|
+
Funlog.instance.fancyinfo_success("请求applovin数据,获取到#{skadnetwork_id_array.size}条数据...")
|
89
|
+
|
90
|
+
if !skadnetwork_id_array.nil? && skadnetwork_id_array.size > 50
|
91
|
+
# puts "From Applovin SKAdNetworkItems Size: #{skadnetwork_id_array.size}"
|
92
|
+
if @args_upload_flag
|
93
|
+
applovin_config_file = File.join(pindo_single_config.pindo_common_configdir,"applovin_client_config.json")
|
94
|
+
origin_json = {}
|
95
|
+
if File.exist?(applovin_config_file)
|
96
|
+
origin_json = JSON.parse(File.read(applovin_config_file))
|
97
|
+
end
|
98
|
+
origin_json["SKAdNetworkItems"] = skadnetwork_id_array
|
99
|
+
File.write(applovin_config_file, JSON.pretty_generate(origin_json))
|
100
|
+
git_addpush_repo(path:pindo_single_config.pindo_common_configdir, message:"Applovin SKAdNetworkItems", commit_file_params:["applovin_client_config.json"])
|
101
|
+
end
|
102
|
+
else
|
103
|
+
Funlog.instance.fancyinfo_start("网络拉取applovin数据太少,从缓存中获取数据...")
|
104
|
+
config_file = File.join(File::expand_path(Pindoconfig.instance.pindo_common_configdir), "applovin_client_config.json")
|
105
|
+
config_json = JSON.parse(File.read(config_file))
|
106
|
+
skadnetwork_id_array = skadnetwork_id_array + config_json["SKAdNetworkItems"]
|
107
|
+
# puts "From Config SKAdNetworkItems Size: #{skadnetwork_id_array.size}"
|
108
|
+
Funlog.instance.fancyinfo_success("网络拉取applovin数据太少,从缓存中获取到#{skadnetwork_id_array.size}条数据...")
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
Funlog.instance.fancyinfo_start("正在写入Xcode中...")
|
113
|
+
|
114
|
+
skadnetwork_id_array = skadnetwork_id_array.uniq || []
|
115
|
+
|
116
|
+
project_root_dir = Dir.pwd
|
117
|
+
xcodeproj_file_name = Dir.glob(File.join(project_root_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
118
|
+
|
119
|
+
plist_file_name = File.join(project_root_dir, "AppEntry/Info.plist")
|
120
|
+
if !xcodeproj_file_name.nil?
|
121
|
+
proj_name = File.basename(xcodeproj_file_name, ".xcodeproj")
|
122
|
+
plist_file_name = get_applovin_infoplist(project_dir:project_root_dir, proj_name:proj_name)
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
info_plist_dict = {}
|
127
|
+
if File.exist?(plist_file_name)
|
128
|
+
info_plist_dict = Xcodeproj::Plist.read_from_path(plist_file_name)
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
info_plist_dict["NSAdvertisingAttributionReportEndpoint"] = info_plist_dict["NSAdvertisingAttributionReportEndpoint"] || "https://postbacks-app.com"
|
133
|
+
|
134
|
+
if !info_plist_dict.has_key?("NSAppTransportSecurity")
|
135
|
+
info_plist_dict["NSAppTransportSecurity"] = {}
|
136
|
+
info_plist_dict["NSAppTransportSecurity"]["NSAllowsArbitraryLoads"] = true
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
if !skadnetwork_id_array.nil? && skadnetwork_id_array.size > 0
|
141
|
+
info_plist_dict["SKAdNetworkItems"] = []
|
142
|
+
skadnetwork_id_array.each do |network_id|
|
143
|
+
item = {}
|
144
|
+
item["SKAdNetworkIdentifier"] = network_id
|
145
|
+
info_plist_dict["SKAdNetworkItems"] << item
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
Xcodeproj::Plist.write_to_path(info_plist_dict, plist_file_name)
|
150
|
+
|
151
|
+
Funlog.instance.fancyinfo_success("Xcode中applovin数据修改完成!")
|
152
|
+
|
153
|
+
if @args_install_flag && !xcodeproj_file_name.nil? && File.exist?(xcodeproj_file_name)
|
154
|
+
|
155
|
+
pindo_common_dir = pindo_single_config.pindo_common_configdir
|
156
|
+
|
157
|
+
app_lovin_script = File.join(pindo_common_dir, "AppLovinQualityServiceSetup-ios-dev.rb")
|
158
|
+
if @args_appstore_flag
|
159
|
+
app_lovin_script = File.join(pindo_common_dir, "AppLovinQualityServiceSetup-ios.rb")
|
160
|
+
end
|
161
|
+
|
162
|
+
project_script_file = File.join(project_root_dir, "AppLovinQualityServiceSetup-ios.rb")
|
163
|
+
FileUtils.cp_r(app_lovin_script, project_script_file)
|
164
|
+
command = "ruby " + project_script_file
|
165
|
+
# puts command
|
166
|
+
system command
|
167
|
+
end
|
168
|
+
|
169
|
+
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
def get_applovin_infoplist(project_dir:nil, proj_name:nil)
|
174
|
+
|
175
|
+
info_plist_path = File.join(project_dir, "AppEntry/Info.plist")
|
176
|
+
proj_fullname = File.join(project_dir, proj_name) + ".xcodeproj"
|
177
|
+
if File.exist?(proj_fullname)
|
178
|
+
project_obj = Xcodeproj::Project.open(proj_fullname)
|
179
|
+
project_obj.targets.each do |target|
|
180
|
+
|
181
|
+
if target.product_type.to_s.eql?("com.apple.product-type.application") then
|
182
|
+
temp_info = target.build_configurations.first.build_settings['INFOPLIST_FILE']
|
183
|
+
info_plist_path = File.join(project_dir, temp_info)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
return info_plist_path
|
189
|
+
end
|
190
|
+
|
191
|
+
|
192
|
+
def req_applovin_json
|
193
|
+
|
194
|
+
begin
|
195
|
+
# https://dash.applovin.com/docs/v1/skadnetwork_ids.json
|
196
|
+
applovin_url = "https://dash.applovin.com/docs/v1/skadnetwork_ids.json"
|
197
|
+
con = Faraday.new
|
198
|
+
res = con.get do |req|
|
199
|
+
req.url applovin_url
|
200
|
+
req.headers['Content-Type'] = 'application/json'
|
201
|
+
end
|
202
|
+
|
203
|
+
applovin_res_json = JSON.parse(res.body)
|
204
|
+
|
205
|
+
return applovin_res_json
|
206
|
+
rescue Exception => e
|
207
|
+
return nil
|
208
|
+
end
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
def req_applovin_mediia_json
|
215
|
+
|
216
|
+
|
217
|
+
begin
|
218
|
+
applovin_url = "https://dash.applovin.com/docs/v1/mediation_sk_adnetwork_ids"
|
219
|
+
con = Faraday.new
|
220
|
+
res = con.get do |req|
|
221
|
+
req.url applovin_url
|
222
|
+
req.headers['Content-Type'] = 'application/json'
|
223
|
+
end
|
224
|
+
|
225
|
+
applovin_res_json = JSON.parse(res.body)
|
226
|
+
return applovin_res_json
|
227
|
+
rescue Exception => e
|
228
|
+
return nil
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
@@ -0,0 +1,164 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
require 'xcodeproj'
|
3
|
+
require 'find'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'pindo/base/executable'
|
6
|
+
|
7
|
+
module Pindo
|
8
|
+
class Command
|
9
|
+
class Ios < Command
|
10
|
+
class Autoresign < Ios
|
11
|
+
|
12
|
+
include Appselect
|
13
|
+
self.summary = 'IPA包重签名工具'
|
14
|
+
|
15
|
+
self.description = <<-DESC
|
16
|
+
使用最新的证书重签名IPA包。
|
17
|
+
|
18
|
+
支持功能:
|
19
|
+
|
20
|
+
* 使用开发或发布证书重签名
|
21
|
+
|
22
|
+
* 支持指定IPA路径
|
23
|
+
|
24
|
+
* 支持上传到测试平台
|
25
|
+
|
26
|
+
* 支持发送测试通知
|
27
|
+
|
28
|
+
使用示例:
|
29
|
+
|
30
|
+
$ pindo ios autoresign # 使用开发证书重签名当前目录下的IPA
|
31
|
+
|
32
|
+
$ pindo ios autoresign /path/to/demo.ipa # 重签名指定IPA文件
|
33
|
+
|
34
|
+
$ pindo ios autoresign --adhoc # 使用adhoc证书重签名
|
35
|
+
|
36
|
+
$ pindo ios autoresign --deploy # 使用发布bundle id
|
37
|
+
|
38
|
+
$ pindo ios autoresign --upload # 重签名并上传
|
39
|
+
|
40
|
+
$ pindo ios autoresign --send # 重签名上传并发送通知
|
41
|
+
DESC
|
42
|
+
|
43
|
+
self.arguments = [
|
44
|
+
CLAide::Argument.new('path/to/demo.ipa', true),
|
45
|
+
]
|
46
|
+
|
47
|
+
def self.options
|
48
|
+
[
|
49
|
+
['--ipa', '指定要重签名的IPA文件路径'],
|
50
|
+
['--adhoc', '使用adhoc证书重签名(默认使用开发证书)'],
|
51
|
+
['--deploy', '使用发布证书和bundle id重签名(默认使用开发证书)'],
|
52
|
+
['--proj', '指定上传到测试平台的项目名称'],
|
53
|
+
['--upload', '上传重签名后的IPA到测试平台'],
|
54
|
+
['--send', '上传成功后发送测试通知'],
|
55
|
+
].concat(super)
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
def initialize(argv)
|
60
|
+
|
61
|
+
@args_ipa_file = argv.shift_argument
|
62
|
+
@args_set_ipa_name = argv.option('ipa')
|
63
|
+
@args_adhoc_flag = argv.flag?('adhoc', false)
|
64
|
+
@args_deploy_flag = argv.flag?('deploy', false)
|
65
|
+
|
66
|
+
@args_upload_flag = argv.flag?('upload', false)
|
67
|
+
@args_send_flag = argv.flag?('send', false)
|
68
|
+
@args_proj_name = argv.option('proj')
|
69
|
+
|
70
|
+
if @args_send_flag
|
71
|
+
@args_upload_flag = true
|
72
|
+
end
|
73
|
+
|
74
|
+
super
|
75
|
+
@additional_args = argv.remainder!
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
def run
|
80
|
+
|
81
|
+
ipa_file_name = @args_ipa_file
|
82
|
+
if !@args_set_ipa_name.nil?
|
83
|
+
ipa_file_name = @args_set_ipa_name
|
84
|
+
end
|
85
|
+
|
86
|
+
if !ipa_file_name.nil? && File.exist?(ipa_file_name)
|
87
|
+
else
|
88
|
+
current_dir = Dir.pwd
|
89
|
+
# File.basename(f).include?("_resigned") ? Time.local(0, 0, 0) : File.mtime(f)
|
90
|
+
ipa_file_name = Dir.glob(File.join(current_dir, "/*.ipa")).max_by {|f| File.basename(f).include?("_resigned") ? Time.local(0, 1, 1) : File.mtime(f)}
|
91
|
+
end
|
92
|
+
|
93
|
+
if !ipa_file_name.nil? && File.exist?(ipa_file_name)
|
94
|
+
puts
|
95
|
+
puts "正在重签名的ipa: #{ipa_file_name}"
|
96
|
+
puts "时间: #{File.mtime(ipa_file_name)}"
|
97
|
+
puts
|
98
|
+
else
|
99
|
+
return
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
mainapp_bundleid = nil
|
104
|
+
|
105
|
+
if @args_deploy_flag
|
106
|
+
mainapp_bundleid = get_selected_deploy_bundleid()
|
107
|
+
else
|
108
|
+
mainapp_bundleid = get_selected_dev_bundleid()
|
109
|
+
end
|
110
|
+
puts "mainapp_bundleid: #{mainapp_bundleid}"
|
111
|
+
|
112
|
+
args_temp = []
|
113
|
+
args_temp << mainapp_bundleid
|
114
|
+
|
115
|
+
Pindo::Command::Deploy::Pullconfig::run(args_temp)
|
116
|
+
|
117
|
+
app_info_obj = nil
|
118
|
+
if @args_upload_flag
|
119
|
+
proj_name = @args_proj_name
|
120
|
+
app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:proj_name)
|
121
|
+
end
|
122
|
+
|
123
|
+
args_temp = []
|
124
|
+
if @args_adhoc_flag
|
125
|
+
args_temp << "--adhoc"
|
126
|
+
else
|
127
|
+
args_temp << "--dev"
|
128
|
+
end
|
129
|
+
|
130
|
+
if !ipa_file_name.nil?
|
131
|
+
|
132
|
+
args_temp << "--ipa=#{ipa_file_name}"
|
133
|
+
Pindo::Command::Deploy::Resign::run(args_temp)
|
134
|
+
|
135
|
+
|
136
|
+
ipa_file_name = File::expand_path(ipa_file_name)
|
137
|
+
ipa_base_name = File.basename(ipa_file_name, ".ipa")
|
138
|
+
ipa_dir = File.dirname(ipa_file_name)
|
139
|
+
ipa_file_upload = File.join(ipa_dir, ipa_base_name + "_resigned.ipa")
|
140
|
+
|
141
|
+
if !ipa_file_upload.nil? && !app_info_obj.nil?
|
142
|
+
result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:nil)
|
143
|
+
if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
|
144
|
+
msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
|
145
|
+
PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
|
146
|
+
if @args_send_flag
|
147
|
+
PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
#
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|