github.phpd.cn/goreleaser/goreleaser@v0.92.0/internal/pipe/brew/template.go (about) 1 package brew 2 3 type templateData struct { 4 Name string 5 Desc string 6 Homepage string 7 DownloadURL string 8 Version string 9 Caveats []string 10 SHA256 string 11 Plist string 12 DownloadStrategy string 13 Install []string 14 Dependencies []string 15 Conflicts []string 16 Tests []string 17 } 18 19 const formulaTemplate = `class {{ .Name }} < Formula 20 desc "{{ .Desc }}" 21 homepage "{{ .Homepage }}" 22 url "{{ .DownloadURL }}" 23 {{- if .DownloadStrategy }}, :using => {{ .DownloadStrategy }}{{- end }} 24 version "{{ .Version }}" 25 sha256 "{{ .SHA256 }}" 26 27 {{- with .Dependencies }} 28 {{ range $index, $element := . }} 29 depends_on "{{ . }}" 30 {{- end }} 31 {{- end -}} 32 33 {{- with .Conflicts }} 34 {{ range $index, $element := . }} 35 conflicts_with "{{ . }}" 36 {{- end }} 37 {{- end }} 38 39 def install 40 {{- range $index, $element := .Install }} 41 {{ . -}} 42 {{- end }} 43 end 44 45 {{- with .Caveats }} 46 47 def caveats; <<~EOS 48 {{- range $index, $element := . }} 49 {{ . -}} 50 {{- end }} 51 EOS 52 end 53 {{- end -}} 54 55 {{- with .Plist }} 56 57 plist_options :startup => false 58 59 def plist; <<~EOS 60 {{ . }} 61 EOS 62 end 63 {{- end -}} 64 65 {{- if .Tests }} 66 67 test do 68 {{- range $index, $element := .Tests }} 69 {{ . -}} 70 {{- end }} 71 end 72 {{- end }} 73 end 74 `