1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/internal/pipeline/brew/template.go
Carlos Alexandro Becker 64b1f14a86
refactor: better code organization (#757)
* refactor: merging archive in the same repo

* refactor: merging archive in the same repo

* refactor: better organizing packages

* refactor: fixing renames

* fix: new dep version

* fix: makefile

* fix: zip/tar tests

* fix: gitigonore

* fix: s3 tests

* fix: archive test
2018-08-14 23:50:20 -03:00

75 lines
1.3 KiB
Go

package brew
type templateData struct {
Name string
Desc string
Homepage string
DownloadURL string
Version string
Caveats []string
SHA256 string
Plist string
DownloadStrategy string
Install []string
Dependencies []string
Conflicts []string
Tests []string
}
const formulaTemplate = `class {{ .Name }} < Formula
desc "{{ .Desc }}"
homepage "{{ .Homepage }}"
url "{{ .DownloadURL }}"
{{- if .DownloadStrategy }}, :using => {{ .DownloadStrategy }}{{- end }}
version "{{ .Version }}"
sha256 "{{ .SHA256 }}"
{{- with .Dependencies }}
{{ range $index, $element := . }}
depends_on "{{ . }}"
{{- end }}
{{- end -}}
{{- with .Conflicts }}
{{ range $index, $element := . }}
conflicts_with "{{ . }}"
{{- end }}
{{- end }}
def install
{{- range $index, $element := .Install }}
{{ . -}}
{{- end }}
end
{{- with .Caveats }}
def caveats; <<~EOS
{{- range $index, $element := . }}
{{ . -}}
{{- end }}
EOS
end
{{- end -}}
{{- with .Plist }}
plist_options :startup => false
def plist; <<~EOS
{{ . }}
EOS
end
{{- end -}}
{{- if .Tests }}
test do
{{- range $index, $element := .Tests }}
{{ . -}}
{{- end }}
end
{{- end }}
end
`