73359f41d9
Closes #46623. Signed-off-by: Rui Chen <rchen@meetup.com>
42 lines
1.4 KiB
Ruby
42 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-5.2.3-release.zip"
|
|
sha256 "40e2d8514da5930986e2d2f5720a5be9eb12cd49359bc442bcf6e9e63242afd8"
|
|
|
|
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/"lib/#{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 <<~EOS
|
|
cve.startyear=2017
|
|
analyzer.assembly.enabled=false
|
|
EOS
|
|
system bin/"dependency-check", "-P", "temp-props.properties", "-f", "XML",
|
|
"--project", "dc", "-s", libexec, "-d", testpath, "-o", testpath
|
|
assert_predicate testpath/"dependency-check-report.xml", :exist?
|
|
end
|
|
end
|