Class: CodeBuildTail::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/code_build_tail/build.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, build_id) ⇒ Build

Returns a new instance of Build.



5
6
7
8
9
# File 'lib/code_build_tail/build.rb', line 5

def initialize(client, build_id)
  @refresh_count = 0
  @client = client
  @build_id = build_id
end

Instance Attribute Details

#buildObject (readonly)

Returns the value of attribute build.



4
5
6
# File 'lib/code_build_tail/build.rb', line 4

def build
  @build
end

#build_idObject (readonly)

Returns the value of attribute build_id.



4
5
6
# File 'lib/code_build_tail/build.rb', line 4

def build_id
  @build_id
end

#refresh_countObject (readonly)

Returns the value of attribute refresh_count.



4
5
6
# File 'lib/code_build_tail/build.rb', line 4

def refresh_count
  @refresh_count
end

Instance Method Details

#logsObject



11
12
13
# File 'lib/code_build_tail/build.rb', line 11

def logs
  @build.logs
end

#missing?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/code_build_tail/build.rb', line 15

def missing?
  @build.nil?
end

#refreshObject



27
28
29
30
31
32
33
34
35
# File 'lib/code_build_tail/build.rb', line 27

def refresh
  response = @client.batch_get_builds({ ids: [@build_id] })
  @refresh_count += 1
  @build = if response[:builds].empty?
             nil
           else
             response[:builds][0]
           end
end

#running?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/code_build_tail/build.rb', line 19

def running?
  @build.build_status == "IN_PROGRESS"
end

#successful?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/code_build_tail/build.rb', line 23

def successful?
  @build.build_status == "SUCCEEDED"
end