Skip to content
Permalink
Browse files
feat: allow to specify version of brew deps (#3319)
* feat: add version for homebrew dependencies

* resolve conflicts

* resolve conflicts

* feat: allow to specify version of brew deps

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* docs: brew

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Purushotham <purushotham@hasura.io>
  • Loading branch information
caarlos0 and purush7 committed Aug 18, 2022
1 parent dcd402c commit 6d000e5cb1b1feaebfb84ecc44aebadbadeb7188
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 19 deletions.
@@ -268,16 +268,20 @@ func TestFullPipe(t *testing.T) {
IDs: []string{
"foo",
},
Description: "Run pipe test formula and FOO={{ .Env.FOO }}",
Caveats: "don't do this {{ .ProjectName }}",
Test: "system \"true\"\nsystem \"#{bin}/foo\", \"-h\"",
Plist: `<xml>whatever</xml>`,
Dependencies: []config.HomebrewDependency{{Name: "zsh", Type: "optional"}, {Name: "bash"}},
Conflicts: []string{"gtk+", "qt"},
Service: "run foo/bar\nkeep_alive true",
PostInstall: "system \"echo\"\ntouch \"/tmp/hi\"",
Install: `bin.install "{{ .ProjectName }}"`,
Goamd64: "v1",
Description: "Run pipe test formula and FOO={{ .Env.FOO }}",
Caveats: "don't do this {{ .ProjectName }}",
Test: "system \"true\"\nsystem \"#{bin}/foo\", \"-h\"",
Plist: `<xml>whatever</xml>`,
Dependencies: []config.HomebrewDependency{
{Name: "zsh", Type: "optional"},
{Name: "bash", Version: "3.2.57"},
{Name: "fish", Type: "optional", Version: "v1.2.3"},
},
Conflicts: []string{"gtk+", "qt"},
Service: "run foo/bar\nkeep_alive true",
PostInstall: "system \"echo\"\ntouch \"/tmp/hi\"",
Install: `bin.install "{{ .ProjectName }}"`,
Goamd64: "v1",
},
},
},
@@ -48,7 +48,7 @@ class {{ .Name }} < Formula
{{- with .Dependencies }}
{{ range $index, $element := . }}
depends_on "{{ .Name }}"
{{- if .Type }} => :{{ .Type }}{{- end }}
{{- if .Type }} => :{{ .Type }}{{- else if .Version }} => "{{ .Version }}"{{- end }}
{{- end }}
{{- end -}}
@@ -8,7 +8,8 @@ class CustomBlock < Formula
version "1.0.1"

depends_on "zsh" => :optional
depends_on "bash"
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on :macos

on_macos do
@@ -8,7 +8,8 @@ class CustomDownloadStrategy < Formula
version "1.0.1"

depends_on "zsh" => :optional
depends_on "bash"
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on :macos

on_macos do
@@ -9,7 +9,8 @@ class CustomRequire < Formula
version "1.0.1"

depends_on "zsh" => :optional
depends_on "bash"
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on :macos

on_macos do
@@ -8,7 +8,8 @@ class Default < Formula
version "1.0.1"

depends_on "zsh" => :optional
depends_on "bash"
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on :macos

on_macos do
@@ -8,7 +8,8 @@ class DefaultGitlab < Formula
version "1.0.1"

depends_on "zsh" => :optional
depends_on "bash"
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on :macos

on_macos do
@@ -8,7 +8,8 @@ class ValidTapTemplates < Formula
version "1.0.1"

depends_on "zsh" => :optional
depends_on "bash"
depends_on "bash" => "3.2.57"
depends_on "fish" => :optional
depends_on :macos

on_macos do
@@ -82,8 +82,9 @@ type RepoRef struct {

// HomebrewDependency represents Homebrew dependency.
type HomebrewDependency struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
Type string `yaml:"type,omitempty" json:"type,omitempty"`
Name string `yaml:"name,omitempty" json:"name,omitempty"`
Type string `yaml:"type,omitempty" json:"type,omitempty"`
Version string `yaml:"version,omitempty" json:"version,omitempty"`
}

// type alias to prevent stack overflowing in the custom unmarshaler.
@@ -113,6 +113,13 @@ brews:
- name: git
- name: zsh
type: optional
- name: fish
version: v1.2.3
# if providing both version and type, only the type will be taken into account.
- name: elvish
type: optional
version: v1.2.3
# Packages that conflict with your package.
conflicts:

0 comments on commit 6d000e5

Please sign in to comment.