registry

package
Version: v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrSourceNotFound

func IsErrSourceNotFound(err error) bool

func IsErrTemplateExists added in v0.0.8

func IsErrTemplateExists(err error) bool

func IsErrTemplateNotFound

func IsErrTemplateNotFound(err error) bool

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   `toml:"sources"`
	Templates []*Template `toml:"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

RemoveTemplate updates the Template on disk and in meta

type Source

type Source struct {
	Name string `toml:"name"`
	URL  string `toml:"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    `toml:"name"`
	Path       string    `toml:"path"`
	Repository string    `toml:"repository"`
	Branch     string    `toml:"branch"`
	LastUpdate time.Time `toml:"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