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:
parent
67482044d2
commit
a273a978f2
@ -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 {
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user