Sha256: 0ea6d2d755f282de3dce6bd2e23e3c2c2e65d7c945a7a48844482953a54be919

Contents?: true

Size: 855 Bytes

Versions: 4

Compression:

Stored size: 855 Bytes

Contents

require "erb"
require "foreman/export"

class Foreman::Export::Upstart < Foreman::Export::Base

  def export
    super

    (Dir["#{location}/#{app}-*.conf"] << "#{location}/#{app}.conf").each do |file|
      clean file
    end

    write_template master_template, "#{app}.conf", binding

    engine.each_process do |name, process|
      next if engine.formation[name] < 1
      write_template process_master_template, "#{app}-#{name}.conf", binding

      1.upto(engine.formation[name]) do |num|
        port = engine.port_for(process, num)
        write_template process_template, "#{app}-#{name}-#{num}.conf", binding
      end
    end
  end

  private

  def master_template
    "upstart/master.conf.erb"
  end

  def process_master_template
    "upstart/process_master.conf.erb"
  end

  def process_template
    "upstart/process.conf.erb"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman-0.76.0 lib/foreman/export/upstart.rb
foreman-0.75.0 lib/foreman/export/upstart.rb
foreman-0.74.0 lib/foreman/export/upstart.rb
foreman-0.73.0 lib/foreman/export/upstart.rb