1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-01 13:07:49 +02:00

First implementation of plist field

This commit is contained in:
lucapette 2017-02-21 16:04:57 +01:00
parent 177aea9817
commit 846a822bb2
4 changed files with 18 additions and 0 deletions

View File

@ -274,6 +274,11 @@ brew:
conflicts:
- svn
- bash
# Packages that run as a service
plist:
<?xml version="1.0" encoding="UTF-8"?>
...
```
By defining the `brew` section, GoReleaser will take care of publishing the Homebrew tap.

View File

@ -11,6 +11,7 @@ type Homebrew struct {
Repo string
Folder string
Caveats string
Plist string
Dependencies []string
Conflicts []string
}

View File

@ -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
}

View File

@ -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) {