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