Class: Buildbox::Runner
- Inherits:
-
Object
- Object
- Buildbox::Runner
- Includes:
- Celluloid, Celluloid::Logger
- Defined in:
- lib/buildbox/runner.rb
Instance Method Summary collapse
-
#initialize(build) ⇒ Runner
constructor
A new instance of Runner.
- #start ⇒ Object
Constructor Details
#initialize(build) ⇒ Runner
Returns a new instance of Runner.
10 11 12 |
# File 'lib/buildbox/runner.rb', line 10 def initialize(build) @build = build end |
Instance Method Details
#start ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/buildbox/runner.rb', line 14 def start info "Starting to build #{@build.namespace}/#{@build.id} starting..." FileUtils.mkdir_p(directory_path) File.open(script_path, 'w+') { |file| file.write(@build.script) } File.chmod(0777, script_path) command = Command.new(script_path, :environment => @build.env, :directory => directory_path) @build.output = "" @build.process = command.process @build.started_at = Time.now.utc command.start { |chunk| @build.output << chunk } @build.output = command.output @build.exit_status = command.exit_status File.delete(script_path) @build.finished_at = Time.now.utc info "#{@build.namespace} ##{@build.id} finished with exit status #{command.exit_status}" end |