tmpl

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCachePath

func GetCachePath() string

GetCachePath returns the path of the local cache of fetched remote templates.

func GetLocalPath

func GetLocalPath() string

GetLocalPath returns the path of the local templates

Types

type Copy added in v1.7.0

type Copy struct {
	Into string `yaml:"into"`
	From string `yaml:"from"`
	When string `yaml:"when"`
}

Copy is an instance of each expansion configuration object. Expansions are used to determine the files/directories to expand (copy) form the template into the project.

type Fill added in v1.7.0

type Fill struct {
	File string                 `yaml:"file"`
	When string                 `yaml:"when"`
	Vars map[string]interface{} `yaml:"vars"`
}

Fill is an instance of each template fill configuration object. Templates are used to specify templates the files that should be ran through the template engine for variable replacement.

type Template

type Template struct {
	From              string
	Directory         fs.Directory
	TemplateDirectory fs.Directory
	Manifest          TemplateManifest
}

Template holds information related to the template being rendered.

func Make

func Make(expandDir fs.Directory, template string) Template

Make initializes a Template given a dir and the template name or remote.

func (Template) CachedPath

func (temp Template) CachedPath() string

CachedPath returns the path to the locally cached template.

func (Template) CheckIfCoreRemote

func (temp Template) CheckIfCoreRemote() bool

CheckIfCoreRemote checks if the remote provided is a Lavra repository remote.

func (Template) CheckIfGithubRemote

func (temp Template) CheckIfGithubRemote() bool

CheckIfGithubRemote checks if the remoote provided is a Github repository remote.

func (Template) Copy added in v1.7.0

func (temp Template) Copy()

Copy expands the template into the template's directory.

func (Template) EnsureTemplateIsFetched

func (temp Template) EnsureTemplateIsFetched()

EnsureTemplateIsFetched fetches the remote template, ensuring that the fetched version is the latest.

func (Template) Fill added in v1.7.0

func (temp Template) Fill()

Fill fills the templates specified wtihin the template.

func (Template) GetLocalPathByRemote

func (temp Template) GetLocalPathByRemote() string

GetLocalPathByRemote returns the local path of the remote provided.

func (Template) GetSafeRemote

func (temp Template) GetSafeRemote() string

GetSafeRemote returns a string with the full Git URL for Lavra-owned projects as well Github-hosted projects, and finally the given remote string.

func (Template) IsTemplateAvailableLocally

func (temp Template) IsTemplateAvailableLocally() bool

IsTemplateAvailableLocally checks whether or not a local template exists by the specific name.

func (Template) IsTemplateAvailableRemotely

func (temp Template) IsTemplateAvailableRemotely(remote string) bool

IsTemplateAvailableRemotely returns a boolean stating whether the the remote template is available.

func (Template) LoadManifest

func (temp Template) LoadManifest() Template

LoadManifest loads the template.yml into the Manifest of the Template.

func (Template) LoadRemoteTemplateIntoMemory

func (temp Template) LoadRemoteTemplateIntoMemory() (*git.Repository, error)

LoadRemoteTemplateIntoMemory loads the remote template into memory for

func (Template) Prompt added in v1.10.0

func (temp Template) Prompt() prompt.AnswerMap

Prompt runs the manifest Prompt.

type TemplateManifest

type TemplateManifest struct {
	Name        string        `yaml:"name"`
	Author      string        `yaml:"author"`
	Description string        `yaml:"description"`
	Prompt      prompt.Prompt `yaml:"prompt"`
	Copy        []Copy        `yaml:"copy"`
	Fill        []Fill        `yaml:"fill"`
}

TemplateManifest is an instance of the template configuration file.

type WhenEnvironment added in v1.7.0

type WhenEnvironment struct {
	Answers  prompt.AnswerMap
	Template TemplateManifest
	Vars     map[string]interface{}
	Env      map[string]string
}

WhenEnvironment provides the available fields for `when` evaluations.

Jump to

Keyboard shortcuts

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