class Splash::Config::ConfigLinter
Public Class Methods
new()
click to toggle source
# File lib/splash/config.rb, line 15 def initialize @lints_present = {:logs => [:label, :log, :pattern ], :processes => [:process, :patterns ], :commands => [:name, :desc, :command ]} @lints_types = {:logs => {:label => Symbol, :log => String, :pattern => String, :retention => Hash}, :processes => {:process => Symbol, :patterns => Array, :retention => Hash}, :commands => {:name => Symbol, :desc => String, :command => String, :schedule => Hash, :retention => Hash, :on_failure => Symbol, :on_success => Symbol, :user => String, :delegate_to => Hash}} end
Public Instance Methods
verify(options ={})
click to toggle source
# File lib/splash/config.rb, line 26 def verify(options ={}) status = :success missings = [] type_errors = [] useless = [] options[:record].each do |key,value| useless.push key unless @lints_present[options[:type]].include? key or @lints_types[options[:type]].keys.include? key type_errors.push key if @lints_types[options[:type]][key] != value.class and (@lints_present[options[:type]].include? key or @lints_types[options[:type]].keys.include? key) end @lints_present[options[:type]].each do |item| missings.push item unless options[:record].keys.include? item end status = :failure if (missings.count > 0) or (type_errors.count > 0) return {:missings => missings, :type_errors => type_errors, :useless => useless, :status => status} end