Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidTemplate = errors.New("invalid template content")
ErrInvalidTemplate is returned when template content is invalid
var ErrTemplateNotFound = errors.New("template not found")
ErrTemplateNotFound is returned when a template cannot be found
Functions ¶
This section is empty.
Types ¶
type GitHubReleasesProvider ¶
GitHubReleasesProvider implements TemplateProvider using GitHub Releases
func NewGitHubReleasesProvider ¶
func NewGitHubReleasesProvider(owner, repo string) *GitHubReleasesProvider
NewGitHubReleasesProvider creates a new GitHub releases template provider
func (*GitHubReleasesProvider) DownloadTemplate ¶
func (p *GitHubReleasesProvider) DownloadTemplate(releaseTag string) (string, error)
DownloadTemplate downloads and extracts a template release to a temporary directory
func (*GitHubReleasesProvider) ExtractTemplate ¶
func (p *GitHubReleasesProvider) ExtractTemplate(archivePath, destDir string) error
ExtractTemplate extracts a template archive to the destination directory Note: For GitHub releases, we expect the archive to already be extracted by DownloadTemplate, so this is a no-op that just validates the directory exists.
func (*GitHubReleasesProvider) GetTemplate ¶
func (p *GitHubReleasesProvider) GetTemplate(version string) ([]byte, error)
GetTemplate returns the template content for the given version Note: This implementation downloads the release each time. In practice, you might want to cache this locally.
type TemplateProvider ¶
type TemplateProvider interface {
// GetTemplate returns the template content for the given version
GetTemplate(version string) ([]byte, error)
// DownloadTemplate downloads and extracts a template release to a temporary directory
DownloadTemplate(releaseTag string) (string, error)
// ExtractTemplate extracts a template archive to the destination directory
ExtractTemplate(archivePath, destDir string) error
}
TemplateProvider defines the interface for obtaining project templates