Module: XamplGenerator
- Includes:
- Xampl
- Defined in:
- lib/xamplr/yuml-out.rb,
lib/xamplr/graphml-out.rb,
lib/xamplr/xampl-generator.rb,
lib/xamplr/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
Constant Summary
Constants included from Xampl
Class Method Summary collapse
Methods included from Xampl
auto_cache, auto_persistence, auto_uncache, block_future_changes, cache, clear_cache, close_all_persisters, count_changed, default_persister_format, default_persister_kind, disable_all_persisters, disable_persister, drop_all_persisters, drop_persister, enable_persister, find_known, find_mentions_of, find_meta, find_pids, find_xampl, flush_persister_caches, introduce_to_persister, lazy_load, log, lookup, lookup_in_map, make, optimise, persister, print_known_persisters, print_stats, query, query_implemented, read_only, read_only_transaction, register_persister_kind, remove_from_map, rollback, rollback_all, set_default_persister_format, set_default_persister_kind, store_in_cache, store_in_map, sync, sync_all, transaction, verboseTransactions, version, write_to_cache, xampl_extends_symbols, xampl_extends_symbols=
Class Method Details
.from_command_line(options = nil) ⇒ Object
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
# File 'lib/xamplr/xampl-generator.rb', line 475 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) generator.print_elements(write_elements) if write_elements end end |