Skip to content
Permalink
Browse files

fix: brew formula path on windows

  • Loading branch information...
caarlos0 committed Nov 6, 2018
1 parent 6748204 commit a273a978f2d780ed1bd3d5b1142a8bb8c125ee04
Showing with 15 additions and 3 deletions.
  1. +10 −3 internal/pipe/brew/brew.go
  2. +5 −0 internal/pipe/brew/brew_test.go
@@ -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

0 comments on commit a273a97

Please sign in to comment.
You can’t perform that action at this time.