cirandas.net

ref: master

lib/tasks/error_messages.rake


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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