Class: Gct::Command::Robot::Start

Inherits:
Gct::Command::Robot show all
Defined in:
lib/gct/command/robot/start.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Gct::Command::Robot

#robot_send

Methods inherited from Gct::Command

#auto_add_tag, #check_branch_can_be_update, #config_gitlab, #current_branch, #file_contents, #get_project, #gitlab_error, run

Constructor Details

#initialize(argv) ⇒ Start

Returns a new instance of Start.



23
24
25
26
27
28
# File 'lib/gct/command/robot/start.rb', line 23

def initialize(argv)
  @project_name = ENV['CI_PROJECT_NAME']
  @tag = ENV['CI_COMMIT_REF_NAME']
  @test = argv.flag?('test', false)
  super
end

Class Method Details

.optionsObject



17
18
19
20
21
# File 'lib/gct/command/robot/start.rb', line 17

def self.options
  [
    ['--test', '测试机器人,测试webhook'],
  ].concat(super)
end

Instance Method Details

#runObject



30
31
32
33
34
# File 'lib/gct/command/robot/start.rb', line 30

def run
  message = " <font color=\"info\">#{@tag}</font>  开始打tag"
  content = "**#{@project_name}** #{message}"
  robot_send(content)
end