-
-
Save endzyme/6222546 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'yaml' | |
exit_code = 0 | |
if ARGV.length != 1 | |
puts "Usage: ruby validate_ymls.rb directory_absolute_path" | |
exit! | |
end | |
base_path = ARGV[0].chomp("/") | |
base_dir = Dir.glob("#{base_path}/**/*.yaml") + Dir.glob("#{base_path}/**/*.yml") | |
base_dir.each do |file_name| | |
#puts "validating #{file_name}" | |
begin | |
env_constants = YAML::load(open(file_name)) | |
rescue Exception => e | |
puts "ERROR!!! #{file_name} contains error! Message: #{e.message}" | |
exit_code = 1 | |
end | |
end | |
if exit_code == 0 | |
puts "No Errors Detected in loading Yamls" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment