Documentation
¶
Index ¶
- Variables
- func Bump(bump BumpParams) (version string, err error)
- func Confirm(msg string)
- type BumpParams
- type CGen
- type ConfigProperties
- type Generator
- func (gen *Generator) Ask(q Question) (answer string, err error)
- func (gen *Generator) Copy(src, dst string) error
- func (gen *Generator) Exec() (err error)
- func (gen *Generator) Extends() error
- func (gen *Generator) Init(params GeneratorParams) error
- func (gen *Generator) Prompt() error
- func (gen *Generator) Pull() error
- func (gen *Generator) RunAfter() (err error)
- func (gen *Generator) RunBefore() (err error)
- func (gen *Generator) WalkFiles(inPath string, file os.FileInfo, err error) error
- type GeneratorParams
- type Project
- type ProjectState
- type Question
- type Template
- type VersionIncrement
Constants ¶
This section is empty.
Variables ¶
var ApplicationDirectory string
ApplicationDirectory root directory of the cgen application
var Log = golog.Log{
Name: "cgen",
}
Log cgen logger
var TemplatesDirectory string
TemplatesDirectory where all template generators are cached
Functions ¶
Types ¶
type BumpParams ¶
BumpParams options for running bump
type CGen ¶
CGen application
func (*CGen) ListInstalled ¶
ListInstalled generators from ~/.cgen/generators
type ConfigProperties ¶ added in v0.6.2
ConfigProperties forgot
func ReadPropertiesFile ¶
func ReadPropertiesFile(filename string) (ConfigProperties, error)
ReadPropertiesFile reads props
type Generator ¶
type Generator struct {
Template Template `json:"template"`
Project Project `json:"project"`
Options struct {
StaticOnly bool `json:"StaticOnly"`
PerformUpgrade bool `json:"PerformUpgrade"`
PromoteFile bool `json:"PromoteFile"`
Verbose bool `json:"Verbose"`
}
}
Generator struct
func (*Generator) Extends ¶
Extends checks to see if this template extends another template and generates that first.
func (*Generator) Init ¶
func (gen *Generator) Init(params GeneratorParams) error
Init a new instance of Generator
type GeneratorParams ¶
type GeneratorParams struct {
ProjectName string `json:"ProjectName"` // name of this project
TemplateName string `json:"TemplateName"` // selected cgen template
ProjectDirectory string `json:"ProjectDirectory"` // destination directory for generated files
// options
PerformUpgrade bool `json:"PerformUpgrade"` // perform upgrade
PromoteFile bool `json:"PromoteFile"` // run file promotion mode
StaticOnly bool `json:"StaticOnly"` // only copy static files, no template interpolation
Verbose bool `json:"Verbose"` // use verbose logging
}
GeneratorParams struct
type Project ¶ added in v0.6.2
type Project struct {
Name string
Directory string
State ProjectState
StateFile string
// contains filtered or unexported fields
}
Project struct
func (*Project) AppendAnswer ¶ added in v0.6.2
AppendAnswer to proj.State.Answers map
func (*Project) LoadHelpers ¶ added in v0.6.2
func (proj *Project) LoadHelpers()
LoadHelpers adds additional helper functions
type ProjectState ¶ added in v0.6.2
type ProjectState struct {
Name string `json:"name"`
Template string `yaml:"template"`
Version string `yaml:"version"`
Timestamp string `yaml:"timestamp"`
Answers map[string]interface{} `yaml:"answers"`
}
ProjectState maintains last generated state by project
type Question ¶
type Question struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
Prompt string `yaml:"prompt"`
Default string `yaml:"default"`
Options []string `yaml:"options,omitempty"`
}
Question struct for questions file.
type Template ¶ added in v0.6.2
type Template struct {
CgenVersion string `yaml:"cgen_version"`
Extends string `yaml:"extends"`
Variables yaml.MapSlice `yaml:"variables"`
Questions []*Question `yaml:"questions"`
TemplateFiles []string `yaml:"template_files"`
RunAfter []string `yaml:"run_after"`
RunBefore []string `yaml:"run_before"`
// private properties
Name string
LatestVersion string
LatestStableVersion string
Directory git.Repository
Files string
ConfigFile string
}
Template - the config.yaml
func (*Template) FileIsTemplate ¶ added in v0.6.2
FileIsTemplate checks to see if file has been marked as a template and should be expanded
type VersionIncrement ¶
type VersionIncrement string
VersionIncrement major, minor, patch, pre
func (VersionIncrement) Bump ¶
func (increment VersionIncrement) Bump(version string) (incremented string, err error)
Bump the incoming version by version increment
func (VersionIncrement) IsValid ¶
func (increment VersionIncrement) IsValid() error
IsValid - Version Increment