lib/invoker/config.rb in invoker-0.0.2 vs lib/invoker/config.rb in invoker-0.0.3
- old
+ new
@@ -7,13 +7,22 @@
def initialize(filename)
@ini_content = File.read(filename)
@processes = process_ini(@ini_content)
end
+ private
def process_ini(ini_content)
document = IniParse.parse(ini_content)
document.map do |section|
+ check_directory(section["directory"])
OpenStruct.new(label: section.key, dir: section["directory"], cmd: section["command"])
end
end
+
+ def check_directory(app_dir)
+ if app_dir && !app_dir.empty? && !File.directory?(app_dir)
+ raise Invoker::Errors::InvalidConfig.new("Invalid directory #{app_dir}")
+ end
+ end
+
end
end