Sha256: e89f26326fd0367cee63e381dd1634a3caae70b3564202f51dcd35db4a9b0441
Contents?: true
Size: 756 Bytes
Versions: 3
Compression:
Stored size: 756 Bytes
Contents
require 'iniparse' module Invoker module Parsers class Config attr_accessor :processes 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 end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
invoker-0.1.2 | lib/invoker/parsers/config.rb |
invoker-0.1.1 | lib/invoker/parsers/config.rb |
invoker-0.1.1.pre | lib/invoker/parsers/config.rb |