Class: Buildbox::Agent

Inherits:
Object
  • Object
show all
Includes:
Celluloid::Logger
Defined in:
lib/buildbox/agent.rb

Instance Method Summary collapse

Constructor Details

#initialize(access_token, api) ⇒ Agent

Returns a new instance of Agent.



8
9
10
11
# File 'lib/buildbox/agent.rb', line 8

def initialize(access_token, api)
  @api          = api
  @access_token = access_token
end

Instance Method Details

#workObject



13
14
15
16
17
18
19
20
21
# File 'lib/buildbox/agent.rb', line 13

def work
  running_builds = scheduled_builds.map do |build|
    Monitor.new(build, @api).async.monitor
    Runner.new(build).future(:start)
  end

  # wait for all the running builds to finish
  running_builds.map(&:value)
end