Documentation ¶
Index ¶
- Constants
- func LoadShadow(subdir string, verbose bool) (map[string]*File, error)
- type File
- func (F *File) FormatRendered() error
- func (F *File) ReadShadow() error
- func (F *File) ReadUser() error
- func (F *File) Render(shadow_basedir string) error
- func (F *File) RenderTemplate() error
- func (F *File) UnifyContent() (write bool, err error)
- func (F *File) WriteOutput() error
- func (F *File) WriteShadow(basedir string) error
- type FileStats
- type Generator
- type GeneratorStats
Constants ¶
View Source
const CUE_VENDOR_DIR = "./cue.mod/pkg/"
View Source
const SHADOW_DIR = ".hof/shadow/"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct { // Input Data, local to this file In map[string]interface{} // The full path under the output location // empty implies don't generate, even though it may endup in the list Filepath string // Template parameters TemplateSystem string // which system ['text/template'(default), 'mustache'] Template string // The content, takes precedence over next option TemplateName string // Named template // Template delimiters TemplateConfig *templates.Config // Generator that owns this file // TODO, does this break with the multi-generator hack? // or is this the behavior defined by the way generators are included together // because the user will be able to do it both ways, the hack doesn't to away, // there's just a more recommended way to do it Gen *Generator // Template Instance Pointer // If local, this will be created when the template content is laoded // If a named template, acutal template lives in the generator and is created at folder import time TemplateInstance *templates.Template // Content RenderContent []byte FinalContent []byte // Shadow related ShadowFile *File UserFile *File DoWrite bool // Bookkeeping Errors []error FileStats }
func (*File) FormatRendered ¶
func (*File) ReadShadow ¶
func (*File) RenderTemplate ¶
func (*File) UnifyContent ¶
func (*File) WriteOutput ¶
func (*File) WriteShadow ¶
type FileStats ¶
type FileStats struct { // using 0 (false) and 1 (true) for easier summation code below IsNew int IsSame int IsSkipped int IsWritten int IsErr int IsModified int IsModifiedRender int IsModifiedOutput int IsModifiedDiff3 int IsConflicted int RenderingTime time.Duration CompareTime time.Duration TotalTime time.Duration }
type Generator ¶
type Generator struct { // // Set by Hof via cuelang extraction // Label in Cuelang Name string // Base directory for output Outdir string // "Global" input, merged with out replacing onto the files In map[string]interface{} // The list fo files for hof to generate, in cue values Out []map[string]interface{} // Subgenerators for composition Generators map[string]*Generator // Template delimiters TemplateConfig *templates.Config // The following will be automatically added to the template context // under its name for reference in GenFiles and partials in templates NamedTemplates map[string]string NamedPartials map[string]string // Static files are available for pure cue generators that want to have static files // These should be named by their filepath, but be the content of the file StaticFiles map[string]string // Used for indexing into the vendor directory... PackageName string // Base directory of entrypoint templates to load TemplatesDir string TemplatesDirConfig map[string]*templates.Config // Base directory of partial templatess to load PartialsDir string PartialsDirConfig map[string]*templates.Config // Filepath globs for static files to load StaticGlobs []string // Disabled? we do this when looking at expressions and optimizing // TODO, make this field available in cuelang? Disabled bool // Template System Cache PartialsMap templates.TemplateMap TemplateMap templates.TemplateMap // Files and the shadow dir for doing neat things Files map[string]*File Shadow map[string]*File // Status for this generator and processing Stats *GeneratorStats // Cuelang related, also set externally CueValue cue.Value }
A generator pulled from the cue instances
func (*Generator) GenerateFiles ¶
func (*Generator) Initialize ¶ added in v0.2.9
func (*Generator) ResolveFile ¶ added in v0.2.9
type GeneratorStats ¶
type GeneratorStats struct { NumNew int NumSame int NumSkipped int NumDeleted int NumWritten int NumStatic int NumErr int TotalFiles int NumModified int NumModifiedRender int NumModifiedOutput int NumModifiedDiff3 int NumConflicted int CueLoadingTime time.Duration RenderingTime time.Duration WritingTime time.Duration TotalTime time.Duration }
func (*GeneratorStats) CalcTotals ¶
func (S *GeneratorStats) CalcTotals(G *Generator) error
func (*GeneratorStats) String ¶
func (S *GeneratorStats) String() string
Click to show internal directories.
Click to hide internal directories.