gct 0.3.92 → 0.3.93

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: f56c709eefbd77dd98e8a28edc0843b6aa03b6736a4d5c395b7e5ebbdb788dba
4
- data.tar.gz: 53e1af2275b00d0aa11a83199f9d830ac63559f99a9f63fb046f63ca8e5dfb93
3
+ metadata.gz: a90278a27edf99a940f703b359f26160c3534f51bb8e3ad7dc2b9af240209fe1
4
+ data.tar.gz: 9a62537fadb1678a6d8c1969e1b487c844117b1e58c9089038ccc9bbcaba8328
5
5
  SHA512:
6
- metadata.gz: 898c5d910ceec03da053813748b246121ff5cc379910f4b86ebf1ef5ab46096a7e86e8c7cf2e9dba381abe29c138dc263be5fd49a54a42b130562bc0ed8ce184
7
- data.tar.gz: ec2228784c42ac7bf0ef80e1a7e422e9c1f9f2df630350febf66a04bf49411f3aa8a61f85e453f226ff0cf77160b9d220ad8e2b6382a90243d9eae29649450f0
6
+ metadata.gz: acfa21c1c8cc42efc63f2d06fd49799146e8a17f6fcbcefc7480a9d2579db448280cdd78ea035bcb9906ab0facaa00926452fe429f7733c35c54b035ca6c411d
7
+ data.tar.gz: feafb9b42ecdbc68b5dd91ef4415ebb6d0b0f871a0e70f11fe49537ecfa1319ad282bf1dca09c5c42974ff203c6123dbb3a0bf78b3c749657f0be9fcfff9801c
@@ -15,6 +15,12 @@ module Gct
15
15
  CLAide::Argument.new('BUILD_STATUS', true),
16
16
  ]
17
17
 
18
+ def self.options
19
+ [
20
+ ['--test', '测试机器人,测试webhook'],
21
+ ].concat(super)
22
+ end
23
+
18
24
  def initialize(argv)
19
25
  @project_name = ENV['CI_PROJECT_NAME']
20
26
  @user_name = ENV['GITLAB_USER_NAME']
@@ -22,6 +28,7 @@ module Gct
22
28
  @build_status = argv.shift_argument
23
29
  @commit_sha = ENV['CI_COMMIT_SHA']
24
30
  @ci_url = ENV['CI_PIPELINE_URL']
31
+ @test = argv.flag?('test', false)
25
32
  super
26
33
  end
27
34
 
@@ -29,7 +36,12 @@ module Gct
29
36
  build_text = @build_status ? "<font color=\"info\">CI运行成功</font>" : "<font color=\"comment\">CI运行失败</font>,请相关人员注意"
30
37
  ci_text = "[点击跳转](#{@ci_url})"
31
38
 
32
- webhook = FileBase.get_config("gitlab-robot-webhook")
39
+ if @test
40
+ webhook = FileBase.get_config("gitlab-robot-webhook-test")
41
+ elsif
42
+ webhook = FileBase.get_config("gitlab-robot-webhook")
43
+ end
44
+ raise "请先设置webhook --> gct config set gitlab-robot-webhook WEBHOOK_URL" if webhook.nil? || webhook.empty?
33
45
  url = URI(webhook)
34
46
 
35
47
  http = Net::HTTP.new(url.host, url.port)
@@ -14,14 +14,25 @@ module Gct
14
14
  self.arguments = [
15
15
  ]
16
16
 
17
+ def self.options
18
+ [
19
+ ['--test', '测试机器人,测试webhook'],
20
+ ].concat(super)
21
+ end
22
+
17
23
  def initialize(argv)
18
24
  @project_name = ENV['CI_PROJECT_NAME']
19
25
  @tag = ENV['CI_COMMIT_REF_NAME']
26
+ @test = argv.flag?('test', false)
20
27
  super
21
28
  end
22
29
 
23
30
  def run
24
- webhook = FileBase.get_config("gitlab-robot-webhook")
31
+ if @test
32
+ webhook = FileBase.get_config("gitlab-robot-webhook-test")
33
+ elsif
34
+ webhook = FileBase.get_config("gitlab-robot-webhook")
35
+ end
25
36
  raise "请先设置webhook --> gct config set gitlab-robot-webhook WEBHOOK_URL" if webhook.nil? || webhook.empty?
26
37
  url = URI(webhook)
27
38
 
@@ -2,5 +2,5 @@ module Gct
2
2
  # freeze 冻结对象,将对象变成一个常量
3
3
  # unless 右边的代码块成立,才会运行左边的代码块
4
4
  # defined? 是用来判断本地变量是否存在,也可用来判断是否存在方法
5
- VERSION = "0.3.92".freeze unless defined? Gct::VERSION
5
+ VERSION = "0.3.93".freeze unless defined? Gct::VERSION
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.92
4
+ version: 0.3.93
5
5
  platform: ruby
6
6
  authors:
7
7
  - jieming
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
204
  - !ruby/object:Gem::Version
205
205
  version: '0'
206
206
  requirements: []
207
- rubygems_version: 3.0.3
207
+ rubygems_version: 3.0.8
208
208
  signing_key:
209
209
  specification_version: 4
210
210
  summary: '"gct ios 自动化脚本工具"'