Module: Travis::Builder::Base

Included in:
Travis::Builder
Defined in:
lib/travis/builder/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#buildObject (readonly)

Returns the value of attribute build.



4
5
6
# File 'lib/travis/builder/base.rb', line 4

def build
  @build
end

#meta_idObject (readonly)

Returns the value of attribute meta_id.



4
5
6
# File 'lib/travis/builder/base.rb', line 4

def meta_id
  @meta_id
end

Instance Method Details

#buildableObject



18
19
20
21
22
23
24
# File 'lib/travis/builder/base.rb', line 18

def buildable
  @buildable ||= Travis::Buildable.new(
    :script => 'rake',
    :commit => build['commit'],
    :url => build['repository']['url']
  )
end

#initialize(meta_id, build) ⇒ Object



6
7
8
9
# File 'lib/travis/builder/base.rb', line 6

def initialize(meta_id, build)
  @meta_id = meta_id
  @build   = build.dup
end

#on_finishObject



38
39
40
# File 'lib/travis/builder/base.rb', line 38

def on_finish
  build.merge!('finished_at' => Time.now)
end

#on_log(chars) ⇒ Object



34
35
36
# File 'lib/travis/builder/base.rb', line 34

def on_log(chars)
  build['log'] << chars
end

#on_startObject



30
31
32
# File 'lib/travis/builder/base.rb', line 30

def on_start
  build.merge!('log' => '', 'started_at' => Time.now)
end

#repository_idObject



26
27
28
# File 'lib/travis/builder/base.rb', line 26

def repository_id
  build['repository']['id']
end

#work!Object



11
12
13
14
15
16
# File 'lib/travis/builder/base.rb', line 11

def work!
  on_start
  build['status'] = buildable.build!
  # sleep(1)
  on_finish
end