class GOCD_PRE_PUSH::BuildOfficer

Public Class Methods

new(concerned_pipelines, server_details) click to toggle source
# File lib/gocd_pre_push/build_officer.rb, line 8
def initialize(concerned_pipelines, server_details)
  @build_informer = BuildInformer.new concerned_pipelines, server_details
end

Public Instance Methods

investigate() click to toggle source
# File lib/gocd_pre_push/build_officer.rb, line 12
def investigate
  print_info "Build cop is on duty.."
  red_pipelines = @build_informer.red_pipelines

  if red_pipelines.any?
    report_red_builds(red_pipelines)
  else
    print_success 'All clear!'
  end

  red_pipelines.any?
end

Private Instance Methods

report_red_builds(pipelines) click to toggle source
# File lib/gocd_pre_push/build_officer.rb, line 26
def report_red_builds(pipelines)
  print_info "The cop found below crimes, all will be judged..\n"
  pipelines.each_with_index do |pipeline, index|
    pipeline, stage = pipeline.name.gsub(' ', '').split('::')
    print_error "  #{index+1}. #{pipeline}'s #{stage} stage is failing.\n"
  end
end