Documentation ¶
Index ¶
- func GetCachePath() string
- func GetLocalPath() string
- type Copy
- type Fill
- type Template
- func (temp Template) CachedPath() string
- func (temp Template) CheckIfCoreRemote() bool
- func (temp Template) CheckIfGithubRemote() bool
- func (temp Template) Copy()
- func (temp Template) EnsureTemplateIsFetched() error
- func (temp Template) Fill()
- func (temp Template) GetLocalPathByRemote() string
- func (temp Template) GetSafeRemote() string
- func (temp Template) IsTemplateAvailableLocally() bool
- func (temp Template) IsTemplateAvailableRemotely(remote string) bool
- func (temp Template) LoadManifest() Template
- func (temp Template) LoadRemoteTemplateIntoMemory() (*git.Repository, error)
- type TemplateManifest
- type WhenEnvironment
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.
Types ¶
type Copy ¶ added in v1.7.0
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 (Template) CachedPath ¶
CachedPath returns the path to the locally cached template.
func (Template) CheckIfCoreRemote ¶
CheckIfCoreRemote checks if the remote provided is a Lavra repository remote.
func (Template) CheckIfGithubRemote ¶
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 ¶
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 ¶
GetLocalPathByRemote returns the local path of the remote provided.
func (Template) GetSafeRemote ¶
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 ¶
IsTemplateAvailableLocally checks whether or not a local template exists by the specific name.
func (Template) IsTemplateAvailableRemotely ¶
IsTemplateAvailableRemotely returns a boolean stating whether the the remote template is available.
func (Template) LoadManifest ¶
LoadManifest loads the template.yml into the Manifest of the Template.
func (Template) LoadRemoteTemplateIntoMemory ¶
LoadRemoteTemplateIntoMemory loads the remote template into memory for
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.