Sha256: 23c995a5a5ec6ee35de1ba97bdf62053e1336db7eb0dfd16435c8b25f75b9a96

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require "pathname"

require_relative "command_config"

module Foobara
  module Generators
    module CommandGenerator
      class GenerateCommand < Foobara::Generators::Generate
        class MissingManifestError < RuntimeError; end

        possible_error MissingManifestError

        inputs CommandConfig

        def execute
          add_initial_elements_to_generate

          each_element_to_generate do
            generate_element
          end

          paths_to_source_code
        end

        attr_accessor :manifest_data

        def base_generator
          Generators::CommandGenerator
        end

        # TODO: delegate this to base_generator
        def templates_dir
          # TODO: implement this?
          # :nocov:
          "#{__dir__}/../templates"
          # :nocov:
        end

        def add_initial_elements_to_generate
          elements_to_generate << command_config
        end

        def command_config
          @command_config ||= CommandConfig.new(inputs)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foobara-command-generator-0.0.3 src/generate_command.rb
foobara-command-generator-0.0.2 src/generate_command.rb
foobara-command-generator-0.0.1 src/generate_command.rb