1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-31 01:53:50 +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 // Default sets the pipe defaults
func (Pipe) Default(ctx *context.Context) error { 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 == "" { if ctx.Config.Scoop.CommitAuthor.Name == "" {
ctx.Config.Scoop.CommitAuthor.Name = "goreleaserbot" ctx.Config.Scoop.CommitAuthor.Name = "goreleaserbot"
} }
@ -70,7 +73,7 @@ func doRun(ctx *context.Context, client client.Client) error {
return ErrNoWindows return ErrNoWindows
} }
path := ctx.Config.ProjectName + ".json" var path = ctx.Config.Scoop.Name + ".json"
content, err := buildManifest(ctx, archives) content, err := buildManifest(ctx, archives)
if err != nil { if err != nil {
@ -142,7 +145,7 @@ func buildManifest(ctx *context.Context, artifacts []artifact.Artifact) (bytes.B
manifest.Architecture[arch] = Resource{ manifest.Architecture[arch] = Resource{
URL: url, URL: url,
Bin: ctx.Config.Builds[0].Binary + ".exe", Bin: ctx.Config.Builds[0].Binary + ".exe", // TODO: this is wrong
Hash: sum, Hash: sum,
} }
} }

View File

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

View File

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