Documentation
¶
Overview ¶
Package themeinstall installs, updates and removes the themes kept in their own git repositories (app theme …, internal/app/theme.go): a theme's repository is its directory (theme.yaml at its root), its releases are its tags (v1.2.0). A theme is installed into themes/<name>/ at a tag, and themes/themes.lock (themes.Lock) records its source, tag, commit and files' checksum; the files are the site's to commit (as vendoring), the deploy carries them, Verify checks they are what the lock says.
Index ¶
- func Hash(dir string) (string, error)
- func NameOf(source string) string
- func ReadSources(file string) ([]string, error)
- type Finding
- type Installer
- func (in Installer) Add(ctx context.Context, source, version, name string) (themes.LockEntry, error)
- func (in Installer) BuildIndex(ctx context.Context, sources []string, stats StatsFunc) (themes.Catalog, []error)
- func (in Installer) Check(ctx context.Context, dir string, engine []i18n.Source) ([]Finding, error)
- func (in Installer) Remove(name string) error
- func (in Installer) Tags(ctx context.Context, source string) ([]string, error)
- func (in Installer) Update(ctx context.Context, name, version string) (themes.LockEntry, error)
- type Problem
- type RepoStats
- type StatsFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hash ¶
Hash - the checksum of the theme files in dir (dirhash's "h1:…", as go.sum's): every file but the minified ones the build makes (*.min.css, *.min.js) and the system's (.DS_Store), by path.
func NameOf ¶
NameOf - a theme's name from its repository's address: the last part, without ".git" and a "kosatka-theme-" prefix ("…/kosatka-theme-sand.git" → "sand").
func ReadSources ¶
ReadSources - the repositories listed in file (one a line; blank lines and # comments skipped), each once.
Types ¶
type Finding ¶
Finding - one thing Check found in a theme: a Problem (a site or the themes catalog would refuse it or show it wrong) or a warning. File and Line - where, File relative to the theme's directory ("" - the theme as a whole, Line 0 - the file as a whole).
type Installer ¶
Installer - the themes of the project in paths.ThemesDir. Git - the git binary ("" - "git" from PATH); Log - where progress goes (nil - none).
func (Installer) Add ¶
func (in Installer) Add(ctx context.Context, source, version, name string) (themes.LockEntry, error)
Add installs the theme in source at version ("" - its newest release) as themes/<name> (name "" - the repository's name, without a "kosatka-theme-" prefix). A theme directory already there is refused.
func (Installer) BuildIndex ¶
func (in Installer) BuildIndex(ctx context.Context, sources []string, stats StatsFunc) (themes.Catalog, []error)
BuildIndex - the catalog of sources' newest releases (stats - nil for none); the repositories that failed, each with its error.
func (Installer) Check ¶
Check checks the theme in dir before a release (app theme check):
- the manifest (as installing checks it) and what the catalog asks of it, the files it names (screenshot, stylesheets);
- the theme's files its templates, scripts and stylesheets refer to;
- resources loaded from other servers (CDNs, web fonts), which the catalog doesn't accept;
- each language's catalog (translations/<lang>.json): the theme's strings it lacks, translations that can't stand for their source, strings the theme doesn't use - engine is the engine's and the modules' strings (translations.Sources), translated by their own catalogs, not the theme's;
- its own demo sets (demo/<lang>.yaml): each loads, in the theme's regions;
- in a theme's own git repository, its version against the latest release tag.
func (Installer) Remove ¶
Remove deletes installed theme name and its lock entry. Its blocks' placements and settings stay in the database (harmless, as a theme's that is just not active); a site with it active falls back to the engine's templates.