require 'yaml' # run `ruby validator.rb` in current directory Dir.children('projects').each do |folder| begin path = "projects/#{folder}/imports.yml" YAML.load(File.read(path)) if File.exists?(path) rescue => exception puts "#{exception}" puts "Format wrong with projects/#{folder}/imports.yml" end end