1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/pipeline/defaults/defaults.go

68 lines
1.8 KiB
Go
Raw Normal View History

2017-04-14 20:39:32 +02:00
// Package defaults implements the Pipe interface providing default values
// for missing configuration.
2017-01-14 16:34:22 +02:00
package defaults
import (
2017-06-28 00:20:08 +02:00
"github.com/apex/log"
2017-01-15 00: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/artifactory"
"github.com/goreleaser/goreleaser/pipeline/brew"
"github.com/goreleaser/goreleaser/pipeline/build"
"github.com/goreleaser/goreleaser/pipeline/checksums"
"github.com/goreleaser/goreleaser/pipeline/docker"
2018-02-03 04:06:48 +02:00
"github.com/goreleaser/goreleaser/pipeline/env"
"github.com/goreleaser/goreleaser/pipeline/fpm"
"github.com/goreleaser/goreleaser/pipeline/nfpm"
"github.com/goreleaser/goreleaser/pipeline/release"
"github.com/goreleaser/goreleaser/pipeline/scoop"
"github.com/goreleaser/goreleaser/pipeline/sign"
2017-12-27 01:45:53 +02:00
"github.com/goreleaser/goreleaser/pipeline/snapcraft"
"github.com/goreleaser/goreleaser/pipeline/snapshot"
2017-01-14 16:34:22 +02:00
)
// Pipe that sets the defaults
2017-01-14 16:34:22 +02:00
type Pipe struct{}
func (Pipe) String() string {
return "setting defaults for:"
}
var defaulters = []pipeline.Defaulter{
2018-02-03 04:06:48 +02:00
env.Pipe{},
snapshot.Pipe{},
release.Pipe{},
archive.Pipe{},
build.Pipe{},
fpm.Pipe{},
nfpm.Pipe{},
2017-12-27 01:45:53 +02:00
snapcraft.Pipe{},
checksums.Pipe{},
sign.Pipe{},
docker.Pipe{},
artifactory.Pipe{},
brew.Pipe{},
scoop.Pipe{},
2017-01-14 16: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.Info(defaulter.String())
if err := defaulter.Default(ctx); err != nil {
return err
}
2017-05-01 14:59:18 +02:00
}
2017-07-02 03:42:10 +02:00
if ctx.Config.ProjectName == "" {
ctx.Config.ProjectName = ctx.Config.Release.GitHub.Name
2017-06-28 00:20:08 +02:00
}
if ctx.Config.GitHubURLs.Download == "" {
ctx.Config.GitHubURLs.Download = "https://github.com"
}
2017-01-14 20:41:32 +02:00
return nil
2017-01-14 16:34:22 +02:00
}