Class: Gct::Command::Update::Next
- Inherits:
-
Gct::Command::Update
- Object
- CLAide::Command
- Gct::Command
- Gct::Command::Update
- Gct::Command::Update::Next
- Defined in:
- lib/gct/command/update/next.rb
Instance Method Summary collapse
- #batch_tag ⇒ Object
-
#initialize(argv) ⇒ Next
constructor
A new instance of Next.
- #run ⇒ Object
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) ⇒ Next
Returns a new instance of 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 # 查询优先级最高的为完成打tag的数据 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 # 执行更新podfile的操作 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 |