manifest

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFileNotFound is returned when provider is unable to locate file.
	ErrFileNotFound = errors.New("file not found")

	// ErrPermissionDenied is returned when provider doesn't have permissions to open file.
	ErrPermissionDenied = errors.New("permission denied")
)

Functions

This section is empty.

Types

type EmbedFSProvider

type EmbedFSProvider struct {
	// contains filtered or unexported fields
}

EmbedFSProvider is an wrapper for embed.FS that provides implementation of provider interface accepted by projector.Generator.

func NewEmbedFSProvider

func NewEmbedFSProvider(fs *embed.FS, root string) *EmbedFSProvider

func (*EmbedFSProvider) Get

func (e *EmbedFSProvider) Get(filename string) ([]byte, error)

type File

type File struct {
	Path   string `toml:"path"`
	Output string `toml:"output"`
}

File is actually mapping between template file and output file. Also template syntax allowed in Output field.

func (File) Validate

func (f File) Validate() error

type Manifest

type Manifest struct {
	Name        string `toml:"name"`
	Author      string `toml:"author"`
	URL         string `toml:"url,omitempty"`
	Version     string `toml:"version"`
	Description string `toml:"description"`
	Steps       Steps  `toml:"steps"`
}

Manifest contains all metadata related to project template and actual steps of project generation.

func Load added in v0.2.0

func Load(p provider, path string) (*Manifest, error)

func (Manifest) Validate

func (m Manifest) Validate() error

type RealFSProvider

type RealFSProvider struct {
	// contains filtered or unexported fields
}

RealFSProvider is an wrapper for file system that provides implementation of provider interface accepted by projector.Generator.

func NewRealFSProvider

func NewRealFSProvider(root string) *RealFSProvider

func (*RealFSProvider) Get

func (r *RealFSProvider) Get(filename string) ([]byte, error)

type Step

type Step struct {
	Name       string `toml:"name"`
	IsOptional bool   `toml:"optional"`
	Files      []File `toml:"files"`
	Shell      string `toml:"shell"`
}

Step contains template files to output mapping and/or shell script to execute.

func (Step) Validate

func (s Step) Validate() error

type Steps added in v0.3.0

type Steps []Step

func (Steps) Get added in v0.3.0

func (s Steps) Get(name string) (*Step, error)

Jump to

Keyboard shortcuts

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