class

Marten::CLI::Generator

Inherits Marten::Apps::Association / Reference / Object

Abstract generator.

Generators are classes that operate in the context of the gen management command. They can be leveraged to generate new abstractions, structures, and files within an existing application.

Constructors

new(command : Manage::Command::Gen)
Source

Class methods

generator_name(name : String | Symbol)

Allows to set the name of the generator.

The value set using this method will be used by users when they invoke the generator through the use of the marten gen management command.

Source
generator_name

Returns the name of the considered generator.

Source
help(help : String)

Allows to set the help description of the generator.

Source
help

Returns the help description of the generator.

Source

Instance methods

command

Returns the command instance that is used to invoke the generator.

Source
create_app_files(app_config : Apps::Config, files : Array(Tuple(String, String)))

Creates the specified files under the passed application config.

files must be an array of tuples where the first element is the path of the file to create and the second element is the content of the file.

Source
create_spec_files(files : Array(Tuple(String, String)))

Creates the specified files under the project's spec folder.

files must be an array of tuples where the first element is the path of the file to create and the second element is the content of the file.

Source
setup
Source
warnings

Returns an array of warning messages that should be printed at the end of the generator execution.

Source
warnings=(warnings : Array(String))

Allows to set the warning messages that should be printed at the end of the generator execution.

Source

Nested types