pindo 4.9.2 → 4.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pindo/base/githelper.rb +6 -6
- data/lib/pindo/command/dev/autobuild.rb +14 -0
- data/lib/pindo/command/dev/build.rb +12 -0
- data/lib/pindo/command/dev/tag.rb +1 -1
- data/lib/pindo/command/ios/autobuild.rb +210 -0
- data/lib/pindo/command/ios/build.rb +14 -0
- data/lib/pindo/command/ios/debug.rb +133 -164
- data/lib/pindo/command/ios.rb +2 -2
- data/lib/pindo/command/unity/ipa.rb +34 -67
- data/lib/pindo/command.rb +0 -1
- data/lib/pindo/module/build/buildhelper.rb +48 -4
- data/lib/pindo/module/build/unityhelper.rb +33 -106
- data/lib/pindo/version.rb +1 -1
- metadata +3 -4
- data/lib/pindo/command/ios/cert.rb +0 -164
- data/lib/pindo/command/upgrade.rb +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62de96b4f16a275d27052cbd6339c78848e4ab461ae0797ac498e266736aa182
|
4
|
+
data.tar.gz: '0832db3211e5d145f56a2d2582a5286780fbf5ddfde1ca3b3a56f3618a3968f4'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9a2b3f0de32f931efb4b7259fa387b04b52fd6d178ba6e3814bec682a5822bdd320d1629494deba21011deccb078dd31f8cee912dab277e5989f6e95830ad90
|
7
|
+
data.tar.gz: 290d04752c4ec0a6e2d77d7ca159b24eddd90dd9973757efd1dc9d954ac3bc2c85bacdee5cfcb69c386774a3ff8c49e88f553c8260041e0b81c40245e41f4bf1
|
data/lib/pindo/base/githelper.rb
CHANGED
@@ -590,7 +590,7 @@ module Pindo
|
|
590
590
|
return new_tag
|
591
591
|
end
|
592
592
|
|
593
|
-
if is_tag_at_head?(
|
593
|
+
if is_tag_at_head?(git_root_dir: project_dir, tag_name: latest_tag)
|
594
594
|
return latest_tag
|
595
595
|
end
|
596
596
|
|
@@ -627,17 +627,17 @@ module Pindo
|
|
627
627
|
end
|
628
628
|
|
629
629
|
# 检查tag是否在指定的commit上
|
630
|
-
# @param
|
630
|
+
# @param git_root_dir [String] 项目目录路径
|
631
631
|
# @param tag_name [String] 标签名称
|
632
632
|
# @return [Boolean] 如果tag在当前HEAD上返回true,否则返回false
|
633
|
-
def is_tag_at_head?(
|
634
|
-
return false if
|
633
|
+
def is_tag_at_head?(git_root_dir:nil, tag_name:nil)
|
634
|
+
return false if git_root_dir.nil? || tag_name.nil?
|
635
635
|
|
636
636
|
begin
|
637
637
|
# 获取tag的commit hash
|
638
|
-
tag_commit = git!(%W(-C #{
|
638
|
+
tag_commit = git!(%W(-C #{git_root_dir} rev-parse #{tag_name})).strip
|
639
639
|
# 获取HEAD的commit hash
|
640
|
-
head_commit = git!(%W(-C #{
|
640
|
+
head_commit = git!(%W(-C #{git_root_dir} rev-parse HEAD)).strip
|
641
641
|
|
642
642
|
# 比较两个commit hash是否相同
|
643
643
|
tag_commit == head_commit
|
@@ -3,6 +3,7 @@ require 'xcodeproj'
|
|
3
3
|
require 'find'
|
4
4
|
require 'fileutils'
|
5
5
|
require 'pindo/base/executable'
|
6
|
+
require 'pindo/module/build/buildhelper'
|
6
7
|
|
7
8
|
module Pindo
|
8
9
|
class Command
|
@@ -54,6 +55,19 @@ module Pindo
|
|
54
55
|
|
55
56
|
def run
|
56
57
|
|
58
|
+
pindo_unity_project_dir = Dir.pwd
|
59
|
+
build_helper = Pindo::BuildHelper.share_instance
|
60
|
+
unless build_helper.ios_project?(pindo_unity_project_dir)
|
61
|
+
raise Informative, "当前目录不是iOS工程,请在iOS工程根目录下执行此命令"
|
62
|
+
end
|
63
|
+
|
64
|
+
if @args_upload_flag
|
65
|
+
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_unity_project_dir)
|
66
|
+
if is_need_add_tag
|
67
|
+
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
57
71
|
mainapp_bundleid= nil
|
58
72
|
if @args_deploy_flag
|
59
73
|
mainapp_bundleid = get_selected_deploy_bundleid()
|
@@ -46,7 +46,19 @@ module Pindo
|
|
46
46
|
|
47
47
|
def run
|
48
48
|
|
49
|
+
pindo_unity_project_dir = Dir.pwd
|
50
|
+
build_helper = Pindo::BuildHelper.share_instance
|
51
|
+
unless build_helper.ios_project?(pindo_unity_project_dir)
|
52
|
+
raise Informative, "当前目录不是iOS工程,请在iOS工程根目录下执行此命令"
|
53
|
+
end
|
54
|
+
if @args_upload_flag
|
55
|
+
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_unity_project_dir)
|
56
|
+
if is_need_add_tag
|
57
|
+
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
58
|
+
end
|
59
|
+
end
|
49
60
|
|
61
|
+
|
50
62
|
app_info_obj = nil
|
51
63
|
if @args_upload_flag
|
52
64
|
proj_name = @args_proj_name
|
@@ -96,7 +96,7 @@ module Pindo
|
|
96
96
|
return
|
97
97
|
end
|
98
98
|
|
99
|
-
if is_tag_at_head?(
|
99
|
+
if is_tag_at_head?(git_root_dir: project_dir, tag_name: latest_tag)
|
100
100
|
Funlog.instance.fancyinfo_success("当前commit已有tag: #{latest_tag},无需重新打tag")
|
101
101
|
Funlog.instance.fancyinfo_success("仓库路径: #{project_dir}")
|
102
102
|
return
|
@@ -0,0 +1,210 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
require 'xcodeproj'
|
3
|
+
require 'find'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'pindo/base/executable'
|
6
|
+
require 'pindo/module/build/buildhelper'
|
7
|
+
|
8
|
+
module Pindo
|
9
|
+
class Command
|
10
|
+
class Ios < Command
|
11
|
+
class Autobuild < Ios
|
12
|
+
|
13
|
+
include Appselect
|
14
|
+
# 命令的简要说明 - 打包iOS工程并发布到蒲公英
|
15
|
+
self.summary = '打包iOS工程并发布到蒲公英'
|
16
|
+
|
17
|
+
# 命令的详细说明,包含用法示例
|
18
|
+
self.description = <<-DESC
|
19
|
+
编译iOS Debug包并支持上传到测试平台。
|
20
|
+
|
21
|
+
支持功能:
|
22
|
+
|
23
|
+
* 编译Debug包
|
24
|
+
|
25
|
+
* 上传到测试平台
|
26
|
+
|
27
|
+
* 发送测试通知
|
28
|
+
|
29
|
+
使用示例:
|
30
|
+
|
31
|
+
$ pindo ios autobuild # 编译Debug包
|
32
|
+
|
33
|
+
$ pindo ios autobuild --upload # 编译并上传
|
34
|
+
|
35
|
+
$ pindo ios autobuild --send # 编译上传并发送通知
|
36
|
+
|
37
|
+
$ pindo ios autobuild --proj=myapp # 指定项目名称
|
38
|
+
DESC
|
39
|
+
|
40
|
+
# 命令的参数列表
|
41
|
+
self.arguments = [
|
42
|
+
# 暂无参数
|
43
|
+
]
|
44
|
+
|
45
|
+
# 命令的选项列表
|
46
|
+
def self.options
|
47
|
+
[
|
48
|
+
['--bundleid', '指定打包的bundleID'],
|
49
|
+
# 指定上传到蒲公英的项目
|
50
|
+
['--proj', '指定上传到测试平台的项目名称'],
|
51
|
+
# 上传编译包
|
52
|
+
['--upload', '上传编译后的ipa到测试平台'],
|
53
|
+
# 发送通知
|
54
|
+
['--send', '上传成功后发送测试通知']
|
55
|
+
].concat(super)
|
56
|
+
end
|
57
|
+
|
58
|
+
def initialize(argv)
|
59
|
+
|
60
|
+
@args_deploy_flag = argv.flag?('deploy', false)
|
61
|
+
@args_adhoc_flag = argv.flag?('adhoc', false)
|
62
|
+
@args_upload_flag = argv.flag?('upload', false)
|
63
|
+
@args_send_flag = argv.flag?('send', false)
|
64
|
+
@args_proj_name = argv.option('proj')
|
65
|
+
@args_bundle_id = argv.option('bundleid')
|
66
|
+
|
67
|
+
if @args_send_flag
|
68
|
+
@args_upload_flag = true
|
69
|
+
end
|
70
|
+
|
71
|
+
super
|
72
|
+
@additional_args = argv.remainder!
|
73
|
+
end
|
74
|
+
|
75
|
+
def validate!
|
76
|
+
|
77
|
+
super
|
78
|
+
end
|
79
|
+
|
80
|
+
def run
|
81
|
+
|
82
|
+
pindo_unity_project_dir = Dir.pwd
|
83
|
+
build_helper = Pindo::BuildHelper.share_instance
|
84
|
+
unless build_helper.ios_project?(pindo_unity_project_dir)
|
85
|
+
raise Informative, "当前目录不是iOS工程,请在iOS工程根目录下执行此命令"
|
86
|
+
end
|
87
|
+
|
88
|
+
if @args_upload_flag
|
89
|
+
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_unity_project_dir)
|
90
|
+
if is_need_add_tag
|
91
|
+
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
mainapp_bundleid= nil
|
97
|
+
if @args_bundle_id
|
98
|
+
mainapp_bundleid = @args_bundle_id
|
99
|
+
else
|
100
|
+
if @args_deploy_flag
|
101
|
+
mainapp_bundleid = get_selected_deploy_bundleid()
|
102
|
+
else
|
103
|
+
mainapp_bundleid = get_selected_dev_bundleid()
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
app_info_obj = nil
|
108
|
+
if @args_upload_flag
|
109
|
+
proj_name = @args_proj_name
|
110
|
+
app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:proj_name)
|
111
|
+
end
|
112
|
+
|
113
|
+
args_temp = []
|
114
|
+
args_temp << mainapp_bundleid
|
115
|
+
Pindo::Command::Deploy::Pullconfig::run(args_temp)
|
116
|
+
|
117
|
+
project_dir = Dir.pwd
|
118
|
+
Dir.chdir(project_dir)
|
119
|
+
config_json_file = File.join(project_dir,"config.json")
|
120
|
+
Pindo::Command::Ios::Debug::modify_cert_with_project(project_dir:project_dir, config_file:config_json_file)
|
121
|
+
|
122
|
+
if File.exist?(File.join(project_dir, "Podfile"))
|
123
|
+
|
124
|
+
args_temp = []
|
125
|
+
args_temp << config_json_file
|
126
|
+
Pindo::Command::Lib::Update::run([])
|
127
|
+
|
128
|
+
begin
|
129
|
+
if File.exist?(File.join(project_dir, "Podfile.lock"))
|
130
|
+
FileUtils.rm_rf(File.join(project_dir, "Podfile.lock"))
|
131
|
+
end
|
132
|
+
if File.exist?(File.join(project_dir,"Pods"))
|
133
|
+
FileUtils.rm_rf(File.join(project_dir, "Pods"))
|
134
|
+
end
|
135
|
+
puts "正在执行pod deintegrate..."
|
136
|
+
system 'pod deintegrate'
|
137
|
+
puts "正在执行pod install..."
|
138
|
+
system 'pod install'
|
139
|
+
rescue => error
|
140
|
+
puts(error.to_s)
|
141
|
+
raise Informative, "pod install失败!!先pod install 完成后成编译 !"
|
142
|
+
end
|
143
|
+
|
144
|
+
Dir.chdir(project_dir)
|
145
|
+
pod_lock_file = File.join(project_dir, "Podfile.lock")
|
146
|
+
if !File.exist?(pod_lock_file)
|
147
|
+
raise Informative, "pod install失败!!先pod install 完成后成编译 !"
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
args_temp = []
|
154
|
+
if @args_adhoc_flag
|
155
|
+
args_temp << "--adhoc"
|
156
|
+
else
|
157
|
+
args_temp << "--dev"
|
158
|
+
end
|
159
|
+
|
160
|
+
project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
161
|
+
if !project_fullname.nil?
|
162
|
+
project_obj = Xcodeproj::Project.open(project_fullname)
|
163
|
+
project_build_platform = project_obj.root_object.build_configuration_list.get_setting("SDKROOT")["Release"]
|
164
|
+
if !project_build_platform.nil? && project_build_platform.eql?("macosx")
|
165
|
+
@args_macos_flag = true
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
if @args_macos_flag
|
170
|
+
args_temp << "--macos"
|
171
|
+
end
|
172
|
+
|
173
|
+
Pindo::Command::Deploy::Cert::run(args_temp)
|
174
|
+
|
175
|
+
Dir.chdir(project_dir)
|
176
|
+
Pindo::Command::Deploy::Build::run(args_temp)
|
177
|
+
|
178
|
+
|
179
|
+
pindo_new_project_dir = Dir.pwd
|
180
|
+
build_path = File.join(pindo_new_project_dir, "build", "*.{ipa,app}")
|
181
|
+
ipa_file_upload = Dir.glob(build_path).max_by {|f| File.mtime(f)}
|
182
|
+
|
183
|
+
if !ipa_file_upload.nil? && !app_info_obj.nil?
|
184
|
+
description = nil
|
185
|
+
if File.exist?(File.join(pindo_new_project_dir, ".release_info"))
|
186
|
+
description = File.read(File.join(pindo_new_project_dir, ".release_info"))
|
187
|
+
else
|
188
|
+
if File.exist?(File.join(pindo_new_project_dir, ".git"))
|
189
|
+
description = git!(%W(-C #{pindo_new_project_dir} show -s --format=%h::%s)).strip
|
190
|
+
end
|
191
|
+
end
|
192
|
+
result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
|
193
|
+
if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
|
194
|
+
msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
|
195
|
+
PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
|
196
|
+
if @args_send_flag
|
197
|
+
PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
system "open #{project_dir}"
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
@@ -3,6 +3,7 @@ require 'fileutils'
|
|
3
3
|
require 'json'
|
4
4
|
require 'xcodeproj'
|
5
5
|
require 'gym'
|
6
|
+
require 'pindo/module/build/buildhelper'
|
6
7
|
|
7
8
|
module Pindo
|
8
9
|
class Command
|
@@ -64,6 +65,19 @@ module Pindo
|
|
64
65
|
|
65
66
|
def run
|
66
67
|
|
68
|
+
pindo_unity_project_dir = Dir.pwd
|
69
|
+
build_helper = Pindo::BuildHelper.share_instance
|
70
|
+
unless build_helper.ios_project?(pindo_unity_project_dir)
|
71
|
+
raise Informative, "当前目录不是iOS工程,请在iOS工程根目录下执行此命令"
|
72
|
+
end
|
73
|
+
|
74
|
+
if @args_upload_flag
|
75
|
+
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_unity_project_dir)
|
76
|
+
if is_need_add_tag
|
77
|
+
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
67
81
|
|
68
82
|
app_info_obj = nil
|
69
83
|
if @args_upload_flag
|
@@ -1,195 +1,164 @@
|
|
1
|
-
require 'highline/import'
|
2
|
-
require 'xcodeproj'
|
3
|
-
require 'find'
|
4
1
|
require 'fileutils'
|
5
|
-
require 'pindo/base/executable'
|
6
2
|
|
7
3
|
module Pindo
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
class Command
|
5
|
+
class Ios < Command
|
6
|
+
class Debug < Ios
|
11
7
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
支持功能:
|
21
|
-
|
22
|
-
* 编译Debug包
|
23
|
-
|
24
|
-
* 上传到测试平台
|
25
|
-
|
26
|
-
* 发送测试通知
|
27
|
-
|
28
|
-
使用示例:
|
29
|
-
|
30
|
-
$ pindo ios debug # 编译Debug包
|
31
|
-
|
32
|
-
$ pindo ios debug --upload # 编译并上传
|
33
|
-
|
34
|
-
$ pindo ios debug --send # 编译上传并发送通知
|
35
|
-
|
36
|
-
$ pindo ios debug --proj=myapp # 指定项目名称
|
37
|
-
DESC
|
38
|
-
|
39
|
-
# 命令的参数列表
|
40
|
-
self.arguments = [
|
41
|
-
# 暂无参数
|
42
|
-
]
|
43
|
-
|
44
|
-
# 命令的选项列表
|
45
|
-
def self.options
|
46
|
-
[
|
47
|
-
['--bundleid', '指定打包的bundleID'],
|
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
|
-
@args_bundle_id = argv.option('bundleid')
|
65
|
-
|
66
|
-
if @args_send_flag
|
67
|
-
@args_upload_flag = true
|
68
|
-
end
|
8
|
+
include Appselect
|
9
|
+
|
10
|
+
include XcodeCertHelper
|
11
|
+
self.summary = '更新iOS证书并使用新证书设置Xcode工程'
|
12
|
+
self.description = <<-DESC
|
13
|
+
更新iOS证书并使用新证书设置Xcode工程。
|
14
|
+
|
15
|
+
支持功能:
|
69
16
|
|
70
|
-
|
71
|
-
@additional_args = argv.remainder!
|
72
|
-
end
|
73
|
-
|
74
|
-
def validate!
|
75
|
-
|
76
|
-
super
|
77
|
-
end
|
78
|
-
|
79
|
-
def run
|
80
|
-
|
81
|
-
mainapp_bundleid= nil
|
82
|
-
if @args_bundle_id
|
83
|
-
mainapp_bundleid = @args_bundle_id
|
84
|
-
else
|
85
|
-
if @args_deploy_flag
|
86
|
-
mainapp_bundleid = get_selected_deploy_bundleid()
|
87
|
-
else
|
88
|
-
mainapp_bundleid = get_selected_dev_bundleid()
|
89
|
-
end
|
90
|
-
end
|
17
|
+
* 更新iOS证书
|
91
18
|
|
92
|
-
|
93
|
-
if @args_upload_flag
|
94
|
-
proj_name = @args_proj_name
|
95
|
-
app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:proj_name)
|
96
|
-
end
|
19
|
+
* 设置Xcode工程证书
|
97
20
|
|
98
|
-
|
99
|
-
args_temp << mainapp_bundleid
|
100
|
-
Pindo::Command::Deploy::Pullconfig::run(args_temp)
|
21
|
+
* 支持开发和发布证书
|
101
22
|
|
102
|
-
|
103
|
-
Dir.chdir(project_dir)
|
104
|
-
config_json_file = File.join(project_dir,"config.json")
|
105
|
-
Cert::modify_cert_with_project(project_dir:project_dir, config_file:config_json_file)
|
23
|
+
使用示例:
|
106
24
|
|
107
|
-
|
108
|
-
|
109
|
-
args_temp = []
|
110
|
-
args_temp << config_json_file
|
111
|
-
Pindo::Command::Lib::Update::run([])
|
25
|
+
$ pindo ios debug # 更新开发证书
|
112
26
|
|
113
|
-
|
114
|
-
if File.exist?(File.join(project_dir, "Podfile.lock"))
|
115
|
-
FileUtils.rm_rf(File.join(project_dir, "Podfile.lock"))
|
116
|
-
end
|
117
|
-
if File.exist?(File.join(project_dir,"Pods"))
|
118
|
-
FileUtils.rm_rf(File.join(project_dir, "Pods"))
|
119
|
-
end
|
120
|
-
puts "正在执行pod deintegrate..."
|
121
|
-
system 'pod deintegrate'
|
122
|
-
puts "正在执行pod install..."
|
123
|
-
system 'pod install'
|
124
|
-
rescue => error
|
125
|
-
puts(error.to_s)
|
126
|
-
raise Informative, "pod install失败!!先pod install 完成后成编译 !"
|
127
|
-
end
|
27
|
+
$ pindo ios debug --deploy # 更新发布bundle id
|
128
28
|
|
129
|
-
|
130
|
-
pod_lock_file = File.join(project_dir, "Podfile.lock")
|
131
|
-
if !File.exist?(pod_lock_file)
|
132
|
-
raise Informative, "pod install失败!!先pod install 完成后成编译 !"
|
133
|
-
end
|
29
|
+
$ pindo ios debug --adhoc # 更新adhoc证书
|
134
30
|
|
135
|
-
|
136
|
-
|
31
|
+
$ pindo ios debug --macos # 更新macos平台证书
|
137
32
|
|
138
|
-
|
139
|
-
if @args_adhoc_flag
|
140
|
-
args_temp << "--adhoc"
|
141
|
-
else
|
142
|
-
args_temp << "--dev"
|
143
|
-
end
|
33
|
+
DESC
|
144
34
|
|
145
|
-
|
146
|
-
if !project_fullname.nil?
|
147
|
-
project_obj = Xcodeproj::Project.open(project_fullname)
|
148
|
-
project_build_platform = project_obj.root_object.build_configuration_list.get_setting("SDKROOT")["Release"]
|
149
|
-
if !project_build_platform.nil? && project_build_platform.eql?("macosx")
|
150
|
-
@args_macos_flag = true
|
151
|
-
end
|
152
|
-
end
|
35
|
+
self.arguments = [
|
153
36
|
|
154
|
-
|
155
|
-
|
156
|
-
|
37
|
+
]
|
38
|
+
|
39
|
+
# 命令选项
|
40
|
+
def self.options
|
41
|
+
[
|
42
|
+
['--deploy', '默认使用开发环境的bundle id,使用此选项切换为发布环境的bundle id'],
|
43
|
+
['--adhoc', '默认使用开发证书,使用此选项切换为adhoc证书'],
|
44
|
+
['--macos', '指定为macOS平台的证书'],
|
45
|
+
['--upload', '生成用于上传到蒲公英平台的证书'],
|
46
|
+
].concat(super)
|
47
|
+
end
|
48
|
+
|
49
|
+
def initialize(argv)
|
50
|
+
@args_adhoc_flag = argv.flag?('adhoc', false)
|
51
|
+
@args_deploy_flag = argv.flag?('deploy', false)
|
52
|
+
@args_macos_flag = argv.flag?('macos', false)
|
53
|
+
@upload_flag = argv.flag?('upload', false)
|
54
|
+
super
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def run
|
59
|
+
|
60
|
+
mainapp_bundleid= nil
|
61
|
+
if @args_deploy_flag
|
62
|
+
mainapp_bundleid = get_selected_deploy_bundleid()
|
63
|
+
else
|
64
|
+
mainapp_bundleid = get_selected_dev_bundleid()
|
65
|
+
end
|
66
|
+
|
67
|
+
args_temp = []
|
68
|
+
args_temp << mainapp_bundleid
|
69
|
+
Pindo::Command::Deploy::Pullconfig::run(args_temp)
|
70
|
+
|
71
|
+
|
72
|
+
project_dir = Dir.pwd
|
73
|
+
Dir.chdir(project_dir)
|
74
|
+
config_json_file = File.join(project_dir,"config.json")
|
75
|
+
Pindo::Command::Ios::Debug::modify_cert_with_project(project_dir:project_dir, config_file:config_json_file)
|
157
76
|
|
158
|
-
|
77
|
+
args_temp = []
|
78
|
+
if @args_adhoc_flag
|
79
|
+
args_temp << "--adhoc"
|
80
|
+
else
|
81
|
+
args_temp << "--dev"
|
82
|
+
end
|
159
83
|
|
160
|
-
Dir.chdir(project_dir)
|
161
|
-
Pindo::Command::Deploy::Build::run(args_temp)
|
162
84
|
|
163
85
|
|
164
|
-
|
165
|
-
|
166
|
-
|
86
|
+
project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
87
|
+
if !project_fullname.nil?
|
88
|
+
project_obj = Xcodeproj::Project.open(project_fullname)
|
89
|
+
project_build_platform = project_obj.root_object.build_configuration_list.get_setting("SDKROOT")["Release"]
|
90
|
+
if !project_build_platform.nil? && project_build_platform.eql?("macosx")
|
91
|
+
@args_macos_flag = true
|
92
|
+
end
|
93
|
+
end
|
167
94
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
95
|
+
if @args_macos_flag
|
96
|
+
args_temp << "--macos"
|
97
|
+
end
|
98
|
+
|
99
|
+
if @upload_flag
|
100
|
+
args_temp << "--upload"
|
101
|
+
end
|
102
|
+
|
103
|
+
Pindo::Command::Deploy::Cert::run(args_temp)
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.modify_cert_with_project(project_dir:nil, config_file:nil)
|
108
|
+
|
109
|
+
project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
110
|
+
if !project_fullname.nil?
|
111
|
+
|
112
|
+
entitlements_plist_path = nil
|
113
|
+
project_obj = Xcodeproj::Project.open(project_fullname)
|
114
|
+
project_obj.targets.each do |target|
|
115
|
+
if target.product_type.to_s.eql?("com.apple.product-type.application") then
|
116
|
+
temp_entitlements_file = target.build_configurations.first.build_settings['CODE_SIGN_ENTITLEMENTS']
|
117
|
+
if !temp_entitlements_file.nil? && !temp_entitlements_file.empty?
|
118
|
+
entitlements_plist_path = File.join(project_dir, temp_entitlements_file)
|
175
119
|
end
|
176
120
|
end
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
121
|
+
end
|
122
|
+
|
123
|
+
# puts entitlements_plist_path
|
124
|
+
if !entitlements_plist_path.nil? && File.exist?(entitlements_plist_path)
|
125
|
+
config_json = nil
|
126
|
+
if File.exist?(config_file)
|
127
|
+
config_json = JSON.parse(File.read(config_file))
|
128
|
+
end
|
129
|
+
|
130
|
+
entitlements_plist_dict = Xcodeproj::Plist.read_from_path(entitlements_plist_path)
|
131
|
+
|
132
|
+
if entitlements_plist_dict["com.apple.developer.icloud-container-identifiers"].nil?
|
133
|
+
if !config_json.nil? && !config_json["app_info"]['app_icloud_id'].nil?
|
134
|
+
config_json["app_info"].delete('app_icloud_id')
|
183
135
|
end
|
184
136
|
end
|
137
|
+
|
138
|
+
if entitlements_plist_dict["com.apple.security.application-groups"].nil?
|
139
|
+
if !config_json.nil? && !config_json["app_info"]['app_group_id'].nil?
|
140
|
+
config_json["app_info"].delete('app_group_id')
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# puts JSON.pretty_generate(config_json)
|
145
|
+
if !config_json.nil?
|
146
|
+
File.open(config_file, "w") do |f|
|
147
|
+
f.write(JSON.pretty_generate(config_json))
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
185
152
|
end
|
186
|
-
|
187
|
-
system "open #{project_dir}"
|
188
153
|
|
189
|
-
|
154
|
+
end
|
155
|
+
|
190
156
|
|
191
157
|
end
|
192
|
-
|
158
|
+
|
159
|
+
|
160
|
+
end
|
193
161
|
end
|
162
|
+
end
|
194
163
|
end
|
195
164
|
|