lib/invoker/parsers/config.rb in invoker-1.2.0 vs lib/invoker/parsers/config.rb in invoker-1.3.0
- old
+ new
@@ -82,30 +82,34 @@
def make_option_for_subdomain(section, port)
OpenStruct.new(
port: port,
label: section["label"] || section.key,
- dir: section["directory"],
+ 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: section["directory"],
+ dir: expand_directory(section["directory"]),
cmd: section["command"]
)
end
def supports_subdomain?(section)
(section['command'] =~ PORT_REGEX) || section['port']
end
def check_directory(app_dir)
- if app_dir && !app_dir.empty? && !File.directory?(app_dir)
+ if app_dir && !app_dir.empty? && !File.directory?(expand_directory(app_dir))
raise Invoker::Errors::InvalidConfig.new("Invalid directory #{app_dir}")
end
+ end
+
+ def expand_directory(app_dir)
+ File.expand_path(app_dir) if app_dir
end
def replace_port_in_command(command, port)
if command =~ PORT_REGEX
command.gsub(PORT_REGEX, port.to_s)