From 434e282d3d3dc81353cecbdaa2404b4199a0a38b Mon Sep 17 00:00:00 2001 From: Maciej Hryniszak Date: Wed, 26 Sep 2012 21:06:26 +0200 Subject: [PATCH] GH-268 Added parsing of ports variables while initialzing process --- lib/foreman/process.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/foreman/process.rb b/lib/foreman/process.rb index 6ea38936..fb216a4e 100644 --- a/lib/foreman/process.rb +++ b/lib/foreman/process.rb @@ -5,6 +5,7 @@ class Foreman::Process attr_reader :command attr_reader :env + attr_reader :ports # Create a Process # @@ -19,6 +20,11 @@ def initialize(command, options={}) @options = options.dup @options[:env] ||= {} + + # parse list of ports needed for this command + @ports = @command.scan(/\$(PORT[0-9]?)/) + @ports = [ "PORT" ] if @ports.length == 0 + @ports = @ports.flatten.uniq end # Get environment-expanded command for a +Process+