From 846a822bb26b818686c574e397011d9d8aac74e1 Mon Sep 17 00:00:00 2001 From: lucapette Date: Tue, 21 Feb 2017 16:04:57 +0100 Subject: [PATCH] First implementation of plist field --- README.md | 5 +++++ config/config.go | 1 + pipeline/brew/brew.go | 10 ++++++++++ pipeline/brew/brew_test.go | 2 ++ 4 files changed, 18 insertions(+) diff --git a/README.md b/README.md index 2685dce4c..57bf1b2e4 100644 --- a/README.md +++ b/README.md @@ -274,6 +274,11 @@ brew: conflicts: - svn - bash + + # Packages that run as a service + plist: + + ... ``` By defining the `brew` section, GoReleaser will take care of publishing the Homebrew tap. diff --git a/config/config.go b/config/config.go index 2ecfbad75..a6244523b 100644 --- a/config/config.go +++ b/config/config.go @@ -11,6 +11,7 @@ type Homebrew struct { Repo string Folder string Caveats string + Plist string Dependencies []string Conflicts []string } diff --git a/pipeline/brew/brew.go b/pipeline/brew/brew.go index 069d84fd2..e71308422 100644 --- a/pipeline/brew/brew.go +++ b/pipeline/brew/brew.go @@ -47,6 +47,14 @@ const formula = `class {{ .Name }} < Formula "{{ .Caveats }}" end {{- end }} + + {{- if .Plist }} + + def plist; <<-EOS.undent + {{ .Plist }} + EOS + end + {{- end }} end ` @@ -62,6 +70,7 @@ type templateData struct { File string Format string SHA256 string + Plist string Dependencies []string Conflicts []string } @@ -172,6 +181,7 @@ func dataFor(ctx *context.Context, client *github.Client) (result templateData, SHA256: sum, Dependencies: ctx.Config.Brew.Dependencies, Conflicts: ctx.Config.Brew.Conflicts, + Plist: ctx.Config.Brew.Plist, }, err } diff --git a/pipeline/brew/brew_test.go b/pipeline/brew/brew_test.go index 628b760ca..c78d7427e 100644 --- a/pipeline/brew/brew_test.go +++ b/pipeline/brew/brew_test.go @@ -29,6 +29,7 @@ var defaultTemplateData = templateData{ File: "test_Darwin_x86_64", SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68", Format: "tar.gz", + Plist: "it works", } func assertDefaultTemplateData(t *testing.T, formulae string) { @@ -56,6 +57,7 @@ func TestFullFormulae(t *testing.T) { assert.Contains(formulae, "depends_on \"gtk\"") assert.Contains(formulae, "depends_on \"git\"") assert.Contains(formulae, "conflicts_with \"conflicting_dep\"") + assert.Contains(formulae, "def plist;") } func TestFormulaeSimple(t *testing.T) {