gct 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85d233d1ecbfa999c4a14aa6b4e74aa9276640a5817c3004062f828e2f5177ba
4
- data.tar.gz: 3cf89d2442c723781e7810d2956103dea691dc1d9915b7acb19130e716126d81
3
+ metadata.gz: 95e191b1ed5ae2ce3b7cb3c7801ed0902d300ee77a19cfcc1ce455630a1f47b8
4
+ data.tar.gz: 4c6d74e11b168ebe5a5629ff6ea647f23fb7c28a26442224ef05c27e3b83e7d6
5
5
  SHA512:
6
- metadata.gz: e26e73e2887621b495507797954db5d162cd76a0a145ae0213e2e21bf9661f248e6808bdc895aaa62902b5310e52bb9972c5b31b53fc1f0f34d84d1871e90a39
7
- data.tar.gz: 0fa751f79b5dbf67ca993e0c9eae29d122b028628ab919f71ab56de9a75caa99f095f52f2f58b046916145b2e169bede3eb149d5bfeca83e412c277e67e50df3
6
+ metadata.gz: 3049ea6bc870721c728a226f8e07465ffe7b7d919a9a2aa1cfeab750d7f6aabf0eb6fd38a9b630962988a7acdb0beb0c973d90319d50ca7818ca16fb12deb351
7
+ data.tar.gz: ab44e1b3569ec632f1da15c3d904eff2f50eab20104ac1219d6665e322d91fae4ac828e7331d21f149a10c376dcebdc164d915be7682e8bf49c7a3d746bb38aa
@@ -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'
@@ -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}"
@@ -78,9 +85,16 @@ module Gct
78
85
  end
79
86
  end
80
87
 
81
- def check_branch(branch)
82
- ret = @branch.include?(branch)
83
- raise "当前不是发布分支".red if !ret
88
+ def check_remote_branch
89
+ remote_branches = Gitlab.branches(@project_id, per_page: 1000)
90
+ branches = Array.new()
91
+ remote_branches.each do |item|
92
+ hash_branch = item.to_hash
93
+ branch_name = hash_branch["name"]
94
+ branches.push(branch_name)
95
+ end
96
+ is_exist_branch = branches.include?(@branch)
97
+ is_exist_branch
84
98
  end
85
99
 
86
100
  def podfile
@@ -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:
@@ -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
- puts "pod 命令为:pod repo push iOSCRGTPodSource --sources=#{Constant.GitURL}iOSCRGTPodSource.git --verbose --skip-import-validation --use-libraries --allow-warnings --use-modular-headers".green
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 "pod repo push iOSCRGTPodSource --sources=#{Constant.GitURL}iOSCRGTPodSource.git --verbose --skip-import-validation --use-libraries --allow-warnings --use-modular-headers", exception: true
40
+ system "#{command_code}", exception: true
30
41
  end
31
42
  end
32
43
  end
@@ -1,7 +1,6 @@
1
1
  require 'gct/command/robot/start'
2
2
  require 'gct/command/robot/finish'
3
3
  require 'gct/command/robot/podfile'
4
- require 'gct/command/robot/summary'
5
4
  require 'net/https'
6
5
  require 'json'
7
6
 
@@ -0,0 +1,14 @@
1
+ require 'gct/command/skip/modular'
2
+ require 'gct/command/skip/tag'
3
+
4
+ module Gct
5
+ class Command
6
+ class Skip < 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 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
@@ -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)
@@ -2,5 +2,5 @@ module Gct
2
2
  # freeze 冻结对象,将对象变成一个常量
3
3
  # unless 右边的代码块成立,才会运行左边的代码块
4
4
  # defined? 是用来判断本地变量是否存在,也可用来判断是否存在方法
5
- VERSION = "0.5.4".freeze unless defined? Gct::VERSION
5
+ VERSION = "0.5.5".freeze unless defined? Gct::VERSION
6
6
  end
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
4
+ version: 0.5.5
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-11 00:00:00.000000000 Z
11
+ date: 2020-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -192,10 +192,15 @@ files:
192
192
  - lib/gct/command/robot/finish.rb
193
193
  - lib/gct/command/robot/podfile.rb
194
194
  - lib/gct/command/robot/start.rb
195
- - lib/gct/command/robot/summary.rb
196
195
  - lib/gct/command/setup.rb
196
+ - lib/gct/command/skip.rb
197
+ - lib/gct/command/skip/modular.rb
198
+ - lib/gct/command/skip/tag.rb
197
199
  - lib/gct/command/spec.rb
198
200
  - lib/gct/command/spec/lint.rb
201
+ - lib/gct/command/unskip.rb
202
+ - lib/gct/command/unskip/modular.rb
203
+ - lib/gct/command/unskip/tag.rb
199
204
  - lib/gct/command/update.rb
200
205
  - lib/gct/command/update/analyze.rb
201
206
  - lib/gct/command/update/dependency.rb
@@ -230,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
235
  - !ruby/object:Gem::Version
231
236
  version: '0'
232
237
  requirements: []
233
- rubygems_version: 3.0.8
238
+ rubygems_version: 3.0.3
234
239
  signing_key:
235
240
  specification_version: 4
236
241
  summary: '"gct ios 自动化脚本工具"'
@@ -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