Refactor components

This commit is contained in:
Tom Wiesing 2022-09-12 14:44:45 +02:00
parent 17011a277f
commit 487ce09979
No known key found for this signature in database
7 changed files with 117 additions and 63 deletions

View file

@ -34,6 +34,10 @@ type Component interface {
// Context returns a new InstallationContext to be used during installation from the command line.
// Typically this should just pass through the parent, but might perform other tasks.
Context(parent InstallationContext) InstallationContext
// Base() returns a reference to a base component
// This is implemented by an embedding on ComponentBase
Base() *ComponentBase
}
// ComponentBase implements base functionality for a component
@ -43,6 +47,11 @@ type ComponentBase struct {
Config *config.Config // Config is the configuration of the underlying distillery
}
// Base returns a reference to the ComponentBase
func (cb *ComponentBase) Base() *ComponentBase {
return cb
}
// Path returns the path to this component
func (cb ComponentBase) Path() string {
return cb.Dir