Ruby 1.9: add rake task to check parsing yaml by psych library (#8847, #4050).

Original code is written by Etienne Massip.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6647 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-08-27 00:11:08 +00:00
parent 37bd3323da
commit 29fb2fd280
1 changed files with 27 additions and 0 deletions

View File

@ -116,4 +116,31 @@ END_DESC
end
end
end
desc 'Check parsing yaml by psych library on Ruby 1.9.'
# On Fedora 12 and 13, if libyaml-devel is available,
# in case of installing by rvm,
# Ruby 1.9 default yaml library is psych.
task :check_parsing_by_psynch do
begin
require 'psych'
parser = Psych::Parser.new
dir = ENV['DIR'] || './config/locales'
files = Dir.glob(File.join(dir,'*.yml'))
files.each do |filename|
next if File.directory? filename
puts "parsing #{filename}..."
begin
parser.parse File.open(filename)
rescue Exception => e1
puts(e1.message)
puts("")
end
end
rescue Exception => e
puts(e.message)
end
end
end