1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-17 01:42:37 +02:00

fix: brew.post_install indent (#2981)

properly indent brews.post_install block, and also fix indent on newly
added brews.service block.

closes #2980

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker
2022-03-16 21:40:25 -03:00
committed by GitHub
parent 3eaec333d7
commit 4c477b5cd1
10 changed files with 57 additions and 16 deletions

View File

@ -324,7 +324,7 @@ func dataFor(ctx *context.Context, cfg config.Homebrew, cl client.Client, artifa
Conflicts: cfg.Conflicts,
Plist: cfg.Plist,
Service: split(cfg.Service),
PostInstall: cfg.PostInstall,
PostInstall: split(cfg.PostInstall),
Tests: split(cfg.Test),
CustomRequire: cfg.CustomRequire,
CustomBlock: split(cfg.CustomBlock),

View File

@ -103,7 +103,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.PostInstall = []string{`system "touch", "/tmp/foo"`, `system "echo", "done"`}
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.Tests = []string{`system "#{bin}/{{.ProjectName}} -version"`}
formulae, err := doBuildFormula(context.New(config.Project{
@ -275,6 +275,7 @@ func TestFullPipe(t *testing.T) {
Dependencies: []config.HomebrewDependency{{Name: "zsh", Type: "optional"}, {Name: "bash"}},
Conflicts: []string{"gtk+", "qt"},
Service: "run foo/bar\nkeep_alive true",
PostInstall: "system \"echo\"\nsystem \"touch\" \"/tmp/hi\"",
Install: `bin.install "{{ .ProjectName }}"`,
},
},

View File

@ -10,7 +10,7 @@ type templateData struct {
License string
Caveats []string
Plist string
PostInstall string
PostInstall []string
Dependencies []config.HomebrewDependency
Conflicts []string
Tests []string
@ -158,7 +158,9 @@ class {{ .Name }} < Formula
{{- with .PostInstall }}
def post_install
{{- range . }}
{{ . }}
{{- end }}
end
{{- end -}}
@ -183,9 +185,10 @@ class {{ .Name }} < Formula
{{- end -}}
{{- with .Service }}
service do
{{- range . }}
{{ . }}
{{ . }}
{{- end }}
end
{{- end -}}

View File

@ -65,6 +65,7 @@ class Test < Formula
def post_install
system "touch", "/tmp/foo"
system "echo", "done"
end
def caveats; <<~EOS

View File

@ -35,6 +35,11 @@ class CustomBlock < Formula
conflicts_with "gtk+"
conflicts_with "qt"
def post_install
system "echo"
system "touch" "/tmp/hi"
end
def caveats; <<~EOS
don't do this custom_block
EOS
@ -46,9 +51,10 @@ class CustomBlock < Formula
<xml>whatever</xml>
EOS
end
service do
run foo/bar
keep_alive true
run foo/bar
keep_alive true
end
test do

View File

@ -33,6 +33,11 @@ class CustomDownloadStrategy < Formula
conflicts_with "gtk+"
conflicts_with "qt"
def post_install
system "echo"
system "touch" "/tmp/hi"
end
def caveats; <<~EOS
don't do this custom_download_strategy
EOS
@ -44,9 +49,10 @@ class CustomDownloadStrategy < Formula
<xml>whatever</xml>
EOS
end
service do
run foo/bar
keep_alive true
run foo/bar
keep_alive true
end
test do

View File

@ -34,6 +34,11 @@ class CustomRequire < Formula
conflicts_with "gtk+"
conflicts_with "qt"
def post_install
system "echo"
system "touch" "/tmp/hi"
end
def caveats; <<~EOS
don't do this custom_require
EOS
@ -45,9 +50,10 @@ class CustomRequire < Formula
<xml>whatever</xml>
EOS
end
service do
run foo/bar
keep_alive true
run foo/bar
keep_alive true
end
test do

View File

@ -33,6 +33,11 @@ class Default < Formula
conflicts_with "gtk+"
conflicts_with "qt"
def post_install
system "echo"
system "touch" "/tmp/hi"
end
def caveats; <<~EOS
don't do this default
EOS
@ -44,9 +49,10 @@ class Default < Formula
<xml>whatever</xml>
EOS
end
service do
run foo/bar
keep_alive true
run foo/bar
keep_alive true
end
test do

View File

@ -33,6 +33,11 @@ class DefaultGitlab < Formula
conflicts_with "gtk+"
conflicts_with "qt"
def post_install
system "echo"
system "touch" "/tmp/hi"
end
def caveats; <<~EOS
don't do this default_gitlab
EOS
@ -44,9 +49,10 @@ class DefaultGitlab < Formula
<xml>whatever</xml>
EOS
end
service do
run foo/bar
keep_alive true
run foo/bar
keep_alive true
end
test do

View File

@ -33,6 +33,11 @@ class ValidTapTemplates < Formula
conflicts_with "gtk+"
conflicts_with "qt"
def post_install
system "echo"
system "touch" "/tmp/hi"
end
def caveats; <<~EOS
don't do this valid_tap_templates
EOS
@ -44,9 +49,10 @@ class ValidTapTemplates < Formula
<xml>whatever</xml>
EOS
end
service do
run foo/bar
keep_alive true
run foo/bar
keep_alive true
end
test do