core

package
v0.0.0-...-bff75be Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneRepo

func CloneRepo(repo string, commit string, intoPath string, branch string) (err error)

func UnmarshalFile

func UnmarshalFile(path string, unmarshalFunc UnmarshalFunction, obj interface{}) (err error)

func WalkComponentTree

func WalkComponentTree(startingPath string, environments []string, iterator ComponentIteration) <-chan WalkResult

WalkComponentTree asynchronously walks a component tree starting at `startingPath` and calls `iterator` on every node in the tree in Breadth First Order.

Returns a channel of WalkResult which can either have a Component or an Error (Error is nillable)

Same level ordering is not ensured; any nodes on the same tree level can be visited in any order. Parent->Child ordering is ensured; A parent is always visited via `iterator` before the children are visited.

Types

type Component

type Component struct {
	Name          string              `yaml:"name" json:"name"`
	Config        ComponentConfig     `yaml:"-" json:"-"`
	Generator     string              `yaml:"generator,omitempty" json:"generator,omitempty"`
	Hooks         map[string][]string `yaml:"hooks,omitempty" json:"hooks,omitempty"`
	Serialization string              `yaml:"-" json:"-"`
	Source        string              `yaml:"source,omitempty" json:"source,omitempty"`
	Method        string              `yaml:"method,omitempty" json:"method,omitempty"`
	Path          string              `yaml:"path,omitempty" json:"path,omitempty"`
	Version       string              `yaml:"version,omitempty" json:"version,omitempty"`
	Branch        string              `yaml:"branch,omitempty" json:"branch,omitempty"`

	Repositories  map[string]string `yaml:"repositories,omitempty" json:"repositories,omitempty"`
	Subcomponents []Component       `yaml:"subcomponents,omitempty" json:"subcomponents,omitempty"`

	PhysicalPath string `yaml:"-" json:"-"`
	LogicalPath  string `yaml:"-" json:"-"`

	Manifest string `yaml:"-" json:"-"`
}

func SynchronizeWalkResult

func SynchronizeWalkResult(results <-chan WalkResult) (components []Component, err error)

SynchronizeWalkResult will synchronize a channel of WalkResult to a list of visited Components. It will return on the first Error encountered; returning the visited Components up until then and the error

func (*Component) AfterGenerate

func (c *Component) AfterGenerate() (err error)

func (*Component) AfterInstall

func (c *Component) AfterInstall() (err error)

func (*Component) BeforeGenerate

func (c *Component) BeforeGenerate() (err error)

func (*Component) BeforeInstall

func (c *Component) BeforeInstall() (err error)

func (*Component) ExecuteHook

func (c *Component) ExecuteHook(hook string) (err error)

func (*Component) Generate

func (c *Component) Generate(generator Generator) (err error)

func (*Component) Install

func (c *Component) Install(componentPath string, generator Generator) (err error)

func (*Component) InstallComponent

func (c *Component) InstallComponent(componentPath string) (err error)

func (*Component) LoadComponent

func (c *Component) LoadComponent() (mergedComponent Component, err error)

func (*Component) LoadConfig

func (c *Component) LoadConfig(environments []string) (err error)

func (*Component) RelativePathTo

func (c *Component) RelativePathTo() string

func (*Component) UnmarshalComponent

func (c *Component) UnmarshalComponent(marshaledType string, unmarshalFunc UnmarshalFunction, component *Component) error

func (*Component) Write

func (c *Component) Write() (err error)

type ComponentConfig

type ComponentConfig struct {
	Path            string                     `yaml:"-" json:"-"`
	Serialization   string                     `yaml:"-" json:"-"`
	Namespace       string                     `yaml:"namespace,omitempty" json:"namespace,omitempty"`
	InjectNamespace bool                       `yaml:"injectNamespace,omitempty" json:"injectNamespace,omitempty"`
	Config          map[string]interface{}     `yaml:"config,omitempty" json:"config,omitempty"`
	Subcomponents   map[string]ComponentConfig `yaml:"subcomponents,omitempty" json:"subcomponents,omitempty"`
}

func NewComponentConfig

func NewComponentConfig(path string) ComponentConfig

func (*ComponentConfig) GetPath

func (cc *ComponentConfig) GetPath(environment string) string

func (*ComponentConfig) GetSubcomponentConfig

func (cc *ComponentConfig) GetSubcomponentConfig(subcomponentPath []string) (subcomponentConfig ComponentConfig)

GetSubcomponentConfig returns the subcomponent config of the given component. If the subcomponent does not exist, it creates it

Returns the subcomponent config

func (*ComponentConfig) HasComponentConfig

func (cc *ComponentConfig) HasComponentConfig(path []string) bool

HasComponentConfig checks if the component contains the given component configuration. The given component is specified via a configuration `path`. Returns true if it contains it, otherwise it returns false.

func (*ComponentConfig) HasSubcomponentConfig

func (cc *ComponentConfig) HasSubcomponentConfig(subcomponentPath []string) bool

HasSubcomponentConfig checks if a component contains the given subcomponents of the `subcomponentPath`

Returns true if it contains the subcomponent, otherwise it returns false

func (*ComponentConfig) Load

func (cc *ComponentConfig) Load(environment string) (err error)

func (*ComponentConfig) Merge

func (cc *ComponentConfig) Merge(newConfig ComponentConfig) (err error)

func (*ComponentConfig) MergeConfigFile

func (cc *ComponentConfig) MergeConfigFile(path string, environment string) (err error)

func (*ComponentConfig) MergeNamespaces

func (cc *ComponentConfig) MergeNamespaces(newConfig ComponentConfig) ComponentConfig

func (*ComponentConfig) SetComponentConfig

func (cc *ComponentConfig) SetComponentConfig(path []string, value string)

SetComponentConfig sets the `value` of the given configuration setting. The configuration setting is indicated via a configuration `path`.

func (*ComponentConfig) SetConfig

func (cc *ComponentConfig) SetConfig(subcomponentPath []string, path []string, value string)

SetConfig sets or creates the configuration `value` for the given `subcomponentPath`.

func (*ComponentConfig) UnmarshalJSONConfig

func (cc *ComponentConfig) UnmarshalJSONConfig(environment string) (err error)

func (*ComponentConfig) UnmarshalYAMLConfig

func (cc *ComponentConfig) UnmarshalYAMLConfig(environment string) (err error)

func (*ComponentConfig) Write

func (cc *ComponentConfig) Write(environment string) (err error)

type ComponentIteration

type ComponentIteration func(path string, component *Component) (err error)

type Generator

type Generator interface {
	Generate(component *Component) (manifest string, err error)
	Install(component *Component) (err error)
}

type PathValuePair

type PathValuePair struct {
	Path  []string
	Value string
}

type UnmarshalFunction

type UnmarshalFunction func(in []byte, v interface{}) error

type WalkResult

type WalkResult struct {
	Component *Component
	Error     error
}

WalkResult is what WalkComponentTree returns. Will contain either a Component OR an Error (Error is nillable; meaning both fields can be nil)

Jump to

Keyboard shortcuts

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