module Hyla
Constants
- DESCRIPTION
- SUMMARY
- VERSION
Public Class Methods
check_config()
click to toggle source
Singleton var to allow to only check one time if the config_yaml is there
# File lib/hyla.rb, line 66 def self.check_config() @params ||= self.config end
config()
click to toggle source
# File lib/hyla.rb, line 70 def self.config() configs = $options[:config].split(",").map(&:strip) if $options[:config] if !configs.nil? && !configs.empty? @yaml_cfg = nil configs.each do |config| cfg = safe_load_file(config) @yaml_cfg = cfg if @yaml_cfg.nil? @yaml_cfg = @yaml_cfg.deep_merge(cfg) end else # We will try to read the _config.yaml file if it exists within the project cfg = safe_load_file(Configuration::YAML_CONFIG_FILE_NAME) @yaml_cfg = cfg if !cfg.nil? && !cfg.empty? end hyla_cfg ||= @yaml_cfg if @yaml_cfg log_cfg ||= $options[:log] mode ||= hyla_cfg['mode'] if hyla_cfg dirname ||= hyla_cfg['dirname'] if hyla_cfg logname ||= hyla_cfg['logname'] if hyla_cfg level ||= hyla_cfg['level'] if hyla_cfg tracer ||= hyla_cfg['tracer'] if hyla_cfg return mode, log_cfg, dirname, logname, level, tracer end
logger()
click to toggle source
# File lib/hyla.rb, line 54 def self.logger @logger ||= Logger.new end
logger2()
click to toggle source
# File lib/hyla.rb, line 58 def self.logger2 params = self.check_config @logger2 ||= Logger2.new(params[0],params[1],params[2],params[3],params[4],params[5]) end
safe_load_file(filename)
click to toggle source
# File lib/hyla.rb, line 95 def self.safe_load_file(filename) begin f = File.expand_path(filename, $cmd_directory) YAML.safe_load_file(f) rescue SystemCallError puts "No configuration file retrieved for the name : #{filename}" end end