1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/internal/pipe/brew/template.go

86 lines
1.5 KiB
Go
Raw Normal View History

2017-07-16 20:06:32 +02:00
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
CustomRequire string
CustomBlock []string
2017-07-16 20:06:32 +02:00
}
const formulaTemplate = `{{ if .CustomRequire -}}
require_relative "{{ .CustomRequire }}"
{{ end -}}
class {{ .Name }} < Formula
2017-07-16 20:06:32 +02:00
desc "{{ .Desc }}"
homepage "{{ .Homepage }}"
url "{{ .DownloadURL }}"
{{- if .DownloadStrategy }}, :using => {{ .DownloadStrategy }}{{- end }}
2017-07-16 20:06:32 +02:00
version "{{ .Version }}"
sha256 "{{ .SHA256 }}"
{{- with .CustomBlock }}
{{ range $index, $element := . }}
{{ . }}
{{- end }}
{{- end }}
2018-04-04 02:13:17 +02:00
{{- with .Dependencies }}
{{ range $index, $element := . }}
2018-04-01 20:07:28 +02:00
depends_on "{{ . }}"
{{- end }}
{{- end -}}
2017-07-16 20:06:32 +02:00
{{- with .Conflicts }}
{{ range $index, $element := . }}
2017-07-16 20:06:32 +02:00
conflicts_with "{{ . }}"
{{- end }}
{{- end }}
def install
{{- range $index, $element := .Install }}
{{ . -}}
{{- end }}
end
{{- with .Caveats }}
2017-07-16 20:06:32 +02:00
def caveats; <<~EOS
{{- range $index, $element := . }}
{{ . -}}
{{- end }}
EOS
2017-07-16 20:06:32 +02:00
end
{{- end -}}
{{- with .Plist }}
2017-07-16 20:06:32 +02:00
plist_options :startup => false
def plist; <<~EOS
{{ . }}
EOS
2017-07-16 20:06:32 +02:00
end
{{- end -}}
{{- if .Tests }}
test do
{{- range $index, $element := .Tests }}
{{ . -}}
{{- end }}
end
{{- end }}
end
`