Module: XamplGenerator
- Includes:
- Xampl
- Defined in:
- lib/xamplr-gen/yuml-out.rb,
lib/xamplr-gen/graphml-out.rb,
lib/xamplr-gen/xampl-generator.rb,
lib/xamplr-gen/xampl-hand-generated.rb
Defined Under Namespace
Modules: AttributeAsChild, ChildElementAsChild, ElementAsChild, ElementsAsChild, IndexAttributeAsChild, OptionsAsChild, ResolveAsChild Classes: Attribute, ChildElement, Element, Elements, Generator, GraphMLOut, IndexAttribute, Options, Resolve, StandardGeneratorTemplates, YUMLOut
Class Method Summary collapse
Class Method Details
.from_command_line(options = nil) ⇒ Object
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 |
# File 'lib/xamplr-gen/xampl-generator.rb', line 517 def XamplGenerator.from_command_line(=nil) opts = GetoptLong.new( ["--options", "-o", GetoptLong::REQUIRED_ARGUMENT], ["--elements", "-e", GetoptLong::REQUIRED_ARGUMENT], ["--gen:options", "-O", GetoptLong::OPTIONAL_ARGUMENT], ["--gen:elements", "-E", GetoptLong::OPTIONAL_ARGUMENT], ["--directory", "-d", GetoptLong::REQUIRED_ARGUMENT], ["--help", "-h", GetoptLong::NO_ARGUMENT], ["--version", "-v", GetoptLong::NO_ARGUMENT] ) = nil write_elements = nil directory = File.join(".", "tmp") opts.each do |opt, arg| case opt when "--help" then puts "--help, -h :: this help message" puts "--options, -o :: xml file seting the generation options" puts "--elements, -e :: xml file providing a hint 'schema' (very optional)" puts "--gen:options, -O :: write an xml file describing the options used (default gen-options.xml)" puts "--gen:elements, -E :: write an xml file describing the 'schema' (default gen-elements.xml)" puts "--directory, -o :: where to write the generated files (default #{directory})" puts "--version, -o :: what version of xampl is this?" exit when "--version" then puts "version 0.0.0" exit when "--directory" directory = arg when "--options" puts "sorry, cannot read options yet" when "--elements" puts "sorry, cannot read elements yet" when "--gen:options" = (arg and (0 < arg.length)) ? arg : "gen-options.xml" when "--gen:elements" write_elements = (arg and (0 < arg.length)) ? arg : "gen-elements.xml" else puts " #{opt} #{arg}" end end puts "write options to: #{}" if puts "write elements to: #{write_elements}" if write_elements puts "write generated code to: #{directory}" if directory generator = Generator.new() filenames = [] ARGV.each do |name| filenames << name end if 0 < filenames.length then generator.comprehend_from_files(filenames) generator.generate_to_directory(directory) #TODO -- are these writing to the correct location, is this even possible to call anymore? generator.print_elements(write_elements) if write_elements end end |