class Flyctl < Formula desc "Command-line tools for fly.io services" homepage "https://fly.io" url "https://github.com/superfly/flyctl.git", tag: "v0.0.395", revision: "01205c00e5353dba2b0b770c9e150a9d897c97a1" license "Apache-2.0" head "https://github.com/superfly/flyctl.git", branch: "master" livecheck do url :stable regex(/^v?(\d+(?:\.\d+)+)$/i) end bottle do sha256 cellar: :any_skip_relocation, arm64_monterey: "bdb268fb1e287989583cd2bda4d3832613640dbd1608ccc363071e3dd7847d94" sha256 cellar: :any_skip_relocation, arm64_big_sur: "bdb268fb1e287989583cd2bda4d3832613640dbd1608ccc363071e3dd7847d94" sha256 cellar: :any_skip_relocation, monterey: "fe0795397821feca1d102558c5f67b97284c7a51b3b450f7068267148caaede9" sha256 cellar: :any_skip_relocation, big_sur: "fe0795397821feca1d102558c5f67b97284c7a51b3b450f7068267148caaede9" sha256 cellar: :any_skip_relocation, catalina: "fe0795397821feca1d102558c5f67b97284c7a51b3b450f7068267148caaede9" sha256 cellar: :any_skip_relocation, x86_64_linux: "715dd1b4c712142cf7a21ba4f41cd81b3c1fbb6df9e94291ea7d9863bfbd1d57" end # Required latest gvisor.dev/gvisor/pkg/gohacks # Try to switch to the latest go on the next release depends_on "go@1.18" => :build def install ENV["CGO_ENABLED"] = "0" ldflags = %W[ -s -w -X github.com/superfly/flyctl/internal/buildinfo.environment=production -X github.com/superfly/flyctl/internal/buildinfo.buildDate=#{time.iso8601} -X github.com/superfly/flyctl/internal/buildinfo.version=#{version} -X github.com/superfly/flyctl/internal/buildinfo.commit=#{Utils.git_short_head} ] system "go", "build", *std_go_args(ldflags: ldflags) bin.install_symlink "flyctl" => "fly" generate_completions_from_executable(bin/"flyctl", "completion") end test do assert_match "flyctl v#{version}", shell_output("#{bin}/flyctl version") flyctl_status = shell_output("flyctl status 2>&1", 1) assert_match "Error No access token available. Please login with 'flyctl auth login'", flyctl_status end end