composer

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package composer implements the Composite design pattern used to manage files and folder structure for sveltin projects and artifacts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component interface {
	GetName() string
	SetName(string)
	SetPath(string)
	Create(*factory.Artifact) error
}

Component describes operations common to elements of the tree.

type File

type File struct {
	Name string

	TemplateID   string
	TemplateData *config.TemplateData
	// contains filtered or unexported fields
}

File is the main struct representing a file to be generated by sveltin cmds.

func (*File) Create

func (f *File) Create(sf *factory.Artifact) error

Create is resposibile to execute the file template providing the info needed by the builder get the content and save the newly creted file on the file system.

func (*File) GetName

func (f *File) GetName() string

GetName returns a string representing the file name.

func (*File) GetPath

func (f *File) GetPath() string

GetPath returns a string representing the file path.

func (*File) GetTemplateData

func (f *File) GetTemplateData() *config.TemplateData

GetTemplateData returns a TemplateData struct the file.

func (*File) GetTemplateID

func (f *File) GetTemplateID() string

GetTemplateID returns a string representing the template id for the file.

func (*File) SetName

func (f *File) SetName(name string)

SetName set the file name.

func (*File) SetPath

func (f *File) SetPath(path string)

SetPath set the file path.

type Folder

type Folder struct {
	Name string
	// contains filtered or unexported fields
}

Folder is the struct representing a folder on the file system.

func GetAPIFolder

func GetAPIFolder(maker *pathmaker.SveltinPathMaker) *Folder

GetAPIFolder create a Folder struct for the "src/routes/api" folder of the project.

func GetConfigFolder

func GetConfigFolder(maker *pathmaker.SveltinPathMaker) *Folder

GetConfigFolder create a Folder struct for the "config" folder of the project.

func GetContentFolder

func GetContentFolder(maker *pathmaker.SveltinPathMaker) *Folder

GetContentFolder create a Folder struct for the "content" folder of the project.

func GetLibFolder

func GetLibFolder(maker *pathmaker.SveltinPathMaker) *Folder

GetLibFolder create a Folder struct for the "src/lib" folder of the project.

func GetParamsFolder

func GetParamsFolder(maker *pathmaker.SveltinPathMaker) *Folder

GetParamsFolder create a Folder struct for the "src/params" folder of the project.

func GetRootFolder

func GetRootFolder(maker *pathmaker.SveltinPathMaker) *Folder

GetRootFolder create a Folder struct for the project root folder.

func GetRoutesFolder

func GetRoutesFolder(maker *pathmaker.SveltinPathMaker) *Folder

GetRoutesFolder create a Folder struct for the "src/routes" folder of the project.

func GetStaticFolder

func GetStaticFolder(maker *pathmaker.SveltinPathMaker) *Folder

GetStaticFolder create a Folder struct for the "static" folder of the project.

func GetThemesFolder

func GetThemesFolder(maker *pathmaker.SveltinPathMaker) *Folder

GetThemesFolder create a Folder struct for the "themes" folder of the project.

func NewFolder

func NewFolder(name string) *Folder

NewFolder returns a pointer to a Folder struct.

func (*Folder) Add

func (f *Folder) Add(c Component)

Add append an item to the Folder's components list.

func (*Folder) Create

func (f *Folder) Create(sf *factory.Artifact) error

Create is the function to create the entire folder structure on the file system.

func (*Folder) GetComponents

func (f *Folder) GetComponents() []Component

GetComponents returns the slice of component for a Folder struct.

func (*Folder) GetName

func (f *Folder) GetName() string

GetName returns the Folder name as string.

func (*Folder) GetPath

func (f *Folder) GetPath() string

GetPath returns the Folder path as string.

func (*Folder) SetName

func (f *Folder) SetName(name string)

SetName sets the folder name.

func (*Folder) SetPath

func (f *Folder) SetPath(path string)

SetPath sets the Folder path.

Jump to

Keyboard shortcuts

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