class Fuci::Travis::Build

Constants

FAILED
PASSED

Attributes

branch_name[R]

Public Class Methods

create() click to toggle source
# File lib/fuci/travis/build.rb, line 47
def self.create
  if Fuci::Travis::CliOptions.pull_request?
    branch_name =
      Fuci::Travis::CliOptions.pull_request_branch || current_branch_name

    return PullRequest.new branch_name
  end

  branch_name =
    Fuci::Travis::CliOptions.branch ||
    Fuci::Travis.default_branch     ||
    current_branch_name

  from_branch_name branch_name
end
from_branch_name(branch_name) click to toggle source
# File lib/fuci/travis/build.rb, line 63
def self.from_branch_name branch_name
  if branch_name == 'master'
    Master.new
  else
    Generic.new branch_name
  end
end
new(branch_name) click to toggle source
# File lib/fuci/travis/build.rb, line 20
def initialize branch_name
  @branch_name = branch_name
end

Public Instance Methods

branch() click to toggle source
# File lib/fuci/travis/build.rb, line 39
def branch
  @branch ||= build_branch
end
build_branch() click to toggle source
# File lib/fuci/travis/build.rb, line 43
def build_branch
  raise NotImplementedError
end
log() click to toggle source
# File lib/fuci/travis/build.rb, line 35
def log
  jobs.first.log.body
end
status() click to toggle source
# File lib/fuci/travis/build.rb, line 24
def status
  case state
  when FAILED
    :red
  when PASSED
    :green
  else
    :yellow
  end
end

Private Instance Methods

repo() click to toggle source
# File lib/fuci/travis/build.rb, line 73
def repo
  Fuci::Travis.repo
end