mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
feat(brew): post_install (#1790)
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> Co-authored-by: Grachev Mikhail <work@mgrachev.com>
This commit is contained in:
parent
f3f8b71373
commit
2eb6ec200f
@ -261,6 +261,7 @@ func dataFor(ctx *context.Context, cfg config.Homebrew, cl client.Client, artifa
|
||||
Conflicts: cfg.Conflicts,
|
||||
Plist: cfg.Plist,
|
||||
Install: split(cfg.Install),
|
||||
PostInstall: cfg.PostInstall,
|
||||
Tests: split(cfg.Test),
|
||||
DownloadStrategy: cfg.DownloadStrategy,
|
||||
CustomRequire: cfg.CustomRequire,
|
||||
|
@ -77,6 +77,7 @@ func TestFullFormulae(t *testing.T) {
|
||||
data.Dependencies = []config.HomebrewDependency{{Name: "gtk+"}}
|
||||
data.Conflicts = []string{"svn"}
|
||||
data.Plist = "it works"
|
||||
data.PostInstall = `system "touch", "/tmp/foo"`
|
||||
data.CustomBlock = []string{"devel do", ` url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Darwin_x86_64.tar.gz"`, ` sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68"`, "end"}
|
||||
data.Install = []string{"custom install script", "another install script"}
|
||||
data.Tests = []string{`system "#{bin}/{{.ProjectName}} -version"`}
|
||||
|
@ -11,6 +11,7 @@ type templateData struct {
|
||||
Plist string
|
||||
DownloadStrategy string
|
||||
Install []string
|
||||
PostInstall string
|
||||
Dependencies []config.HomebrewDependency
|
||||
Conflicts []string
|
||||
Tests []string
|
||||
@ -95,6 +96,13 @@ class {{ .Name }} < Formula
|
||||
{{- end }}
|
||||
end
|
||||
|
||||
{{- with .PostInstall }}
|
||||
|
||||
def post_install
|
||||
{{ . }}
|
||||
end
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Caveats }}
|
||||
|
||||
def caveats; <<~EOS
|
||||
|
4
internal/pipe/brew/testdata/test.rb.golden
vendored
4
internal/pipe/brew/testdata/test.rb.golden
vendored
@ -38,6 +38,10 @@ class Test < Formula
|
||||
another install script
|
||||
end
|
||||
|
||||
def post_install
|
||||
system "touch", "/tmp/foo"
|
||||
end
|
||||
|
||||
def caveats; <<~EOS
|
||||
Here are some caveats
|
||||
EOS
|
||||
|
@ -95,6 +95,7 @@ type Homebrew struct {
|
||||
Caveats string `yaml:",omitempty"`
|
||||
Plist string `yaml:",omitempty"`
|
||||
Install string `yaml:",omitempty"`
|
||||
PostInstall string `yaml:"post_install,omitempty"`
|
||||
Dependencies []HomebrewDependency `yaml:",omitempty"`
|
||||
Test string `yaml:",omitempty"`
|
||||
Conflicts []string `yaml:",omitempty"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user