gct 0.3.93 → 0.3.95

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a90278a27edf99a940f703b359f26160c3534f51bb8e3ad7dc2b9af240209fe1
4
- data.tar.gz: 9a62537fadb1678a6d8c1969e1b487c844117b1e58c9089038ccc9bbcaba8328
3
+ metadata.gz: 3a66d72b82441d12f72050bcb612ada7ed56a250b6f647eb7e8828f126dc1285
4
+ data.tar.gz: 793399e10ac9879a19a6088808f184ba2f1496749bee1b0d113c836bafa71047
5
5
  SHA512:
6
- metadata.gz: acfa21c1c8cc42efc63f2d06fd49799146e8a17f6fcbcefc7480a9d2579db448280cdd78ea035bcb9906ab0facaa00926452fe429f7733c35c54b035ca6c411d
7
- data.tar.gz: feafb9b42ecdbc68b5dd91ef4415ebb6d0b0f871a0e70f11fe49537ecfa1319ad282bf1dca09c5c42974ff203c6123dbb3a0bf78b3c749657f0be9fcfff9801c
6
+ metadata.gz: d9d2b0c7d925ec5f9fcb175615d87c9ca9440b836a003449d9afd70e295c46c6ea3ab91223b2cd4d98bef5c0d326c26c179bd1a9962754665a548aec9ae23138
7
+ data.tar.gz: ea22f65f15803aefaed9e8b447c9d113dc93d78409aa6af4de2c004ca218a1c3057d907af0d17ab6272a25cac976bf8f8a1f83d529e5d05299f5ba66e67b7529
@@ -27,6 +27,7 @@ module Gct
27
27
  require 'gct/command/setup'
28
28
  require 'gct/command/update'
29
29
  require 'gct/command/robot'
30
+ require 'gct/command/clean'
30
31
 
31
32
  self.abstract_command = true
32
33
  self.command = 'gct'
@@ -0,0 +1,15 @@
1
+ require 'gct/command/clean/cache'
2
+ require 'gct/command/clean/ci'
3
+ require 'gct/command/clean/lint'
4
+
5
+ module Gct
6
+ class Command
7
+ class Clean < Command
8
+ self.abstract_command = true
9
+ self.summary = '清理缓存的相关操作'
10
+ self.description = <<-DESC
11
+ 清理lint缓存,Xcode build缓存,ci build 缓存
12
+ DESC
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,26 @@
1
+ module Gct
2
+ class Command
3
+ class Clean < Command
4
+ class Cache < Clean
5
+
6
+ self.summary = '清理Xcode build缓存'
7
+ self.description = <<-DESC
8
+ 清理Xcode build缓存
9
+ DESC
10
+
11
+ def initialize(argv)
12
+
13
+ super
14
+ end
15
+
16
+ def run
17
+ home_path = Generator::GctFile.get_system_home_path().rstrip
18
+ xcache_path = "#{home_path}/Library/Developer/Xcode/DerivedData/"
19
+ `rm -rf #{xcache_path}`
20
+ end
21
+
22
+
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,23 @@
1
+ module Gct
2
+ class Command
3
+ class Clean < Command
4
+ class Ci < Clean
5
+
6
+ self.summary = '清除ci缓存'
7
+ self.description = <<-DESC
8
+ 清除ci缓存,默认清除所有
9
+ DESC
10
+
11
+ self.arguments = [
12
+ CLAide::Argument.new('POD_NAME', false),
13
+ ]
14
+
15
+ def initialize(argv)
16
+ super
17
+ end
18
+
19
+
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ module Gct
2
+ class Command
3
+ class Clean < Command
4
+ class Lint < Clean
5
+
6
+ self.summary = '清除lint缓存'
7
+ self.description = <<-DESC
8
+ 清除lint缓存,默认清除所有
9
+ DESC
10
+
11
+ self.arguments = [
12
+ CLAide::Argument.new('POD_NAME', false),
13
+ ]
14
+
15
+ def initialize(argv)
16
+ @pod_name = argv.shift_argument
17
+ super
18
+ end
19
+
20
+ def run
21
+ home_path = Generator::GctFile.get_system_home_path().rstrip
22
+ lintcahce_path = "#{home_path}/Library/Caches/CocoaPods/Pods/External/#{@pod_name}"
23
+ `rm -rf #{lintcahce_path}`
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -7,6 +7,7 @@ push_pod:
7
7
  script:
8
8
  - gct robot start
9
9
  - echo "开始lint 和 push podspec"
10
+ - gct clean lint $CI_PROJECT_NAME
10
11
  - gct repo update
11
12
  - gct repo push
12
13
  - gct robot finish true
@@ -20,5 +21,7 @@ on_failure:
20
21
  script:
21
22
  - gct robot finish false
22
23
  when: on_failure
24
+ only:
25
+ - tags
23
26
  tags:
24
27
  - iOS
@@ -2,6 +2,7 @@ require 'gct/command/op/gems'
2
2
  require 'gct/command/op/gitconf'
3
3
  require 'gct/command/op/xcache'
4
4
  require 'gct/command/op/root'
5
+ require 'gct/command/op/lint'
5
6
 
6
7
  module Gct
7
8
  class Command
@@ -0,0 +1,35 @@
1
+ module Gct
2
+ class Command
3
+ class Op < Command
4
+ class Lint < Op
5
+
6
+ self.summary = '打开lint 缓存文件夹'
7
+ self.description = <<-DESC
8
+ 打开lint 缓存文件夹
9
+ DESC
10
+
11
+ self.arguments = [
12
+ ]
13
+
14
+ def initialize(argv)
15
+ super
16
+ end
17
+
18
+ def validate!
19
+ super
20
+ end
21
+
22
+ def run
23
+ openLintCache
24
+ end
25
+
26
+ def openLintCache
27
+ lintCache = '~/Library/Caches/CocoaPods/Pods/External/'
28
+ puts "Xcode缓存路径为:#{lintCache}".green
29
+ system "open #{lintCache}"
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+
@@ -33,6 +33,7 @@ module Gct
33
33
  end
34
34
 
35
35
  def run
36
+ puts "build_status == #{@build_status}"
36
37
  build_text = @build_status ? "<font color=\"info\">CI运行成功</font>" : "<font color=\"comment\">CI运行失败</font>,请相关人员注意"
37
38
  ci_text = "[点击跳转](#{@ci_url})"
38
39
 
@@ -31,7 +31,7 @@ module Gct
31
31
  @project_id = "#{Constant.NameSpace}#{@name}"
32
32
  super
33
33
  end
34
-
34
+
35
35
  def run
36
36
  update_ci_method if @update_ci
37
37
  if @skip_tag
@@ -44,8 +44,17 @@ module Gct
44
44
  def skip_tag_method
45
45
  @new_tag = @spec.version
46
46
  puts "tag == #{@new_tag}"
47
- delete_tag # remove tag
48
- create_tag # create tag
47
+ if !@update_ci
48
+ isEmptyMR = mr_to_master
49
+ if !isEmptyMR
50
+ accept_merge_request
51
+ end
52
+ end
53
+ # remove tag
54
+ `git tag -d #{@new_tag}`
55
+ `git push origin :refs/tags/#{@new_tag}`
56
+ # create tag
57
+ create_tag
49
58
  end
50
59
 
51
60
  def update_ci_method
@@ -54,8 +63,10 @@ module Gct
54
63
  path = File.expand_path("../../init", __FILE__)
55
64
  ci_content = temp_local_file.read_path_file(path, "gitlab-ci.rb")
56
65
  edit_file('.gitlab-ci.yml', ci_content, 'update ci')
57
- mr_to_master
58
- accept_merge_request
66
+ isEmptyMR = mr_to_master
67
+ if !isEmptyMR
68
+ accept_merge_request
69
+ end
59
70
  end
60
71
 
61
72
  def get_spec_file
@@ -90,12 +101,18 @@ module Gct
90
101
 
91
102
  def mr_to_master
92
103
  puts "正在创建MR请求将develop分支合并到master!".green
93
- mr = Gitlab.create_merge_request("#{Constant.NameSpace}#{@name}", "更新版本podpesc版本号", { source_branch: "#{@update_version_branch}", target_branch: 'master' })
104
+ mr = Gitlab.create_merge_request("#{Constant.NameSpace}#{@name}", "mr", { source_branch: "#{@update_version_branch}", target_branch: 'master' })
105
+ # puts mr.to_hash
94
106
  @id = mr.iid
95
107
  puts mr.merge_status
96
- if mr.merge_status == 'cannot_be_merged'
108
+ isEmptyMR = mr.diff_refs.base_sha.eql?(mr.diff_refs.head_sha)
109
+ # puts mr.diff_refs.base_sha
110
+ # puts mr.diff_refs.head_sha
111
+ close_mr if isEmptyMR
112
+ if mr.merge_status == 'cannot_be_merged' && !isEmptyMR
97
113
  raise "Merge有冲突,请前往 https://gi-dev.ccrgt.com/#{Constant.NameSpace}#{@name}/merge_requests/#{@id} 解决".red
98
114
  end
115
+ isEmptyMR
99
116
  end
100
117
 
101
118
  def accept_merge_request
@@ -105,8 +122,8 @@ module Gct
105
122
  end
106
123
  end
107
124
 
108
- def delete_tag
109
- Gitlab.delete_tag("#{@project_id}", "#{@new_tag}")
125
+ def close_mr
126
+ Gitlab.update_merge_request("#{@project_id}", @id, {state_event: 'close'})
110
127
  end
111
128
 
112
129
  def create_tag
@@ -2,5 +2,5 @@ module Gct
2
2
  # freeze 冻结对象,将对象变成一个常量
3
3
  # unless 右边的代码块成立,才会运行左边的代码块
4
4
  # defined? 是用来判断本地变量是否存在,也可用来判断是否存在方法
5
- VERSION = "0.3.93".freeze unless defined? Gct::VERSION
5
+ VERSION = "0.3.95".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.3.93
4
+ version: 0.3.95
5
5
  platform: ruby
6
6
  authors:
7
7
  - jieming
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-29 00:00:00.000000000 Z
11
+ date: 2020-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -149,6 +149,10 @@ files:
149
149
  - lib/gct/command/autotag.rb
150
150
  - lib/gct/command/build.rb
151
151
  - lib/gct/command/build/r.rb
152
+ - lib/gct/command/clean.rb
153
+ - lib/gct/command/clean/cache.rb
154
+ - lib/gct/command/clean/ci.rb
155
+ - lib/gct/command/clean/lint.rb
152
156
  - lib/gct/command/config.rb
153
157
  - lib/gct/command/config/get.rb
154
158
  - lib/gct/command/config/set.rb
@@ -163,6 +167,7 @@ files:
163
167
  - lib/gct/command/op.rb
164
168
  - lib/gct/command/op/gems.rb
165
169
  - lib/gct/command/op/gitconf.rb
170
+ - lib/gct/command/op/lint.rb
166
171
  - lib/gct/command/op/root.rb
167
172
  - lib/gct/command/op/xcache.rb
168
173
  - lib/gct/command/repo.rb
@@ -204,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
209
  - !ruby/object:Gem::Version
205
210
  version: '0'
206
211
  requirements: []
207
- rubygems_version: 3.0.8
212
+ rubygems_version: 3.0.3
208
213
  signing_key:
209
214
  specification_version: 4
210
215
  summary: '"gct ios 自动化脚本工具"'