diff --git a/README.md b/README.md index 6f0d8671c..f4bc44c25 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,14 @@ brew: # Default is empty. caveats: "How to use this binary" + # Your app's homepage + # Default is empty + homepage: "https://example.com/" + + # Your app's description + # Default is empty + description: "Software to create fast and easy drum rolls." + # Dependencies of your package dependencies: - git @@ -339,13 +347,25 @@ GoReleaser can be wired to [fpm]() to generate `.deb`, `.rpm` and other archives ```yml # goreleaser.yml fpm: - # Options used in deb control file etc. - options: - vendor: "Drum Roll Inc." - url: "https://example.com/" - maintainer: "" - description: "Software to create fast and easy drum rolls." - license: "Apache 2.0" + # Your app's vendor + # Default is empty + vendor: Drum Roll Inc. + # Your app's homepage + # Default is empty + homepage: https://example.com/ + + # Your app's maintainer (probably you) + # Default is empty + maintainer: + + # Your app's description + # Default is empty + description: Software to create fast and easy drum rolls. + + # Your app's license + # Default is empty + license: Apache 2.0 + # Formats to generate as output formats: - deb diff --git a/client/client.go b/client/client.go index 12e7af1c4..421d37546 100644 --- a/client/client.go +++ b/client/client.go @@ -17,7 +17,6 @@ type Info struct { // Client interface type Client interface { - GetInfo(ctx *context.Context) (info Info, err error) CreateRelease(ctx *context.Context, body string) (releaseID int, err error) CreateFile(ctx *context.Context, content bytes.Buffer, path string) (err error) Upload(ctx *context.Context, releaseID int, name string, file *os.File) (err error) diff --git a/client/github.go b/client/github.go index f02b6862c..c28f50ac5 100644 --- a/client/github.go +++ b/client/github.go @@ -67,21 +67,6 @@ func (c *githubClient) CreateFile( return } -func (c *githubClient) GetInfo(ctx *context.Context) (info Info, err error) { - rep, _, err := c.client.Repositories.Get( - ctx, - ctx.Config.Release.GitHub.Owner, - ctx.Config.Release.GitHub.Name, - ) - if err != nil { - return - } - info.Homepage = rep.GetHomepage() - info.URL = rep.GetHTMLURL() - info.Description = rep.GetDescription() - return -} - func (c *githubClient) CreateRelease(ctx *context.Context, body string) (releaseID int, err error) { data := &github.RepositoryRelease{ Name: github.String(ctx.Git.CurrentTag), diff --git a/config/config.go b/config/config.go index 9245f339a..bfe801abd 100644 --- a/config/config.go +++ b/config/config.go @@ -28,6 +28,8 @@ type Homebrew struct { Install string Dependencies []string Conflicts []string + Description string + URL string } // Hooks define actions to run before and/or after something @@ -72,16 +74,11 @@ type FPM struct { Formats []string Dependencies []string Conflicts []string - Options FPMOptions -} - -// FPMOptions config options -type FPMOptions struct { - Vendor string - URL string - Maintainer string - Description string - License string + Vendor string + Homepage string + Maintainer string + Description string + License string } // Project includes all project configuration diff --git a/goreleaser.yml b/goreleaser.yml index 3d50dcf11..9d9eee966 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -1,3 +1,5 @@ +homepage: &homepage http://goreleaser.github.io +description: &description Deliver Go binaries as fast and easily as possible build: main: ./cmd/goreleaser/main.go goos: @@ -18,9 +20,16 @@ brew: owner: goreleaser name: homebrew-tap folder: Formula + homepage: *homepage + description: *description dependencies: - git fpm: + homepage: *homepage + description: *description + maintainer: Carlos Alexandro Becker + license: MIT + vendor: GoReleaser formats: - deb dependencies: diff --git a/pipeline/brew/brew.go b/pipeline/brew/brew.go index 7892b1e2e..0f5d108ff 100644 --- a/pipeline/brew/brew.go +++ b/pipeline/brew/brew.go @@ -143,21 +143,17 @@ func dataFor(ctx *context.Context, client client.Client) (result templateData, e if err != nil { return } - homepage, description, err := getInfo(ctx, client) - if err != nil { - return - } return templateData{ Name: formulaNameFor(ctx.Config.Build.Binary), - Desc: description, - Homepage: homepage, + Desc: ctx.Config.Brew.Description, + Homepage: ctx.Config.Brew.URL, Repo: ctx.Config.Release.GitHub, Tag: ctx.Git.CurrentTag, Version: ctx.Version, Binary: ctx.Config.Build.Binary, Caveats: ctx.Config.Brew.Caveats, File: file, - Format: ctx.Config.Archive.Format, + Format: ctx.Config.Archive.Format, // TODO this can be broken by format_overrides SHA256: sum, Dependencies: ctx.Config.Brew.Dependencies, Conflicts: ctx.Config.Brew.Conflicts, @@ -166,27 +162,6 @@ func dataFor(ctx *context.Context, client client.Client) (result templateData, e }, err } -func getInfo( - ctx *context.Context, - client client.Client, -) (homepage string, description string, err error) { - info, err := client.GetInfo(ctx) - if err != nil { - return - } - if info.Homepage == "" { - homepage = info.URL - } else { - homepage = info.Homepage - } - if info.Description == "" { - description = "TODO" - } else { - description = info.Description - } - return -} - func formulaNameFor(name string) string { name = strings.Replace(name, "-", " ", -1) name = strings.Replace(name, "_", " ", -1) diff --git a/pipeline/brew/brew_test.go b/pipeline/brew/brew_test.go index ca339646a..a7895861b 100644 --- a/pipeline/brew/brew_test.go +++ b/pipeline/brew/brew_test.go @@ -7,7 +7,6 @@ import ( "path/filepath" "testing" - "github.com/goreleaser/goreleaser/client" "github.com/goreleaser/goreleaser/config" "github.com/goreleaser/goreleaser/context" "github.com/stretchr/testify/assert" @@ -170,10 +169,6 @@ type DummyClient struct { CreatedFile bool } -func (client *DummyClient) GetInfo(ctx *context.Context) (info client.Info, err error) { - return -} - func (client *DummyClient) CreateRelease(ctx *context.Context, body string) (releaseID int, err error) { return } diff --git a/pipeline/fpm/fpm.go b/pipeline/fpm/fpm.go index 626fa560c..a3e58da0a 100644 --- a/pipeline/fpm/fpm.go +++ b/pipeline/fpm/fpm.go @@ -71,20 +71,20 @@ func create(ctx *context.Context, format, archive, arch string) error { "--force", } - if ctx.Config.FPM.Options.Vendor != "" { - options = append(options, "--vendor", ctx.Config.FPM.Options.Vendor) + if ctx.Config.FPM.Vendor != "" { + options = append(options, "--vendor", ctx.Config.FPM.Vendor) } - if ctx.Config.FPM.Options.URL != "" { - options = append(options, "--url", ctx.Config.FPM.Options.URL) + if ctx.Config.FPM.Homepage != "" { + options = append(options, "--url", ctx.Config.FPM.Homepage) } - if ctx.Config.FPM.Options.Maintainer != "" { - options = append(options, "--maintainer", ctx.Config.FPM.Options.Maintainer) + if ctx.Config.FPM.Maintainer != "" { + options = append(options, "--maintainer", ctx.Config.FPM.Maintainer) } - if ctx.Config.FPM.Options.Description != "" { - options = append(options, "--description", ctx.Config.FPM.Options.Description) + if ctx.Config.FPM.Description != "" { + options = append(options, "--description", ctx.Config.FPM.Description) } - if ctx.Config.FPM.Options.License != "" { - options = append(options, "--license", ctx.Config.FPM.Options.License) + if ctx.Config.FPM.License != "" { + options = append(options, "--license", ctx.Config.FPM.License) } for _, dep := range ctx.Config.FPM.Dependencies { options = append(options, "--depends", dep) diff --git a/pipeline/fpm/fpm_test.go b/pipeline/fpm/fpm_test.go index 5e0dcf5e7..ba34ac16e 100644 --- a/pipeline/fpm/fpm_test.go +++ b/pipeline/fpm/fpm_test.go @@ -49,13 +49,11 @@ func TestRunPipe(t *testing.T) { Formats: []string{"deb"}, Dependencies: []string{"make"}, Conflicts: []string{"git"}, - Options: config.FPMOptions{ - Description: "Some description", - License: "MIT", - Maintainer: "me@me", - Vendor: "asdf", - URL: "https://goreleaser.github.io", - }, + Description: "Some description", + License: "MIT", + Maintainer: "me@me", + Vendor: "asdf", + Homepage: "https://goreleaser.github.io", }, }, } diff --git a/pipeline/release/release_test.go b/pipeline/release/release_test.go index 76e7a2f19..5810ee63b 100644 --- a/pipeline/release/release_test.go +++ b/pipeline/release/release_test.go @@ -8,7 +8,6 @@ import ( "path/filepath" "testing" - "github.com/goreleaser/goreleaser/client" "github.com/goreleaser/goreleaser/config" "github.com/goreleaser/goreleaser/context" "github.com/stretchr/testify/assert" @@ -144,10 +143,6 @@ type DummyClient struct { UploadedFile bool } -func (client *DummyClient) GetInfo(ctx *context.Context) (info client.Info, err error) { - return -} - func (client *DummyClient) CreateRelease(ctx *context.Context, body string) (releaseID int, err error) { if client.FailToCreateRelease { return 0, errors.New("release failed")