github.com/tomsquest/goreleaser@v0.34.3-0.20171008022654-7d6ef4d338b3/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 Install []string 18 Dependencies []string 19 Conflicts []string 20 Tests []string 21 } 22 23 const formulaTemplate = `class {{ .Name }} < Formula 24 desc "{{ .Desc }}" 25 homepage "{{ .Homepage }}" 26 url "{{ .DownloadURL }}/{{ .Repo.Owner }}/{{ .Repo.Name }}/releases/download/{{ .Tag }}/{{ .File }}" 27 version "{{ .Version }}" 28 sha256 "{{ .SHA256 }}" 29 30 {{- if .Dependencies }} 31 32 {{ range $index, $element := .Dependencies -}} 33 depends_on "{{ . }}" 34 {{- end }} 35 {{- end -}} 36 37 {{- if .Conflicts }} 38 {{ range $index, $element := .Conflicts -}} 39 conflicts_with "{{ . }}" 40 {{- end }} 41 {{- end }} 42 43 def install 44 {{- range $index, $element := .Install }} 45 {{ . -}} 46 {{- end }} 47 end 48 49 {{- if .Caveats }} 50 51 def caveats 52 "{{ .Caveats }}" 53 end 54 {{- end -}} 55 56 {{- if .Plist }} 57 58 plist_options :startup => false 59 60 def plist; <<-EOS.undent 61 {{ .Plist }} 62 EOS 63 end 64 {{- end -}} 65 66 {{- if .Tests }} 67 68 test do 69 {{- range $index, $element := .Tests }} 70 {{ . -}} 71 {{- end }} 72 end 73 {{- end }} 74 end 75 `