Created
November 9, 2010 16:52
-
-
Save wyanez/669368 to your computer and use it in GitHub Desktop.
[ruby] Script para validar un archivo .yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Script para validar un archivo .yml | |
Ejemplo de uso: | |
ruby validar_yml.rb mi_archivo.yml | |
William Yanez - Nov 2010 | |
=end | |
require 'yaml' | |
if ARGV.length.zero? | |
puts "Sintaxis: #{$0} archivo.yml" | |
exit | |
end | |
begin | |
yml = YAML::load( File.open(ARGV[0]) ) | |
puts "Archivo #{ARGV[0]} validado correctamente!" | |
rescue Exception => ex | |
puts "El archivo #{ARGV[0]} tiene el(los) siguiente(s) error(es):" | |
puts ex | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment