pindo 4.8.9 → 4.9.1
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 +201 -77
- data/lib/pindo/command/dev/tag.rb +184 -0
- data/lib/pindo/command/dev.rb +1 -1
- data/lib/pindo/command/unity/ipa.rb +54 -18
- data/lib/pindo/config/pindouserlocalconfig.rb +17 -1
- data/lib/pindo/module/build/buildhelper.rb +143 -0
- data/lib/pindo/{client → module/build}/unityhelper.rb +93 -12
- data/lib/pindo/module/pgyer/pgyerhelper.rb +39 -77
- data/lib/pindo/version.rb +1 -1
- metadata +5 -4
- data/lib/pindo/command/dev/pub.rb +0 -171
@@ -1,171 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module Pindo
|
4
|
-
class Command
|
5
|
-
class Dev < Command
|
6
|
-
class Pub < Dev
|
7
|
-
|
8
|
-
self.summary = '发布代码,添加tag,添加发布信息,并合并到发布分支'
|
9
|
-
|
10
|
-
self.description = <<-DESC
|
11
|
-
发布代码,添加tag,添加发布信息,并合并到发布分支。用法:在当前代码仓库下执行pindo dev pub
|
12
|
-
DESC
|
13
|
-
|
14
|
-
self.arguments = [
|
15
|
-
|
16
|
-
]
|
17
|
-
|
18
|
-
def self.options
|
19
|
-
[
|
20
|
-
].concat(super)
|
21
|
-
end
|
22
|
-
|
23
|
-
def initialize(argv)
|
24
|
-
|
25
|
-
super
|
26
|
-
@additional_args = argv.remainder!
|
27
|
-
end
|
28
|
-
|
29
|
-
def run
|
30
|
-
|
31
|
-
release_branch = "master"
|
32
|
-
current_project_dir = Dir.pwd
|
33
|
-
|
34
|
-
process_need_add_files(project_dir:current_project_dir)
|
35
|
-
|
36
|
-
answer = agree("是否添加发布备注信息?(Y/n)")
|
37
|
-
if answer
|
38
|
-
add_release_info(project_dir:current_project_dir)
|
39
|
-
end
|
40
|
-
|
41
|
-
answer = agree("是否将代码合并到master分支?(Y/n)")
|
42
|
-
|
43
|
-
if answer
|
44
|
-
current_branch = git!(%W(-C #{current_project_dir} rev-parse --abbrev-ref HEAD)).strip
|
45
|
-
coding_branch = current_branch
|
46
|
-
merge_to_release_branch(project_dir:current_project_dir, release_branch:release_branch, coding_branch:coding_branch)
|
47
|
-
add_release_tag(project_dir:current_project_dir)
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
def add_release_info(project_dir:nil)
|
54
|
-
|
55
|
-
puts
|
56
|
-
puts "输入Release 备注:"
|
57
|
-
description = PgyerHelper.share_instace.get_description()
|
58
|
-
File.open("#{project_dir}/.release_info", 'w') { |f| f.write(description) }
|
59
|
-
git_addpush_repo(path:project_dir, message:"update release info", commit_file_params:[".release_info"])
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
def add_release_tag(project_dir:nil)
|
64
|
-
|
65
|
-
time_str = Time.now.strftime('%Y_%m_%d')
|
66
|
-
tag_name = "dev_" + time_str
|
67
|
-
remove_tag(local_repo_dir:project_dir, tag_name:tag_name)
|
68
|
-
result = add_tag(local_repo_dir:project_dir, tag_name:tag_name)
|
69
|
-
|
70
|
-
puts
|
71
|
-
puts "已经为当前仓库添加tag: #{tag_name}"
|
72
|
-
puts "仓库路径:#{project_dir}"
|
73
|
-
puts
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
def merge_to_release_branch(project_dir:nil, release_branch:nil, coding_branch:nil)
|
79
|
-
|
80
|
-
current_project_dir = project_dir
|
81
|
-
|
82
|
-
|
83
|
-
if !coding_branch.eql?(release_branch)
|
84
|
-
|
85
|
-
coding_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{coding_branch})).strip
|
86
|
-
release_branch_commit_id = "111"
|
87
|
-
|
88
|
-
if remote_branch_exists?(local_repo_dir: current_project_dir, branch:release_branch)
|
89
|
-
if local_branch_exists?(local_repo_dir: current_project_dir, branch:release_branch)
|
90
|
-
puts "存在#{release_branch}远程分支"
|
91
|
-
puts "存在#{release_branch}本地分支"
|
92
|
-
git!(%W(-C #{current_project_dir} checkout #{release_branch}))
|
93
|
-
else
|
94
|
-
puts "存在#{release_branch}远程分支"
|
95
|
-
puts "不存在#{release_branch}本地分支"
|
96
|
-
git!(%W(-C #{current_project_dir} checkout -b #{release_branch} origin/#{release_branch}))
|
97
|
-
end
|
98
|
-
|
99
|
-
git!(%W(-C #{current_project_dir} branch --set-upstream-to=origin/#{release_branch} #{release_branch}))
|
100
|
-
git!(%W(-C #{current_project_dir} pull))
|
101
|
-
# git!(%W(-C #{current_project_dir} merge #{coding_branch} --quiet))
|
102
|
-
res_data = Executable.capture_command('git', %W(merge #{coding_branch}), :capture => :out)
|
103
|
-
|
104
|
-
conflict_filelist = git!(%W(-C #{current_project_dir} diff --name-only --diff-filter=U --relative))
|
105
|
-
if !conflict_filelist.nil? && conflict_filelist.size > 0
|
106
|
-
puts "合并代码冲突, 冲突文件如下:"
|
107
|
-
|
108
|
-
raise Informative, "请手动处理冲突的文件!!!"
|
109
|
-
|
110
|
-
else
|
111
|
-
git!(%W(-C #{current_project_dir} push))
|
112
|
-
|
113
|
-
|
114
|
-
puts ""
|
115
|
-
puts "===================================="
|
116
|
-
puts "代码已经合并到#{release_branch}分支"
|
117
|
-
puts "===================================="
|
118
|
-
puts ""
|
119
|
-
release_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{release_branch})).strip
|
120
|
-
end
|
121
|
-
|
122
|
-
else
|
123
|
-
if local_branch_exists?(local_repo_dir: current_project_dir, branch:release_branch)
|
124
|
-
puts "不存在#{release_branch}远程分支"
|
125
|
-
puts "存在#{release_branch}本地分支"
|
126
|
-
git!(%W(-C #{current_project_dir} checkout #{release_branch}))
|
127
|
-
git!(%W(-C #{current_project_dir} checkout -b #{release_branch}_temp))
|
128
|
-
git!(%W(-C #{current_project_dir} checkout #{coding_branch}))
|
129
|
-
git!(%W(-C #{current_project_dir} branch -D #{release_branch}))
|
130
|
-
else
|
131
|
-
puts "不存在#{release_branch}远程分支"
|
132
|
-
puts "不存在#{release_branch}本地分支"
|
133
|
-
end
|
134
|
-
|
135
|
-
git!(%W(-C #{current_project_dir} checkout -b #{release_branch}))
|
136
|
-
git!(%W(-C #{current_project_dir} push origin #{release_branch}))
|
137
|
-
git!(%W(-C #{current_project_dir} branch --set-upstream-to=origin/#{release_branch} #{release_branch}))
|
138
|
-
|
139
|
-
|
140
|
-
puts ""
|
141
|
-
puts "===================================="
|
142
|
-
puts "代码已经合并到#{release_branch}分支"
|
143
|
-
puts "===================================="
|
144
|
-
puts ""
|
145
|
-
release_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{release_branch})).strip
|
146
|
-
end
|
147
|
-
|
148
|
-
|
149
|
-
git!(%W(-C #{current_project_dir} checkout #{coding_branch}))
|
150
|
-
if !release_branch_commit_id.eql?(coding_branch_commit_id)
|
151
|
-
git!(%W(-C #{current_project_dir} merge #{release_branch}))
|
152
|
-
puts
|
153
|
-
puts "已将#{release_branch}合并到#{coding_branch}"
|
154
|
-
puts
|
155
|
-
end
|
156
|
-
|
157
|
-
else
|
158
|
-
puts ""
|
159
|
-
puts "===================================="
|
160
|
-
puts "代码处于#{coding_branch}分支,无需合并"
|
161
|
-
puts "===================================="
|
162
|
-
puts ""
|
163
|
-
end
|
164
|
-
|
165
|
-
end
|
166
|
-
|
167
|
-
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|