Class: Build

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Altria::Proprietary
Defined in:
app/models/build.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Altria::Proprietary

#update_properties

Class Method Details

.latestObject



22
23
24
# File 'app/models/build.rb', line 22

def self.latest
  recent.first
end

Instance Method Details

#enqueueObject

Pushes this build to worker’s queue.



27
28
29
# File 'app/models/build.rb', line 27

def enqueue
  BuildWorker.perform_async(id)
end

#runObject

Runs this build, usually called from BuildWorker#perform.



32
33
34
35
# File 'app/models/build.rb', line 32

def run
  start
  finish(job.run)
end

#secObject

Returns elapsed sec as a Float or nil.



38
39
40
# File 'app/models/build.rb', line 38

def sec
  finished_at - started_at if finished_at && started_at
end

#status_nameObject



42
43
44
45
46
47
48
49
50
51
# File 'app/models/build.rb', line 42

def status_name
  case status
  when true
    "success"
  when false
    "failure"
  when nil
    "unfinished"
  end
end