Method: Beaker::Options::Validator#check_yaml_file
- Defined in:
- lib/beaker/options/validator.rb
#check_yaml_file(f, msg = '') ⇒ Object
Determine is a given file exists and is a valid YAML file
13 14 15 16 17 18 19 20 21 |
# File 'lib/beaker/options/validator.rb', line 13 def check_yaml_file(f, msg = '') validator_error "#{f} does not exist (#{msg})" unless File.file?(f) begin YAML.load_file(f) rescue Beaker::Options::Parser::PARSE_ERROR => e validator_error "#{f} is not a valid YAML file (#{msg})\n\t#{e}" end end |