1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-04 03:11:55 +02:00

feat(homebrew): add os to dependency (#4481)

closes #4480
This commit is contained in:
Carlos Alexandro Becker 2023-12-15 12:14:01 -03:00 committed by GitHub
parent e39548dde7
commit ee14837127
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 32 additions and 0 deletions

View File

@ -313,6 +313,8 @@ func TestFullPipe(t *testing.T) {
{Name: "zsh", Type: "optional"},
{Name: "bash", Version: "3.2.57"},
{Name: "fish", Type: "optional", Version: "v1.2.3"},
{Name: "powershell", Type: "optional", OS: "mac"},
{Name: "ash", Version: "1.0.0", OS: "linux"},
},
Conflicts: []string{"gtk+", "qt"},
Service: "run foo/bar\nkeep_alive true",

View File

@ -49,6 +49,7 @@ class {{ .Name }} < Formula
{{ range $index, $element := . }}
depends_on "{{ .Name }}"
{{- if .Type }} => :{{ .Type }}{{- else if .Version }} => "{{ .Version }}"{{- end }}
{{- with .OS }} if OS.{{ . }}?{{- end }}
{{- end }}
{{- end -}}

View File

@ -7,8 +7,10 @@ class CustomBlock < Formula
homepage "https://github.com/goreleaser"
version "1.0.1"
depends_on "ash" => "1.0.0" if OS.linux?
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on "powershell" => :optional if OS.mac?
depends_on "zsh" => :optional
on_macos do

View File

@ -7,8 +7,10 @@ class CustomDownloadStrategy < Formula
homepage "https://github.com/goreleaser"
version "1.0.1"
depends_on "ash" => "1.0.0" if OS.linux?
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on "powershell" => :optional if OS.mac?
depends_on "zsh" => :optional
on_macos do

View File

@ -8,8 +8,10 @@ class CustomRequire < Formula
homepage "https://github.com/goreleaser"
version "1.0.1"
depends_on "ash" => "1.0.0" if OS.linux?
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on "powershell" => :optional if OS.mac?
depends_on "zsh" => :optional
on_macos do

View File

@ -7,8 +7,10 @@ class Default < Formula
homepage "https://github.com/goreleaser"
version "1.0.1"
depends_on "ash" => "1.0.0" if OS.linux?
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on "powershell" => :optional if OS.mac?
depends_on "zsh" => :optional
on_macos do

View File

@ -7,8 +7,10 @@ class DefaultGitlab < Formula
homepage "https://gitlab.com/goreleaser"
version "1.0.1"
depends_on "ash" => "1.0.0" if OS.linux?
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on "powershell" => :optional if OS.mac?
depends_on "zsh" => :optional
on_macos do

View File

@ -7,8 +7,10 @@ class GitRemote < Formula
homepage "https://github.com/goreleaser"
version "1.0.1"
depends_on "ash" => "1.0.0" if OS.linux?
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on "powershell" => :optional if OS.mac?
depends_on "zsh" => :optional
on_macos do

View File

@ -7,8 +7,10 @@ class OpenPr < Formula
homepage "https://github.com/goreleaser"
version "1.0.1"
depends_on "ash" => "1.0.0" if OS.linux?
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on "powershell" => :optional if OS.mac?
depends_on "zsh" => :optional
on_macos do

View File

@ -7,8 +7,10 @@ class ValidRepositoryTemplates < Formula
homepage ""
version "1.0.1"
depends_on "ash" => "1.0.0" if OS.linux?
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on "powershell" => :optional if OS.mac?
depends_on "zsh" => :optional
on_macos do

View File

@ -156,6 +156,7 @@ type HomebrewDependency struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
Type string `yaml:"type,omitempty" json:"type,omitempty"`
Version string `yaml:"version,omitempty" json:"version,omitempty"`
OS string `yaml:"os,omitempty" json:"os,omitempty" jsonschema:"enum=mac,enum=linux"`
}
// type alias to prevent stack overflowing in the custom unmarshaler.

View File

@ -115,6 +115,11 @@ brews:
# Packages your package depends on.
dependencies:
- name: git
# Allow to specify the OS in which the dependency is required.
# Valid options are `mac` and `linux`.
#
# Since: v1.23.0
os: mac
- name: zsh
type: optional
- name: fish

7
www/docs/static/schema.json generated vendored
View File

@ -1268,6 +1268,13 @@
},
"version": {
"type": "string"
},
"os": {
"type": "string",
"enum": [
"mac",
"linux"
]
}
},
"additionalProperties": false,