Sha256: 2e4df027851d1454bcac39c5f914ea14d83afdb1b78037db6f3d12ae69dbd63a

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

module Foobara
  module Generators
    module CommandGenerator
      module Generators
        class CommandGenerator < Foobara::FilesGenerator
          class << self
            def manifest_to_generator_classes(manifest)
              case manifest
              when CommandConfig
                [
                  Generators::CommandGenerator,
                  Generators::CommandSpecGenerator
                ]
              else
                # :nocov:
                raise "Not sure how build a generator for a #{manifest}"
                # :nocov:
              end
            end
          end

          def template_path
            ["src", "command.rb.erb"]
          end

          def target_path
            *path, file = module_path.map { |part| Util.underscore(part) }

            file = "#{file}.rb"

            ["src", *path, file]
          end

          alias command_config relevant_manifest

          def templates_dir
            "#{__dir__}/../templates"
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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