mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
homebrew: fix indent on template and remove install commands logic from it
This commit is contained in:
parent
938b50c399
commit
a5104aca17
@ -37,22 +37,12 @@ const formula = `class {{ .Name }} < Formula
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Install }}
|
||||
|
||||
def install
|
||||
{{- range $index, $element := .Install }}
|
||||
{{ . -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
end
|
||||
|
||||
{{- else }}
|
||||
|
||||
def install
|
||||
bin.install "{{ .BinaryName }}"
|
||||
end
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- if .Caveats }}
|
||||
|
||||
def caveats
|
||||
@ -162,6 +152,7 @@ func dataFor(
|
||||
) (result templateData, err error) {
|
||||
var homepage string
|
||||
var description string
|
||||
var installCmds string
|
||||
rep, _, err := client.Repositories.Get(
|
||||
ctx, ctx.ReleaseRepo.Owner, ctx.ReleaseRepo.Name,
|
||||
)
|
||||
@ -186,6 +177,12 @@ func dataFor(
|
||||
} else {
|
||||
description = *rep.Description
|
||||
}
|
||||
if ctx.Config.Brew.Install != "" {
|
||||
installCmds = ctx.Config.Brew.Install
|
||||
} else {
|
||||
installCmds = "bin.install \"" + ctx.Config.Build.BinaryName + "\""
|
||||
}
|
||||
|
||||
return templateData{
|
||||
Name: formulaNameFor(ctx.Config.Build.BinaryName),
|
||||
Desc: description,
|
||||
@ -201,7 +198,7 @@ func dataFor(
|
||||
Dependencies: ctx.Config.Brew.Dependencies,
|
||||
Conflicts: ctx.Config.Brew.Conflicts,
|
||||
Plist: ctx.Config.Brew.Plist,
|
||||
Install: strings.Split(ctx.Config.Brew.Install, "\n"),
|
||||
Install: strings.Split(installCmds, "\n"),
|
||||
}, err
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,6 @@ func TestFormulaeSimple(t *testing.T) {
|
||||
assert.NoError(err)
|
||||
formulae := out.String()
|
||||
assertDefaultTemplateData(t, formulae)
|
||||
assert.Contains(formulae, "bin.install \"test\"")
|
||||
assert.NotContains(formulae, "def caveats")
|
||||
assert.NotContains(formulae, "depends_on")
|
||||
assert.NotContains(formulae, "def plist;")
|
||||
|
Loading…
x
Reference in New Issue
Block a user