class Bedouin::Job

Attributes

name[R]
status[RW]
stderr[RW]
stdout[RW]

Public Class Methods

new(environment,template) click to toggle source
# File lib/bedouin/job.rb, line 7
def initialize(environment,template)
  @name = (template.name + '_' + environment.name).freeze
  @environment = environment
  @template = template
end

Public Instance Methods

file_path() click to toggle source
# File lib/bedouin/job.rb, line 13
def file_path
  tempfile.path
end
to_s() click to toggle source
# File lib/bedouin/job.rb, line 17
def to_s
  [stdout, stderr].map do |output|
    output.each_line.map do |l|
      @name + ": " + l
    end
  end
end

Private Instance Methods

tempfile() click to toggle source
# File lib/bedouin/job.rb, line 26
def tempfile
  unless @tempfile
    @tempfile = Tempfile.new(@name)
    f = @tempfile.open
    f.write @template.run(@environment)
    f.close
  end

  @tempfile
end