You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-11-06 09:09:29 +02:00
feat: --skip=chocolately
This commit is contained in:
committed by
Carlos Alexandro Becker
parent
24722b0a6a
commit
f724460ac1
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/caarlos0/log"
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/client"
|
||||
"github.com/goreleaser/goreleaser/internal/skips"
|
||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||
"github.com/goreleaser/goreleaser/pkg/config"
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
@@ -31,9 +32,11 @@ var cmd cmder = stdCmd{}
|
||||
// Pipe for chocolatey packaging.
|
||||
type Pipe struct{}
|
||||
|
||||
func (Pipe) String() string { return "chocolatey packages" }
|
||||
func (Pipe) ContinueOnError() bool { return true }
|
||||
func (Pipe) Skip(ctx *context.Context) bool { return len(ctx.Config.Chocolateys) == 0 }
|
||||
func (Pipe) String() string { return "chocolatey packages" }
|
||||
func (Pipe) ContinueOnError() bool { return true }
|
||||
func (Pipe) Skip(ctx *context.Context) bool {
|
||||
return skips.Any(ctx, skips.Chocolatey) || len(ctx.Config.Chocolateys) == 0
|
||||
}
|
||||
func (Pipe) Dependencies(_ *context.Context) []string { return []string{"choco"} }
|
||||
|
||||
// Default sets the pipe defaults.
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/client"
|
||||
"github.com/goreleaser/goreleaser/internal/golden"
|
||||
"github.com/goreleaser/goreleaser/internal/skips"
|
||||
"github.com/goreleaser/goreleaser/internal/testctx"
|
||||
"github.com/goreleaser/goreleaser/internal/testlib"
|
||||
"github.com/goreleaser/goreleaser/pkg/config"
|
||||
@@ -25,8 +26,26 @@ func TestDescription(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSkip(t *testing.T) {
|
||||
ctx := testctx.New()
|
||||
require.True(t, Pipe{}.Skip(ctx))
|
||||
t.Run("skip", func(t *testing.T) {
|
||||
require.True(t, Pipe{}.Skip(testctx.New()))
|
||||
})
|
||||
t.Run("skip flag", func(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Chocolateys: []config.Chocolatey{
|
||||
{},
|
||||
},
|
||||
}, testctx.Skip(skips.Chocolatey))
|
||||
require.True(t, Pipe{}.Skip(ctx))
|
||||
})
|
||||
|
||||
t.Run("dont skip", func(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Chocolateys: []config.Chocolatey{
|
||||
{},
|
||||
},
|
||||
})
|
||||
require.False(t, Pipe{}.Skip(ctx))
|
||||
})
|
||||
}
|
||||
|
||||
func TestDefault(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user