Class: Stax::Aws::Codebuild

Inherits:
Sdk
  • Object
show all
Defined in:
lib/stax/aws/codebuild.rb

Constant Summary

Constants inherited from Sdk

Sdk::RETRY_LIMIT

Class Method Summary collapse

Methods inherited from Sdk

paginate

Class Method Details

.builds(ids) ⇒ Object



29
30
31
# File 'lib/stax/aws/codebuild.rb', line 29

def builds(ids)
  client.batch_get_builds(ids: ids).builds
end

.builds_for_project(name, num = 100) ⇒ Object

returns ids of num most recent builds for project



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/stax/aws/codebuild.rb', line 16

def builds_for_project(name, num = 100)
  count = 0
  next_token = nil
  builds = []
  loop do
    r = client.list_builds_for_project(project_name: name, next_token: next_token)
    builds += r.ids
    break if (count += r.ids.count) >= num
    break if (next_token = r.next_token).nil?
  end
  builds.first(num)
end

.clientObject



7
8
9
# File 'lib/stax/aws/codebuild.rb', line 7

def client
  @_client ||= ::Aws::CodeBuild::Client.new
end

.projects(names) ⇒ Object



11
12
13
# File 'lib/stax/aws/codebuild.rb', line 11

def projects(names)
  client.batch_get_projects(names: names).projects
end

.start(opt) ⇒ Object



33
34
35
# File 'lib/stax/aws/codebuild.rb', line 33

def start(opt)
  client.start_build(opt).build
end