File: launchd.rb

package info (click to toggle)
ruby-foreman 0.90.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 584 kB
  • sloc: ruby: 2,020; sh: 88; makefile: 8
file content (22 lines) | stat: -rw-r--r-- 530 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require "erb"
require "foreman/export"

class Foreman::Export::Launchd < Foreman::Export::Base

  def export
    super
    engine.each_process do |name, process|
      1.upto(engine.formation[name]) do |num|
        port = engine.port_for(process, num)
        command_args = process.command.split(/\s+/).map{|arg|
          case arg
          when "$PORT" then port
          else arg
          end
        }
        write_template "launchd/launchd.plist.erb", "#{app}-#{name}-#{num}.plist", binding
      end
    end
  end

end