Update to new goprogram version

This commit is contained in:
Tom Wiesing 2023-11-01 22:01:24 +01:00
parent 7bd9570bc0
commit 873fdcd5c2
No known key found for this signature in database
106 changed files with 478 additions and 825 deletions

View file

@ -15,7 +15,7 @@ import (
// Drush implements commands related to drush
type Composer struct {
ingredient.Base
Dependencies struct {
dependencies struct {
Barrel *barrel.Barrel
MStore *mstore.MStore
Drush *drush.Drush
@ -35,7 +35,7 @@ func (composer *Composer) ExecWissKI(ctx context.Context, progress io.Writer, co
}
func (composer *Composer) exec(ctx context.Context, progress io.Writer, command ...string) error {
if err := composer.Dependencies.Barrel.ShellScript(ctx, stream.NonInteractive(progress), append([]string{"composer", "--no-interaction"}, command...)...); err != nil {
if err := composer.dependencies.Barrel.ShellScript(ctx, stream.NonInteractive(progress), append([]string{"composer", "--no-interaction"}, command...)...); err != nil {
return err
}
return nil
@ -44,7 +44,7 @@ func (composer *Composer) exec(ctx context.Context, progress io.Writer, command
// FixPermissions fixes the permissions of the sites directory.
// This needs to be run after every installation of a composer module.
func (composer *Composer) FixPermission(ctx context.Context, progress io.Writer) error {
composer.Dependencies.Barrel.ShellScript(ctx, stream.NonInteractive(progress), "chmod", "-R", "u+w", barrel.SitesDirectory)
composer.dependencies.Barrel.ShellScript(ctx, stream.NonInteractive(progress), "chmod", "-R", "u+w", barrel.SitesDirectory)
return nil
}

View file

@ -36,7 +36,7 @@ func (composer *Composer) Update(ctx context.Context, progress io.Writer) (err e
logging.LogMessage(progress, "Installing database updates")
{
err := composer.Dependencies.Drush.Exec(ctx, progress, "-y", "updatedb")
err := composer.dependencies.Drush.Exec(ctx, progress, "-y", "updatedb")
if err != nil {
return err
}
@ -56,7 +56,7 @@ func (composer *Composer) Update(ctx context.Context, progress io.Writer) (err e
const lastUpdate = mstore.For[int64]("lastUpdate")
func (drush *Composer) LastUpdate(ctx context.Context) (t time.Time, err error) {
epoch, err := lastUpdate.Get(ctx, drush.Dependencies.MStore)
epoch, err := lastUpdate.Get(ctx, drush.dependencies.MStore)
if err == meta.ErrMetadatumNotSet {
return t, nil
}
@ -69,12 +69,12 @@ func (drush *Composer) LastUpdate(ctx context.Context) (t time.Time, err error)
}
func (drush *Composer) setLastUpdate(ctx context.Context) error {
return lastUpdate.Set(ctx, drush.Dependencies.MStore, time.Now().Unix())
return lastUpdate.Set(ctx, drush.dependencies.MStore, time.Now().Unix())
}
type LastUpdateFetcher struct {
ingredient.Base
Dependencies struct {
dependencies struct {
Composer *Composer
}
}
@ -84,6 +84,6 @@ var (
)
func (lbr *LastUpdateFetcher) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
info.LastUpdate, err = lbr.Dependencies.Composer.LastUpdate(flags.Context)
info.LastUpdate, err = lbr.dependencies.Composer.LastUpdate(flags.Context)
return
}