lib/tasks/error_messages.rake
root = Pathname(File.dirname(__FILE__)).join("../../").expand_path
templates = Dir.glob(root.join("public", "*.html.erb"))
targets = []
templates.each do |template|
target = template.gsub(/.erb$/, "")
targets << target
file target => [:makemo, template, :environment] do
require "erb"
erb = ERB.new(File.read(template))
File.open(target, "w") do |file|
file.write(erb.result)
end
puts "#{template} -> #{target}"
end
end
namespace :noosfero do
namespace "error-pages" do
desc "Translates Noosfero error pages"
task translate: targets
end
end