pindo 5.14.8 → 5.15.1
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 +53 -22
- data/lib/pindo/base/git_handler.rb +243 -22
- data/lib/pindo/client/giteeclient.rb +15 -6
- data/lib/pindo/command/android/autobuild.rb +7 -5
- data/lib/pindo/command/appstore/autobuild.rb +5 -2
- data/lib/pindo/command/appstore/cert.rb +6 -0
- data/lib/pindo/command/ios/autobuild.rb +31 -21
- data/lib/pindo/command/ios/cert.rb +1 -1
- data/lib/pindo/command/jps/apptest.rb +1 -1
- data/lib/pindo/command/jps/bind.rb +6 -2
- data/lib/pindo/command/jps/media.rb +6 -2
- data/lib/pindo/command/jps/upload.rb +6 -4
- data/lib/pindo/command/repo/clone.rb +110 -32
- data/lib/pindo/command/repo/subgit.rb +91 -0
- data/lib/pindo/command/repo.rb +1 -0
- data/lib/pindo/command/unity/autobuild.rb +6 -4
- data/lib/pindo/command/unity/packbuild.rb +14 -7
- data/lib/pindo/command/utils/tag.rb +5 -3
- data/lib/pindo/command/web/autobuild.rb +7 -5
- data/lib/pindo/command.rb +1 -1
- data/lib/pindo/config/build_info_manager.rb +37 -14
- data/lib/pindo/module/appstore/bundleid_helper.rb +7 -3
- data/lib/pindo/module/build/git_repo_helper.rb +1 -14
- data/lib/pindo/module/cert/cert_helper.rb +33 -9
- data/lib/pindo/module/cert/xcode_cert_helper.rb +17 -7
- data/lib/pindo/module/pgyer/pgyerhelper.rb +110 -22
- data/lib/pindo/module/task/model/git/git_commit_task.rb +106 -6
- data/lib/pindo/module/task/model/git/git_tag_task.rb +17 -7
- data/lib/pindo/module/task/model/jps/jps_upload_media_task.rb +13 -8
- data/lib/pindo/module/task/model/resign/ipa_local_resign_task.rb +5 -0
- data/lib/pindo/options/core/option_item.rb +4 -5
- data/lib/pindo/options/groups/git_options.rb +40 -0
- data/lib/pindo/options/helpers/git_constants.rb +28 -0
- data/lib/pindo/version.rb +1 -1
- metadata +7 -5
|
@@ -57,6 +57,9 @@ module Pindo
|
|
|
57
57
|
# Task 参数
|
|
58
58
|
@args_select_flag = @options[:select] || false
|
|
59
59
|
|
|
60
|
+
# Git 参数
|
|
61
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
62
|
+
|
|
60
63
|
super(argv)
|
|
61
64
|
end
|
|
62
65
|
|
|
@@ -91,7 +94,7 @@ module Pindo
|
|
|
91
94
|
app_info_obj, git_workflow_info = pgyer_helper.prepare_upload(
|
|
92
95
|
working_directory: project_path,
|
|
93
96
|
proj_name: @args_proj_name,
|
|
94
|
-
package_type:
|
|
97
|
+
package_type: nil,
|
|
95
98
|
manage_type: "git"
|
|
96
99
|
)
|
|
97
100
|
|
|
@@ -127,7 +130,8 @@ module Pindo
|
|
|
127
130
|
# Git 提交任务
|
|
128
131
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
129
132
|
project_dir: project_path,
|
|
130
|
-
interactive:
|
|
133
|
+
interactive: @args_git_commit.nil?,
|
|
134
|
+
default_process_type: @args_git_commit
|
|
131
135
|
)
|
|
132
136
|
|
|
133
137
|
git_commit_task = Pindo::TaskSystem::GitCommitTask.new(
|
|
@@ -70,6 +70,9 @@ module Pindo
|
|
|
70
70
|
# Task 参数
|
|
71
71
|
@args_select_flag = @options[:select] || false
|
|
72
72
|
|
|
73
|
+
# Git 参数
|
|
74
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
75
|
+
|
|
73
76
|
super(argv)
|
|
74
77
|
end
|
|
75
78
|
|
|
@@ -102,7 +105,7 @@ module Pindo
|
|
|
102
105
|
app_info_obj, workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
103
106
|
working_directory: project_path,
|
|
104
107
|
proj_name: @args_proj_name,
|
|
105
|
-
package_type:
|
|
108
|
+
package_type: nil, # package_type 在 manage_type=git 时会被忽略
|
|
106
109
|
manage_type: "git"
|
|
107
110
|
)
|
|
108
111
|
|
|
@@ -119,7 +122,8 @@ module Pindo
|
|
|
119
122
|
# 1. 提前询问用户如何处理未提交的文件
|
|
120
123
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
121
124
|
project_dir: project_path,
|
|
122
|
-
interactive:
|
|
125
|
+
interactive: @args_git_commit.nil?,
|
|
126
|
+
default_process_type: @args_git_commit
|
|
123
127
|
)
|
|
124
128
|
|
|
125
129
|
# 2. 创建 Git 提交任务
|
|
@@ -59,7 +59,7 @@ module Pindo
|
|
|
59
59
|
# 定义此命令使用的参数项
|
|
60
60
|
def self.option_items
|
|
61
61
|
@option_items ||= Pindo::Options::OptionGroup.merge(
|
|
62
|
-
Pindo::Options::JPSOptions.
|
|
62
|
+
Pindo::Options::JPSOptions.select(:proj, :send, :desc, :resign),
|
|
63
63
|
Pindo::Options::GitOptions.all
|
|
64
64
|
)
|
|
65
65
|
end
|
|
@@ -103,9 +103,10 @@ module Pindo
|
|
|
103
103
|
|
|
104
104
|
# Git 参数
|
|
105
105
|
@args_release_branch = @options[:release_branch] || 'master'
|
|
106
|
-
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc]
|
|
107
|
-
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type]
|
|
106
|
+
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
|
|
107
|
+
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
|
|
108
108
|
@args_tag_pre = @options[:tag_pre] || 'v'
|
|
109
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
109
110
|
|
|
110
111
|
if !@args_cert_id.nil? && !@args_cert_id.empty?
|
|
111
112
|
@args_resign_flag = true
|
|
@@ -169,7 +170,8 @@ module Pindo
|
|
|
169
170
|
# 1.0 提前询问用户如何处理未提交的文件
|
|
170
171
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
171
172
|
project_dir: project_dir,
|
|
172
|
-
interactive:
|
|
173
|
+
interactive: @args_git_commit.nil?,
|
|
174
|
+
default_process_type: @args_git_commit
|
|
173
175
|
)
|
|
174
176
|
|
|
175
177
|
git_options_with_process = git_options.merge({
|
|
@@ -14,72 +14,150 @@ module Pindo
|
|
|
14
14
|
self.summary = '下载仓库到本地'
|
|
15
15
|
|
|
16
16
|
self.description = <<-DESC
|
|
17
|
-
|
|
17
|
+
下载仓库到本地,支持从配置文件自动获取仓库信息或手动指定仓库 URL 进行下载。
|
|
18
18
|
|
|
19
19
|
支持功能:
|
|
20
|
-
•
|
|
21
|
-
• 自动从当前目录config.json文件读取仓库信息
|
|
22
|
-
•
|
|
20
|
+
• 手动指定仓库 URL 进行下载
|
|
21
|
+
• 自动从当前目录 config.json 文件读取仓库信息
|
|
22
|
+
• 支持指定分支或标签下载
|
|
23
|
+
• 自动初始化子模块
|
|
23
24
|
• 下载到当前工作目录
|
|
24
25
|
|
|
25
26
|
使用示例:
|
|
26
|
-
pindo repo clone
|
|
27
|
-
pindo repo clone
|
|
27
|
+
pindo repo clone https://gitee.com/xxx/repo.git # 下载 master 分支
|
|
28
|
+
pindo repo clone https://gitee.com/xxx/repo.git --branch=dev # 指定分支
|
|
29
|
+
pindo repo clone https://gitee.com/xxx/repo.git --tag=1.0.0 # 指定标签
|
|
30
|
+
pindo repo clone # 从 config.json 自动获取
|
|
28
31
|
DESC
|
|
29
32
|
|
|
30
33
|
self.arguments = [
|
|
31
|
-
CLAide::Argument.new('
|
|
34
|
+
CLAide::Argument.new('仓库URL', false),
|
|
32
35
|
]
|
|
33
36
|
|
|
34
37
|
def self.options
|
|
35
38
|
[
|
|
36
|
-
|
|
39
|
+
['--branch=NAME', '指定分支名称(默认:master)'],
|
|
40
|
+
['--tag=NAME', '指定标签名称(与 --branch 互斥)'],
|
|
37
41
|
].concat(super)
|
|
38
42
|
end
|
|
39
43
|
|
|
40
44
|
|
|
41
45
|
def initialize(argv)
|
|
42
|
-
|
|
43
|
-
@
|
|
46
|
+
@args_repo_url = argv.shift_argument
|
|
47
|
+
@args_branch = argv.option('branch')
|
|
48
|
+
@args_tag = argv.option('tag')
|
|
44
49
|
super(argv)
|
|
45
50
|
@additional_args = argv.remainder!
|
|
46
|
-
|
|
47
51
|
end
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
51
53
|
def validate!
|
|
52
54
|
super
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if @
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
|
|
56
|
+
# 验证 --branch 和 --tag 互斥
|
|
57
|
+
if @args_branch && @args_tag
|
|
58
|
+
raise Informative, "--branch 和 --tag 参数不能同时使用!\n" \
|
|
59
|
+
"请选择其中一个参数。"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# 设置默认值
|
|
63
|
+
# 注意:即使使用 --tag,也需要一个默认分支用于 getcode_to_dir 的逻辑
|
|
64
|
+
@args_branch = 'master' if @args_branch.nil?
|
|
65
|
+
|
|
66
|
+
# 1. 优先使用命令行参数
|
|
67
|
+
if @args_repo_url
|
|
68
|
+
@code_git_url = @args_repo_url
|
|
69
|
+
@repo_name = extract_repo_name(@code_git_url)
|
|
70
|
+
# 2. 否则从 config.json 读取
|
|
71
|
+
else
|
|
72
|
+
temp_config_file = "./config.json"
|
|
73
|
+
if File.exist?(temp_config_file)
|
|
74
|
+
temp_config_file_fullname = File.expand_path(temp_config_file)
|
|
75
|
+
temp_config_json = JSON.parse(File.read(temp_config_file_fullname))
|
|
76
|
+
if temp_config_json['project_info'] &&
|
|
77
|
+
temp_config_json['project_info']['launch_project'] &&
|
|
78
|
+
temp_config_json['project_info']['launch_project']['project_git_url']
|
|
60
79
|
@code_git_url = temp_config_json['project_info']['launch_project']['project_git_url']
|
|
61
|
-
|
|
62
|
-
index = temp_url.rindex('/')
|
|
63
|
-
temp_url = temp_url.slice(index + 1, temp_url.length)
|
|
64
|
-
@repo_name = temp_url.gsub!(/\.git/, "")
|
|
80
|
+
@repo_name = extract_repo_name(@code_git_url)
|
|
65
81
|
end
|
|
66
82
|
end
|
|
67
83
|
end
|
|
84
|
+
|
|
85
|
+
# 验证是否获取到仓库 URL
|
|
86
|
+
if @code_git_url.nil? || @repo_name.nil?
|
|
87
|
+
raise Informative, "请提供仓库 URL 或在当前目录创建 config.json 文件!\n" \
|
|
88
|
+
"使用示例:pindo repo clone https://gitee.com/xxx/repo.git"
|
|
89
|
+
end
|
|
68
90
|
end
|
|
69
91
|
|
|
92
|
+
# 从 Git URL 提取仓库名称
|
|
93
|
+
def extract_repo_name(git_url)
|
|
94
|
+
return nil if git_url.nil? || git_url.empty?
|
|
70
95
|
|
|
71
|
-
|
|
96
|
+
# 提取最后一个 / 后面的部分
|
|
97
|
+
temp_url = git_url.dup
|
|
98
|
+
index = temp_url.rindex('/')
|
|
99
|
+
return nil unless index
|
|
72
100
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
puts "Repo Url: #{@code_git_url}"
|
|
78
|
-
puts "New Branch: #{new_branch}"
|
|
101
|
+
repo_name = temp_url.slice(index + 1, temp_url.length)
|
|
102
|
+
# 移除 .git 后缀
|
|
103
|
+
repo_name.gsub(/\.git$/, '')
|
|
104
|
+
end
|
|
79
105
|
|
|
80
|
-
Pindo::GitHandler.getcode_to_dir(reponame:@repo_name, remote_url:@code_git_url, path:Dir.pwd, new_branch:new_branch, new_tag:nil)
|
|
81
106
|
|
|
107
|
+
def run
|
|
108
|
+
puts "\n"
|
|
109
|
+
puts "=" * 60
|
|
110
|
+
puts "克隆仓库".center(60)
|
|
111
|
+
puts "=" * 60
|
|
112
|
+
puts "仓库名称: #{@repo_name}"
|
|
113
|
+
puts "仓库 URL: #{@code_git_url}"
|
|
114
|
+
if @args_tag
|
|
115
|
+
puts "目标标签: #{@args_tag}"
|
|
116
|
+
else
|
|
117
|
+
puts "目标分支: #{@args_branch}"
|
|
118
|
+
end
|
|
119
|
+
puts "目标目录: #{Dir.pwd}/#{@repo_name}"
|
|
120
|
+
puts "=" * 60
|
|
121
|
+
puts "\n"
|
|
122
|
+
|
|
123
|
+
# 1. 克隆仓库
|
|
124
|
+
Pindo::GitHandler.getcode_to_dir(
|
|
125
|
+
reponame: @repo_name,
|
|
126
|
+
remote_url: @code_git_url,
|
|
127
|
+
path: Dir.pwd,
|
|
128
|
+
new_branch: @args_branch,
|
|
129
|
+
new_tag: @args_tag
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
# 2. 检查是否有子模块
|
|
133
|
+
repo_path = File.join(Dir.pwd, @repo_name)
|
|
134
|
+
gitmodules_path = File.join(repo_path, '.gitmodules')
|
|
135
|
+
|
|
136
|
+
if File.exist?(gitmodules_path)
|
|
137
|
+
puts "\n"
|
|
138
|
+
Funlog.instance.fancyinfo_start("检测到子模块配置,正在初始化...")
|
|
139
|
+
|
|
140
|
+
begin
|
|
141
|
+
# 调用 update_submodules 方法初始化子模块
|
|
142
|
+
Pindo::GitHandler.update_submodules(
|
|
143
|
+
local_repo_dir: repo_path,
|
|
144
|
+
force: false
|
|
145
|
+
)
|
|
146
|
+
Funlog.instance.fancyinfo_success("子模块初始化完成!")
|
|
147
|
+
rescue => e
|
|
148
|
+
Funlog.instance.fancyinfo_warning("子模块初始化失败: #{e.message}")
|
|
149
|
+
puts "你可以手动执行以下命令初始化子模块:".yellow
|
|
150
|
+
puts " cd #{@repo_name}".yellow
|
|
151
|
+
puts " pindo repo subgit".yellow
|
|
152
|
+
end
|
|
153
|
+
else
|
|
154
|
+
puts "\n"
|
|
155
|
+
Funlog.instance.fancyinfo_success("仓库克隆完成!(无子模块)")
|
|
82
156
|
end
|
|
157
|
+
|
|
158
|
+
puts "\n"
|
|
159
|
+
puts "✅ 完成!仓库已克隆到: #{repo_path}".green
|
|
160
|
+
puts "\n"
|
|
83
161
|
end
|
|
84
162
|
|
|
85
163
|
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
require 'highline/import'
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
require 'json'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
module Pindo
|
|
9
|
+
class Command
|
|
10
|
+
class Repo < Command
|
|
11
|
+
|
|
12
|
+
class Subgit < Repo
|
|
13
|
+
|
|
14
|
+
self.summary = '初始化和更新所有 Git 子模块'
|
|
15
|
+
|
|
16
|
+
self.description = <<-DESC
|
|
17
|
+
初始化并递归更新当前仓库的所有 Git 子模块。
|
|
18
|
+
|
|
19
|
+
支持功能:
|
|
20
|
+
• 自动读取 .gitmodules 配置文件
|
|
21
|
+
• 递归初始化和更新所有层级的子模块
|
|
22
|
+
• 支持强制重新初始化(清除现有子模块状态)
|
|
23
|
+
• 显示详细的子模块状态信息
|
|
24
|
+
|
|
25
|
+
使用示例:
|
|
26
|
+
pindo repo subgit # 基本用法
|
|
27
|
+
pindo repo subgit --force # 强制重新初始化子模块
|
|
28
|
+
DESC
|
|
29
|
+
|
|
30
|
+
self.arguments = [
|
|
31
|
+
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
def self.options
|
|
35
|
+
[
|
|
36
|
+
['--force', '强制重新初始化子模块(覆盖本地修改)'],
|
|
37
|
+
].concat(super)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def initialize(argv)
|
|
43
|
+
|
|
44
|
+
@force = argv.flag?('force', false)
|
|
45
|
+
|
|
46
|
+
super(argv)
|
|
47
|
+
@additional_args = argv.remainder!
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def validate!
|
|
51
|
+
super
|
|
52
|
+
|
|
53
|
+
# 验证当前目录是否是 Git 仓库
|
|
54
|
+
unless Pindo::GitHandler.is_git_directory?(local_repo_dir: Dir.pwd)
|
|
55
|
+
raise Informative, "当前目录不是有效的 Git 仓库!请在 Git 仓库根目录下执行此命令。"
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def run
|
|
60
|
+
|
|
61
|
+
puts "\n"
|
|
62
|
+
puts "=" * 60
|
|
63
|
+
puts "Git 子模块更新".center(60)
|
|
64
|
+
puts "=" * 60
|
|
65
|
+
puts "当前目录: #{Dir.pwd}"
|
|
66
|
+
puts "强制模式: #{@force ? '是' : '否'}"
|
|
67
|
+
puts "=" * 60
|
|
68
|
+
puts "\n"
|
|
69
|
+
|
|
70
|
+
# 调用 GitHandler 的子模块更新方法
|
|
71
|
+
result = Pindo::GitHandler.update_submodules(
|
|
72
|
+
local_repo_dir: Dir.pwd,
|
|
73
|
+
force: @force
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
if result
|
|
77
|
+
puts "\n"
|
|
78
|
+
puts "✅ 子模块更新成功完成!".green
|
|
79
|
+
puts "\n"
|
|
80
|
+
else
|
|
81
|
+
puts "\n"
|
|
82
|
+
puts "⚠️ 当前仓库没有配置子模块".yellow
|
|
83
|
+
puts "\n"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
data/lib/pindo/command/repo.rb
CHANGED
|
@@ -150,9 +150,10 @@ module Pindo
|
|
|
150
150
|
|
|
151
151
|
# Git 参数
|
|
152
152
|
@args_release_branch = @options[:release_branch] || 'master'
|
|
153
|
-
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc]
|
|
154
|
-
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type]
|
|
153
|
+
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
|
|
154
|
+
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
|
|
155
155
|
@args_tag_pre = @options[:tag_pre] || 'v'
|
|
156
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
156
157
|
|
|
157
158
|
super
|
|
158
159
|
end
|
|
@@ -242,7 +243,8 @@ module Pindo
|
|
|
242
243
|
# 提前询问用户如何处理未提交的文件
|
|
243
244
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
244
245
|
project_dir: Dir.pwd,
|
|
245
|
-
interactive:
|
|
246
|
+
interactive: @args_git_commit.nil?,
|
|
247
|
+
default_process_type: @args_git_commit
|
|
246
248
|
)
|
|
247
249
|
|
|
248
250
|
git_commit_task = Pindo::TaskSystem::GitCommitTask.new(
|
|
@@ -359,7 +361,7 @@ module Pindo
|
|
|
359
361
|
git_app_info_obj, git_workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
360
362
|
working_directory: Dir.pwd,
|
|
361
363
|
proj_name: all_platform_configs["project_name"],
|
|
362
|
-
package_type:
|
|
364
|
+
package_type: nil, # package_type 在 manage_type=git 时会被忽略
|
|
363
365
|
manage_type: "git"
|
|
364
366
|
)
|
|
365
367
|
end
|
|
@@ -8,6 +8,7 @@ require 'pindo/module/task/model/git/git_commit_task'
|
|
|
8
8
|
require 'pindo/module/task/model/git/git_tag_task'
|
|
9
9
|
require 'pindo/module/task/model/nuget/nuget_build_task'
|
|
10
10
|
require 'pindo/options/options'
|
|
11
|
+
require 'pindo/options/helpers/git_constants'
|
|
11
12
|
|
|
12
13
|
module Pindo
|
|
13
14
|
class Command
|
|
@@ -57,8 +58,8 @@ module Pindo
|
|
|
57
58
|
|
|
58
59
|
# Git 参数
|
|
59
60
|
@args_release_branch = @options[:release_branch] || 'master'
|
|
60
|
-
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc]
|
|
61
|
-
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type]
|
|
61
|
+
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
|
|
62
|
+
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
|
|
62
63
|
@args_tag_pre = @options[:tag_pre] || 'v'
|
|
63
64
|
|
|
64
65
|
super
|
|
@@ -67,13 +68,19 @@ module Pindo
|
|
|
67
68
|
def run
|
|
68
69
|
package_dir = Dir.pwd
|
|
69
70
|
# 1. Git 提交任务 (确保工作区干净,或提交预构建更改)
|
|
70
|
-
#
|
|
71
|
+
# 默认自动提交(packbuild 场景需要确保代码已提交)
|
|
72
|
+
git_commit_opt = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit]) || Pindo::UncommittedFilesProcessType::COMMIT
|
|
73
|
+
|
|
71
74
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
project_dir: package_dir,
|
|
76
|
+
interactive: false,
|
|
77
|
+
default_process_type: git_commit_opt
|
|
75
78
|
)
|
|
76
|
-
|
|
79
|
+
|
|
80
|
+
# packbuild 场景强制提交:如果返回 NONE(无未提交文件),改为 COMMIT 以确保执行提交流程
|
|
81
|
+
if process_type == Pindo::UncommittedFilesProcessType::NONE
|
|
82
|
+
process_type = Pindo::UncommittedFilesProcessType::COMMIT
|
|
83
|
+
end
|
|
77
84
|
|
|
78
85
|
Funlog.instance.fancyinfo_start("Unity Package 打包流程")
|
|
79
86
|
|
|
@@ -57,9 +57,10 @@ module Pindo
|
|
|
57
57
|
|
|
58
58
|
# Git 参数
|
|
59
59
|
@args_release_branch = @options[:release_branch] || 'master'
|
|
60
|
-
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc]
|
|
61
|
-
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type]
|
|
60
|
+
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
|
|
61
|
+
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
|
|
62
62
|
@args_tag_pre = @options[:tag_pre] || 'v'
|
|
63
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
63
64
|
|
|
64
65
|
super
|
|
65
66
|
@additional_args = argv.remainder!
|
|
@@ -79,7 +80,8 @@ module Pindo
|
|
|
79
80
|
# 0. 提前询问用户如何处理未提交的文件
|
|
80
81
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
81
82
|
project_dir: pindo_project_dir,
|
|
82
|
-
interactive:
|
|
83
|
+
interactive: @args_git_commit.nil?,
|
|
84
|
+
default_process_type: @args_git_commit
|
|
83
85
|
)
|
|
84
86
|
|
|
85
87
|
# 1. Git 提交任务
|
|
@@ -137,9 +137,10 @@ module Pindo
|
|
|
137
137
|
|
|
138
138
|
# Git 参数
|
|
139
139
|
@args_release_branch = @options[:release_branch] || 'master'
|
|
140
|
-
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc]
|
|
141
|
-
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type]
|
|
140
|
+
@args_ver_inc = Pindo::Options::GitOptions.parse_version_increase_type(@options[:ver_inc])
|
|
141
|
+
@args_tag_type = Pindo::Options::GitOptions.parse_create_tag_type(@options[:tag_type])
|
|
142
142
|
@args_tag_pre = @options[:tag_pre] || 'v'
|
|
143
|
+
@args_git_commit = Pindo::Options::GitOptions.parse_git_commit_type(@options[:git_commit])
|
|
143
144
|
|
|
144
145
|
super
|
|
145
146
|
@additional_args = argv.remainder!
|
|
@@ -254,7 +255,8 @@ module Pindo
|
|
|
254
255
|
# 提前询问用户如何处理未提交的文件
|
|
255
256
|
process_type = Pindo::GitHandler.get_uncommitted_files_process_type(
|
|
256
257
|
project_dir: config[:project_path],
|
|
257
|
-
interactive:
|
|
258
|
+
interactive: @args_git_commit.nil?,
|
|
259
|
+
default_process_type: @args_git_commit
|
|
258
260
|
)
|
|
259
261
|
|
|
260
262
|
git_commit_task = Pindo::TaskSystem::GitCommitTask.new(
|
|
@@ -363,7 +365,7 @@ module Pindo
|
|
|
363
365
|
git_app_info_obj, git_workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
364
366
|
working_directory: config[:project_path],
|
|
365
367
|
proj_name: @args_proj_name,
|
|
366
|
-
package_type:
|
|
368
|
+
package_type: nil, # package_type 在 manage_type=git 时会被忽略
|
|
367
369
|
manage_type: "git"
|
|
368
370
|
)
|
|
369
371
|
|
|
@@ -401,7 +403,7 @@ module Pindo
|
|
|
401
403
|
git_app_info_obj, git_workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
402
404
|
working_directory: config[:project_path],
|
|
403
405
|
proj_name: @args_proj_name,
|
|
404
|
-
package_type:
|
|
406
|
+
package_type: nil,
|
|
405
407
|
manage_type: "git"
|
|
406
408
|
)
|
|
407
409
|
|
data/lib/pindo/command.rb
CHANGED
|
@@ -46,7 +46,7 @@ module Pindo
|
|
|
46
46
|
require 'pindo/command/utils'
|
|
47
47
|
require 'pindo/command/jps'
|
|
48
48
|
require 'pindo/command/setup'
|
|
49
|
-
|
|
49
|
+
require 'pindo/command/repo'
|
|
50
50
|
require 'pindo/command/appstore'
|
|
51
51
|
require 'pindo/command/gplay'
|
|
52
52
|
require 'pindo/command/unity'
|
|
@@ -31,7 +31,7 @@ module Pindo
|
|
|
31
31
|
begin
|
|
32
32
|
app_config_dir = Pindo::GitHandler.clong_buildconfig_repo(repo_name: normalized_repo_name)
|
|
33
33
|
rescue StandardError => e
|
|
34
|
-
|
|
34
|
+
Funlog.instance.fancyinfo_error("拉取配置仓库失败: #{e.message}")
|
|
35
35
|
return false
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -42,17 +42,17 @@ module Pindo
|
|
|
42
42
|
if !app_config_dir.eql?(target_dir) && File.exist?(File.join(app_config_dir, 'config.json'))
|
|
43
43
|
begin
|
|
44
44
|
FileUtils.cp_r(File.join(app_config_dir, "config.json"), target_dir)
|
|
45
|
-
|
|
45
|
+
Funlog.instance.fancyinfo_success("配置文件已复制到: #{target_dir}")
|
|
46
46
|
return true
|
|
47
47
|
rescue StandardError => e
|
|
48
|
-
|
|
48
|
+
Funlog.instance.fancyinfo_error("复制配置文件失败: #{e.message}")
|
|
49
49
|
return false
|
|
50
50
|
end
|
|
51
51
|
elsif app_config_dir.eql?(target_dir)
|
|
52
|
-
|
|
52
|
+
Funlog.instance.fancyinfo_success("配置文件已存在于目标目录")
|
|
53
53
|
return true
|
|
54
54
|
else
|
|
55
|
-
|
|
55
|
+
Funlog.instance.fancyinfo_error("配置仓库中未找到 config.json")
|
|
56
56
|
return false
|
|
57
57
|
end
|
|
58
58
|
end
|
|
@@ -95,28 +95,51 @@ module Pindo
|
|
|
95
95
|
modify_repo_setting(repo_name: repo_name, owner_org: owner_org)
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
-
#
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
# Gitee 仓库创建后需要短暂延迟,等待仓库完全初始化
|
|
99
|
+
Funlog.instance.fancyinfo_update("等待 Gitee 仓库初始化...")
|
|
100
|
+
sleep 2
|
|
101
|
+
|
|
102
|
+
# 克隆配置仓库,带重试机制
|
|
103
|
+
app_config_dir = nil
|
|
104
|
+
max_retries = 3
|
|
105
|
+
retry_count = 0
|
|
106
|
+
|
|
107
|
+
while retry_count < max_retries
|
|
108
|
+
begin
|
|
109
|
+
app_config_dir = Pindo::GitHandler.clong_buildconfig_repo(repo_name: repo_name)
|
|
110
|
+
break if app_config_dir && File.exist?(app_config_dir)
|
|
111
|
+
rescue StandardError => e
|
|
112
|
+
retry_count += 1
|
|
113
|
+
if retry_count < max_retries
|
|
114
|
+
Funlog.instance.fancyinfo_update("克隆失败 (#{retry_count}/#{max_retries}),#{3}秒后重试...")
|
|
115
|
+
sleep 3
|
|
116
|
+
else
|
|
117
|
+
Funlog.instance.fancyinfo_error("克隆仓库失败: #{e.message}")
|
|
118
|
+
return nil
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
system "open #{app_config_dir}" if app_config_dir
|
|
101
124
|
|
|
102
|
-
if File.exist?(app_config_dir)
|
|
125
|
+
if app_config_dir && File.exist?(app_config_dir)
|
|
103
126
|
# 从模板仓库复制配置文件
|
|
104
127
|
update_appconfig_repo(
|
|
105
128
|
bundle_id: bundle_id,
|
|
106
129
|
demo_dir: demo_dir,
|
|
107
130
|
app_config_dir: app_config_dir
|
|
108
131
|
)
|
|
109
|
-
|
|
132
|
+
Funlog.instance.fancyinfo_success("配置仓库创建成功: #{app_config_dir}")
|
|
110
133
|
return app_config_dir
|
|
111
134
|
else
|
|
112
|
-
|
|
135
|
+
Funlog.instance.fancyinfo_error("创建应用配置仓库失败")
|
|
113
136
|
return nil
|
|
114
137
|
end
|
|
115
138
|
else
|
|
116
139
|
# 仓库已存在,直接打开
|
|
117
140
|
app_config_dir = Pindo::GitHandler.clong_buildconfig_repo(repo_name: repo_name)
|
|
118
141
|
system "open #{app_config_dir}"
|
|
119
|
-
|
|
142
|
+
Funlog.instance.fancyinfo_update("配置仓库已存在: #{app_config_dir}")
|
|
120
143
|
return app_config_dir
|
|
121
144
|
end
|
|
122
145
|
end
|
|
@@ -130,7 +153,7 @@ module Pindo
|
|
|
130
153
|
# 读取 deploy_build_setting.json
|
|
131
154
|
setting_file = File.join(pindo_single_config.pindo_env_configdir, 'deploy_build_setting.json')
|
|
132
155
|
unless File.exist?(setting_file)
|
|
133
|
-
|
|
156
|
+
Funlog.instance.fancyinfo_error("deploy_build_setting.json 不存在: #{setting_file}")
|
|
134
157
|
return nil
|
|
135
158
|
end
|
|
136
159
|
|
|
@@ -144,7 +167,7 @@ module Pindo
|
|
|
144
167
|
|
|
145
168
|
return repo_name
|
|
146
169
|
rescue JSON::ParserError => e
|
|
147
|
-
|
|
170
|
+
Funlog.instance.fancyinfo_error("解析 deploy_build_setting.json 失败: #{e.message}")
|
|
148
171
|
return nil
|
|
149
172
|
rescue => e
|
|
150
173
|
raise Informative, "config.json app_type is error!!!"
|