51 lines
2.1 KiB
Ruby
51 lines
2.1 KiB
Ruby
class Circleci < Formula
|
|
desc "Enables you to reproduce the CircleCI environment locally"
|
|
homepage "https://circleci.com/docs/2.0/local-cli/"
|
|
# Updates should be pushed no more frequently than once per week.
|
|
url "https://github.com/CircleCI-Public/circleci-cli.git",
|
|
tag: "v0.1.15044",
|
|
revision: "ec2b22ab0e18d5cf4e9445f6ff8ee78374fa00c6"
|
|
license "MIT"
|
|
head "https://github.com/CircleCI-Public/circleci-cli.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, big_sur: "5ddbb7905afdb70418c1ce8c9e7f0498d81c9830fcdcc3c65288a21ba6a0f185"
|
|
sha256 cellar: :any_skip_relocation, catalina: "c70672f41af03055d9202d07165852e035f0bef5f56d6776dbfd8e99b1f29668"
|
|
sha256 cellar: :any_skip_relocation, mojave: "507d125bf14e5e66bad917f367360c856b24cb1533d50a262d51edcc3d66e9cb"
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
dir = buildpath/"src/github.com/CircleCI-Public/circleci-cli"
|
|
dir.install buildpath.children
|
|
|
|
cd dir do
|
|
ldflags = %W[
|
|
-s -w
|
|
-X github.com/CircleCI-Public/circleci-cli/version.packageManager=homebrew
|
|
-X github.com/CircleCI-Public/circleci-cli/version.Version=#{version}
|
|
-X github.com/CircleCI-Public/circleci-cli/version.Commit=#{Utils.git_short_head}
|
|
]
|
|
system "make", "pack"
|
|
system "go", "build", "-ldflags", ldflags.join(" "),
|
|
"-o", bin/"circleci"
|
|
prefix.install_metafiles
|
|
end
|
|
end
|
|
|
|
test do
|
|
# assert basic script execution
|
|
assert_match(/#{version}\+.{7}/, shell_output("#{bin}/circleci version").strip)
|
|
(testpath/".circleci.yml").write("{version: 2.1}")
|
|
output = shell_output("#{bin}/circleci config pack #{testpath}/.circleci.yml")
|
|
assert_match "version: 2.1", output
|
|
# assert update is not included in output of help meaning it was not included in the build
|
|
assert_match "update This command is unavailable on your platform", shell_output("#{bin}/circleci help")
|
|
assert_match "`update` is not available because this tool was installed using `homebrew`.",
|
|
shell_output("#{bin}/circleci update")
|
|
end
|
|
end
|