Sha256: f082bcfbaf5d8a2b653dcf60de9b1e42b536b4303dab98e804bc5fecb6648656
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
# frozen_string_literal: true require 'avm/registry' require 'eac_cli/core_ext' module Avm module SourceGenerators class Runner OPTION_NAME_VALUE_SEPARATOR = ':' runner_with :help do arg_opt '-o', '--option', 'Option for generator.', repeat: true, optional: true pos_arg :stereotype_name pos_arg :target_path end def run start_banner generate end def generate infom 'Generating...' generator.perform success "Source generated in \"#{generator.target_path}\"" end # @return [String] def help_extra_text help_list_section('Stereotypes', ::Avm::Registry.source_generators.available .map(&:application_stereotype_name)) end def start_banner infov 'Stereotype', stereotype_name infov 'Target path', target_path infov 'Generator', generator.class end def generator_uncached ::Avm::Registry.source_generators .detect_optional(stereotype_name, target_path, options) || fatal_error("No generator found for stereotype \"#{stereotype_name}\"") end delegate :stereotype_name, to: :parsed # @return [Hash<String, String>] def options parsed.option.map { |v| v.split(OPTION_NAME_VALUE_SEPARATOR) }.to_h end def target_path parsed.target_path.to_pathname end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
avm-0.84.0 | lib/avm/source_generators/runner.rb |
eac_tools-0.83.0 | sub/avm/lib/avm/source_generators/runner.rb |