-
Notifications
You must be signed in to change notification settings - Fork 4
/
imagemagick.go
34 lines (29 loc) · 899 Bytes
/
imagemagick.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package checks
import (
"context"
"strings"
"projectforge.dev/projectforge/app/doctor"
"projectforge.dev/projectforge/app/util"
)
var Imagemagick = &doctor.Check{
Key: "imagemagick",
Section: "icons",
Title: "ImageMagick",
Summary: "Renders SVGs for the icon pipeline",
URL: "https://imagemagick.org",
UsedBy: "SVG icon pipeline",
Fn: simpleOut(".", "magick", []string{"-version"}, checkImageMagick),
Solve: solveImageMagick,
}
func checkImageMagick(_ context.Context, r *doctor.Result, out string) *doctor.Result {
if !strings.Contains(out, "ImageMagick") {
return r.WithError(doctor.NewError("invalid", "[magick] is not provided by ImageMagick"))
}
return r
}
func solveImageMagick(_ context.Context, r *doctor.Result, _ util.Logger) *doctor.Result {
if r.Errors.Find("missing") != nil {
r.AddPackageSolution("Imagemagick", "imagemagick")
}
return r
}