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:
parent
b41b2f7bd8
commit
b93061570c
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user