pindo 5.2.4 → 5.4.0
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/aeshelper.rb +23 -2
- data/lib/pindo/base/pindocontext.rb +476 -0
- data/lib/pindo/client/pgyer_feishu_oauth_cli.rb +343 -80
- data/lib/pindo/client/pgyerclient.rb +30 -20
- data/lib/pindo/command/android/autobuild.rb +58 -22
- data/lib/pindo/command/android/build.rb +27 -16
- data/lib/pindo/command/android/debug.rb +25 -15
- data/lib/pindo/command/dev/debug.rb +2 -51
- data/lib/pindo/command/dev/feishu.rb +19 -2
- data/lib/pindo/command/ios/adhoc.rb +2 -1
- data/lib/pindo/command/ios/autobuild.rb +39 -9
- data/lib/pindo/command/ios/build.rb +7 -0
- data/lib/pindo/command/ios/debug.rb +2 -132
- data/lib/pindo/command/lib/lint.rb +24 -1
- data/lib/pindo/command/setup.rb +24 -4
- data/lib/pindo/command/unity/apk.rb +20 -0
- data/lib/pindo/command/unity/ipa.rb +27 -3
- data/lib/pindo/command/unity/web.rb +15 -10
- data/lib/pindo/command/web/autobuild.rb +5 -0
- data/lib/pindo/command.rb +58 -1
- data/lib/pindo/module/android/android_build_config_helper.rb +427 -0
- data/lib/pindo/module/android/apk_helper.rb +23 -25
- data/lib/pindo/module/android/base_helper.rb +572 -0
- data/lib/pindo/module/android/build_helper.rb +8 -318
- data/lib/pindo/module/android/gp_compliance_helper.rb +668 -0
- data/lib/pindo/module/android/gradle_helper.rb +746 -3
- data/lib/pindo/module/appselect.rb +18 -5
- data/lib/pindo/module/build/buildhelper.rb +120 -29
- data/lib/pindo/module/build/unityhelper.rb +674 -18
- data/lib/pindo/module/build/versionhelper.rb +146 -0
- data/lib/pindo/module/cert/certhelper.rb +33 -2
- data/lib/pindo/module/cert/xcodecerthelper.rb +3 -1
- data/lib/pindo/module/pgyer/pgyerhelper.rb +114 -31
- data/lib/pindo/module/xcode/xcodebuildconfig.rb +232 -0
- data/lib/pindo/module/xcode/xcodebuildhelper.rb +0 -1
- data/lib/pindo/version.rb +356 -86
- data/lib/pindo.rb +72 -3
- metadata +7 -3
@@ -2,15 +2,24 @@ require 'highline/import'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'pindo/base/executable'
|
4
4
|
require 'pindo/module/build/buildhelper'
|
5
|
+
require 'pindo/module/build/versionhelper'
|
5
6
|
require 'pindo/module/android/build_helper'
|
7
|
+
require 'pindo/module/android/android_build_config_helper'
|
6
8
|
|
7
9
|
module Pindo
|
8
10
|
class Command
|
9
11
|
class Android < Command
|
10
12
|
class Autobuild < Android
|
11
13
|
include Appselect
|
14
|
+
include Pindo::Githelper
|
12
15
|
|
13
16
|
self.summary = '打包Android工程并发布到蒲公英'
|
17
|
+
|
18
|
+
# 启用缓存机制
|
19
|
+
def self.use_cache?
|
20
|
+
true # 此命令启用缓存
|
21
|
+
end
|
22
|
+
|
14
23
|
self.description = <<-DESC
|
15
24
|
编译Android包并支持上传到测试平台。
|
16
25
|
|
@@ -100,42 +109,69 @@ module Pindo
|
|
100
109
|
end
|
101
110
|
if scheme_name.nil? || scheme_name.empty? && is_git_directory?(local_repo_dir:pindo_project_dir)
|
102
111
|
current_git_root_path = git_root_directory(local_repo_dir: pindo_project_dir)
|
103
|
-
|
104
|
-
|
105
|
-
|
112
|
+
if current_git_root_path && !current_git_root_path.empty?
|
113
|
+
git_repo_name = File.basename(current_git_root_path)
|
114
|
+
if !git_repo_name.nil? && !git_repo_name.empty?
|
115
|
+
scheme_name = git_repo_name
|
116
|
+
end
|
106
117
|
end
|
107
118
|
end
|
108
119
|
|
109
120
|
android_build_helper = Pindo::AndroidBuildHelper.share_instance
|
110
|
-
|
121
|
+
|
122
|
+
# 更新版本号和Build号(仅在Git仓库中)
|
123
|
+
version_helper = Pindo::VersionHelper.share_instance
|
124
|
+
version_info = version_helper.get_version_info(project_dir: pindo_project_dir)
|
125
|
+
|
126
|
+
if version_info[:is_git_repo]
|
127
|
+
# 更新Android工程版本
|
128
|
+
Pindo::AndroidBuildConfigHelper.update_android_project_version(
|
129
|
+
project_dir: pindo_project_dir,
|
130
|
+
version_name: version_info[:version],
|
131
|
+
version_code: version_info[:build_number]
|
132
|
+
)
|
133
|
+
else
|
134
|
+
puts "非Git仓库,保持工程原有版本号"
|
135
|
+
end
|
136
|
+
|
111
137
|
# 添加以项目名称为 scheme 的配置
|
112
|
-
|
113
|
-
|
138
|
+
Pindo::AndroidBuildConfigHelper.add_test_scheme(project_dir: pindo_project_dir, scheme_name: scheme_name)
|
139
|
+
|
114
140
|
# 获取 bundle ID 并添加以 bundle ID 为 scheme 的配置
|
115
141
|
bundle_id = android_build_helper.get_application_id(pindo_project_dir)
|
116
142
|
if !bundle_id.nil? && !bundle_id.empty?
|
117
143
|
puts "获取到 Bundle ID: #{bundle_id}"
|
118
|
-
|
144
|
+
Pindo::AndroidBuildConfigHelper.add_test_scheme(project_dir: pindo_project_dir, scheme_name: bundle_id)
|
119
145
|
else
|
120
146
|
puts "警告: 未能获取到 Bundle ID,跳过添加 Bundle ID scheme"
|
121
147
|
end
|
122
148
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
149
|
+
begin
|
150
|
+
apk_path = android_build_helper.auto_build_apk(pindo_project_dir, !@args_release_flag)
|
151
|
+
ipa_file_upload = Dir.glob(apk_path).max_by {|f| File.mtime(f)}
|
152
|
+
|
153
|
+
if !ipa_file_upload.nil? && !app_info_obj.nil?
|
154
|
+
description = nil
|
155
|
+
result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
|
156
|
+
if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
|
157
|
+
msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
|
158
|
+
PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
|
159
|
+
if @args_send_flag
|
160
|
+
PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
137
164
|
|
138
|
-
|
165
|
+
# 只在构建成功完成时弹出目标文件夹
|
166
|
+
puts "\e[32m构建完成!正在打开目标文件夹...\e[0m"
|
167
|
+
system "open #{pindo_project_dir}"
|
168
|
+
|
169
|
+
rescue => e
|
170
|
+
puts "\e[31m构建失败: #{e.message}\e[0m"
|
171
|
+
puts "\e[33m正在打开项目文件夹以便检查错误...\e[0m"
|
172
|
+
system "open #{pindo_project_dir}"
|
173
|
+
raise e
|
174
|
+
end
|
139
175
|
|
140
176
|
|
141
177
|
end
|
@@ -87,24 +87,35 @@ module Pindo
|
|
87
87
|
|
88
88
|
|
89
89
|
android_build_helper = Pindo::AndroidBuildHelper.share_instance
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
90
|
+
|
91
|
+
begin
|
92
|
+
apk_path = android_build_helper.auto_build_apk(pindo_project_dir, !@args_release_flag)
|
93
|
+
ipa_file_upload = Dir.glob(apk_path).max_by {|f| File.mtime(f)}
|
94
|
+
|
95
|
+
if !ipa_file_upload.nil? && !app_info_obj.nil?
|
96
|
+
|
97
|
+
description = nil
|
98
|
+
result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
|
99
|
+
if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
|
100
|
+
msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
|
101
|
+
|
102
|
+
PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
|
103
|
+
if @args_send_flag
|
104
|
+
PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
99
108
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
109
|
+
# 只在构建成功完成时弹出目标文件夹
|
110
|
+
puts "\e[32m构建完成!正在打开目标文件夹...\e[0m"
|
111
|
+
system "open #{pindo_project_dir}"
|
112
|
+
|
113
|
+
rescue => e
|
114
|
+
puts "\e[31m构建失败: #{e.message}\e[0m"
|
115
|
+
puts "\e[33m正在打开项目文件夹以便检查错误...\e[0m"
|
116
|
+
system "open #{pindo_project_dir}"
|
117
|
+
raise e
|
105
118
|
end
|
106
|
-
|
107
|
-
system "open #{pindo_project_dir}"
|
108
119
|
end
|
109
120
|
end
|
110
121
|
end
|
@@ -85,23 +85,33 @@ module Pindo
|
|
85
85
|
app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:proj_name)
|
86
86
|
end
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
88
|
+
begin
|
89
|
+
apk_path = Pindo::AndroidBuildHelper.share_instance.auto_build_apk(pindo_project_dir, !@args_release_flag, @args_direct_flag)
|
90
|
+
ipa_file_upload = Dir.glob(apk_path).max_by {|f| File.mtime(f)}
|
91
|
+
|
92
|
+
if !ipa_file_upload.nil? && !app_info_obj.nil?
|
93
|
+
description = nil
|
94
|
+
result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
|
95
|
+
if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
|
96
|
+
msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
|
97
|
+
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)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# 只在构建成功完成时弹出目标文件夹
|
105
|
+
puts "\e[32m构建完成!正在打开目标文件夹...\e[0m"
|
106
|
+
system "open #{pindo_project_dir}"
|
107
|
+
|
108
|
+
rescue => e
|
109
|
+
puts "\e[31m构建失败: #{e.message}\e[0m"
|
110
|
+
puts "\e[33m正在打开项目文件夹以便检查错误...\e[0m"
|
111
|
+
system "open #{pindo_project_dir}"
|
112
|
+
raise e
|
101
113
|
end
|
102
114
|
|
103
|
-
system "open #{pindo_project_dir}"
|
104
|
-
|
105
115
|
end
|
106
116
|
|
107
117
|
end
|
@@ -76,7 +76,8 @@ module Pindo
|
|
76
76
|
project_dir = Dir.pwd
|
77
77
|
Dir.chdir(project_dir)
|
78
78
|
config_json_file = File.join(project_dir,"config.json")
|
79
|
-
|
79
|
+
# 处理entitlements配置
|
80
|
+
Pindo::XcodeBuildConfig.update_entitlements_config(project_dir: project_dir, config_file: config_json_file)
|
80
81
|
|
81
82
|
args_temp = []
|
82
83
|
if @args_adhoc_flag
|
@@ -104,56 +105,6 @@ module Pindo
|
|
104
105
|
|
105
106
|
end
|
106
107
|
|
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)
|
119
|
-
end
|
120
|
-
end
|
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')
|
135
|
-
end
|
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
|
-
|
152
|
-
end
|
153
|
-
|
154
|
-
end
|
155
|
-
|
156
|
-
end
|
157
108
|
|
158
109
|
end
|
159
110
|
end
|
@@ -8,15 +8,32 @@ module Pindo
|
|
8
8
|
class Command
|
9
9
|
class Dev < Command
|
10
10
|
class Feishu < Dev
|
11
|
+
# 命令的简要说明 - 发送飞书消息
|
11
12
|
self.summary = '发送飞书消息'
|
12
13
|
|
13
14
|
# 命令的详细说明,包含用法示例
|
14
15
|
self.description = <<-DESC
|
15
16
|
发送飞书消息到指定的飞书群。
|
16
17
|
|
18
|
+
支持功能:
|
19
|
+
|
20
|
+
* 发送文本消息到飞书群
|
21
|
+
|
22
|
+
* 支持自定义Webhook URL
|
23
|
+
|
24
|
+
* 支持消息签名验证
|
25
|
+
|
26
|
+
* 支持富文本格式
|
27
|
+
|
17
28
|
使用示例:
|
18
|
-
|
19
|
-
$ pindo dev feishu
|
29
|
+
|
30
|
+
$ pindo dev feishu "要发送的消息" # 发送简单文本消息
|
31
|
+
|
32
|
+
$ pindo dev feishu --webhook=URL "消息内容" # 指定webhook发送
|
33
|
+
|
34
|
+
$ pindo dev feishu "构建完成通知" # 发送构建通知
|
35
|
+
|
36
|
+
$ pindo dev feishu "@所有人 版本已发布" # 发送@所有人消息
|
20
37
|
DESC
|
21
38
|
|
22
39
|
# 命令的参数列表
|
@@ -97,7 +97,8 @@ module Pindo
|
|
97
97
|
project_dir = Dir.pwd
|
98
98
|
Dir.chdir(project_dir)
|
99
99
|
config_json_file = File.join(project_dir,"config.json")
|
100
|
-
|
100
|
+
# 处理entitlements配置
|
101
|
+
Pindo::XcodeBuildConfig.update_entitlements_config(project_dir: project_dir, config_file: config_json_file)
|
101
102
|
|
102
103
|
if File.exist?(File.join(project_dir, "Podfile"))
|
103
104
|
|
@@ -1,19 +1,29 @@
|
|
1
1
|
require 'highline/import'
|
2
2
|
require 'xcodeproj'
|
3
|
-
require 'find'
|
3
|
+
require 'find'
|
4
4
|
require 'fileutils'
|
5
5
|
require 'pindo/base/executable'
|
6
6
|
require 'pindo/module/build/buildhelper'
|
7
|
+
require 'pindo/module/build/versionhelper'
|
8
|
+
require 'pindo/module/xcode/xcodebuildconfig'
|
9
|
+
require 'pindo/base/pindocontext'
|
7
10
|
|
8
11
|
module Pindo
|
9
12
|
class Command
|
10
13
|
class Ios < Command
|
11
14
|
class Autobuild < Ios
|
12
|
-
|
15
|
+
|
13
16
|
include Appselect
|
14
17
|
include Pindo::Githelper
|
15
18
|
# 命令的简要说明 - 打包iOS工程并发布到蒲公英
|
16
19
|
self.summary = '打包iOS工程并发布到蒲公英'
|
20
|
+
|
21
|
+
# 启用缓存机制
|
22
|
+
def self.use_cache?
|
23
|
+
true # 此命令启用缓存
|
24
|
+
end
|
25
|
+
# 缓存组已在 PindoContext#get_command_group 中定义
|
26
|
+
# ios:autobuild 与 unity:ipa 共享 'ios:autobuild' 缓存组
|
17
27
|
|
18
28
|
# 命令的详细说明,包含用法示例
|
19
29
|
self.description = <<-DESC
|
@@ -151,14 +161,20 @@ module Pindo
|
|
151
161
|
end
|
152
162
|
if scheme_name.nil? || scheme_name.empty? && is_git_directory?(local_repo_dir:pindo_project_dir)
|
153
163
|
current_git_root_path = git_root_directory(local_repo_dir: pindo_project_dir)
|
154
|
-
|
155
|
-
|
156
|
-
|
164
|
+
if current_git_root_path && !current_git_root_path.empty?
|
165
|
+
git_repo_name = File.basename(current_git_root_path)
|
166
|
+
if !git_repo_name.nil? && !git_repo_name.empty?
|
167
|
+
scheme_name = git_repo_name
|
168
|
+
end
|
157
169
|
end
|
158
170
|
end
|
159
171
|
|
160
|
-
|
161
|
-
|
172
|
+
# 处理entitlements配置
|
173
|
+
Pindo::XcodeBuildConfig.update_entitlements_config(project_dir: pindo_project_dir, config_file: config_json_file)
|
174
|
+
|
175
|
+
# 添加URL Schemes
|
176
|
+
Pindo::XcodeBuildConfig.add_url_schemes(project_dir: pindo_project_dir, scheme_name: scheme_name)
|
177
|
+
|
162
178
|
if File.exist?(File.join(pindo_project_dir, "Podfile"))
|
163
179
|
|
164
180
|
args_temp = []
|
@@ -211,8 +227,22 @@ module Pindo
|
|
211
227
|
end
|
212
228
|
|
213
229
|
Pindo::Command::Deploy::Cert::run(args_temp)
|
214
|
-
|
215
|
-
|
230
|
+
|
231
|
+
# 更新版本号和Build号(仅在Git仓库中)
|
232
|
+
version_helper = Pindo::VersionHelper.share_instance
|
233
|
+
version_info = version_helper.get_version_info(project_dir: pindo_project_dir)
|
234
|
+
|
235
|
+
if version_info[:is_git_repo]
|
236
|
+
# 更新iOS工程版本
|
237
|
+
Pindo::XcodeBuildConfig.update_ios_project_version(
|
238
|
+
project_dir: pindo_project_dir,
|
239
|
+
version: version_info[:version],
|
240
|
+
build_number: version_info[:build_number]
|
241
|
+
)
|
242
|
+
else
|
243
|
+
puts "非Git仓库,保持工程原有版本号"
|
244
|
+
end
|
245
|
+
|
216
246
|
Dir.chdir(pindo_project_dir)
|
217
247
|
Pindo::Command::Deploy::Build::run(args_temp)
|
218
248
|
|
@@ -13,6 +13,13 @@ module Pindo
|
|
13
13
|
# 命令的简要说明 - 编译iOS工程并可选择上传到测试平台
|
14
14
|
self.summary = '编译iOS工程,并支持上传ipa'
|
15
15
|
|
16
|
+
# 启用缓存机制
|
17
|
+
def self.use_cache?
|
18
|
+
true # 此命令启用缓存
|
19
|
+
end
|
20
|
+
# 缓存组已在 PindoContext#get_command_group 中定义
|
21
|
+
# ios:build 与 ios:autobuild 共享 'ios:autobuild' 缓存组
|
22
|
+
|
16
23
|
# 命令的详细说明,包含用法示例
|
17
24
|
self.description = <<-DESC
|
18
25
|
编译iOS工程并生成ipa文件。
|
@@ -72,7 +72,8 @@ module Pindo
|
|
72
72
|
project_dir = Dir.pwd
|
73
73
|
Dir.chdir(project_dir)
|
74
74
|
config_json_file = File.join(project_dir,"config.json")
|
75
|
-
|
75
|
+
# 处理entitlements配置
|
76
|
+
Pindo::XcodeBuildConfig.update_entitlements_config(project_dir: project_dir, config_file: config_json_file)
|
76
77
|
|
77
78
|
args_temp = []
|
78
79
|
if @args_adhoc_flag
|
@@ -104,137 +105,6 @@ module Pindo
|
|
104
105
|
|
105
106
|
end
|
106
107
|
|
107
|
-
def self.modify_cert_with_project(project_dir:nil, config_file:nil, scheme_name:nil, bundleid: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
|
-
info_plist_path = nil
|
114
|
-
project_obj = Xcodeproj::Project.open(project_fullname)
|
115
|
-
project_obj.targets.each do |target|
|
116
|
-
if target.product_type.to_s.eql?("com.apple.product-type.application") then
|
117
|
-
temp_entitlements_file = target.build_configurations.first.build_settings['CODE_SIGN_ENTITLEMENTS']
|
118
|
-
if !temp_entitlements_file.nil? && !temp_entitlements_file.empty?
|
119
|
-
entitlements_plist_path = File.join(project_dir, temp_entitlements_file)
|
120
|
-
end
|
121
|
-
temp_info_file = target.build_configurations.first.build_settings['INFOPLIST_FILE']
|
122
|
-
if !temp_info_file.nil? && !temp_info_file.empty?
|
123
|
-
info_plist_path = File.join(project_dir, temp_info_file)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
if !info_plist_path.nil? && File.exist?(info_plist_path) && !scheme_name.nil? && !scheme_name.empty?
|
129
|
-
# scheme_name = scheme_name.to_s.downcase.strip.gsub(/[\s\-_]/, '')
|
130
|
-
scheme_name = scheme_name.to_s.gsub(/[^a-zA-Z0-9]/, '').downcase
|
131
|
-
info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
|
132
|
-
info_plist_dict["CFBundleURLTypes"] = info_plist_dict["CFBundleURLTypes"] || []
|
133
|
-
# info_plist_dict["CFBundleURLTypes"] 中不存在CFBundleURLName为scheme_name的item
|
134
|
-
if !info_plist_dict["CFBundleURLTypes"].any? { |item| item["CFBundleURLName"] == scheme_name }
|
135
|
-
item0 = {}
|
136
|
-
item0["CFBundleTypeRole"] = "Editor"
|
137
|
-
item0["CFBundleURLName"] = scheme_name
|
138
|
-
item0["CFBundleURLSchemes"] = []
|
139
|
-
item0["CFBundleURLSchemes"] << scheme_name
|
140
|
-
info_plist_dict["CFBundleURLTypes"] << item0
|
141
|
-
end
|
142
|
-
Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
|
143
|
-
end
|
144
|
-
# puts entitlements_plist_path
|
145
|
-
if !entitlements_plist_path.nil? && File.exist?(entitlements_plist_path)
|
146
|
-
config_json = nil
|
147
|
-
if File.exist?(config_file)
|
148
|
-
config_json = JSON.parse(File.read(config_file))
|
149
|
-
end
|
150
|
-
|
151
|
-
entitlements_plist_dict = Xcodeproj::Plist.read_from_path(entitlements_plist_path)
|
152
|
-
|
153
|
-
if entitlements_plist_dict["com.apple.developer.icloud-container-identifiers"].nil?
|
154
|
-
if !config_json.nil? && !config_json["app_info"]['app_icloud_id'].nil?
|
155
|
-
config_json["app_info"].delete('app_icloud_id')
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
if entitlements_plist_dict["com.apple.security.application-groups"].nil?
|
160
|
-
if !config_json.nil? && !config_json["app_info"]['app_group_id'].nil?
|
161
|
-
config_json["app_info"].delete('app_group_id')
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
# puts JSON.pretty_generate(config_json)
|
166
|
-
if !config_json.nil?
|
167
|
-
File.open(config_file, "w") do |f|
|
168
|
-
f.write(JSON.pretty_generate(config_json))
|
169
|
-
end
|
170
|
-
|
171
|
-
end
|
172
|
-
|
173
|
-
end
|
174
|
-
|
175
|
-
end
|
176
|
-
|
177
|
-
|
178
|
-
end
|
179
|
-
|
180
|
-
def self.modify_plist_scheme(project_dir:nil, scheme_name:nil)
|
181
|
-
|
182
|
-
puts "modify_plist_scheme: #{project_dir} #{scheme_name}"
|
183
|
-
project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
184
|
-
if !project_fullname.nil?
|
185
|
-
info_plist_path = nil
|
186
|
-
bundleid_scheme_name = nil
|
187
|
-
project_obj = Xcodeproj::Project.open(project_fullname)
|
188
|
-
project_obj.targets.each do |target|
|
189
|
-
if target.product_type.to_s.eql?("com.apple.product-type.application") then
|
190
|
-
temp_info_file = target.build_configurations.first.build_settings['INFOPLIST_FILE']
|
191
|
-
if !temp_info_file.nil? && !temp_info_file.empty?
|
192
|
-
info_plist_path = File.join(project_dir, temp_info_file)
|
193
|
-
end
|
194
|
-
bundleid_scheme_name = target.build_configurations.first.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
if !info_plist_path.nil? && File.exist?(info_plist_path) && !scheme_name.nil? && !scheme_name.empty?
|
199
|
-
|
200
|
-
scheme_name = scheme_name.to_s.gsub(/[^a-zA-Z0-9]/, '').downcase
|
201
|
-
|
202
|
-
info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
|
203
|
-
info_plist_dict["CFBundleURLTypes"] = info_plist_dict["CFBundleURLTypes"] || []
|
204
|
-
# info_plist_dict["CFBundleURLTypes"] 中不存在CFBundleURLName为scheme_name的item
|
205
|
-
if !info_plist_dict["CFBundleURLTypes"].any? { |item| item["CFBundleURLName"] == scheme_name }
|
206
|
-
item0 = {}
|
207
|
-
item0["CFBundleTypeRole"] = "Editor"
|
208
|
-
item0["CFBundleURLName"] = scheme_name
|
209
|
-
item0["CFBundleURLSchemes"] = []
|
210
|
-
item0["CFBundleURLSchemes"] << scheme_name
|
211
|
-
info_plist_dict["CFBundleURLTypes"] << item0
|
212
|
-
end
|
213
|
-
Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
|
214
|
-
end
|
215
|
-
|
216
|
-
if !info_plist_path.nil? && File.exist?(info_plist_path) && !bundleid_scheme_name.nil? && !bundleid_scheme_name.empty?
|
217
|
-
info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
|
218
|
-
info_plist_dict["CFBundleURLTypes"] = info_plist_dict["CFBundleURLTypes"] || []
|
219
|
-
# info_plist_dict["CFBundleURLTypes"] 中不存在CFBundleURLName为bundleid的item
|
220
|
-
#bundle id去除. 特殊字符串,保留全小写
|
221
|
-
bundleid_scheme_valeu = bundleid_scheme_name.gsub(/[^a-zA-Z0-9]/, '').downcase
|
222
|
-
|
223
|
-
if !bundleid_scheme_name.nil? && !bundleid_scheme_name.empty? && !info_plist_dict["CFBundleURLTypes"].any? { |item| item["CFBundleURLName"] == bundleid_scheme_valeu }
|
224
|
-
item0 = {}
|
225
|
-
item0["CFBundleTypeRole"] = "Editor"
|
226
|
-
item0["CFBundleURLName"] = bundleid_scheme_valeu
|
227
|
-
item0["CFBundleURLSchemes"] = []
|
228
|
-
item0["CFBundleURLSchemes"] << bundleid_scheme_valeu
|
229
|
-
info_plist_dict["CFBundleURLTypes"] << item0
|
230
|
-
end
|
231
|
-
Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
|
232
|
-
end
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
|
237
|
-
end
|
238
108
|
end
|
239
109
|
end
|
240
110
|
end
|
@@ -7,12 +7,35 @@ module Pindo
|
|
7
7
|
class Lib < Command
|
8
8
|
class Lint < Lib
|
9
9
|
|
10
|
+
# 命令的简要说明 - 本地编译验证pod库
|
10
11
|
self.summary = '本地编译私有pod库, 相当于pod lint功能'
|
11
12
|
|
13
|
+
# 命令的详细说明,包含用法示例
|
12
14
|
self.description = <<-DESC
|
13
|
-
pod
|
15
|
+
本地编译验证私有pod库。
|
16
|
+
|
17
|
+
支持功能:
|
18
|
+
|
19
|
+
* 本地编译验证pod库
|
20
|
+
|
21
|
+
* 检查podspec文件
|
22
|
+
|
23
|
+
* 验证依赖关系
|
24
|
+
|
25
|
+
* 检查代码规范
|
26
|
+
|
27
|
+
使用示例:
|
28
|
+
|
29
|
+
$ pindo lib lint # 在当前目录lint pod库
|
30
|
+
|
31
|
+
$ pindo lib lint MyPod.podspec # 指定podspec文件
|
32
|
+
|
33
|
+
$ pindo lib lint --p=~/MyPod # 指定pod库目录
|
34
|
+
|
35
|
+
$ pindo lib lint --verbose # 显示详细输出
|
14
36
|
DESC
|
15
37
|
|
38
|
+
# 命令的参数列表
|
16
39
|
self.arguments = [
|
17
40
|
CLAide::Argument.new('podspec', true)
|
18
41
|
]
|
data/lib/pindo/command/setup.rb
CHANGED
@@ -5,16 +5,36 @@ module Pindo
|
|
5
5
|
class Command
|
6
6
|
class Setup < Command
|
7
7
|
|
8
|
+
# 命令的简要说明 - 初始化pindo配置
|
8
9
|
self.summary = '初始化pindo配置'
|
9
10
|
|
11
|
+
# 命令的详细说明,包含用法示例
|
10
12
|
self.description = <<-DESC
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
初始化pindo的基础配置环境。
|
14
|
+
|
15
|
+
支持功能:
|
16
|
+
|
17
|
+
* 创建pindo配置目录
|
18
|
+
|
19
|
+
* 拉取公共配置文件
|
20
|
+
|
21
|
+
* 初始化环境配置
|
22
|
+
|
23
|
+
* 设置默认参数
|
24
|
+
|
25
|
+
使用示例:
|
26
|
+
|
27
|
+
$ pindo setup # 初始化默认配置(dreamstudio环境)
|
28
|
+
|
29
|
+
$ pindo setup --env=workhard # 初始化workhard环境配置
|
30
|
+
|
31
|
+
$ pindo setup --force # 强制重新初始化配置
|
32
|
+
|
33
|
+
$ pindo setup --clean # 清理并重新初始化
|
14
34
|
DESC
|
15
35
|
|
36
|
+
# 命令的参数列表
|
16
37
|
self.arguments = [
|
17
|
-
|
18
38
|
]
|
19
39
|
|
20
40
|
def self.options
|