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

39 lines
681 B
Go
Raw Normal View History

2017-01-14 12:34:22 -02:00
package repos
import (
"strings"
2017-01-14 20:01:32 -02:00
"github.com/goreleaser/goreleaser/context"
2017-01-14 12:34:22 -02:00
)
// Pipe for brew deployment
type Pipe struct{}
2017-01-14 19:41:32 +01:00
// Description of the pipe
2017-01-14 15:14:35 -02:00
func (Pipe) Description() string {
2017-01-19 10:04:41 +01:00
return "Setting repositories"
2017-01-14 12:34:22 -02:00
}
// Run the pipe
2017-01-14 14:06:57 -02:00
func (Pipe) Run(ctx *context.Context) (err error) {
owner, name := split(ctx.Config.Release.Repo)
2017-01-18 15:08:48 -02:00
ctx.ReleaseRepo = context.Repo{
2017-01-14 14:06:57 -02:00
Owner: owner,
Name: name,
}
owner, name = split(ctx.Config.Brew.Repo)
2017-01-18 15:08:48 -02:00
ctx.BrewRepo = context.Repo{
2017-01-14 14:06:57 -02:00
Owner: owner,
Name: name,
}
2017-01-14 12:34:22 -02:00
return
}
func split(pair string) (string, string) {
parts := strings.Split(pair, "/")
if len(parts) == 1 {
return parts[0], ""
}
2017-01-14 12:34:22 -02:00
return parts[0], parts[1]
}