Class: Buildbox::Agent
- Inherits:
-
Object
- Object
- Buildbox::Agent
- Includes:
- Celluloid, Celluloid::Logger
- Defined in:
- lib/buildbox/agent.rb
Instance Method Summary collapse
-
#initialize(access_token, api = Buildbox::API.new) ⇒ Agent
constructor
A new instance of Agent.
- #work ⇒ Object
Constructor Details
#initialize(access_token, api = Buildbox::API.new) ⇒ Agent
Returns a new instance of Agent.
8 9 10 11 |
# File 'lib/buildbox/agent.rb', line 8 def initialize(access_token, api = Buildbox::API.new) @api = api @access_token = access_token end |
Instance Method Details
#work ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/buildbox/agent.rb', line 13 def work builds = scheduled_builds # Run the builds one at a time builds.each do |build| # Let the agent know that we're about to start working on this build @api.update_build(build, :agent_accepted => @access_token) Monitor.new(build, @api).async.monitor Runner.new(build).start end end |