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

View file

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