mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
homebrew: move default install cmd to defaults pipe
This commit is contained in:
parent
a5104aca17
commit
3ed26ed83b
@ -152,7 +152,6 @@ 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,
|
||||
)
|
||||
@ -177,12 +176,6 @@ 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,
|
||||
@ -198,7 +191,7 @@ func dataFor(
|
||||
Dependencies: ctx.Config.Brew.Dependencies,
|
||||
Conflicts: ctx.Config.Brew.Conflicts,
|
||||
Plist: ctx.Config.Brew.Plist,
|
||||
Install: strings.Split(installCmds, "\n"),
|
||||
Install: strings.Split(ctx.Config.Brew.Install, "\n"),
|
||||
}, err
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,9 @@ func (Pipe) Run(ctx *context.Context) error {
|
||||
}
|
||||
ctx.Config.Archive.Files = files
|
||||
}
|
||||
if ctx.Config.Brew.Install == "" {
|
||||
ctx.Config.Brew.Install = "bin.install \"" + ctx.Config.Build.BinaryName + "\""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ func TestFillBasicData(t *testing.T) {
|
||||
assert.Contains(ctx.Config.Build.Goos, "linux")
|
||||
assert.Contains(ctx.Config.Build.Goarch, "386")
|
||||
assert.Contains(ctx.Config.Build.Goarch, "amd64")
|
||||
assert.Contains(ctx.Config.Brew.Install, "bin.install \"goreleaser\"")
|
||||
assert.NotEmpty(
|
||||
ctx.Config.Archive.Replacements,
|
||||
ctx.Config.Archive.NameTemplate,
|
||||
|
Loading…
x
Reference in New Issue
Block a user