1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

fix: brew formula path on windows

This commit is contained in:
Carlos Alexandro Becker 2018-11-06 10:46:00 -02:00 committed by Carlos Alexandro Becker
parent 67482044d2
commit a273a978f2
2 changed files with 15 additions and 3 deletions

View File

@ -131,13 +131,20 @@ func doRun(ctx *context.Context, client client.Client) error {
return pipe.Skip("release is marked as draft")
}
path = filepath.Join(ctx.Config.Brew.Folder, filename)
log.WithField("formula", path).
var gpath = ghFormulaPath(ctx.Config.Brew.Folder, filename)
log.WithField("formula", gpath).
WithField("repo", ctx.Config.Brew.GitHub.String()).
Info("pushing")
var msg = fmt.Sprintf("Brew formula update for %s version %s", ctx.Config.ProjectName, ctx.Git.CurrentTag)
return client.CreateFile(ctx, ctx.Config.Brew.CommitAuthor, ctx.Config.Brew.GitHub, content, path, msg)
return client.CreateFile(ctx, ctx.Config.Brew.CommitAuthor, ctx.Config.Brew.GitHub, content, gpath, msg)
}
func ghFormulaPath(folder, filename string) string {
if folder == "" {
return filename
}
return folder + "/" + filename
}
func getFormat(ctx *context.Context) string {

View File

@ -372,6 +372,11 @@ func TestDefault(t *testing.T) {
assert.Equal(t, `bin.install "foo"`, ctx.Config.Brew.Install)
}
func TestGHFolder(t *testing.T) {
assert.Equal(t, "bar.rb", ghFormulaPath("", "bar.rb"))
assert.Equal(t, "fooo/bar.rb", ghFormulaPath("fooo", "bar.rb"))
}
type DummyClient struct {
CreatedFile bool
Content string