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

fixing one todo

This commit is contained in:
Carlos Alexandro Becker 2017-07-01 22:06:40 -03:00
parent b41b2f7bd8
commit b93061570c
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 29 additions and 1 deletions

View File

@ -41,7 +41,9 @@ func (Pipe) Run(ctx *context.Context) error {
if ctx.Config.Brew.Install == "" {
var installs []string
for _, build := range ctx.Config.Builds {
// TODO: check for OSX builds only
if !isBrewBuild(build) {
continue
}
installs = append(
installs,
fmt.Sprintf(`bin.install "%s"`, build.Binary),
@ -54,6 +56,24 @@ func (Pipe) Run(ctx *context.Context) error {
return err
}
func isBrewBuild(build config.Build) bool {
for _, ignore := range build.Ignore {
if ignore.Goos == "darwin" && ignore.Goarch == "amd64" {
return false
}
}
return contains(build.Goos, "darwin") && contains(build.Goarch, "amd64")
}
func contains(ss []string, s string) bool {
for _, zs := range ss {
if zs == s {
return true
}
}
return false
}
func setReleaseDefaults(ctx *context.Context) error {
if ctx.Config.Release.GitHub.Name != "" {
return nil

View File

@ -57,11 +57,19 @@ func TestFillPartial(t *testing.T) {
},
Builds: []config.Build{
{Binary: "testreleaser"},
{Goos: []string{"linux"}},
{
Binary: "another",
Ignore: []config.IgnoredBuild{
{Goos: "darwin", Goarch: "amd64"},
},
},
},
},
}
assert.NoError(Pipe{}.Run(ctx))
assert.Len(ctx.Config.Archive.Files, 1)
assert.Equal(`bin.install "testreleaser"`, ctx.Config.Brew.Install)
}
func TestFillSingleBuild(t *testing.T) {