summaryrefslogtreecommitdiff
path: root/cpp/rubygen/generate
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/rubygen/generate')
-rwxr-xr-xcpp/rubygen/generate23
1 files changed, 23 insertions, 0 deletions
diff --git a/cpp/rubygen/generate b/cpp/rubygen/generate
new file mode 100755
index 0000000000..09b27211af
--- /dev/null
+++ b/cpp/rubygen/generate
@@ -0,0 +1,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 }