Sha256: 9f3b9a70f547e553f10d6c9dff453e785f51e53ffa4abefd52fc06f39398763d
Contents?: true
Size: 708 Bytes
Versions: 1
Compression:
Stored size: 708 Bytes
Contents
require "yaml" require 'iniparse' module Invoker 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
invoker-0.0.3 | lib/invoker/config.rb |