Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Created December 13, 2021 09:06
Show Gist options
  • Save kwilczynski/ff87e7a82ce8453824927ee7e3c1788f to your computer and use it in GitHub Desktop.
Save kwilczynski/ff87e7a82ce8453824927ee7e3c1788f to your computer and use it in GitHub Desktop.
class Terramate < Formula
desc "Tool for managing multiple Terraform stacks"
homepage "https://github.com/mineiros-io/terramate"
# Disabled. No official release of Terramate yet.
# url ""
# sha256 ""
license "Apache-2.0"
head "https://github.com/mineiros-io/terramate.git", branch: "main"
# Disabled. No official release of Terramate yet.
# livecheck do
# url :stable
# regex(/^v?(\d+(?:\.\d+)+)$/i)
# end
depends_on "go" => :build
depends_on "git"
def install
ENV["CGO_ENABLED"] = "0"
ENV["GOGC"] = "off"
# Disabled. Terramate validates its own version?
# N.B. Using the `version` method here could also work
# in lieu of using short hash from Git commit.
# if build.head?
# cd buildpath do
# File.open("VERSION", "r+") do |f|
# f.write("#{f.read.strip}-#{Utils.git_short_head}")
# end
# end
# end
ldflags = %w[
-s -w
]
system "go", "build", *std_go_args(ldflags: ldflags), "./cmd/terramate/"
prefix.install_metafiles
end
test do
# Terramate runs Git every time it's executed, which then breaks
# once it hits the Homebrew Git shim, thus we need to make sure it
# finds Git binary installed that was installed as dependency.
ENV.prepend_path "PATH", Formula["git"].opt_bin.to_s
system "#{bin}/terramate", "version"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment