steps

package
v3.0.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: BSD-2-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package steps provides a set of handlers for create command chain of responsibility.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckPackageName

type CheckPackageName struct{}

CheckPackageName represents the step that checks the package name of the project manifest a template writes.

func (CheckPackageName) Run

func (CheckPackageName) Run(createCtx *create_ctx.CreateCtx,
	templateCtx *app_template.TemplateCtx,
) error

Run refuses the application when the template leaves a project manifest whose [package].name is not a package name.

The name is what the instance commands, tt package and tt binary know the project by, and a manifest whose name does not fit breaks all of them: the project would be created only to fail on its first start. A template derives the name from --name its own way - vshard_cluster replaces "_" with "-" - so the name is checked as the template wrote it, once the template is instantiated and its hooks have run, and before anything is moved to the destination. A template without a manifest is left alone.

type Cleanup

type Cleanup struct{}

Cleanup represents application directory cleanup step.

func (Cleanup) Run

func (hook Cleanup) Run(createCtx *create_ctx.CreateCtx,
	templateCtx *app_template.TemplateCtx,
) error

Run removes all files/directories, except files in the include list.

type CollectTemplateVarsFromUser

type CollectTemplateVarsFromUser struct {
	// Reader is used to get user input.
	Reader stringReader
}

CollectTemplateVarsFromUser represents interactive variables collecting step.

func (CollectTemplateVarsFromUser) Run

func (collectTemplateVarsFromUser CollectTemplateVarsFromUser) Run(
	createCtx *create_ctx.CreateCtx, templateCtx *app_template.TemplateCtx,
) error

Run collects template variables from user in interactive mode.

type CopyAppTemplate

type CopyAppTemplate struct{}

CopyAppTemplate represents template -> app directory copy step.

func (CopyAppTemplate) Run

func (CopyAppTemplate) Run(createCtx *create_ctx.CreateCtx,
	templateCtx *app_template.TemplateCtx,
) error

Run copies/extracts application template to target application directory.

type CreateTemporaryAppDirectory

type CreateTemporaryAppDirectory struct{}

CreateTemporaryAppDirectory represents create temporary application directory step.

func (CreateTemporaryAppDirectory) Run

Run creates temporary application directory.

type FillTemplateVarsFromCli

type FillTemplateVarsFromCli struct{}

FillTemplateVarsFromCli represents a step for collecting variables from command line args.

func (FillTemplateVarsFromCli) Run

Run collects variables passed using command line args.

type LoadManifest

type LoadManifest struct{}

LoadManifest represents manifest load step.

func (LoadManifest) Run

Run loads template manifest. Missing manifest is not an error.

type LoadVarsFile

type LoadVarsFile struct{}

LoadVarsFile represents variables file load step.

func (LoadVarsFile) Run

func (LoadVarsFile) Run(ctx *create_ctx.CreateCtx,
	templateCtx *app_template.TemplateCtx,
) error

Run collects variables passed using command line args.

type MoveAppDirectory

type MoveAppDirectory struct{}

MoveAppDirectory represents temporary application directory move step.

func (MoveAppDirectory) Run

func (MoveAppDirectory) Run(createCtx *create_ctx.CreateCtx,
	templateCtx *app_template.TemplateCtx,
) error

Run moves temporary application directory to destination.

type PrintFollowUpMessage

type PrintFollowUpMessage struct {
	// Writer is used to write follow-up message.
	Writer io.Writer
}

func (PrintFollowUpMessage) Run

func (printFollowUpMsgStep PrintFollowUpMessage) Run(createCtx *create_ctx.CreateCtx,
	templateCtx *app_template.TemplateCtx,
) error

Run prints application template follow-up message.

type RenderTemplate

type RenderTemplate struct{}

RenderTemplate represents template render step.

func (RenderTemplate) Run

Run renders template in application directory.

type RunHook

type RunHook struct {
	HookType string
}

RunHook represents run hook step.

func (RunHook) Run

func (hook RunHook) Run(ctx *create_ctx.CreateCtx, templateCtx *app_template.TemplateCtx) error

Run executes template hooks.

type SetPredefinedVariables

type SetPredefinedVariables struct{}

SetPredefinedVariables represents a step for setting pre-defined variables.

func (SetPredefinedVariables) Run

func (SetPredefinedVariables) Run(createCtx *create_ctx.CreateCtx,
	templateCtx *app_template.TemplateCtx,
) error

Run sets predefined variables values.

type Step

type Step interface {
	Run(ctx *create_ctx.CreateCtx, appTemplateCtx *app_template.TemplateCtx) error
}

Step is an interface for single step in create chain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL