homebrew-core/Formula/dependency-check.rb
colezlaw c2860331b6
dependency-check 1.4.5
Closes #9169.

Signed-off-by: William Woodruff <william@tuffbizz.com>
2017-01-23 00:45:27 -05:00

40 lines
1.4 KiB
Ruby

class DependencyCheck < Formula
desc "OWASP Dependency Check"
homepage "https://www.owasp.org/index.php/OWASP_Dependency_Check"
url "https://dl.bintray.com/jeremy-long/owasp/dependency-check-1.4.5-release.zip"
version "1.4.5"
sha256 "129323b238c372b156c0c315d0b365518025765f3c0855f0ec6ac385f91b91be"
bottle :unneeded
depends_on :java
def install
rm_f Dir["bin/*.bat"]
chmod 0755, "bin/dependency-check.sh"
libexec.install Dir["*"]
mv libexec/"bin/dependency-check.sh", libexec/"bin/dependency-check"
bin.install_symlink libexec/"bin/dependency-check"
(var/"dependencycheck").mkpath
libexec.install_symlink var/"dependencycheck" => "data"
(etc/"dependencycheck").mkpath
jar = "dependency-check-core-#{version}.jar"
corejar = libexec/"repo/org/owasp/dependency-check-core/#{version}/#{jar}"
system "unzip", "-o", corejar, "dependencycheck.properties", "-d", libexec/"etc"
(etc/"dependencycheck").install_symlink libexec/"etc/dependencycheck.properties"
end
test do
output = shell_output("#{libexec}/bin/dependency-check --version").strip
assert_match "Dependency-Check Core version #{version}", output
(testpath/"temp-props.properties").write "cve.startyear=2017"
system bin/"dependency-check", "-P", "temp-props.properties", "-f", "XML",
"--project", "dc", "-s", libexec, "-d", testpath, "-o", testpath
assert File.exist?(testpath/"dependency-check-report.xml")
end
end