53 lines
1.6 KiB
Ruby
53 lines
1.6 KiB
Ruby
class Packer < Formula
|
|
desc "Tool for creating identical machine images for multiple platforms"
|
|
homepage "https://packer.io"
|
|
url "https://github.com/hashicorp/packer.git",
|
|
tag: "v1.7.1",
|
|
revision: "030da4b6b9a0efd62447dbd2ae177dbe3f0ffcc5"
|
|
license "MPL-2.0"
|
|
head "https://github.com/hashicorp/packer.git"
|
|
|
|
livecheck do
|
|
url "https://releases.hashicorp.com/packer/"
|
|
regex(%r{href=.*?v?(\d+(?:\.\d+)+)/?["' >]}i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, big_sur: "98db76a946447d78a2619edae9bc10661c900cb41658b3a1cc58a2af16f3aa65"
|
|
sha256 cellar: :any_skip_relocation, catalina: "7943e79ec575a7c7d7db2fb58ebca80fdfe61a456872439e81f68fd6c12dd559"
|
|
sha256 cellar: :any_skip_relocation, mojave: "5f5ade4bc6964363e111a5391337040db1803cceeff860205486513126f4e6df"
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
system "go", "build", *std_go_args
|
|
zsh_completion.install "contrib/zsh-completion/_packer"
|
|
prefix.install_metafiles
|
|
end
|
|
|
|
test do
|
|
minimal = testpath/"minimal.json"
|
|
minimal.write <<~EOS
|
|
{
|
|
"builders": [{
|
|
"type": "amazon-ebs",
|
|
"region": "us-east-1",
|
|
"source_ami": "ami-59a4a230",
|
|
"instance_type": "m3.medium",
|
|
"ssh_username": "ubuntu",
|
|
"ami_name": "homebrew packer test {{timestamp}}"
|
|
}],
|
|
"provisioners": [{
|
|
"type": "shell",
|
|
"inline": [
|
|
"sleep 30",
|
|
"sudo apt-get update"
|
|
]
|
|
}]
|
|
}
|
|
EOS
|
|
system "#{bin}/packer", "validate", "-syntax-only", minimal
|
|
end
|
|
end
|