Class: Gct::Command::Robot::Podfile

Inherits:
Gct::Command::Robot show all
Defined in:
lib/gct/command/robot/podfile.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) ⇒ Podfile

Returns a new instance of Podfile.



23
24
25
26
27
28
# File 'lib/gct/command/robot/podfile.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/podfile.rb', line 17

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

Instance Method Details

#runObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/gct/command/robot/podfile.rb', line 30

def run
  db = Database::Data.new
  sql = "select * from project where is_done = 1 order by create_time DESC limit 1"
  res = db.query(sql)
  message = "<font color=\"info\">podfile 更新完毕</font>"
  if !res.nil? && res.count > 0 
    res.each do |row|
      branch = row["branch"]
      message = "<font color=\"info\">#{branch} podfile 更新完毕</font>"
    end
  end
  
  content = "#{message}"
  robot_send(content)
end