mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
fix: Fix Brew formula class name when using custom name
The #597 added support for customizing the final Brew formula name. The generated *.rb file still were using the project name as class name and installing with custom name didn't work. Fixed the issue by using the `name` field as an input for building the class name, which defaults to project name if no name given.
This commit is contained in:
parent
07b021ca11
commit
79a48eae7b
@ -165,7 +165,7 @@ func dataFor(ctx *context.Context, client client.Client, artifact artifact.Artif
|
||||
}
|
||||
var cfg = ctx.Config.Brew
|
||||
return templateData{
|
||||
Name: formulaNameFor(ctx.Config.ProjectName),
|
||||
Name: formulaNameFor(ctx.Config.Brew.Name),
|
||||
DownloadURL: ctx.Config.GitHubURLs.Download,
|
||||
Desc: cfg.Description,
|
||||
Homepage: cfg.Homepage,
|
||||
|
@ -203,8 +203,13 @@ func TestRunPipe(t *testing.T) {
|
||||
assert.NoError(tt, doRun(ctx, client))
|
||||
assert.True(tt, client.CreatedFile)
|
||||
|
||||
_, err := os.Stat(filepath.Join(folder, "custom-brew-name.rb"))
|
||||
distFile := filepath.Join(folder, "custom-brew-name.rb")
|
||||
_, err := os.Stat(distFile)
|
||||
assert.NoError(t, err)
|
||||
|
||||
distBts, err := ioutil.ReadFile(distFile)
|
||||
assert.NoError(tt, err)
|
||||
assert.Contains(tt, string(distBts), "class CustomBrewName < Formula")
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user