build(download): rename DownloadForgejo to Download

This commit is contained in:
Dan Anglin 2023-02-25 21:16:20 +00:00
parent 67510372ee
commit 5f00909726
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
2 changed files with 11 additions and 7 deletions

View file

@ -38,18 +38,20 @@ func Clean() error {
return nil return nil
} }
// DownloadForgejo downloads the Forgejo binary from Codeberg. // Download downaloads the binaries for a given service.
func DownloadForgejo() error { func Download(name string) error {
cfg, err := newConfig(configFile) cfg, err := newConfig(configFile)
if err != nil { if err != nil {
return fmt.Errorf("unable to load the configuration; %v", err) return fmt.Errorf("unable to load the configuration; %v", err)
} }
version := cfg.Forgejo.Version if name == "forgejo" {
if err := downloadForgejo(cfg.Forgejo.Version); err != nil {
if err := downloadForgejo(version); err != nil {
return fmt.Errorf("an error occurred whilst getting the forgejo binary; %w", err) return fmt.Errorf("an error occurred whilst getting the forgejo binary; %w", err)
} }
} else {
return fmt.Errorf("unsupported service: %s", name)
}
return nil return nil
} }

View file

@ -21,7 +21,9 @@ func Render(name string) error {
} }
if name == "forgejo" || name == "all" { if name == "forgejo" || name == "all" {
mg.Deps(DownloadForgejo) mg.Deps(
mg.F(Download, "forgejo"),
)
} }
if name == "all" { if name == "all" {