drnic / sake-tasks forked from defunkt/sake-tasks

Your own personal sake tasks, ripe for sharing.

This URL has Read+Write access

sake-tasks / check / yaml.sake
100644 16 lines (14 sloc) 0.401 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
namespace :check do
  desc "Find all .yml files in the current directory tree and report any syntax errors"
  task :yaml do
    require 'yaml'
    Dir['**/*.yml'].each do |file|
      next if file.match("vendor/rails")
      begin
        YAML.load_file(file)
      rescue => e
        puts "#{file}:#{(e.message.match(/on line (\d+)/)[1] + ':') rescue nil} #{e.message}"
      end
    end
  end
end