deps

package
v0.112.4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildState

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

BuildState are state used during a build.

func (*BuildState) AddFilenameWithPostPrefix added in v0.112.4

func (b *BuildState) AddFilenameWithPostPrefix(filename string)

func (*BuildState) GetFilenamesWithPostPrefix added in v0.112.4

func (b *BuildState) GetFilenamesWithPostPrefix() []string

func (*BuildState) Incr

func (b *BuildState) Incr() int

type Closer added in v0.6.0

type Closer interface {
	Close() error
}

type Closers added in v0.6.0

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

func (*Closers) Add added in v0.6.0

func (cs *Closers) Add(c Closer)

func (*Closers) Close added in v0.6.0

func (cs *Closers) Close() error

type Deps

type Deps struct {
	// The logger to use.
	Log loggers.Logger `json:"-"`

	// Used to log errors that may repeat itself many times.
	LogDistinct loggers.Logger

	ExecHelper *hexec.Exec

	// The file systems to use.
	Fs *hugofs.Fs `json:"-"`

	// The PathSpec to use
	*helpers.PathSpec `json:"-"`

	// The ContentSpec to use
	*helpers.ContentSpec `json:"-"`

	// The SourceSpec to use
	SourceSpec *source.SourceSpec `json:"-"`

	// The Resource Spec to use
	ResourceSpec *resources.Spec

	// The configuration to use
	Conf config.AllProvider `json:"-"`

	// The translation func to use
	Translate func(ctx context.Context, translationID string, templateData any) string `json:"-"`

	// The site building.
	Site page.Site

	TemplateProvider ResourceProvider
	// Used in tests
	OverloadedTemplateFuncs map[string]any

	TranslationProvider ResourceProvider

	Metrics metrics.Provider

	// BuildStartListeners will be notified before a build starts.
	BuildStartListeners *Listeners

	// Resources that gets closed when the build is done or the server shuts down.
	BuildClosers *Closers

	// This is common/global for all sites.
	BuildState *BuildState
	// contains filtered or unexported fields
}

Deps holds dependencies used by many. There will be normally only one instance of deps in play at a given time, i.e. one per Site built.

func (Deps) Clone added in v0.112.4

func (d Deps) Clone(s page.Site, conf config.AllProvider) (*Deps, error)

func (*Deps) Close added in v0.6.0

func (d *Deps) Close() error

func (*Deps) Compile added in v0.112.4

func (d *Deps) Compile(prototype *Deps) error

func (*Deps) Init added in v0.112.4

func (d *Deps) Init() error

func (Deps) SendError

func (e Deps) SendError(err error)

SendError sends the error on a channel to be handled later. This can be used in situations where returning and aborting the current operation isn't practical.

func (*Deps) SetTempl added in v0.112.4

func (d *Deps) SetTempl(t *tpl.TemplateHandlers)

func (Deps) StartErrorCollector

func (e Deps) StartErrorCollector() chan error

func (Deps) StopErrorCollector added in v0.112.4

func (e Deps) StopErrorCollector()

func (*Deps) TextTmpl

func (d *Deps) TextTmpl() tpl.TemplateParseFinder

func (*Deps) Tmpl

func (d *Deps) Tmpl() tpl.TemplateHandler

type DepsCfg

type DepsCfg struct {
	// The Logger to use.
	Logger loggers.Logger

	// The file systems to use
	Fs *hugofs.Fs

	// The Site in use
	Site page.Site

	Configs *allconfig.Configs

	// Template handling.
	TemplateProvider ResourceProvider

	// i18n handling.
	TranslationProvider ResourceProvider
}

DepsCfg contains configuration options that can be used to configure Hugo on a global level, i.e. logging etc. Nil values will be given default values.

type Listeners

type Listeners struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Listeners represents an event listener.

func (*Listeners) Add

func (b *Listeners) Add(f func())

Add adds a function to a Listeners instance.

func (*Listeners) Notify

func (b *Listeners) Notify()

Notify executes all listener functions.

type ResourceProvider

type ResourceProvider interface {
	NewResource(dst *Deps) error
	CloneResource(dst, src *Deps) error
}

ResourceProvider is used to create and refresh, and clone resources needed.

Jump to

Keyboard shortcuts

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