scaffold

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Field    string `yaml:"field" validate:"required"`
	Value    string `yaml:"value" validate:"required"`
	Operator string `yaml:"operator" validate:"required,oneof=equal not_equal"`
}

Condition is a condition structure to apply to files.

type File

type File struct {
	Permissions       os.FileMode  `yaml:"mode" validate:"required"`
	DirPermissions    os.FileMode  `yaml:"dir_mode"`
	Template          string       `yaml:"template" validate:"required"`
	Conditions        []Condition  `yaml:"conditions"`
	TemplateTags      TemplateTags `yaml:"template_tags"`
	DisableTemplating bool         `yaml:"disable_templating"`
}

File is the structure of a file template.

type IoWriter

type IoWriter struct {
}

IoWriter uses the default go ioutils package to write the files.

func (*IoWriter) Write

func (i *IoWriter) Write(path string, file File) error

type Loader

type Loader interface {
	Get(source string) (Scaffold, error)
}

Loader is the interface for loading scaffolds.

type Scaffold

type Scaffold struct {
	UserInput map[string]Variable `yaml:"user_input" validate:"dive"`
	Files     map[string]File     `yaml:"files" validate:"required,dive"`
}

Scaffold is the configuration for a directory.

type TemplateTags

type TemplateTags struct {
	Open  string `yaml:"open" validate:"omitempty,required"`
	Close string `yaml:"close" validate:"omitempty,required"`
}

TemplateTags configures the templating syntax within a file.

type URLFileLoader

type URLFileLoader struct {
}

URLFileLoader is responsible for returning Scaffolds from yaml files at a remote URL.

func (*URLFileLoader) Get

func (l *URLFileLoader) Get(source string) (scaffold Scaffold, err error)

Get returns a Scaffold from a given yaml file.

type Variable

type Variable struct {
	Description string   `yaml:"description" validate:"required"`
	Value       string   `yaml:"value"`
	Options     []string `yaml:"options"`
}

Variable is the config for a variable of mixed types (multi-select, text, etc).

type Writer

type Writer interface {
	Write(path string, file File) error
}

Writer is the interface for writing scaffolds.

type YamlFileLoader

type YamlFileLoader struct {
}

YamlFileLoader is responsible for returning Scaffolds from yaml files.

func (*YamlFileLoader) Get

func (l *YamlFileLoader) Get(source string) (scaffold Scaffold, err error)

Get returns a Scaffold from a given yaml file.

Jump to

Keyboard shortcuts

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