Class: ProcfileUpstartExporter::ProcessJobRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/procfile_upstart_exporter/process_job_renderer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template = File.read( File.expand_path( File.join('..', '..', '..', 'templates', 'process.conf.erb'), __FILE__ ) )) ⇒ ProcessJobRenderer

Returns a new instance of ProcessJobRenderer.



4
5
6
7
8
9
10
11
12
# File 'lib/procfile_upstart_exporter/process_job_renderer.rb', line 4

def initialize(
  template = File.read(
    File.expand_path(
      File.join('..', '..', '..', 'templates', 'process.conf.erb'), __FILE__
    )
  )
)
  @erb = ERB.new template, nil, '-'
end

Instance Attribute Details

#templateObject (readonly)

Returns the value of attribute template.



2
3
4
# File 'lib/procfile_upstart_exporter/process_job_renderer.rb', line 2

def template
  @template
end

Instance Method Details

#render(application, user, environment_variables, application_root, log, process) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/procfile_upstart_exporter/process_job_renderer.rb', line 14

def render application, user, environment_variables, application_root,
           log, process
  ProcfileUpstartExporter.logger.debug 'Start rendering process job'
  # Double assign to avoid warnings
  home = home = Etc.getpwnam(user).dir
  @erb.result binding
end