abstract class Marten::CLI::Generator

Overview

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.

Included Modules

Direct Known Subclasses

Defined in:

marten/cli/generator.cr
marten/cli/generator/app.cr
marten/cli/generator/auth.cr
marten/cli/generator/email.cr
marten/cli/generator/email/context.cr
marten/cli/generator/email/templates.cr
marten/cli/generator/handler.cr
marten/cli/generator/handler/context.cr
marten/cli/generator/handler/templates.cr
marten/cli/generator/model.cr
marten/cli/generator/model/context.cr
marten/cli/generator/model/field_definition.cr
marten/cli/generator/model/field_definition/qualifier_renderer.cr
marten/cli/generator/model/templates.cr
marten/cli/generator/schema.cr
marten/cli/generator/schema/context.cr
marten/cli/generator/schema/field_definition.cr
marten/cli/generator/schema/templates.cr
marten/cli/generator/secret_key.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(command : Manage::Command::Gen) #

[View source]

Class Method Detail

def self.footer_description(footer_description : String | Symbol) #

Allows to define a footer description that will be displayed after the generator usage help.


[View source]
def self.footer_description #

Returns the footer description of the generator.


[View source]
def self.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.


[View source]
def self.generator_name #

Returns the name of the considered generator.


[View source]
def self.help(help : String) #

Allows to set the help description of the generator.


[View source]
def self.help #

Returns the help description of the generator.


[View source]

Instance Method Detail

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


[View source]
def 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.


[View source]
def 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.


[View source]
def print_warnings #

Prints the warning messages that have been collected during the generator execution.


[View source]
abstract def run : Nil #

[View source]
def setup #

[View source]
def warnings : Array(String) #

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


[View source]
def warnings=(warnings : Array(String)) #

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


[View source]