summaryrefslogtreecommitdiff
path: root/cpp/rubygen/generate
blob: ce9e7afc1b6324640c5ab1ac55b11e19b94bffea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env ruby
require 'amqpgen'

#
# Run a set of code generation templates.
#

if ARGV.size < 3
  puts <<EOS
Usage: #{ARGV[0]} OUTDIR  SPEC.xml [ ... ] TEMPLATE.rb [ ... ]
Parse all SPEC.xml files to create an AMQP model, run each TEMPLATE
putting the resulting files under OUTDIR. Prints a list of files
generated to standard output.

If OUTDIR is '-'  then just prints file list without generating files.
EOS
  exit 1
end
Outdir=ARGV[0]
specs=ARGV.grep(/\.xml$/)
templates=ARGV.grep(/\.rb$/)
Amqp=AmqpRoot.new(*specs)
templates.each { |t| require t }