summaryrefslogtreecommitdiffstats
path: root/lib/tasks/locales.rake
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-08-27 00:11:08 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-08-27 00:11:08 +0000
commit29fb2fd280c4266bc96856cc4d839c0ca21eb34a (patch)
treed85fdce85d35be10ccca7e5009e4cdc92dca5279 /lib/tasks/locales.rake
parent37bd3323da107030b97cb261e53b45cd09f6af50 (diff)
downloadredmine-29fb2fd280c4266bc96856cc4d839c0ca21eb34a.tar.gz
redmine-29fb2fd280c4266bc96856cc4d839c0ca21eb34a.zip
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
Diffstat (limited to 'lib/tasks/locales.rake')
-rw-r--r--lib/tasks/locales.rake27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/tasks/locales.rake b/lib/tasks/locales.rake
index 541f5b2f0..bc99a9a9b 100644
--- a/lib/tasks/locales.rake
+++ b/lib/tasks/locales.rake
@@ -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