1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-29 01:44:39 +02:00

feat: scoop: accept name/project name (#811)

* feat: scoop: accept name/project name

* fix: added todo to fix an issue
This commit is contained in:
Carlos Alexandro Becker 2018-09-30 11:04:32 -03:00 committed by GitHub
parent 08e0830979
commit aded99f621
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -35,6 +35,9 @@ func (Pipe) Run(ctx *context.Context) error {
// Default sets the pipe defaults
func (Pipe) Default(ctx *context.Context) error {
if ctx.Config.Scoop.Name == "" {
ctx.Config.Scoop.Name = ctx.Config.ProjectName
}
if ctx.Config.Scoop.CommitAuthor.Name == "" {
ctx.Config.Scoop.CommitAuthor.Name = "goreleaserbot"
}
@ -70,7 +73,7 @@ func doRun(ctx *context.Context, client client.Client) error {
return ErrNoWindows
}
path := ctx.Config.ProjectName + ".json"
var path = ctx.Config.Scoop.Name + ".json"
content, err := buildManifest(ctx, archives)
if err != nil {
@ -142,7 +145,7 @@ func buildManifest(ctx *context.Context, artifacts []artifact.Artifact) (bytes.B
manifest.Architecture[arch] = Resource{
URL: url,
Bin: ctx.Config.Builds[0].Binary + ".exe",
Bin: ctx.Config.Builds[0].Binary + ".exe", // TODO: this is wrong
Hash: sum,
}
}

View File

@ -31,6 +31,7 @@ func TestDefault(t *testing.T) {
var ctx = &context.Context{
Config: config.Project{
ProjectName: "barr",
Builds: []config.Build{
{
Binary: "foo",
@ -54,6 +55,7 @@ func TestDefault(t *testing.T) {
},
}
assert.NoError(t, Pipe{}.Default(ctx))
assert.Equal(t, ctx.Config.ProjectName, ctx.Config.Scoop.Name)
assert.NotEmpty(t, ctx.Config.Scoop.CommitAuthor.Name)
assert.NotEmpty(t, ctx.Config.Scoop.CommitAuthor.Email)
}

View File

@ -55,6 +55,7 @@ type Homebrew struct {
// Scoop contains the scoop.sh section
type Scoop struct {
Name string `yaml:",omitempty"`
Bucket Repo `yaml:",omitempty"`
CommitAuthor CommitAuthor `yaml:"commit_author,omitempty"`
Homepage string `yaml:",omitempty"`