homebrew-core/Formula/artifactory.rb

64 lines
1.9 KiB
Ruby

class Artifactory < Formula
desc "Manages binaries"
homepage "https://www.jfrog.com/artifactory/"
# v7 is available but does contain a number of pre-builts that need to be avoided.
# Note that just using the source archive is not sufficient.
url "https://releases.jfrog.io/artifactory/bintray-artifactory/org/artifactory/oss/jfrog-artifactory-oss/6.23.36/jfrog-artifactory-oss-6.23.36.zip"
sha256 "b35f2f21344ad1cf230ef61db3275b3b095725a26c367802ee7e2dee6d378ce3"
license "AGPL-3.0-or-later"
livecheck do
url "https://releases.jfrog.io/artifactory/bintray-artifactory/org/artifactory/oss/jfrog-artifactory-oss/"
regex(/href=.*?v?(\d+(?:\.\d+)+)/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "9ff73d50b8c353dbc200539374793efbf83e07bf3081b7815a8e41a4b1294753"
end
depends_on "openjdk"
def install
# Remove Windows binaries
rm_f Dir["bin/*.bat"]
rm_f Dir["bin/*.exe"]
# Prebuilts
rm_rf "bin/metadata"
# Set correct working directory
inreplace "bin/artifactory.sh",
'export ARTIFACTORY_HOME="$(cd "$(dirname "${artBinDir}")" && pwd)"',
"export ARTIFACTORY_HOME=#{libexec}"
libexec.install Dir["*"]
# Launch Script
bin.install libexec/"bin/artifactory.sh"
# Memory Options
bin.install libexec/"bin/artifactory.default"
bin.env_script_all_files libexec/"bin", JAVA_HOME: Formula["openjdk"].opt_prefix
end
def post_install
# Create persistent data directory. Artifactory heavily relies on the data
# directory being directly under ARTIFACTORY_HOME.
# Therefore, we symlink the data dir to var.
data = var/"artifactory"
data.mkpath
libexec.install_symlink data => "data"
end
service do
run opt_bin/"artifactory.sh"
keep_alive true
working_dir libexec
end
test do
assert_match "Checking arguments to Artifactory", pipe_output("#{bin}/artifactory.sh check")
end
end