Class: Avm::SourceGenerators::Runner
- Inherits:
-
Object
- Object
- Avm::SourceGenerators::Runner
- Defined in:
- lib/avm/source_generators/runner.rb
Constant Summary collapse
- OPTION_NAME_VALUE_SEPARATOR =
':'
Instance Method Summary collapse
- #generate ⇒ Object
- #generator_uncached ⇒ Object
- #help_extra_text ⇒ String
- #options ⇒ Hash<String, String>
- #run ⇒ Object
- #start_banner ⇒ Object
- #target_path ⇒ Object
Instance Method Details
#generate ⇒ Object
22 23 24 25 26 |
# File 'lib/avm/source_generators/runner.rb', line 22 def generate infom 'Generating...' generator.perform success "Source generated in \"#{generator.target_path}\"" end |
#generator_uncached ⇒ Object
40 41 42 43 44 |
# File 'lib/avm/source_generators/runner.rb', line 40 def generator_uncached ::Avm::Registry.source_generators .detect_optional(stereotype_name, target_path, ) || fatal_error("No generator found for stereotype \"#{stereotype_name}\"") end |
#help_extra_text ⇒ String
29 30 31 32 |
# File 'lib/avm/source_generators/runner.rb', line 29 def help_extra_text help_list_section('Stereotypes', ::Avm::Registry.source_generators.available .map(&:application_stereotype_name)) end |
#options ⇒ Hash<String, String>
49 50 51 |
# File 'lib/avm/source_generators/runner.rb', line 49 def parsed.option.to_h { |v| v.split(OPTION_NAME_VALUE_SEPARATOR) } end |
#run ⇒ Object
17 18 19 20 |
# File 'lib/avm/source_generators/runner.rb', line 17 def run generate end |
#start_banner ⇒ Object
34 35 36 37 38 |
# File 'lib/avm/source_generators/runner.rb', line 34 def infov 'Stereotype', stereotype_name infov 'Target path', target_path infov 'Generator', generator.class end |
#target_path ⇒ Object
53 54 55 |
# File 'lib/avm/source_generators/runner.rb', line 53 def target_path parsed.target_path.to_pathname end |