Class: SFlow::SFlow
- Inherits:
-
Object
- Object
- SFlow::SFlow
- Extended by:
- TtyIntegration
- Defined in:
- lib/sflow/sflow.rb
Class Method Summary collapse
- .bugfix_codereview(branch_name) ⇒ Object
- .bugfix_finish(branch_name) ⇒ Object
- .bugfix_reintegration(branch_name) ⇒ Object
- .bugfix_staging(branch_name) ⇒ Object
- .bugfix_start(external_id_ref, branch_description, parent_branch_name = nil) ⇒ Object
- .call ⇒ Object
- .codereview(branch_name) ⇒ Object
- .feature_codereview(branch_name) ⇒ Object
- .feature_finish(branch_name) ⇒ Object
- .feature_reintegration(branch_name) ⇒ Object
- .feature_staging(branch_name) ⇒ Object
- .feature_start(external_id_ref, branch_description, parent_branch_name = nil) ⇒ Object
- .hotfix_finish(branch_name) ⇒ Object
- .hotfix_reintegration(branch_name) ⇒ Object
- .hotfix_staging(branch_name) ⇒ Object
- .hotfix_start(external_id_ref, branch_description, parent_branch_name = nil) ⇒ Object
- .push_ ⇒ Object
- .push_origin ⇒ Object
- .reintegration(type = 'feature', branch_name) ⇒ Object
- .release_finish(branch_name) ⇒ Object
- .release_start ⇒ Object
- .set_error(e) ⇒ Object
- .staging(branch_name) ⇒ Object
- .start(branch, issue, ref_branch = $GIT_BRANCH_DEVELOP, parent_branch_name) ⇒ Object
- .validates ⇒ Object
Methods included from TtyIntegration
bar, cmd, error, green, pastel, prompt, red, success, table, yellow
Class Method Details
.bugfix_codereview(branch_name) ⇒ Object
150 151 152 153 154 |
# File 'lib/sflow/sflow.rb', line 150 def self.bugfix_codereview(branch_name) raise 'A branch informada não é do tipo bugfix' unless branch_name.match(%r{-bugfix/}) codereview(branch_name) end |
.bugfix_finish(branch_name) ⇒ Object
128 129 130 |
# File 'lib/sflow/sflow.rb', line 128 def self.bugfix_finish(branch_name) bugfix_reintegration branch_name end |
.bugfix_reintegration(branch_name) ⇒ Object
120 121 122 123 124 125 126 |
# File 'lib/sflow/sflow.rb', line 120 def self.bugfix_reintegration(branch_name) raise 'A branch informada não é do tipo bugfix' unless branch_name.match(%r{-bugfix/}) @@bar = ('Processando ') @@bar.start reintegration 'bugfix', branch_name end |
.bugfix_staging(branch_name) ⇒ Object
162 163 164 165 166 |
# File 'lib/sflow/sflow.rb', line 162 def self.bugfix_staging(branch_name) raise 'A branch informada não é do tipo bugfix' unless branch_name.match(%r{-bugfix/}) staging branch_name end |
.bugfix_start(external_id_ref, branch_description, parent_branch_name = nil) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/sflow/sflow.rb', line 72 def self.bugfix_start(external_id_ref, branch_description, parent_branch_name = nil) @@bar = ('Processando ') @@bar.start 2.times do sleep(0.2) @@bar.advance end parent_issue_id = parent_branch_name.to_s.match(/^(\d*)-/).to_a.last parent_issue_id_formated = "-##{parent_issue_id}" if parent_branch_name title = '' title += "(##{parent_issue_id}) " if parent_branch_name title += branch_description || external_id_ref issue = GitLab::Issue.new(title: title, labels: ['bugfix']) issue.create branch = "#{issue.iid}-bugfix/#{external_id_ref}#{parent_issue_id_formated}" start(branch, issue, $GIT_BRANCH_DEVELOP, parent_branch_name) end |
.call ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/sflow/sflow.rb', line 38 def self.call system('clear') Config.init # prompt.ok("GitSflow #{VERSION}") box = TTY::Box.frame align: :center, width: TTY::Screen.width, height: 4, title: { bottom_right: pastel.cyan("(v#{VERSION})") } do pastel.green('GitSflow') end print box validates Menu.new.principal rescue StandardError => e set_error e end |
.codereview(branch_name) ⇒ Object
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 |
# File 'lib/sflow/sflow.rb', line 588 def self.codereview(branch_name) Git.checkout $GIT_BRANCH_DEVELOP source_branch = branch_name issue_id = branch_name.to_s.match(/^(\d*)-/).to_a.last issue = GitLab::Issue.find_by_id issue_id # issue.move mr = GitLab::MergeRequest.new( source_branch: source_branch, target_branch: $GIT_BRANCH_DEVELOP, issue_iid: issue.iid ) mr.create_code_review issue.labels = (issue.obj_gitlab['labels'] + ['code_review']).uniq issue.update end |
.feature_codereview(branch_name) ⇒ Object
144 145 146 147 148 |
# File 'lib/sflow/sflow.rb', line 144 def self.feature_codereview(branch_name) raise 'A branch informada não é do tipo feature' unless branch_name.match(%r{-feature/}) codereview(branch_name) end |
.feature_finish(branch_name) ⇒ Object
108 109 110 |
# File 'lib/sflow/sflow.rb', line 108 def self.feature_finish(branch_name) feature_reintegration branch_name end |
.feature_reintegration(branch_name) ⇒ Object
112 113 114 115 116 117 118 |
# File 'lib/sflow/sflow.rb', line 112 def self.feature_reintegration(branch_name) raise 'A branch informada não é do tipo feature' unless branch_name.match(%r{-feature/}) @@bar = ('Processando ') @@bar.start reintegration 'feature', branch_name end |
.feature_staging(branch_name) ⇒ Object
168 169 170 171 172 |
# File 'lib/sflow/sflow.rb', line 168 def self.feature_staging(branch_name) raise 'A branch informada não é do tipo feature' unless branch_name.match(%r{-feature/}) staging branch_name end |
.feature_start(external_id_ref, branch_description, parent_branch_name = nil) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/sflow/sflow.rb', line 53 def self.feature_start(external_id_ref, branch_description, parent_branch_name = nil) @@bar = ('Processando ') @@bar.start 2.times do sleep(0.2) @@bar.advance end parent_issue_id = parent_branch_name.to_s.match(/^(\d*)-/).to_a.last parent_issue_id_formated = "-##{parent_issue_id}" if parent_branch_name title = '' title += "(##{parent_issue_id}) " if parent_branch_name title += branch_description || external_id_ref issue = GitLab::Issue.new(title: title, labels: ['feature']) issue.create branch = "#{issue.iid}-feature/#{external_id_ref}#{parent_issue_id_formated}" start(branch, issue, $GIT_BRANCH_DEVELOP, parent_branch_name) end |
.hotfix_finish(branch_name) ⇒ Object
140 141 142 |
# File 'lib/sflow/sflow.rb', line 140 def self.hotfix_finish(branch_name) hotfix_reintegration branch_name end |
.hotfix_reintegration(branch_name) ⇒ Object
132 133 134 135 136 137 138 |
# File 'lib/sflow/sflow.rb', line 132 def self.hotfix_reintegration(branch_name) raise 'A branch informada não é do tipo hotfix' unless branch_name.match(%r{-hotfix/}) @@bar = ('Processando ') @@bar.start reintegration 'hotfix', branch_name end |
.hotfix_staging(branch_name) ⇒ Object
156 157 158 159 160 |
# File 'lib/sflow/sflow.rb', line 156 def self.hotfix_staging(branch_name) raise 'A branch informada não é do tipo hotfix' unless branch_name.match(%r{-hotfix/}) staging branch_name end |
.hotfix_start(external_id_ref, branch_description, parent_branch_name = nil) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/sflow/sflow.rb', line 90 def self.hotfix_start(external_id_ref, branch_description, parent_branch_name = nil) @@bar = ('Processando ') @@bar.start 2.times do sleep(0.2) @@bar.advance end parent_issue_id = parent_branch_name.to_s.match(/^(\d*)-/).to_a.last parent_issue_id_formated = "-##{parent_issue_id}" if parent_branch_name title = '' title += "(##{parent_issue_id}) " if parent_branch_name title += branch_description || external_id_ref issue = GitLab::Issue.new(title: title, labels: %w[hotfix production]) issue.create branch = "#{issue.iid}-hotfix/#{external_id_ref}#{parent_issue_id_formated}" start(branch, issue, $GIT_BRANCH_MASTER, parent_branch_name) end |
.push_ ⇒ Object
390 391 392 |
# File 'lib/sflow/sflow.rb', line 390 def self.push_ push_origin end |
.push_origin ⇒ Object
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/sflow/sflow.rb', line 394 def self.push_origin branch = !branch_name ? Git.execute { 'git branch --show-current' } : branch_name branch.delete!("\n") = Git.log_last_changes branch issue_id = branch_name.to_s.match(/^(\d*)-/).to_a.last issue = GitLab::Issue.find_by_id issue_id Git.push branch if != '' print "Send messages commit for issue\n".yellow issue.add_comment() end remove_labels = $GIT_BRANCHES_STAGING + ['Staging', $GITLAB_NEXT_RELEASE_LIST] old_labels = issue.obj_gitlab['labels'] old_labels.delete_if { |label| remove_labels.include? label } issue.labels = old_labels + ['Doing'] issue.update print "Success!\n\n".yellow end |
.reintegration(type = 'feature', branch_name) ⇒ Object
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
# File 'lib/sflow/sflow.rb', line 480 def self.reintegration(type = 'feature', branch_name) # Git.fetch ref_branch # Git.checkout ref_branch # Git.pull ref_branch source_branch = branch_name has_parent_branch = branch_name.match?(/-#\d*/) issue_id = branch_name.to_s.match(/^(\d*)-/).to_a.last issue = GitLab::Issue.find_by_id issue_id 2.times do sleep(0.2) @@bar.advance end if has_parent_branch parent_issue_id = branch_name.match(/-#(\d*)/)[1] parent_issue = GitLab::Issue.find_by_id parent_issue_id branchs_list = Git.execute { "git ls-remote --heads --refs | awk '{print $2}'" } branchs_list = branchs_list.gsub('refs/heads/', '').split("\n") - ($GIT_BRANCHES_STAGING + [$GIT_BRANCH_MASTER, $GIT_BRANCH_DEVELOP]) parent_branch = branchs_list.detect { |i| i.match?(/^#{parent_issue_id}-*/) } target_branch = parent_branch Git.reset_hard target_branch, target_branch @@bar.advance Git.merge branch_name, target_branch @@bar.advance Git.push target_branch @@bar.advance issue.close parent_issue.description += "\n* finalizada: ##{issue_id}" parent_issue.update success("\nFoi realizado o MERGE da branch #{branch_name} \ncom a branch pai #{target_branch}.\n\nA branch #{branch_name} e issue associada foram fechadas.") else # Setting Changelog # print "Title: #{issue.title}\n\n" # print "CHANGELOG message:\n--> ".yellow @@bar.finish = prompt.ask('Informe a mensagem de CHANGELOG:', require: true, default: issue.title) # message_changelog = STDIN.gets.chomp.to_s.encode('UTF-8') # print "\n ok!\n\n".green new_labels = [] if type == 'hotfix' begin !source_branch.match('hotfix') rescue StandardError raise 'Branch inválida!' end new_labels << 'hotfix' new_labels << 'urgent' else begin (!source_branch.match('feature') && !source_branch.match('bugfix')) rescue StandardError raise 'invalid branch!' end end remove_labels = $GIT_BRANCHES_STAGING + $GITLAB_LISTS + ['Staging'] new_labels << 'changelog' new_labels << $GITLAB_NEXT_RELEASE_LIST old_labels = issue.obj_gitlab['labels'] old_labels.delete_if { |label| remove_labels.include? label } issue.labels = (old_labels + new_labels).uniq issue.description.gsub!(/\* ~changelog .*\n?/, '') issue.description = "#{issue.description} \n* ~changelog #{}" # Setting Tasks tasks = prompt.ask('Informe a lista de scripts ou tasks (opcional):') issue.update success("#{branch_name} foi finalizada e transferida por #{$GITLAB_NEXT_RELEASE_LIST} com sucesso!") end end |
.release_finish(branch_name) ⇒ Object
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/sflow/sflow.rb', line 350 def self.release_finish(branch_name) version = branch_name.gsub(/(.*)\//, '') new_labels = [] issue_release = GitLab::Issue.find_by_branch(branch_name) Git.merge issue_release.branch, $GIT_BRANCH_DEVELOP Git.push $GIT_BRANCH_DEVELOP type = issue_release.labels.include?('hotfix') ? 'hotfix' : nil mr_master = GitLab::MergeRequest.new( source_branch: issue_release.branch, target_branch: $GIT_BRANCH_MASTER, issue_iid: issue_release.iid, title: "Reintegration release #{version}: #{issue_release.branch} into #{$GIT_BRANCH_MASTER}", description: "Closes ##{issue_release.iid}", type: type ) mr_master.create # end # mr_develop = GitLab::MergeRequest.new( # source_branch: issue_release.branch, # target_branch: $GIT_BRANCH_DEVELOP, # issue_iid: issue_release.iid, # title: "##{issue_release.iid} - #{version} - Reintegration #{issue_release.branch} into develop", # type: 'hotfix' # ) # mr_develop.create # remove_labels = [$GITLAB_NEXT_RELEASE_LIST] remove_labels = [] old_labels = issue_release.obj_gitlab['labels'] + ['merge_request'] old_labels.delete_if { |label| remove_labels.include? label } issue_release.labels = (old_labels + new_labels).uniq issue_release.update success("Release #{version} finalizada com sucesso!") end |
.release_start ⇒ Object
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/sflow/sflow.rb', line 174 def self.release_start version = prompt.ask('Por favor dígite o nº da versão:') raise "parâmetro 'VERSION' não encontrado" unless version issues = GitLab::Issue.from_list($GITLAB_NEXT_RELEASE_LIST).select { |i| !i.labels.include? 'ready_to_deploy' } issues_total = issues.size raise 'Não existem issues disponíveis para inciar uma nova Versão de Release' if issues_total == 0 issues_urgent = issues.select { |i| i.labels.include? 'urgent' } issues_urgent_total = issues_urgent.size issue_title = "Release version #{version}\n" issue_release = begin GitLab::Issue.find_by(title: issue_title) rescue StandardError nil end if issue_release option = prompt.yes? 'Já existem uma Issue com mesmo nome criada previamente. Se você quer reutilizar a issue digite Y, caso deseja criar uma nova, digite n? :'.yellow.bg_red else option = 'n' end if option == 'n' issue_release = GitLab::Issue.new(title: issue_title) issue_release.create end new_labels = [] changelogs = [] release_branch = "#{issue_release.iid}-release/#{version}" # print "Creating release version #{version}\n" begin # Git.delete_branch(release_branch) Git.checkout $GIT_BRANCH_DEVELOP Git.new_branch release_branch prompt.say "\nIssues disponíveis para criar versão:" header = [pastel.cyan('Issue'), pastel.cyan('Labels')] prompt.say( table.new(header, issues.map do |i| [i.title, i.labels.join(',')] end, orientation: :vertical).render(:unicode) ) # prompt.say pastel.yellow "Atenção!" option = prompt.select("\nEscolha uma opção de Branch:", symbols: { marker: '>' }) do || .choice("Somente as (#{issues_urgent_total}) issues de hotfix/urgent", '0') if issues_urgent_total > 0 .choice "Todas as (#{issues_total}) issues", '1' end case option when '0' prompt.say "Título das Issues: \n" # header = [pastel.cyan('Issues'), pastel.cyan('Labels')] # prompt.say ( # table.new(header, # issues_urgent.map do |i| # [i.title, i.labels.join(',')] # end # ).render(:unicode)) issues_urgent.each do |issue| Git.merge(issue.branch, release_branch) changelogs << "* ~changelog #{issue.msg_changelog} \n" new_labels << 'hotfix' end issues = issues_urgent when '1' type = 'other' # promtp.say "Existem (#{issues_total}) issues disponíveis para Próxima Release.\n\n".yellow # header = [pastel.cyan('Issues'), pastel.cyan('Labels')] # prompt.say ( # table.new(header, # issues.map do |i| # [i.title, i.labels.join(',')] # end # ).render(:unicode)) issues.each do |issue| Git.merge(issue.branch, release_branch) changelogs << "* ~changelog #{issue.msg_changelog} \n" end else raise 'Opção Inválida!' end prompt.say pastel.bold 'Mensagens incluida no change CHANGELOG:' d_split = $SFLOW_TEMPLATE_RELEASE_DATE_FORMAT.split('/') date = Date.today.strftime("%#{d_split[0]}/%#{d_split[1]}/%#{d_split[2]}") version_header = "#{$SFLOW_TEMPLATE_RELEASE.gsub('{version}', version).gsub('{date}', date)}\n" # print version_header.blue msgs_changelog = [] changelogs.each do |clog| msg_changelog = "#{clog.strip.chomp.gsub('* ~changelog ', ' - ')}\n" msgs_changelog << msg_changelog # print msg_changelog.light_blue end msgs_changelog << "\n" header = [pastel.cyan(version_header.delete("\n"))] prompt.say( table.new(header, [ msgs_changelog.map do |msg| msg.delete("\n") end ]).render(:unicode) ) # print "\nConfigurando mensagem de changelog no arquivo CHANGELOG\n".yellow system('touch CHANGELOG') line = version_header + ' ' + msgs_changelog.join('') File.write('CHANGELOG', line + File.open('CHANGELOG').read.encode('UTF-8'), mode: 'w') system('git add CHANGELOG') system(%(git commit -m "update CHANGELOG version #{version}")) Git.push release_branch issue_release.description = "#{changelogs.join('')}\n" issue_release.labels = ['ready_to_deploy', 'Next Release'] issue_release.set_default_branch(release_branch) tasks = [] issues.each do |issue| tasks << "* ~tasks #{issue.list_tasks} \n" if issue.description.match(/(\* ~tasks .*)+/) end if tasks.size > 0 prompt.say pastel.bold 'Lista de Tasks:'.yellow new_labels << 'tasks' header = [pastel.cyan('Tasks')] prompt.say( table.new(header, [ tasks.map do |task| task.strip.chomp.gsub('* ~tasks ', ' - ').delete("\n") end ]).render(:unicode) ) # tasks.each do |task| # task = "#{task.strip.chomp.gsub('* ~tasks ', ' - ')}\n" # print task.light_blue # end issue_release.description += "#{tasks.join('')}\n" end issues.each do |issue| issue.labels = (issue.labels + new_labels).uniq issue.close end # print "\Você está na branch: #{release_branch}\n".yellow success "Release #{version} criada com sucesso!" issue_release.description += "* #{issues.map { |i| "##{i.iid}," }.join(' ')}" issue_release.update rescue StandardError => e Git.delete_branch(release_branch) raise e. end end |
.set_error(e) ⇒ Object
415 416 417 418 419 |
# File 'lib/sflow/sflow.rb', line 415 def self.set_error(e) print "\n\n" print TTY::Box.error(e., border: :light) print e.backtrace end |
.staging(branch_name) ⇒ Object
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
# File 'lib/sflow/sflow.rb', line 604 def self.staging(branch_name) branch = branch_name issue_id = branch_name.to_s.match(/^(\d*)-/).to_a.last issue = GitLab::Issue.find_by_id(issue_id) prompt.say(pastel.cyan("\nVamos lá!")) target_branch = prompt.select("\nEscolha a branch de homologação:", $GIT_BRANCHES_STAGING, symbols: { marker: '>' }, filter: true) = [] << { name: 'Limpar primeiro a branch e depois fazer o merge', value: :clear } << { name: 'Somente fazer o merge', value: :only_merge } option_merge = prompt.select("\nO que deseja fazer?", , symbols: { marker: '>' }, filter: true) @@bar = ('Realizando merge da branch em homologação') @@bar.start 2.times do sleep(0.2) @@bar.advance end if option_merge == :clear 2.times do sleep(0.2) @@bar.advance end issues_staging = GitLab::Issue.from_list(target_branch).select { |i| i.branch != branch } issues_staging.each do |i| i.labels.delete(target_branch) i.labels.delete('Staging') i.labels.push('Doing') i.update end @@bar.advance Git.reset_hard branch, target_branch @@bar.advance Git.push_force target_branch elsif option_merge == :only_merge Git.reset_hard target_branch, target_branch @@bar.advance Git.merge branch, target_branch @@bar.advance Git.push target_branch @@bar.advance else @@bar.stop raise 'Escolha inválida' end new_labels = [target_branch, 'Staging'] remove_labels = $GITLAB_LISTS old_labels = issue.obj_gitlab['labels'] old_labels.delete_if { |label| remove_labels.include? label } issue.labels = (old_labels + new_labels).uniq issue.update @@bar.finish # self.codereview branch_name Git.checkout(branch) prompt.say "\n" success('Merge em homologação realizado com sucesso') end |
.start(branch, issue, ref_branch = $GIT_BRANCH_DEVELOP, parent_branch_name) ⇒ Object
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
# File 'lib/sflow/sflow.rb', line 563 def self.start(branch, issue, ref_branch = $GIT_BRANCH_DEVELOP, parent_branch_name) 2.times do sleep(0.2) @@bar.advance end Git.checkout ref_branch description = "* ~default_branch #{branch}\n" description += "* ~parent #{parent_branch_name}\n" if parent_branch_name issue.description = description issue.update 2.times do sleep(0.2) @@bar.advance end Git.new_branch(branch) Git.pull(parent_branch_name) unless parent_branch_name.nil? Git.push(branch) @@bar.finish prompt.say(pastel.cyan("Você está na branch: #{branch}")) success("Issue criada com sucesso!\nURL: #{issue.web_url}") issue # print "\nYou are on branch: #{branch}\n\n".yellow end |
.validates ⇒ Object
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
# File 'lib/sflow/sflow.rb', line 421 def self.validates @@bar = 6.times do # sleep(0.1) @@bar.advance end if !$GITLAB_PROJECT_ID || !$GITLAB_TOKEN || !$GITLAB_URL_API || !$GIT_BRANCH_MASTER || !$GIT_BRANCH_DEVELOP || !$GITLAB_LISTS || !$GITLAB_NEXT_RELEASE_LIST @@bar.stop Menu.new.setup_variables @@bar.finish end begin branchs_validations = $GIT_BRANCHES_STAGING + [$GIT_BRANCH_MASTER, $GIT_BRANCH_DEVELOP] Git.exist_branch?(branchs_validations.join(' ')) rescue StandardError => e Git.checkout($GIT_BRANCH_MASTER) begin Git.new_branch($GIT_BRANCH_DEVELOP) rescue StandardError nil end begin Git.push($GIT_BRANCH_DEVELOP) rescue StandardError nil end $GIT_BRANCHES_STAGING.each do |staging| begin Git.new_branch(staging) rescue StandardError nil end begin Git.push(staging) rescue StandardError nil end end end 2.times do # sleep(0.1) @@bar.advance end # Git.exist_branch?(branchs_validations.join(' ')) rescue raise "You need to create branches #{branchs_validations.join(', ')}" 2.times do # sleep(0.1) @@bar.advance end GitLab::Issue.ping @@bar.finish end |