forge

package
v0.0.0-...-17d9b22 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT, MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TemplateDomain                = "app-types"
	DefinedAppTypesPropertyName   = TemplateDomain + "." + "defined"
	TemplatesDirPropertyName      = TemplateDomain + "." + "templates-dir"
	DefaultTemplatesDir           = ".." + files.PathSeparator + "deployment-templates"
	TemplateFileRegexPropertyName = TemplateDomain + "." + "templates-regex"
	DefaultTemplatesRegex         = ".*(.yml|.yaml)"
)
View Source
const (
	TargetsFlagName  = "target"
	AppTypesFlagName = "app-type"
)
View Source
const (
	DeployableDomain                            = "deployments"
	DefinedDeploymentsPropertyName              = DeployableDomain + "." + "defined"
	DefaultDeployablesDir                       = "." + files.PathSeparator + "deployables"
	DeployableDirPropertyName                   = DeployableDomain + "." + "deployables-dir"
	DeploymentSpecificationFileNameFlag         = "file"
	DeploymentSpecificationFilenamePropertyName = DeployableDomain + "." + "deployment-specification-filename"
	DefaultDeploymentSpecificationFilename      = "deployment.yml"
	DeploymentNameFlagName                      = "name"
)

CMD Flags and Forge Config Property constants

View Source
const (
	ImageTagPropertyKey = "ImageTag"
	RegistryPropertyKey = "ContainerRegistry"
	ImagePropertyKey    = "Image"
)

Property Key Constants

View Source
const (
	ForgeDescriptorGenerationPropertiesFileFileNameConfigPropertyName = "generation-properties-file-name"
	DefaultDescriptorGenerationPropertiesFileFileName                 = "values.yml"
)
View Source
const (
	DocsDir                   = "./docs"
	GenDocsFlagName           = "generate-documentation"
	RevEngineerFlagName       = "reverse-from-fs"
	ForgeMarkdownFilename     = "forge.md"
	DocumentationErrorMessage = "Error generating documentation for `forge`!"
	ReadMeFileName            = "README.md"
)
View Source
const (
	NormalizationDomain            = "normalization"
	IllegalCharRegexPropertyName   = NormalizationDomain + "." + "illegal-char-regex"
	DefaultIllegalCharRegexPattern = "[\\\\/_\\\\.\\\\]"
)
View Source
const (
	ReplacementsDomain                  = NormalizationDomain + "." + "replacements"
	GlobalWordReplacementsPropertyName  = ReplacementsDomain + "." + "global"
	AppTypeWordReplacementsPropertyName = ReplacementsDomain + "." + "app-type"
)
View Source
const (
	ConfigFileFlagName = "config"
	HomeConfigFlagName = "home-config"
)
View Source
const (
	TargetDomain               = "targets"
	DefinedTargetsPropertyName = TargetDomain + "." + "defined"
	TargetsDirPropertyName     = TargetDomain + "." + "targets-dir"
	DefaultTargetsDir          = "." + files.PathSeparator + "targets"
)

Variables

View Source
var (
	Config             *Configuration
	Run                *RunInfo
	ResourceNormalizer *Normalizer
	LogLevelVerbose    bool
	PropertyMgr        = maps.NewPropertyManager()
	TemplateRegex      *regexp.Regexp
	AppTypeFlagValue   string
)
View Source
var (
	TargetsFlagValue []string
)
View Source
var (
	Version string
)

Functions

func CheckNormalization

func CheckNormalization(original string, resourceType string)

func Execute

func Execute()

func GetFullCmdName

func GetFullCmdName(cmd *cobra.Command) string

func MakeFlagRequired

func MakeFlagRequired(cmd *cobra.Command, flagName string)

func WriteEmptyPropertiesFile

func WriteEmptyPropertiesFile(path string)

Types

type AppType

type AppType struct {
	TemplatePath   string
	DeployablePath string
	Templates      []*descriptorTemplate
	Deployables    []*files.FileInfo
	// contains filtered or unexported fields
}

func NewAppType

func NewAppType(name string) *AppType

func (*AppType) Print

func (tc *AppType) Print()

type Configuration

type Configuration struct {
	LoadedFrom string
	Warn       bool
	// contains filtered or unexported fields
}

func NewConfiguration

func NewConfiguration(writeInHomeDir bool) *Configuration

func (*Configuration) Default

func (c *Configuration) Default()

func (*Configuration) DeleteFromMap

func (c *Configuration) DeleteFromMap(propertyName string, key string)

func (*Configuration) Get

func (c *Configuration) Get(propertyName string) string

func (*Configuration) GetList

func (c *Configuration) GetList(propertyName string) []string

func (*Configuration) GetMap

func (c *Configuration) GetMap(propertyName string) map[string]string

func (*Configuration) HasAppType

func (c *Configuration) HasAppType(name string) bool

func (*Configuration) HasDeployment

func (c *Configuration) HasDeployment(name string, appType string) bool

func (*Configuration) HasResource

func (c *Configuration) HasResource(name string, property string) bool

func (*Configuration) HasTarget

func (c *Configuration) HasTarget(name string) bool

func (*Configuration) Load

func (c *Configuration) Load(cfgFile string)

func (*Configuration) Print

func (c *Configuration) Print()

func (*Configuration) PrintMapProperty

func (c *Configuration) PrintMapProperty(propertyName string)

func (*Configuration) Update

func (c *Configuration) Update(propertyName string, value string)

func (*Configuration) UpdateList

func (c *Configuration) UpdateList(propertyName string, value string)

func (*Configuration) UpdateMap

func (c *Configuration) UpdateMap(propertyName string, key string, value string)

func (*Configuration) Write

func (c *Configuration) Write(msg string, args ...string)

type Deployment

type Deployment struct {
	// v2
	Name         string
	Type         string
	Path         string
	Targets      []*DeploymentTarget
	AbsolutePath string
}

Deployment something that is individually deployable and testable. E.G. - a set of kubernetes deployment descriptors for defined targets of deployment

func NewDeployment

func NewDeployment(specification *DeploymentSpecification, isExisting bool) *Deployment

type DeploymentSpecification

type DeploymentSpecification struct {
	Name       string          `json:"name" yaml:"name"`
	Type       string          `json:"app-type" yaml:"app-type"`
	Targets    []string        `json:"targets" yaml:"targets"`
	Properties maps.Properties `json:"properties" yaml:"properties"`
}

func (*DeploymentSpecification) IsInConfig

func (s *DeploymentSpecification) IsInConfig() bool

type DeploymentTarget

type DeploymentTarget struct {
	Name       string
	Path       string
	Properties maps.Properties
	Deployment *Deployment
}

func NewDeploymentTarget

func NewDeploymentTarget(name string, path string, deployment *Deployment) *DeploymentTarget

type Normalizer

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

func NewNormalizer

func NewNormalizer(patternExpression string) *Normalizer

func (*Normalizer) AppTypeReplace

func (n *Normalizer) AppTypeReplace(original string) string

func (*Normalizer) CheckNormalizeResource

func (n *Normalizer) CheckNormalizeResource(original string) (string, bool)

func (*Normalizer) GlobalReplace

func (n *Normalizer) GlobalReplace(original string) string

func (*Normalizer) IsNormalized

func (n *Normalizer) IsNormalized(original string) bool

func (*Normalizer) Minify

func (n *Normalizer) Minify(original string) string

func (*Normalizer) NormalizeAndReplace

func (n *Normalizer) NormalizeAndReplace(original string) string

func (*Normalizer) NormalizeResourceName

func (n *Normalizer) NormalizeResourceName(origResourceName string) string

func (*Normalizer) NormalizeResources

func (n *Normalizer) NormalizeResources(resources []string) []string

type RunInfo

type RunInfo struct {
	Cmd       *cobra.Command
	StartTime time.Time
	StopTime  time.Time
	Verbose   bool
	HasError  bool
	User      string
	HomeDir   string
	WorkDir   string
}

func NewRun

func NewRun() *RunInfo

func (*RunInfo) CheckError

func (r *RunInfo) CheckError(err error, msg string, args ...any)

func (*RunInfo) FullCommand

func (r *RunInfo) FullCommand() string

func (*RunInfo) GenError

func (r *RunInfo) GenError(msg string, args ...any)

func (*RunInfo) Stop

func (r *RunInfo) Stop()

type Target

type Target struct {
	Name     string
	Path     string
	Settings []*files.FileInfo
}

func NewTarget

func NewTarget(name string, path string) *Target

func (*Target) Print

func (t *Target) Print()

Jump to

Keyboard shortcuts

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