registry

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrSourceNotFound

type ErrSourceNotFound struct {
	Name string
}

func (ErrSourceNotFound) Error

func (e ErrSourceNotFound) Error() string

type ErrTemplateExists added in v0.0.8

type ErrTemplateExists struct {
	Name string
}

func (ErrTemplateExists) Error added in v0.0.8

func (e ErrTemplateExists) Error() string

type ErrTemplateNotFound

type ErrTemplateNotFound struct {
	Name string
}

func (ErrTemplateNotFound) Error

func (e ErrTemplateNotFound) Error() string

type Registry

type Registry struct {
	Sources   []*Source   `yaml:"sources"`
	Templates []*Template `yaml:"templates"`
	// contains filtered or unexported fields
}

Registry is a collection of Template

func Open

func Open(dir string) (*Registry, error)

Open opens a Registry, creating one if none exists at dir

func (*Registry) AddSource

func (r *Registry) AddSource(url, name string) (*Source, error)

AddSource adds a new Source to the Registry

func (*Registry) DownloadTemplate added in v0.0.2

func (r *Registry) DownloadTemplate(name, repo, branch string) (*Template, error)

DownloadTemplate downloads and adds a new Template to the Registry

func (*Registry) GetSource

func (r *Registry) GetSource(name string) (*Source, error)

GetSource retrieves a Source from the Registry

func (*Registry) GetTemplate

func (r *Registry) GetTemplate(name string) (*Template, error)

GetTemplate retrieves a Template from the Registry

func (*Registry) MetaFilePath

func (r *Registry) MetaFilePath() string

MetaFilePath is the path to the Registry meta-file

func (*Registry) RemoveSource

func (r *Registry) RemoveSource(name string) error

RemoveSource removes the Source from the registry meta

func (*Registry) RemoveTemplate

func (r *Registry) RemoveTemplate(name string) error

RemoveTemplate removes the Template from disk and meta

func (*Registry) SaveTemplate added in v0.0.2

func (r *Registry) SaveTemplate(name, path string) (*Template, error)

SaveTemplate saves a local Template to the Registry

func (*Registry) UpdateTemplate added in v0.0.8

func (r *Registry) UpdateTemplate(name string) error

UpdateTemplate updates the Template on disk and in meta

type Source

type Source struct {
	Name string `yaml:"name"`
	URL  string `yaml:"url"`
}

Source is a quick way to specify a git source e.g. Gitea, GitHub, etc.

func (*Source) CloneURL

func (s *Source) CloneURL(namespace string) string

CloneURL constructs a URL suitable for cloning a repository

type Template

type Template struct {
	Name       string    `yaml:"name"`
	Path       string    `yaml:"path"`
	Repository string    `yaml:"repository"`
	Branch     string    `yaml:"branch"`
	LastUpdate time.Time `yaml:"last_update"`
	// contains filtered or unexported fields
}

Template is a tmpl project

func (*Template) ArchiveName

func (t *Template) ArchiveName() string

ArchiveName is the name given to the archive for this Template

func (*Template) ArchivePath

func (t *Template) ArchivePath() string

ArchivePath is the full path to the archive for this Template within the Registry

func (*Template) Execute

func (t *Template) Execute(dest string, defaults, overwrite bool) error

Execute runs the Template and copies to dest

Jump to

Keyboard shortcuts

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