-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
198 additions
and
23 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.PHONY: gen gen-src gen-bin | ||
gen: gen-src | ||
gen-src: | ||
hof gen hof.cue -T templates/from-git-source.rb=hof.rb --no-format | ||
gen-bin: | ||
hof gen hof.cue -T templates/from-gh-release.rb=hof.rb --no-format | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package main | ||
|
||
import "strings" | ||
|
||
name: "hof" | ||
version: "0.6.6" | ||
tag: "v0.6.6" | ||
commit: "0f49b4d71a66788b006daacf905a2b138768beca" | ||
desc: "Flexible data modeling & code generation system" | ||
homepage: "https://hofstadter.io/" | ||
repo: "github.com/hofstadter-io/hof" | ||
url: "https://\(repo).git" | ||
license: "BSD-3-Clause" | ||
branch: "_dev" | ||
cmddir: "cmd/hof" | ||
ldflags: strings.Replace(""" | ||
-s -w | ||
-X \(repo)/\(cmddir)/verinfo.Version=#{version} | ||
-X \(repo)/\(cmddir)/verinfo.Commit=#{Utils.git_head} | ||
-X \(repo)/\(cmddir)/verinfo.BuildDate=#{time.iso8601} | ||
-X \(repo)/\(cmddir)/verinfo.GoVersion=#{Formula["go"].version} | ||
-X \(repo)/\(cmddir)/verinfo.BuildOS=#{os} | ||
-X \(repo)/\(cmddir)/verinfo.BuildArch=#{arch} | ||
""", "\n", " ", -1) | ||
|
||
builds: { | ||
[os=string]: [arch=string]: { | ||
"name": name | ||
|
||
_url: "https://\(repo)/releases/download/\(tag)/\(name)_\(version)" | ||
sha256: string | ||
} | ||
linux: { | ||
intel: A={ | ||
url: "\(A._url)_Linux_x86_64" | ||
sha256: "581958cf7a69c2b9dc541ad0aac25396f7705d1533f89a90ab4a4b27a1128131" | ||
} | ||
arm: A={ | ||
url: "\(A._url)_Linux_arm64" | ||
sha256: "01c13dbd5d2dc3eaa573d5400c2a013d3fd0fe2b4de8f499c0bef3f10c90cc12" | ||
} | ||
} | ||
macos: { | ||
intel: A={ | ||
url: "\(A._url)_Darwin_x86_64" | ||
sha256: "e1cf5a28e07c34a4aa1dbd7f2c0149a4d76f3450e14e5c0ff1e28813e48bf33b" | ||
} | ||
arm: A={ | ||
url: "\(A._url)_Darwin_arm64" | ||
sha256: "124ad1d08c959690510a8983ac283b4c4ffafda2378768e89af2cd3af7226b54" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
class Hof < Formula | ||
desc "Flexible data modeling & code generation system" | ||
homepage "https://hofstadter.io/" | ||
version "0.6.6" | ||
url "https://github.com/hofstadter-io/hof.git", | ||
tag: "v0.6.6", | ||
revision: "0f49b4d71a66788b006daacf905a2b138768beca" | ||
license "BSD-3-Clause" | ||
head "https://github.com/hofstadter-io/hof.git", branch: "_dev" | ||
|
||
bottle do | ||
sha256 cellar: :any_skip_relocation, arm64_monterey: "da7fa63d18da0c17f4bd2b4d1ddef8a1fa6bf9409ad32646db184e2da74a4472" | ||
sha256 cellar: :any_skip_relocation, arm64_big_sur: "da7fa63d18da0c17f4bd2b4d1ddef8a1fa6bf9409ad32646db184e2da74a4472" | ||
sha256 cellar: :any_skip_relocation, monterey: "0b9a77f9209c943caabd4cbb896a8cd31690d474735998df1a30ce777b7cee19" | ||
sha256 cellar: :any_skip_relocation, big_sur: "0b9a77f9209c943caabd4cbb896a8cd31690d474735998df1a30ce777b7cee19" | ||
sha256 cellar: :any_skip_relocation, catalina: "0b9a77f9209c943caabd4cbb896a8cd31690d474735998df1a30ce777b7cee19" | ||
sha256 cellar: :any_skip_relocation, x86_64_linux: "7386d7a1f88d925e4621e1950e1edbca8361d813f68084eee7d53d185ad0da49" | ||
end | ||
|
||
depends_on "go" => :build | ||
depends_on "docker" => :test | ||
|
||
def install | ||
arch = Hardware::CPU.intel? ? "amd64" : Hardware::CPU.arch.to_s | ||
os = OS.kernel_name.downcase | ||
|
||
ldflags = %W[ -s -w -X github.com/hofstadter-io/hof/cmd/hof/verinfo.Version=#{version} -X github.com/hofstadter-io/hof/cmd/hof/verinfo.Commit=#{Utils.git_head} -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildDate=#{time.iso8601} -X github.com/hofstadter-io/hof/cmd/hof/verinfo.GoVersion=#{Formula["go"].version} -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildOS=#{os} -X github.com/hofstadter-io/hof/cmd/hof/verinfo.BuildArch=#{arch} ] | ||
|
||
ENV["CGO_ENABLED"] = "0" | ||
system "go", "build", *std_go_args(ldflags: ldflags), "./cmd/hof" | ||
|
||
bash_output = Utils.safe_popen_read(bin/"hof", "completion", "bash") | ||
(bash_completion/"hof").write bash_output | ||
zsh_output = Utils.safe_popen_read(bin/"hof", "completion", "zsh") | ||
(zsh_completion/"_hof").write zsh_output | ||
fish_output = Utils.safe_popen_read(bin/"hof", "completion", "fish") | ||
(fish_completion/"hof.fish").write fish_output | ||
end | ||
|
||
test do | ||
assert_match "v#{version}", shell_output("#{bin}/hof version") | ||
|
||
system bin/"hof", "mod", "init", "cue", "brew.sh/brewtest" | ||
assert_predicate testpath/"cue.mods", :exist? | ||
assert_equal "module: \"brew.sh/brewtest\"", (testpath/"cue.mod/module.cue").read.chomp | ||
|
||
assert_match version.to_s, shell_output(bin/"hof version") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
# This file was generated by GoReleaser. DO NOT EDIT. | ||
class {{ title .name }} < Formula | ||
desc "{{ .desc }}" | ||
homepage "{{ .homepage }}" | ||
version "{{ .version }}" | ||
|
||
on_macos do | ||
if Hardware::CPU.intel? | ||
{{ template "build-details" .builds.macos.intel }} | ||
end | ||
if Hardware::CPU.arm? | ||
{{ template "build-details" .builds.macos.arm }} | ||
end | ||
end | ||
|
||
on_linux do | ||
if Hardware::CPU.intel? | ||
{{ template "build-details" .builds.linux.intel }} | ||
end | ||
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit? | ||
{{ template "build-details" .builds.linux.arm }} | ||
end | ||
end | ||
|
||
test do | ||
system "#{bin}/{{ .name }} version" | ||
end | ||
end | ||
|
||
{{ define "build-details" }} | ||
url "{{ .url }}" | ||
sha256 "{{ .sha256 }}" | ||
|
||
def install | ||
bin.install "{{ .name }}" | ||
end | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
class {{ title .name }} < Formula | ||
desc "{{ .desc }}" | ||
homepage "{{ .homepage }}" | ||
version "{{ .version }}" | ||
url "{{ .url }}", | ||
tag: "{{ .tag }}", | ||
revision: "{{ .commit }}" | ||
license "{{ .license }}" | ||
head "{{ .url }}", branch: "{{ .branch }}" | ||
|
||
bottle do | ||
sha256 cellar: :any_skip_relocation, arm64_monterey: "da7fa63d18da0c17f4bd2b4d1ddef8a1fa6bf9409ad32646db184e2da74a4472" | ||
sha256 cellar: :any_skip_relocation, arm64_big_sur: "da7fa63d18da0c17f4bd2b4d1ddef8a1fa6bf9409ad32646db184e2da74a4472" | ||
sha256 cellar: :any_skip_relocation, monterey: "0b9a77f9209c943caabd4cbb896a8cd31690d474735998df1a30ce777b7cee19" | ||
sha256 cellar: :any_skip_relocation, big_sur: "0b9a77f9209c943caabd4cbb896a8cd31690d474735998df1a30ce777b7cee19" | ||
sha256 cellar: :any_skip_relocation, catalina: "0b9a77f9209c943caabd4cbb896a8cd31690d474735998df1a30ce777b7cee19" | ||
sha256 cellar: :any_skip_relocation, x86_64_linux: "7386d7a1f88d925e4621e1950e1edbca8361d813f68084eee7d53d185ad0da49" | ||
end | ||
|
||
depends_on "go" => :build | ||
depends_on "docker" => :test | ||
|
||
def install | ||
arch = Hardware::CPU.intel? ? "amd64" : Hardware::CPU.arch.to_s | ||
os = OS.kernel_name.downcase | ||
|
||
ldflags = %W[ {{ .ldflags }} ] | ||
|
||
ENV["CGO_ENABLED"] = "0" | ||
system "go", "build", *std_go_args(ldflags: ldflags), "./{{ .cmddir }}" | ||
|
||
bash_output = Utils.safe_popen_read(bin/"hof", "completion", "bash") | ||
(bash_completion/"hof").write bash_output | ||
zsh_output = Utils.safe_popen_read(bin/"hof", "completion", "zsh") | ||
(zsh_completion/"_hof").write zsh_output | ||
fish_output = Utils.safe_popen_read(bin/"hof", "completion", "fish") | ||
(fish_completion/"hof.fish").write fish_output | ||
end | ||
|
||
test do | ||
assert_match "v#{version}", shell_output("#{bin}/hof version") | ||
|
||
system bin/"hof", "mod", "init", "cue", "brew.sh/brewtest" | ||
assert_predicate testpath/"cue.mods", :exist? | ||
assert_equal "module: \"brew.sh/brewtest\"", (testpath/"cue.mod/module.cue").read.chomp | ||
|
||
assert_match version.to_s, shell_output(bin/"hof version") | ||
end | ||
end |