ingredient/info: Add Fetcher concept

This commit is contained in:
Tom Wiesing 2022-10-19 10:50:40 +02:00
parent a6501b42c7
commit 52559e4d68
No known key found for this signature in database
22 changed files with 447 additions and 328 deletions

View file

@ -3,6 +3,7 @@ package drush
import (
"time"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient/php"
"github.com/tkw1536/goprogram/exit"
"github.com/tkw1536/goprogram/stream"
@ -35,3 +36,18 @@ func (drush *Drush) LastCron(server *php.Server) (t time.Time, err error) {
}
return time.Unix(timestamp, 0), nil
}
type LastCronFetcher struct {
ingredient.Base
Drush *Drush
}
func (lbr *LastCronFetcher) Fetch(flags ingredient.FetchFlags, info *ingredient.Information) (err error) {
if flags.Quick {
return
}
info.LastRebuild, _ = lbr.Drush.LastCron(flags.Server)
return
}