mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-19 20:57:53 +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 == "" {
|
if ctx.Config.Brew.Install == "" {
|
||||||
var installs []string
|
var installs []string
|
||||||
for _, build := range ctx.Config.Builds {
|
for _, build := range ctx.Config.Builds {
|
||||||
// TODO: check for OSX builds only
|
if !isBrewBuild(build) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
installs = append(
|
installs = append(
|
||||||
installs,
|
installs,
|
||||||
fmt.Sprintf(`bin.install "%s"`, build.Binary),
|
fmt.Sprintf(`bin.install "%s"`, build.Binary),
|
||||||
@ -54,6 +56,24 @@ func (Pipe) Run(ctx *context.Context) error {
|
|||||||
return err
|
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 {
|
func setReleaseDefaults(ctx *context.Context) error {
|
||||||
if ctx.Config.Release.GitHub.Name != "" {
|
if ctx.Config.Release.GitHub.Name != "" {
|
||||||
return nil
|
return nil
|
||||||
|
@ -57,11 +57,19 @@ func TestFillPartial(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Builds: []config.Build{
|
Builds: []config.Build{
|
||||||
{Binary: "testreleaser"},
|
{Binary: "testreleaser"},
|
||||||
|
{Goos: []string{"linux"}},
|
||||||
|
{
|
||||||
|
Binary: "another",
|
||||||
|
Ignore: []config.IgnoredBuild{
|
||||||
|
{Goos: "darwin", Goarch: "amd64"},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
assert.NoError(Pipe{}.Run(ctx))
|
assert.NoError(Pipe{}.Run(ctx))
|
||||||
assert.Len(ctx.Config.Archive.Files, 1)
|
assert.Len(ctx.Config.Archive.Files, 1)
|
||||||
|
assert.Equal(`bin.install "testreleaser"`, ctx.Config.Brew.Install)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFillSingleBuild(t *testing.T) {
|
func TestFillSingleBuild(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user