Class: Foreman::Export::Supervisord

Inherits:
Base
  • Object
show all
Defined in:
lib/foreman/export/supervisord.rb

Instance Attribute Summary

Attributes inherited from Base

#app, #concurrency, #engine, #location, #log, #port, #template, #user

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Foreman::Export::Base

Instance Method Details

#exportObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/foreman/export/supervisord.rb', line 6

def export
  error("Must specify a location") unless location

  FileUtils.mkdir_p location

  app = self.app || File.basename(engine.directory)
  user = self.user || app
  log_root = self.log || "/var/log/#{app}"
  template_root = self.template

  Dir["#{location}/#{app}*.conf"].each do |file|
    say "cleaning up: #{file}"
    FileUtils.rm(file)
  end

  app_template = export_template("supervisord", "app.conf.erb", template_root)
  app_config   = ERB.new(app_template, 0, '<').result(binding)
  write_file "#{location}/#{app}.conf", app_config
end