mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
fixed formula naming
This commit is contained in:
parent
d1c8625672
commit
1399a39603
@ -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")
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user