gct 0.5.3 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gct/command.rb +3 -1
- data/lib/gct/command/autotag.rb +39 -14
- data/lib/gct/command/init/ci.rb +1 -1
- data/lib/gct/command/init/{gitlab-ci.rb → ios-ci.rb} +2 -2
- data/lib/gct/command/init/ios-thirdpart-ci.rb +29 -0
- data/lib/gct/command/repo/push.rb +13 -2
- data/lib/gct/command/robot.rb +0 -1
- data/lib/gct/command/robot/podfile.rb +11 -1
- data/lib/gct/command/skip.rb +14 -0
- data/lib/gct/command/skip/modular.rb +31 -0
- data/lib/gct/command/skip/tag.rb +42 -0
- data/lib/gct/command/unskip.rb +14 -0
- data/lib/gct/command/unskip/modular.rb +31 -0
- data/lib/gct/command/unskip/tag.rb +42 -0
- data/lib/gct/command/update/next.rb +2 -2
- data/lib/gct/command/update/podfile.rb +16 -2
- data/lib/gct/command/update/tag.rb +18 -7
- data/lib/gct/gct_version.rb +1 -1
- metadata +10 -4
- data/lib/gct/command/robot/summary.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f00bf4a54db8a5ed7a97ca67ce4fb5483c4e025cac01b5ecd477f22b6a47bfe2
|
4
|
+
data.tar.gz: 7fed4d6aa0a2f1a0868f7f4431312d359893f8ede337ae793b24484ff2295d09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8a2bb7fd8772bbea7c8957b20e55c3fe78da36390eecb0792cf34ab1161fb91fd2fad732e2ec774f10b12fb86e39351a9112a8ac6058c675c27ac535e255549
|
7
|
+
data.tar.gz: 49bb9f425c5ba77b5b3d4f462fa9d0966f0a77e4ddc22b9775498c293e9f855fc05577f983b54c910e3d0a730016ecf6c2b915b059c6943001f06c8bbebda0c5
|
data/lib/gct/command.rb
CHANGED
@@ -28,6 +28,8 @@ module Gct
|
|
28
28
|
require 'gct/command/update'
|
29
29
|
require 'gct/command/robot'
|
30
30
|
require 'gct/command/clean'
|
31
|
+
require 'gct/command/skip'
|
32
|
+
require 'gct/command/unskip'
|
31
33
|
|
32
34
|
self.abstract_command = true
|
33
35
|
self.command = 'gct'
|
@@ -92,8 +94,8 @@ module Gct
|
|
92
94
|
end
|
93
95
|
|
94
96
|
def auto_add_tag(tag)
|
95
|
-
puts "current tag = #{tag}"
|
96
97
|
tag_points = tag.to_s.split('.')
|
98
|
+
raise "tag is nil" if tag_points.length <= 0
|
97
99
|
index = tag_points.length - 1
|
98
100
|
need_add_point = tag_points[index].to_i + 1
|
99
101
|
tag_points[index] = need_add_point == 10 ? 0 : need_add_point
|
data/lib/gct/command/autotag.rb
CHANGED
@@ -47,6 +47,13 @@ module Gct
|
|
47
47
|
|
48
48
|
def run
|
49
49
|
FileBase.root_err
|
50
|
+
|
51
|
+
# 检查远端是否存在分支
|
52
|
+
is_exist_branch = check_remote_branch
|
53
|
+
if !is_exist_branch
|
54
|
+
raise "远端未找到 #{@branch} 分支".red
|
55
|
+
end
|
56
|
+
|
50
57
|
puts "开始分析podfile文件".green
|
51
58
|
puts ""
|
52
59
|
where_statement = "and is_pre = #{@pre ? 1 : 0}"
|
@@ -67,20 +74,22 @@ module Gct
|
|
67
74
|
raise "#{@project_name} #{@version} 版本已经打完tag了!!!".red
|
68
75
|
end
|
69
76
|
else
|
70
|
-
keys = "(version, name, branch" + (@pre ? ", is_pre)" : ")")
|
71
|
-
values = "('#{@version}', '#{@project_name}', '#{@branch}'" + (@pre ? ", 1)" : ")")
|
72
|
-
db = Database::Data.new
|
73
|
-
sql = "insert into project #{keys} values #{values}"
|
74
|
-
res = db.query(sql)
|
75
77
|
untagged_specs = analyze_dependencies
|
76
78
|
priority_rank(untagged_specs)
|
77
79
|
create_tag_by_priority()
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
81
|
-
def
|
82
|
-
|
83
|
-
|
83
|
+
def check_remote_branch
|
84
|
+
remote_branches = Gitlab.branches(@project_id, per_page: 1000)
|
85
|
+
branches = Array.new()
|
86
|
+
remote_branches.each do |item|
|
87
|
+
hash_branch = item.to_hash
|
88
|
+
branch_name = hash_branch["name"]
|
89
|
+
branches.push(branch_name)
|
90
|
+
end
|
91
|
+
is_exist_branch = branches.include?(@branch)
|
92
|
+
is_exist_branch
|
84
93
|
end
|
85
94
|
|
86
95
|
def podfile
|
@@ -101,7 +110,16 @@ module Gct
|
|
101
110
|
raise "没有需要打tag的库".red if untagged_git_dependencies.count == 0
|
102
111
|
|
103
112
|
spec_files = Parallel.map(untagged_git_dependencies, in_threads: 1) do |dep|
|
104
|
-
|
113
|
+
# 取出组名
|
114
|
+
source = dep.external_source[:git]
|
115
|
+
left1 = "https://gi-dev.ccrgt.com/"
|
116
|
+
left2 = "http://gi-dev.ccrgt.com/"
|
117
|
+
right = "/"
|
118
|
+
source_regex = /(?<=#{left1}|#{left2}).*(?=#{right})/
|
119
|
+
group_name = source_regex.match(source).to_s
|
120
|
+
raise "gitlab中找不到#{dep.name}所在的group".red if group_name.nil? || group_name.empty?
|
121
|
+
|
122
|
+
project_name = "#{group_name}/#{dep.name}"
|
105
123
|
branch = Constant.DefaultTagFromBranch
|
106
124
|
if @pre
|
107
125
|
branch = Constant.PreTagFromBranch
|
@@ -232,7 +250,9 @@ module Gct
|
|
232
250
|
end
|
233
251
|
end
|
234
252
|
end
|
235
|
-
|
253
|
+
# 写入project
|
254
|
+
write_project
|
255
|
+
# 写入tag
|
236
256
|
values = ""
|
237
257
|
temp_spec_map.each do |key, value|
|
238
258
|
values.concat("('#{@version}', '#{key}', '#{@project_name}', '#{value.tag}', '#{value.status}', #{value.priority}" + (@pre ? ", 1)," : "),"))
|
@@ -244,12 +264,20 @@ module Gct
|
|
244
264
|
db.query(sql)
|
245
265
|
end
|
246
266
|
|
267
|
+
def write_project
|
268
|
+
keys = "(version, name, branch" + (@pre ? ", is_pre)" : ")")
|
269
|
+
values = "('#{@version}', '#{@project_name}', '#{@branch}'" + (@pre ? ", 1)" : ")")
|
270
|
+
db = Database::Data.new
|
271
|
+
sql = "insert into project #{keys} values #{values}"
|
272
|
+
res = db.query(sql)
|
273
|
+
end
|
274
|
+
|
247
275
|
# 按优先级打tag, 触发第一个优先级,其他的上一优先级打完之后自动触发
|
248
276
|
def create_tag_by_priority()
|
249
277
|
db = Database::Data.new
|
250
278
|
# 查询优先级最高的为完成打tag的数据
|
251
279
|
where_statement = "and is_pre = " + (@pre ? "1" : "0")
|
252
|
-
sql = "select * from tag where priority = (select MAX(priority) from tag
|
280
|
+
sql = "select * from tag where priority = (select MAX(priority) from tag where tag_status != '#{SpecPublishStatus::SUCCESS}' #{where_statement}) and project_version = '#{@version}'"
|
253
281
|
result = db.query(sql)
|
254
282
|
vals = ""
|
255
283
|
ins = ""
|
@@ -258,11 +286,8 @@ module Gct
|
|
258
286
|
if row["tag_status"].eql?(SpecPublishStatus::WAITING) || row["tag_status"].eql?(SpecPublishStatus::CANCELED) || row["tag_status"].eql?(SpecPublishStatus::FAILED)
|
259
287
|
status = SpecPublishStatus::PENDING
|
260
288
|
name = row["pod_name"]
|
261
|
-
puts "pod name is " + name
|
262
289
|
vals.concat("when pod_name = '#{name}' then '#{status}' ")
|
263
|
-
puts vals
|
264
290
|
ins.concat("'#{name}',")
|
265
|
-
puts ins
|
266
291
|
system "gct update dependency #{name} tag_status #{status}"
|
267
292
|
skip_tag = ""
|
268
293
|
if row["is_tag"].to_i == 1
|
data/lib/gct/command/init/ci.rb
CHANGED
@@ -8,8 +8,8 @@ push_pod:
|
|
8
8
|
- echo "开始lint 和 push podspec"
|
9
9
|
- gct update dependency $CI_PROJECT_NAME "tag_status" "deploying"
|
10
10
|
- gct clean lint $CI_PROJECT_NAME
|
11
|
-
- gct repo update
|
12
|
-
- gct repo push
|
11
|
+
- gct repo update
|
12
|
+
- gct repo push $CI_PROJECT_NAME
|
13
13
|
- gct update dependency $CI_PROJECT_NAME "tag_version" $CI_COMMIT_REF_NAME
|
14
14
|
- gct update next
|
15
15
|
only:
|
@@ -0,0 +1,29 @@
|
|
1
|
+
stages:
|
2
|
+
- push
|
3
|
+
- failure
|
4
|
+
|
5
|
+
push_pod:
|
6
|
+
stage: push
|
7
|
+
script:
|
8
|
+
- echo "开始lint 和 push podspec"
|
9
|
+
- gct update dependency $CI_PROJECT_NAME "tag_status" "deploying"
|
10
|
+
- gct clean lint $CI_PROJECT_NAME
|
11
|
+
- gct repo update
|
12
|
+
- gct repo push $CI_PROJECT_NAME
|
13
|
+
- gct update dependency $CI_PROJECT_NAME "tag_version" $CI_COMMIT_REF_NAME
|
14
|
+
- gct update next
|
15
|
+
only:
|
16
|
+
- tags
|
17
|
+
tags:
|
18
|
+
- ios-third
|
19
|
+
|
20
|
+
on_failure:
|
21
|
+
stage: failure
|
22
|
+
script:
|
23
|
+
- gct robot finish false
|
24
|
+
- gct update dependency $CI_PROJECT_NAME "tag_status" "failed"
|
25
|
+
when: on_failure
|
26
|
+
only:
|
27
|
+
- tags
|
28
|
+
tags:
|
29
|
+
- ios-third
|
@@ -9,9 +9,11 @@ module Gct
|
|
9
9
|
DESC
|
10
10
|
|
11
11
|
self.arguments = [
|
12
|
+
CLAide::Argument.new('POD_NAME', true),
|
12
13
|
]
|
13
14
|
|
14
15
|
def initialize(argv)
|
16
|
+
@pod_name = argv.shift_argument
|
15
17
|
super
|
16
18
|
end
|
17
19
|
|
@@ -24,9 +26,18 @@ module Gct
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def pushRepo
|
27
|
-
|
29
|
+
db = Database::Data.new
|
30
|
+
sql = "select * from modular_headers where pod_name = '#{@pod_name}'"
|
31
|
+
res = db.query(sql)
|
32
|
+
modular_code = "--use-modular-headers"
|
33
|
+
if !res.nil? && res.count > 0
|
34
|
+
modular_code = ""
|
35
|
+
end
|
36
|
+
command_code = "pod repo push iOSCRGTPodSource --sources=#{Constant.GitURL}iOSCRGTPodSource.git --verbose --skip-import-validation --use-libraries --allow-warnings #{modular_code}"
|
37
|
+
|
38
|
+
puts "pod 命令为:#{command_code}".green
|
28
39
|
# exception: ruby 2.6 以上生效
|
29
|
-
system "
|
40
|
+
system "#{command_code}", exception: true
|
30
41
|
end
|
31
42
|
end
|
32
43
|
end
|
data/lib/gct/command/robot.rb
CHANGED
@@ -28,7 +28,17 @@ module Gct
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def run
|
31
|
-
|
31
|
+
db = Database::Data.new
|
32
|
+
sql = "select * from project where is_done = 1 order by create_time DESC limit 1"
|
33
|
+
res = db.query(sql)
|
34
|
+
message = "<font color=\"info\">podfile 更新完毕</font>"
|
35
|
+
if !res.nil? && res.count > 0
|
36
|
+
res.each do |row|
|
37
|
+
branch = row["branch"]
|
38
|
+
message = "<font color=\"info\">#{branch} podfile 更新完毕</font>"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
32
42
|
content = "#{message}"
|
33
43
|
robot_send(content)
|
34
44
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'net/https'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Gct
|
5
|
+
class Command
|
6
|
+
class Skip < Command
|
7
|
+
class Modular < Skip
|
8
|
+
|
9
|
+
self.summary = '跳过modular_headers 验证的pod'
|
10
|
+
self.description = <<-DESC
|
11
|
+
跳过modular_headers 验证的pod
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('POD_NAME', true),
|
16
|
+
]
|
17
|
+
|
18
|
+
def initialize(argv)
|
19
|
+
@pod_name = argv.shift_argument
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
db = Database::Data.new
|
25
|
+
sql = "insert into modular_headers (pod_name) values ('#{@pod_name}')"
|
26
|
+
res = db.query(sql)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'net/https'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Gct
|
5
|
+
class Command
|
6
|
+
class Skip < Command
|
7
|
+
class Tag < Skip
|
8
|
+
|
9
|
+
self.summary = '跳过打tag'
|
10
|
+
self.description = <<-DESC
|
11
|
+
跳过打tag
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('PROJECT_VERSION', true),
|
16
|
+
CLAide::Argument.new('POD_NAME', true),
|
17
|
+
CLAide::Argument.new('Tag', false),
|
18
|
+
]
|
19
|
+
|
20
|
+
def self.options
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(argv)
|
24
|
+
@project_version = argv.shift_argument
|
25
|
+
@pod_name = argv.shift_argument
|
26
|
+
@tag = argv.shift_argument
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def run
|
31
|
+
db = Database::Data.new
|
32
|
+
if !@tag.nil?
|
33
|
+
tag_set = ", tag_version = '#{@tag}'"
|
34
|
+
end
|
35
|
+
update_code = "is_skip_tag = 1, tag_status = 'success'#{tag_set}"
|
36
|
+
sql = "update tag set #{update_code} where pod_name = '#{@pod_name}' and project_version = '#{@project_version}'"
|
37
|
+
res = db.query(sql)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'gct/command/unskip/modular'
|
2
|
+
require 'gct/command/unskip/tag'
|
3
|
+
|
4
|
+
module Gct
|
5
|
+
class Command
|
6
|
+
class Unskip < Command
|
7
|
+
self.abstract_command = true
|
8
|
+
self.summary = '初始化'
|
9
|
+
self.description = <<-DESC
|
10
|
+
移除跳过modular或跳过tag
|
11
|
+
DESC
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'net/https'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Gct
|
5
|
+
class Command
|
6
|
+
class Unskip < Command
|
7
|
+
class Modular < Unskip
|
8
|
+
|
9
|
+
self.summary = '移除跳过modular_headers 验证'
|
10
|
+
self.description = <<-DESC
|
11
|
+
移除跳过modular_headers 验证
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('POD_NAME', true),
|
16
|
+
]
|
17
|
+
|
18
|
+
def initialize(argv)
|
19
|
+
@pod_name = argv.shift_argument
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
db = Database::Data.new
|
25
|
+
sql = "delete from modular_headers where pod_name = '#{@pod_name}'"
|
26
|
+
res = db.query(sql)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'net/https'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Gct
|
5
|
+
class Command
|
6
|
+
class Unskip < Command
|
7
|
+
class Tag < Unskip
|
8
|
+
|
9
|
+
self.summary = '移除跳过打tag'
|
10
|
+
self.description = <<-DESC
|
11
|
+
移除跳过打tag
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('PROJECT_VERSION', true),
|
16
|
+
CLAide::Argument.new('POD_NAME', true),
|
17
|
+
CLAide::Argument.new('Tag', false),
|
18
|
+
]
|
19
|
+
|
20
|
+
def self.options
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(argv)
|
24
|
+
@project_version = argv.shift_argument
|
25
|
+
@pod_name = argv.shift_argument
|
26
|
+
@tag = argv.shift_argument
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def run
|
31
|
+
db = Database::Data.new
|
32
|
+
if !@tag.nil?
|
33
|
+
tag_set = ", tag_version = '#{@tag}'"
|
34
|
+
end
|
35
|
+
update_code = "is_skip_tag = 0, tag_status = 'waiting'#{tag_set}"
|
36
|
+
sql = "update tag set #{update_code} where pod_name = '#{@pod_name}' and project_version = '#{@project_version}'"
|
37
|
+
res = db.query(sql)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -34,7 +34,7 @@ module Gct
|
|
34
34
|
db = Database::Data.new
|
35
35
|
# 查询优先级最高的为完成打tag的数据
|
36
36
|
where_statement = "and is_pre = " + (@pre ? "1" : "0")
|
37
|
-
sql = "select * from tag where priority = (select MAX(priority) from tag where
|
37
|
+
sql = "select * from tag where priority = (select MAX(priority) from tag where tag_status != '#{SpecPublishStatus::SUCCESS}' #{where_statement}) and project_version = '#{@version}'"
|
38
38
|
result = db.query(sql)
|
39
39
|
puts result.count
|
40
40
|
if result.count == 0
|
@@ -54,7 +54,7 @@ module Gct
|
|
54
54
|
if row["is_pre"].to_i == 1
|
55
55
|
pre = "--pre"
|
56
56
|
end
|
57
|
-
system "gct update dependency #{name}
|
57
|
+
system "gct update dependency #{name} tag_status #{status}"
|
58
58
|
system "gct update tag #{name} --auto-tag --update-ci #{skip_tag} #{pre}"
|
59
59
|
end
|
60
60
|
end
|
@@ -39,6 +39,13 @@ module Gct
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
def skip_modular_headers_pods
|
43
|
+
db = Database::Data.new
|
44
|
+
sql = "select * from modular_headers"
|
45
|
+
result = db.query(sql)
|
46
|
+
return result
|
47
|
+
end
|
48
|
+
|
42
49
|
def update_podfile
|
43
50
|
podspec_content = file_contents(@name, @file, @branch)
|
44
51
|
remove_regex = /dev_pod .*/
|
@@ -51,12 +58,20 @@ module Gct
|
|
51
58
|
puts "ERROR: 没有tag库".red
|
52
59
|
return
|
53
60
|
end
|
61
|
+
|
62
|
+
skip_pods = Array.new()
|
63
|
+
skip_modular_headers_pods.each do |row|
|
64
|
+
skip_pods.push(row["pod_name"])
|
65
|
+
end
|
66
|
+
|
54
67
|
result.each do |row|
|
55
68
|
name = row["pod_name"]
|
56
69
|
tag = row["tag_version"]
|
70
|
+
is_skip_modular_headers = skip_pods.include?(name)
|
71
|
+
modular_headers = is_skip_modular_headers ? ", :modular_headers => false" : ""
|
57
72
|
update_regex = /.*#{name}.*/
|
58
73
|
update_match = update_regex.match(podspec_content).to_s
|
59
|
-
update_str = " pod '#{name}', '#{tag}'"
|
74
|
+
update_str = " pod '#{name}', '#{tag}'#{modular_headers}"
|
60
75
|
if update_match.empty?
|
61
76
|
empty_match = "# Pods for iLife"
|
62
77
|
podspec_content = podspec_content.gsub!(empty_match, "#{empty_match} \n#{update_str}") # Pods for iLife
|
@@ -72,7 +87,6 @@ module Gct
|
|
72
87
|
u_db.query(u_sql)
|
73
88
|
|
74
89
|
system "gct robot podfile"
|
75
|
-
system "gct robot summary"
|
76
90
|
end
|
77
91
|
|
78
92
|
def edit_file(content)
|
@@ -37,7 +37,7 @@ module Gct
|
|
37
37
|
if @name.nil?
|
38
38
|
@name = @spec.name
|
39
39
|
end
|
40
|
-
@project_id = "#{
|
40
|
+
@project_id = "#{@group_name}/#{@name}"
|
41
41
|
super
|
42
42
|
end
|
43
43
|
|
@@ -80,7 +80,7 @@ module Gct
|
|
80
80
|
|
81
81
|
def check_ci
|
82
82
|
is_exist_ci = false
|
83
|
-
res = Gitlab.tree("#{
|
83
|
+
res = Gitlab.tree("#{@group_name}/#{@name}")
|
84
84
|
res.each do |g|
|
85
85
|
if g["name"].eql?('.gitlab-ci.yml')
|
86
86
|
is_exist_ci = true
|
@@ -94,10 +94,10 @@ module Gct
|
|
94
94
|
puts "正在检查CI文件".green
|
95
95
|
temp_local_file = TempLocalFile.new()
|
96
96
|
path = File.expand_path("../../init", __FILE__)
|
97
|
-
ci_content = temp_local_file.read_path_file(path, "
|
97
|
+
ci_content = temp_local_file.read_path_file(path, "#{@group_name}-ci.rb")
|
98
98
|
if check_ci
|
99
99
|
# 检查 ci 文件是否有变化
|
100
|
-
remote_content = file_contents("#{
|
100
|
+
remote_content = file_contents("#{@group_name}/#{@name}", '.gitlab-ci.yml', @update_version_branch)
|
101
101
|
remote_content.force_encoding('UTF-8')
|
102
102
|
strip_remote_content = remote_content.gsub(/\s/,'')
|
103
103
|
ci_content.force_encoding('UTF-8')
|
@@ -139,6 +139,17 @@ module Gct
|
|
139
139
|
raise "在 #{Dir.pwd} 目录下找不到podspec文件".red if spec_file.nil?
|
140
140
|
end
|
141
141
|
@spec = Pod::Specification.from_file(full_path)
|
142
|
+
# 取出组名
|
143
|
+
source = @spec.source[:git]
|
144
|
+
left1 = "https://gi-dev.ccrgt.com/"
|
145
|
+
left2 = "http://gi-dev.ccrgt.com/"
|
146
|
+
right = "/"
|
147
|
+
source_regex = /(?<=#{left1}|#{left2}).*(?=#{right})/
|
148
|
+
@group_name = source_regex.match(source).to_s
|
149
|
+
if @group_name.include?("/")
|
150
|
+
@group_name = @group_name.sub!("/", "")
|
151
|
+
end
|
152
|
+
raise "gitlab中找不到#{@spec.name}所在的group".red if @group_name.nil? || @group_name.empty?
|
142
153
|
spec_file
|
143
154
|
end
|
144
155
|
|
@@ -147,7 +158,7 @@ module Gct
|
|
147
158
|
podspec_content = file_contents(@project_id, @file, @update_version_branch)
|
148
159
|
version_regex = /.*version.*/
|
149
160
|
version_match = version_regex.match(podspec_content).to_s
|
150
|
-
tag_regex = /(?<=')\w.*(?=')/
|
161
|
+
tag_regex = /(?<="|')\w.*(?="|')/
|
151
162
|
tag = tag_regex.match(version_match)
|
152
163
|
@now_tag = tag
|
153
164
|
@new_tag = @tag || auto_add_tag(tag.to_s)
|
@@ -173,13 +184,13 @@ module Gct
|
|
173
184
|
|
174
185
|
def mr_to_master
|
175
186
|
puts "正在创建MR请求将#{@update_version_branch}分支合并到#{@update_to_branch}分支!".green
|
176
|
-
mr = Gitlab.create_merge_request("#{
|
187
|
+
mr = Gitlab.create_merge_request("#{@group_name}/#{@name}", "mr", { source_branch: "#{@update_version_branch}", target_branch: "#{@update_to_branch}" })
|
177
188
|
@id = mr.iid
|
178
189
|
puts mr.merge_status
|
179
190
|
isEmptyMR = mr.diff_refs.base_sha.eql?(mr.diff_refs.head_sha)
|
180
191
|
close_mr if isEmptyMR
|
181
192
|
if mr.merge_status == 'cannot_be_merged' && !isEmptyMR
|
182
|
-
raise "Merge有冲突,请前往 https://gi-dev.ccrgt.com/#{
|
193
|
+
raise "Merge有冲突,请前往 https://gi-dev.ccrgt.com/#{@group_name}/#{@name}/merge_requests/#{@id} 解决".red
|
183
194
|
end
|
184
195
|
isEmptyMR
|
185
196
|
end
|
data/lib/gct/gct_version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jieming
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -176,7 +176,8 @@ files:
|
|
176
176
|
- lib/gct/command/create/third.rb
|
177
177
|
- lib/gct/command/init.rb
|
178
178
|
- lib/gct/command/init/ci.rb
|
179
|
-
- lib/gct/command/init/
|
179
|
+
- lib/gct/command/init/ios-ci.rb
|
180
|
+
- lib/gct/command/init/ios-thirdpart-ci.rb
|
180
181
|
- lib/gct/command/init/unit.rb
|
181
182
|
- lib/gct/command/op.rb
|
182
183
|
- lib/gct/command/op/gems.rb
|
@@ -192,10 +193,15 @@ files:
|
|
192
193
|
- lib/gct/command/robot/finish.rb
|
193
194
|
- lib/gct/command/robot/podfile.rb
|
194
195
|
- lib/gct/command/robot/start.rb
|
195
|
-
- lib/gct/command/robot/summary.rb
|
196
196
|
- lib/gct/command/setup.rb
|
197
|
+
- lib/gct/command/skip.rb
|
198
|
+
- lib/gct/command/skip/modular.rb
|
199
|
+
- lib/gct/command/skip/tag.rb
|
197
200
|
- lib/gct/command/spec.rb
|
198
201
|
- lib/gct/command/spec/lint.rb
|
202
|
+
- lib/gct/command/unskip.rb
|
203
|
+
- lib/gct/command/unskip/modular.rb
|
204
|
+
- lib/gct/command/unskip/tag.rb
|
199
205
|
- lib/gct/command/update.rb
|
200
206
|
- lib/gct/command/update/analyze.rb
|
201
207
|
- lib/gct/command/update/dependency.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'net/https'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
module Gct
|
5
|
-
class Command
|
6
|
-
class Robot < Command
|
7
|
-
class Summary < Robot
|
8
|
-
|
9
|
-
self.summary = '汇总'
|
10
|
-
self.description = <<-DESC
|
11
|
-
汇总
|
12
|
-
DESC
|
13
|
-
|
14
|
-
self.arguments = [
|
15
|
-
]
|
16
|
-
|
17
|
-
def self.options
|
18
|
-
[
|
19
|
-
['--test', '测试机器人,测试webhook'],
|
20
|
-
].concat(super)
|
21
|
-
end
|
22
|
-
|
23
|
-
def initialize(argv)
|
24
|
-
@test = argv.flag?('test', false)
|
25
|
-
super
|
26
|
-
end
|
27
|
-
|
28
|
-
def run
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|