1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-04-19 12:12:26 +02:00

54 lines
1.4 KiB
Go
Raw Normal View History

2017-04-14 15:39:32 -03:00
// Package defaults implements the Pipe interface providing default values
// for missing configuration.
2017-01-14 12:34:22 -02:00
package defaults
import (
2017-06-27 19:20:08 -03:00
"github.com/apex/log"
2017-01-14 20:01:32 -02:00
"github.com/goreleaser/goreleaser/context"
"github.com/goreleaser/goreleaser/pipeline"
"github.com/goreleaser/goreleaser/pipeline/archive"
"github.com/goreleaser/goreleaser/pipeline/brew"
"github.com/goreleaser/goreleaser/pipeline/build"
"github.com/goreleaser/goreleaser/pipeline/checksums"
"github.com/goreleaser/goreleaser/pipeline/docker"
"github.com/goreleaser/goreleaser/pipeline/fpm"
"github.com/goreleaser/goreleaser/pipeline/release"
"github.com/goreleaser/goreleaser/pipeline/snapshot"
2017-01-14 12:34:22 -02:00
)
// Pipe for brew deployment
type Pipe struct{}
func (Pipe) String() string {
return "setting defaults for:"
}
var defaulters = []pipeline.Defaulter{
snapshot.Pipe{},
release.Pipe{},
archive.Pipe{},
build.Pipe{},
fpm.Pipe{},
checksums.Pipe{},
docker.Pipe{},
brew.Pipe{},
2017-01-14 12:34:22 -02:00
}
// Run the pipe
func (Pipe) Run(ctx *context.Context) error {
if ctx.Config.Dist == "" {
ctx.Config.Dist = "dist"
}
for _, defaulter := range defaulters {
log.Infof("\t%s", defaulter.String())
if err := defaulter.Default(ctx); err != nil {
return err
}
2017-05-01 09:59:18 -03:00
}
2017-07-01 22:42:10 -03:00
if ctx.Config.ProjectName == "" {
ctx.Config.ProjectName = ctx.Config.Release.GitHub.Name
2017-06-27 19:20:08 -03:00
}
log.WithField("config", ctx.Config).Debug("defaults set")
2017-01-14 19:41:32 +01:00
return nil
2017-01-14 12:34:22 -02:00
}