Metadata are now inserted into the lua files.
[tagua/yd.git] / add_variant.rb
blobaba925724597762936683824d32aa7fdff145ecf
1 #!/usr/bin/ruby
3 require 'erb'
5 TEMPLATE = 'templates/variant_template'
6 VARIANT_DIR = 'src/variants'
8 variant = ARGV.shift or exit
9 %w(h cpp).each do |ext|
10         File.open(TEMPLATE + ".#{ext}.erb") do |f|
11                 template = ERB.new(f.read)
12                 out = File.join(VARIANT_DIR, variant + ".#{ext}")
13                 File.open(out, 'w') do |outfile| 
14                         outfile.write(template.result(binding))
15                 end
16                 puts "generated #{out}"
17         end
18 end