generator: Can perform synchronous generation
This commit is contained in:
parent
ec98e521dc
commit
1769938205
13 changed files with 214 additions and 81 deletions
|
|
@ -29,8 +29,6 @@ type Settings struct {
|
|||
Start time.Time `json:"start"`
|
||||
// End is the expected end time (if empty their is no end-date).
|
||||
End *time.Time `json:"end,omitempty"`
|
||||
// Generation is a value used to regenerate static files.
|
||||
Generation time.Time `json:"generation"`
|
||||
// ActivateTime is the time when the current file should be proceed.
|
||||
ActivateTime time.Time `json:"activateTime"`
|
||||
|
||||
|
|
@ -130,17 +128,6 @@ func SaveSettings(path string, s interface{}) error {
|
|||
}
|
||||
}
|
||||
|
||||
// ForceRegeneration makes a small change to the settings structure in order to force the regeneration of all static files.
|
||||
func ForceRegeneration() error {
|
||||
location := path.Join(SettingsDir, SettingsFile)
|
||||
if settings, err := ReadSettings(location); err != nil {
|
||||
return err
|
||||
} else {
|
||||
settings.Generation = time.Now()
|
||||
return SaveSettings(location, settings)
|
||||
}
|
||||
}
|
||||
|
||||
// LoadAndWatchSettings is the function you are looking for!
|
||||
// Giving the location and a callback, this function will first call your reload function
|
||||
// before returning (if the file can be parsed); then it starts watching modifications made to
|
||||
|
|
|
|||
Reference in a new issue