Sha256: e1a80118f0a5e963a5af6bc28801409da6ab9690093c2d8d7b0773a0e06a0181

Contents?: true

Size: 466 Bytes

Versions: 1

Compression:

Stored size: 466 Bytes

Contents

module Buildbox
  class Worker
    def process
      if scheduled = api.builds.payload.first
        start Build.new(scheduled)
      end
    end

    private

    def start(build)
      api.update_build_state(build.uuid, 'started')
      build.start Buildbox::Observer.new(api, build.uuid)
      api.update_build_state_async(build.uuid, 'finished')
    end

    def api
      @api ||= Buildbox::API.new(:api_key => Buildbox.configuration.api_key)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
buildbox-0.0.4 lib/buildbox/worker.rb