class Fuci::TeamCity::Build

Constants

ERROR
LOG_RESOURCE
SUCCESS

Public Class Methods

create() click to toggle source
# File lib/fuci/team_city/build.rb, line 28
def self.create
  if branch_name = Fuci::TeamCity::CliOptions.branch
    project.latest_build_from branch_name
  else
    create_with_default_branch
  end
end

Private Class Methods

create_with_default_branch() click to toggle source
# File lib/fuci/team_city/build.rb, line 54
def self.create_with_default_branch
  if branch_name = Fuci::TeamCity.default_branch
    project.latest_build_from branch_name
  else
    puts 'No default branch is configured.'
    exit
  end
end
project() click to toggle source
# File lib/fuci/team_city/build.rb, line 50
def self.project
  Fuci::TeamCity::Project.from_name
end

Public Instance Methods

log() click to toggle source
# File lib/fuci/team_city/build.rb, line 24
def log
  Request.new(log_resource).call
end
status_code() click to toggle source
# File lib/fuci/team_city/build.rb, line 13
def status_code
  case status
  when ERROR
    :red
  when SUCCESS
    :green
  else
    :yellow
  end
end

Private Instance Methods

id() click to toggle source
# File lib/fuci/team_city/build.rb, line 46
def id
  element['id']
end
log_resource() click to toggle source
# File lib/fuci/team_city/build.rb, line 42
def log_resource
  LOG_RESOURCE.(id)
end
status() click to toggle source
# File lib/fuci/team_city/build.rb, line 38
def status
  element['status']
end