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.2635", :revision => "3f5897ad5c35ed2f483bbe6c0f1d9aa3334460c2" bottle do cellar :any_skip_relocation sha256 "aae4d10499070bad9827b0af25dac75b2bf6336a1196a4db396860b76e779255" => :mojave sha256 "e5e7b147dc7e2f1da51fe82753b484892833bb475d96841cf6333769be2dde4f" => :high_sierra sha256 "6dc9ba1cb71d40bde45f63f45fd1cc166bc78ace8a2079cbf302565a6c8e2b4b" => :sierra 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 commit = Utils.popen_read("git rev-parse --short HEAD").chomp ldflags = %W[ -s -w -X github.com/CircleCI-Public/circleci-cli/version.Version=#{version} -X github.com/CircleCI-Public/circleci-cli/version.Commit=#{commit} ] 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 # assert script fails because 2.1 config is not supported for local builds (testpath/".circleci.yml").write("{version: 2.1}") output = shell_output("#{bin}/circleci build -c #{testpath}/.circleci.yml 2>&1", 255) assert_match "Local builds do not support that version at this time", output end end