58 lines
2.2 KiB
Ruby
58 lines
2.2 KiB
Ruby
class NewrelicInfraAgent < Formula
|
|
desc "New Relic infrastructure agent"
|
|
homepage "https://github.com/newrelic/infrastructure-agent"
|
|
url "https://github.com/newrelic/infrastructure-agent.git",
|
|
tag: "1.28.0",
|
|
revision: "11480c45d21e47af582eb5f50cbac98e51f06e99"
|
|
license "Apache-2.0"
|
|
head "https://github.com/newrelic/infrastructure-agent.git", branch: "master"
|
|
|
|
# Upstream sometimes creates a tag with a stable version format but marks it
|
|
# as pre-release on GitHub.
|
|
livecheck do
|
|
url :stable
|
|
strategy :github_latest
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, monterey: "c7546e33c4265b59862ae3814b9bec3b4bc312b35d136009f3e258498f02ffc4"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "b50170b3c0ef1542550d6902dd43b75f0490867c4904c30282ba3b9083da1042"
|
|
sha256 cellar: :any_skip_relocation, catalina: "3afd7d5f269285e3c2c1413a9b831ef2b13081d2cb599455ace27dec94333b7b"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "14f20d44c747cbb4c967bed4a4edd9dde3572411441a8d37247ddcd649ec3355"
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
# https://github.com/newrelic/infrastructure-agent/issues/695
|
|
depends_on arch: :x86_64
|
|
|
|
def install
|
|
goarch = Hardware::CPU.intel? ? "amd64" : Hardware::CPU.arch.to_s
|
|
os = OS.kernel_name.downcase
|
|
ENV["VERSION"] = version.to_s
|
|
ENV["GOOS"] = os
|
|
ENV["CGO_ENABLED"] = OS.mac? ? "1" : "0"
|
|
|
|
system "make", "dist-for-os"
|
|
bin.install "dist/#{os}-newrelic-infra_#{os}_#{goarch}/newrelic-infra"
|
|
bin.install "dist/#{os}-newrelic-infra-ctl_#{os}_#{goarch}/newrelic-infra-ctl"
|
|
bin.install "dist/#{os}-newrelic-infra-service_#{os}_#{goarch}/newrelic-infra-service"
|
|
(var/"db/newrelic-infra").install "assets/licence/LICENSE.macos.txt" if OS.mac?
|
|
end
|
|
|
|
def post_install
|
|
(etc/"newrelic-infra").mkpath
|
|
(var/"log/newrelic-infra").mkpath
|
|
end
|
|
|
|
service do
|
|
run [bin/"newrelic-infra-service", "-config", etc/"newrelic-infra/newrelic-infra.yml"]
|
|
log_path var/"log/newrelic-infra/newrelic-infra.log"
|
|
error_log_path var/"log/newrelic-infra/newrelic-infra.stderr.log"
|
|
end
|
|
|
|
test do
|
|
output = shell_output("#{bin}/newrelic-infra -validate")
|
|
assert_match "config validation", output
|
|
end
|
|
end
|