Sha256: b1d333db5ab0835a76b0c257d943ab1b93aee799c828194355ae4be3f6622ab3

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

require 'avm/runners/base'
require 'eac_cli/core_ext'

module Avm
  module Tools
    class Runner
      class SourceGenerate
        runner_with :help do
          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

        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) ||
            fatal_error("No generator found for stereotype \"#{stereotype_name}\"")
        end

        delegate :stereotype_name, to: :parsed

        def target_path
          parsed.target_path.to_pathname
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
avm-tools-0.129.1 lib/avm/tools/runner/source_generate.rb
eac_tools-0.16.1 sub/avm-tools/lib/avm/tools/runner/source_generate.rb
avm-tools-0.129.0 lib/avm/tools/runner/source_generate.rb
eac_tools-0.16.0 sub/avm-tools/lib/avm/tools/runner/source_generate.rb
avm-tools-0.128.0 lib/avm/tools/runner/source_generate.rb
eac_tools-0.15.0 sub/avm-tools/lib/avm/tools/runner/source_generate.rb
eac_tools-0.14.0 sub/avm-tools/lib/avm/tools/runner/source_generate.rb
eac_tools-0.13.0 sub/avm-tools/lib/avm/tools/runner/source_generate.rb
avm-tools-0.127.0 lib/avm/tools/runner/source_generate.rb
eac_tools-0.12.0 sub/avm-tools/lib/avm/tools/runner/source_generate.rb