github.com/goreleaser/goreleaser@v1.25.1/internal/pipe/brew/templates/cask.rb (about)

     1  # typed: false
     2  # frozen_string_literal: true
     3  
     4  # This file was generated by GoReleaser. DO NOT EDIT.
     5  {{ if .CustomRequire -}}
     6  require_relative "{{ .CustomRequire }}"
     7  {{ end -}}
     8  class {{ .Name }} < Formula
     9    desc "{{ .Desc }}"
    10    homepage "{{ .Homepage }}"
    11    version "{{ .Version }}"
    12    {{- if .License }}
    13    license "{{ .License }}"
    14    {{- end }}
    15    {{- with .Dependencies }}
    16    {{ range $index, $element := . }}
    17    depends_on "{{ .Name }}"
    18    {{- if .Type }} => :{{ .Type }}{{- else if .Version }} => "{{ .Version }}"{{- end }}
    19    {{- with .OS }} if OS.{{ . }}?{{- end }}
    20    {{- end }}
    21    {{- end -}}
    22  
    23    {{- if and (not .LinuxPackages) .MacOSPackages }}
    24    depends_on :macos
    25    {{- end }}
    26    {{- if and (not .MacOSPackages) .LinuxPackages }}
    27    depends_on :linux
    28    {{- end }}
    29    {{- printf "\n" }}
    30  
    31    {{- if and .MacOSPackages .LinuxPackages }}
    32    on_macos do
    33    {{- include "macos_packages" . | indent 2 }}
    34    end
    35  
    36    on_linux do
    37    {{- include "linux_packages" . | indent 2 }}
    38    end
    39    {{- end }}
    40  
    41    {{- if and (.MacOSPackages) (not .LinuxPackages) }}
    42    {{- template "macos_packages" . }}
    43    {{- end }}
    44  
    45    {{- if and (not .MacOSPackages) (.LinuxPackages) }}
    46    {{- template "linux_packages" . }}
    47    {{- end }}
    48  
    49    {{- with .Conflicts }}
    50    {{ range $index, $element := . }}
    51    conflicts_with "{{ . }}"
    52    {{- end }}
    53    {{- end }}
    54  
    55    {{- with .CustomBlock }}
    56    {{ range $index, $element := . }}
    57    {{ . }}
    58    {{- end }}
    59    {{- end }}
    60  
    61    {{- with .PostInstall }}
    62  
    63    def post_install
    64      {{- range . }}
    65      {{ . }}
    66      {{- end }}
    67    end
    68    {{- end -}}
    69  
    70    {{- with .Caveats }}
    71  
    72    def caveats
    73      <<~EOS
    74      {{- range $index, $element := . }}
    75        {{ . -}}
    76      {{- end }}
    77      EOS
    78    end
    79    {{- end -}}
    80  
    81    {{- with .Plist }}
    82  
    83    plist_options startup: false
    84  
    85    def plist
    86      <<~EOS
    87        {{ . }}
    88      EOS
    89    end
    90    {{- end -}}
    91  
    92    {{- with .Service }}
    93  
    94    service do
    95      {{- range . }}
    96      {{ . }}
    97      {{- end }}
    98    end
    99    {{- end -}}
   100  
   101    {{- if .Tests }}
   102  
   103    test do
   104      {{- range $index, $element := .Tests }}
   105      {{ . -}}
   106      {{- end }}
   107    end
   108    {{- end }}
   109  end