Class: Gct::Command::Update::Dependency

Inherits:
Gct::Command::Update show all
Defined in:
lib/gct/command/update/dependency.rb

Instance Method Summary collapse

Methods inherited from Gct::Command

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

Constructor Details

#initialize(argv) ⇒ Dependency

Returns a new instance of Dependency.



18
19
20
21
22
23
# File 'lib/gct/command/update/dependency.rb', line 18

def initialize(argv)
  @pod_name = argv.shift_argument
  @field = argv.shift_argument
  @value = argv.shift_argument
  super
end

Instance Method Details

#runObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/gct/command/update/dependency.rb', line 29

def run
  db = Database::Data.new
  set_val = ""
  if (@field.eql?("tag_version"))
    set_val = "t.#{@field} = '#{@value}', t.tag_status = '#{SpecPublishStatus::SUCCESS}'"
  else 
    set_val = "t.#{@field} = '#{@value}'"
  end
  sql = "update tag t left join project p on t.project_version = p.version set #{set_val} where t.pod_name = '#{@pod_name}' and p.is_done = 0"
  db.query(sql)
end

#validate!Object



25
26
27
# File 'lib/gct/command/update/dependency.rb', line 25

def validate!
    super
end