Documentation
¶
Index ¶
- Constants
- func BoilerplateConfigPath(templateFolder string) string
- func EnforceRequiredVersion(boilerplateConfig *BoilerplateConfig) error
- func GetValueForVariable(variable variables.Variable, variablesInConfig map[string]variables.Variable, ...) (interface{}, error)
- func GetVariables(opts *options.BoilerplateOptions, ...) (map[string]interface{}, error)
- type BoilerplateConfig
- type BoilerplateConfigNotFound
- type CyclicalReference
- type InvalidBoilerplateVersion
- type KeyAndOrderPair
- type MissingReference
- type MissingVariableWithNonInteractiveMode
Constants ¶
const BOILERPLATE_CONFIG_FILE = "boilerplate.yml"
const MaxReferenceDepth = 20
Variables ¶
This section is empty.
Functions ¶
func BoilerplateConfigPath ¶
Return the default path for a boilerplate.yml config file in the given folder
func EnforceRequiredVersion ¶
func EnforceRequiredVersion(boilerplateConfig *BoilerplateConfig) error
EnforceRequiredVersion enforces any required_version string that is configured on the boilerplate config by checking against the current version of the CLI.
func GetValueForVariable ¶
func GetVariables ¶
func GetVariables(opts *options.BoilerplateOptions, boilerplateConfig, rootBoilerplateConfig *BoilerplateConfig, thisDep variables.Dependency) (map[string]interface{}, error)
Get a value for each of the variables specified in boilerplateConfig, other than those already in existingVariables. The value for a variable can come from the user (if the non-interactive option isn't set), the default value in the config, or a command line option.
Types ¶
type BoilerplateConfig ¶
type BoilerplateConfig struct { RequiredVersion *string Variables []variables.Variable Dependencies []variables.Dependency Hooks variables.Hooks Partials []string SkipFiles []variables.SkipFile Engines []variables.Engine }
The contents of a boilerplate.yml config file
func LoadBoilerplateConfig ¶
func LoadBoilerplateConfig(opts *options.BoilerplateOptions) (*BoilerplateConfig, error)
Load the boilerplate.yml config contents for the folder specified in the given options
func ParseBoilerplateConfig ¶
func ParseBoilerplateConfig(configContents []byte) (*BoilerplateConfig, error)
Parse the given configContents as a boilerplate.yml config file
func (*BoilerplateConfig) GetVariablesMap ¶
func (config *BoilerplateConfig) GetVariablesMap() map[string]variables.Variable
GetVariablesMap returns a map that maps variable names to the variable config.
func (*BoilerplateConfig) MarshalYAML ¶
func (config *BoilerplateConfig) MarshalYAML() (interface{}, error)
Implement the go-yaml marshaler interface so that the config can be marshaled into yaml. We use a custom marshaler instead of defining the fields as tags so that we skip the attributes that are empty.
func (*BoilerplateConfig) UnmarshalYAML ¶
func (config *BoilerplateConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
Implement the go-yaml unmarshal interface for BoilerplateConfig. We can't let go-yaml handle this itself because:
- Variable is an interface
- We need to provide Defaults for optional fields, such as "type"
- We want to validate the variable as part of the unmarshalling process so we never have invalid Variable or Dependency classes floating around
type BoilerplateConfigNotFound ¶
type BoilerplateConfigNotFound string
func (BoilerplateConfigNotFound) Error ¶
func (err BoilerplateConfigNotFound) Error() string
type CyclicalReference ¶
func (CyclicalReference) Error ¶
func (err CyclicalReference) Error() string
type InvalidBoilerplateVersion ¶
type InvalidBoilerplateVersion struct { CurrentVersion *goversion.Version VersionConstraints goversion.Constraints }
func (InvalidBoilerplateVersion) Error ¶
func (err InvalidBoilerplateVersion) Error() string
type KeyAndOrderPair ¶
Custom types A KeyAndOrderPair is a composite of the user-defined order and the user's variable name
type MissingReference ¶
func (MissingReference) Error ¶
func (err MissingReference) Error() string
type MissingVariableWithNonInteractiveMode ¶
type MissingVariableWithNonInteractiveMode string
func (MissingVariableWithNonInteractiveMode) Error ¶
func (variableName MissingVariableWithNonInteractiveMode) Error() string