module Cagnut::Configuration
Public Class Methods
base()
click to toggle source
# File lib/cagnut/configuration.rb, line 21 def base @base ||= begin Cagnut::Configuration::Base.load(@config) Cagnut::Configuration::Base.instance end end
configure() { |self| ... }
click to toggle source
# File lib/cagnut/configuration.rb, line 13 def configure yield self end
load_config(config_name, options)
click to toggle source
# File lib/cagnut/configuration.rb, line 28 def load_config config_name, options @config ||= check_and_load_yml fetch_system_config_path(options[:config]) @params ||= check_and_load_yml fetch_tools_config_path(config_name, options[:params]) config_check config_name, options[:no_check] end
params()
click to toggle source
# File lib/cagnut/configuration.rb, line 17 def params @params end
Private Class Methods
check_and_load_yml(yml_path)
click to toggle source
# File lib/cagnut/configuration.rb, line 36 def check_and_load_yml yml_path check_path yml_path puts "Using #{yml_path}" YAML.load_file yml_path end
check_datasets(config_name)
click to toggle source
# File lib/cagnut/configuration.rb, line 81 def check_datasets config_name @datasets = Cagnut::Configuration::Checks::Datasets.new @config @datasets.check config_name end
check_path(file)
click to toggle source
# File lib/cagnut/configuration.rb, line 42 def check_path file return file if File.exist?(file) puts "No such File in: #{file}" exit end
config_check(config_name, not_check=false)
click to toggle source
# File lib/cagnut/configuration.rb, line 70 def config_check config_name, not_check=false tools_check unless not_check @config['pipeline_name'] = config_name @config = check_datasets config_name end
fetch_system_config_path(cfg_path=nil)
click to toggle source
# File lib/cagnut/configuration.rb, line 48 def fetch_system_config_path cfg_path=nil if !cfg_path.blank? cfg_path elsif Dir.entries(Dir.pwd).include? "system.yml" File.join(Dir.pwd, 'system.yml') else puts "Not Found system.yml in #{Dir.pwd}" exit end end
fetch_tools_config_path(config_name, config_path=nil)
click to toggle source
# File lib/cagnut/configuration.rb, line 59 def fetch_tools_config_path config_name, config_path=nil if !config_path.blank? config_path elsif Dir.entries(Dir.pwd).include? "#{config_name}_tools.yml" File.join(Dir.pwd, "#{config_name}_tools.yml") else puts "Not Found #{config_name}_tools.yml in #{Dir.pwd}" exit end end
tools_check()
click to toggle source
# File lib/cagnut/configuration.rb, line 76 def tools_check @tools = Cagnut::Configuration::Checks::Tools.new @config @tools.check end