You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-09-16 09:26:52 +02:00
fixed formula naming
This commit is contained in:
@@ -96,9 +96,8 @@ func dataFor(version string, config config.ProjectConfig, client *github.Client)
|
||||
} else {
|
||||
description = *rep.Description
|
||||
}
|
||||
// TODO deal with `-`, `_` and other stuff on binary name
|
||||
return templateData{
|
||||
Name: strings.Title(config.BinaryName),
|
||||
Name: formulaNameFor(config.BinaryName),
|
||||
Desc: description,
|
||||
Homepage: homepage,
|
||||
Repo: config.Repo,
|
||||
@@ -106,3 +105,9 @@ func dataFor(version string, config config.ProjectConfig, client *github.Client)
|
||||
BinaryName: config.BinaryName,
|
||||
}, err
|
||||
}
|
||||
|
||||
func formulaNameFor(name string) string {
|
||||
name = strings.Replace(name, "-", " ", -1)
|
||||
name = strings.Replace(name, "_", " ", -1)
|
||||
return strings.Replace(strings.Title(name), " ", "", -1)
|
||||
}
|
18
brew/brew_test.go
Normal file
18
brew/brew_test.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package brew
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"github.com/docker/docker/pkg/testutil/assert"
|
||||
)
|
||||
|
||||
func TestNameWithDash(t *testing.T) {
|
||||
assert.Equal(t, formulaNameFor("some-binary"), "SomeBinary")
|
||||
}
|
||||
|
||||
func TestNameWithUnderline(t *testing.T) {
|
||||
assert.Equal(t, formulaNameFor("some_binary"), "SomeBinary")
|
||||
}
|
||||
|
||||
func TestSimpleName(t *testing.T) {
|
||||
assert.Equal(t, formulaNameFor("binary"), "Binary")
|
||||
}
|
Reference in New Issue
Block a user