client

package
v0.0.0-...-76cddca Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckErr

func CheckErr(err error)

func PathWithoutVersion

func PathWithoutVersion(s string) string

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(logWriter io.Writer, outDir string) (*Client, error)

func (*Client) CreateThemesConfig

func (c *Client) CreateThemesConfig() error

CreateThemesConfig reads themes.txt and creates a config.json suitable for Hugo. Note that we're only using that config to get the full module listing.

func (*Client) GetGitHubRepos

func (c *Client) GetGitHubRepos(mods ModulesMap, cleanCache bool) (map[string]GitHubRepo, error)

GetGitHubRepos will first look in the chache folder for GitHub repo information for mods. If not found, it will ask GitHub and then store it in the cache.

If you start with an empty cache, you will need to set a GITHUB_TOKEN environment variable.

func (*Client) GetHugoModulesMap

func (c *Client) GetHugoModulesMap(config string) (ModulesMap, error)

func (*Client) InitModule

func (c *Client) InitModule() error

func (*Client) IsBadURL

func (c *Client) IsBadURL(s string) bool

func (*Client) JoinOutPath

func (c *Client) JoinOutPath(elem ...string) string

func (*Client) Logf

func (c *Client) Logf(format string, a ...interface{})

Logf logs to the configured log writer.

func (*Client) OutFileExists

func (c *Client) OutFileExists(name string) bool

func (*Client) RunHugo

func (c *Client) RunHugo(arg ...string) error

func (*Client) TimeTrack

func (c *Client) TimeTrack(start time.Time, name string)

type GitHubRepo

type GitHubRepo struct {
	ID          int       `json:"id"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	HTMLURL     string    `json:"html_url"`
	Stars       int       `json:"stargazers_count"`
}

func (GitHubRepo) IsZero

func (g GitHubRepo) IsZero() bool

type HugoVersion

type HugoVersion struct {
	Min      string
	Max      string
	Extended bool
}

HugoVersion holds Hugo binary version requirements for a module.

type Module

type Module struct {
	Path        string                 `json:"path"`
	Owner       string                 `json:"owner"`
	Version     string                 `json:"version"`
	Time        time.Time              `json:"time"`
	Dir         string                 `json:"dir"`
	HugoVersion HugoVersion            `json:"hugoVersion"`
	Meta        map[string]interface{} `json:"meta"`
}

func (Module) PathRepo

func (m Module) PathRepo() string

PathRepo returns the root path to the repository.

func (Module) PathWithoutVersion

func (m Module) PathWithoutVersion() string

type ModulesMap

type ModulesMap map[string]Module

Jump to

Keyboard shortcuts

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