Class: Gct::Command::Update::Next
Instance Method Summary
collapse
#auto_add_tag, #check_branch_can_be_update, #config_gitlab, #current_branch, #file_contents, #get_project, #gitlab_error, options, run
Constructor Details
#initialize(argv) ⇒ Next
10
11
12
13
14
|
# File 'lib/gct/command/update/next.rb', line 10
def initialize(argv)
config_gitlab
@project_name = ENV['CI_PROJECT_NAME']
super
end
|
Instance Method Details
#batch_tag ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/gct/command/update/next.rb', line 33
def batch_tag
db = Database::Data.new
where_statement = "and is_pre = " + (@pre ? "1" : "0")
sql = "select * from tag where priority = (select MAX(priority) from tag where tag_status != '#{SpecPublishStatus::SUCCESS}' #{where_statement}) and project_version = '#{@version}'"
result = db.query(sql)
puts result.count
if result.count == 0
puts "tag已全部打完!!!".green
system "gct update podfile"
else
result.each do |row|
if row["tag_status"].eql?(SpecPublishStatus::WAITING) || row["tag_status"].eql?(SpecPublishStatus::CANCELED)
status = SpecPublishStatus::PENDING
name = row["pod_name"]
skip_tag = ""
if row["is_tag"].to_i == 1
skip_tag = "--skip-tag"
end
pre = ""
if row["is_pre"].to_i == 1
pre = "--pre"
end
system "gct update dependency #{name} tag_status #{status}"
system "gct update tag #{name} --auto-tag --update-ci #{skip_tag} #{pre}"
end
end
end
end
|
#run ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/gct/command/update/next.rb', line 16
def run
db = Database::Data.new
sql = "select * from project where is_done = 0 limit 1"
res = db.query(sql)
if !res.nil? && res.count > 0
res.each do |row|
@project_name = row["name"]
@branch = row["branch"]
@version = row["version"]
puts "pre is #{row["is_pre"].to_i == 1}"
@pre = row["is_pre"].to_i == 1
break
end
batch_tag
end
end
|