lib/invoker/parsers/config.rb in invoker-1.3.1 vs lib/invoker/parsers/config.rb in invoker-1.3.2
- old
+ new
@@ -25,10 +25,14 @@
def https_port
power_config && power_config.https_port
end
+ def autorunnable_processes
+ processes.reject(&:disable_autorun)
+ end
+
def process(label)
processes.detect { |pconfig| pconfig.label == label }
end
private
@@ -62,14 +66,17 @@
end
def process_command_from_section(section)
if supports_subdomain?(section)
port = pick_port(section)
- make_option_for_subdomain(section, port)
- else
- make_option(section)
+ if port
+ command = replace_port_in_command(section['command'], port)
+ section['port'], section['command'] = port, command
+ end
end
+
+ make_pconfig(section)
end
def pick_port(section)
if section['command'] =~ PORT_REGEX
@port += 1
@@ -78,24 +85,19 @@
else
nil
end
end
- def make_option_for_subdomain(section, port)
- OpenStruct.new(
- port: port,
+ def make_pconfig(section)
+ pconfig = {
label: section["label"] || section.key,
dir: expand_directory(section["directory"]),
- cmd: replace_port_in_command(section["command"], port)
- )
- end
-
- def make_option(section)
- OpenStruct.new(
- label: section["label"] || section.key,
- dir: expand_directory(section["directory"]),
cmd: section["command"]
- )
+ }
+ pconfig['port'] = section['port'] if section['port']
+ pconfig['disable_autorun'] = section['disable_autorun'] if section['disable_autorun']
+
+ OpenStruct.new(pconfig)
end
def supports_subdomain?(section)
(section['command'] =~ PORT_REGEX) || section['port']
end