let's rake it!
in Rakefile:
inputs = Dir.glob('*.erb')
outputs = inputs.map{|o| o[0..-5]}
task :default => [:begin, outputs, :end].flatten
task :begin do; puts "processing templates: #{inputs.inspect}"; end
task :end do; puts "processed output: #{outputs.inspect}"; end
inputs.zip(outputs).each{ |input, output|
file output => input do
open output, 'w' do |o|
o << `erb #{input}`
end
end
}
把所有的 *.erb 轉出來,這樣就能輕鬆玩 meta-programming 了...
到時候可以寫一些 C++ getter/setter 的 generator,
或是 template parameter 吧..?
0 retries:
Post a Comment
Note: Only a member of this blog may post a comment.