Sha256: 807d69301838a9fe724215b2fc2dcf6a402acb3c9ff1ca71932bb68597edcb01
Contents?: true
Size: 891 Bytes
Versions: 9
Compression:
Stored size: 891 Bytes
Contents
module UltraCommandLine module Utils module YamlFactory def from_yaml_file(yaml_file, factory_options = {}, &block) yaml_file = File.expand_path yaml_file UltraCommandLine.logger.debug "Loading commands definitions from '#{yaml_file}'." raise UltraCommandLine::Error, 'Invalid Yaml command file specified !' unless File.exists? yaml_file raise UltraCommandLine::Error, 'Cannot read Yaml command file !' unless File.readable? yaml_file from_yaml File.read(yaml_file), factory_options, &block end def from_yaml(yaml, factory_options = {}, &block) from_hash YAML.load(yaml), factory_options, &block rescue => e UltraCommandLine.logger.error "#{e.message}\nBacktrace:\n#{e.backtrace.join("\n\t")}" raise UltraCommandLine::Error, 'Invalid Yaml content. Parser error !' end end end end
Version data entries
9 entries across 9 versions & 1 rubygems