Class: GoonModelGen::Cli
- Inherits:
-
Thor
- Object
- Thor
- GoonModelGen::Cli
- Includes:
- Thor::Actions
- Defined in:
- lib/goon_model_gen/cli.rb
Instance Method Summary collapse
- #config ⇒ Object
- #converter(*paths) ⇒ Object
- #model(*paths) ⇒ Object
- #sources(*paths) ⇒ Object
- #store(*paths) ⇒ Object
Instance Method Details
#config ⇒ Object
28 29 30 |
# File 'lib/goon_model_gen/cli.rb', line 28 def config puts YAML.dump(cfg) end |
#converter(*paths) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/goon_model_gen/cli.rb', line 66 def converter(*paths) loader = Converter::Loader.new(cfg) package_hash = Golang::StructsLoader.new(cfg).process # Golang::Packages packages = Golang::Packages.wrap(package_hash.values.flatten) converter_package = packages.find_or_new(cfg.converter_package_path) b = Builder::ConverterBuilder.new(cfg, loader, Golang::Packages.new.add(*packages)) conv_packages = b.build(paths) if [:inspect] puts YAML.dump(conv_packages) else conv_packages.map(&:files).flatten.each do |f| new_generator(f, packages). run(converter_package: converter_package) end end end |
#model(*paths) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/goon_model_gen/cli.rb', line 40 def model(*paths) packages = build_model_objects(paths) if [:inspect] puts YAML.dump(packages) else packages.map(&:files).flatten.each do |f| new_generator(f, packages).run end end end |
#sources(*paths) ⇒ Object
33 34 35 36 |
# File 'lib/goon_model_gen/cli.rb', line 33 def sources(*paths) context = load_yamls(paths) puts YAML.dump(context) end |
#store(*paths) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/goon_model_gen/cli.rb', line 53 def store(*paths) packages = build_store_packages(paths).add(*validation_packages) if [:inspect] puts YAML.dump(packages) else packages.map(&:files).flatten.each do |f| new_generator(f, packages).run end end end |