class Artifactory < Formula desc "Manages binaries" homepage "https://www.jfrog.com/artifactory/" url "https://dl.bintray.com/jfrog/artifactory/jfrog-artifactory-oss-4.14.2.zip" sha256 "74ffcb027fc6d6a93acb8f454fe09a90907ed6f8ff7880c282d0ce7f2bef8865" bottle :unneeded option "with-low-heap", "Run artifactory with low Java memory options. Useful for development machines. Do not use in production." depends_on :java => "1.8+" def install # Remove Windows binaries rm_f Dir["bin/*.bat"] rm_f Dir["bin/*.exe"] # Set correct working directory inreplace "bin/artifactory.sh", 'export ARTIFACTORY_HOME="$(cd "$(dirname "${artBinDir}")" && pwd)"', "export ARTIFACTORY_HOME=#{libexec}" if build.with? "low-heap" # Reduce memory consumption for non production use inreplace "bin/artifactory.default", "-server -Xms512m -Xmx2g", "-Xms128m -Xmx768m" end libexec.install Dir["*"] # Launch Script bin.install_symlink libexec/"bin/artifactory.sh" # Memory Options bin.install_symlink libexec/"bin/artifactory.default" 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 plist_options :manual => "#{HOMEBREW_PREFIX}/opt/artifactory/libexec/bin/artifactory.sh" def plist; <<-EOS.undent Label com.jfrog.artifactory WorkingDirectory #{libexec} Program #{bin}/artifactory.sh KeepAlive EOS end test do assert_match "Checking arguments to Artifactory", pipe_output("#{bin}/artifactory.sh check") end end