2015-07-06 14:39:26 +00:00
|
|
|
class DependencyCheck < Formula
|
|
|
|
desc "OWASP Dependency Check"
|
|
|
|
homepage "https://www.owasp.org/index.php/OWASP_Dependency_Check"
|
2015-09-20 19:53:01 +00:00
|
|
|
url "https://dl.bintray.com/jeremy-long/owasp/dependency-check-1.3.1-release.zip"
|
|
|
|
version "1.3.1"
|
|
|
|
sha256 "0f36689b6a8ade5db1d626aa9d067c6f6c083677ca04bcbae16b1d819d9af1d5"
|
2015-07-06 14:39:26 +00:00
|
|
|
|
|
|
|
depends_on :java
|
|
|
|
|
|
|
|
def install
|
|
|
|
rm_f Dir["bin/*.bat"]
|
|
|
|
|
|
|
|
chmod 0755, "bin/dependency-check.sh"
|
|
|
|
|
|
|
|
prefix.install_metafiles
|
|
|
|
libexec.install Dir["*"]
|
|
|
|
|
|
|
|
File.rename "#{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
|
|
|
|
corejar = libexec/"repo/org/owasp/dependency-check-core/#{version}/"\
|
|
|
|
"dependency-check-core-#{version}.jar"
|
|
|
|
system "unzip", "-o", corejar, "dependencycheck.properties", "-d", \
|
2015-08-06 00:50:36 +00:00
|
|
|
libexec/"etc"
|
|
|
|
etc.install_symlink libexec/"etc/dependencycheck.properties" => \
|
|
|
|
"dependencycheck/dependencycheck.properties"
|
2015-07-06 14:39:26 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
output = `#{libexec}/bin/dependency-check --version`.strip
|
2015-08-06 00:50:36 +00:00
|
|
|
assert_match("Dependency-Check Core version #{version}", output)
|
2015-07-06 14:39:26 +00:00
|
|
|
|
|
|
|
props = File.open("temp-props.properties", "w")
|
|
|
|
props.puts "cve.startyear=2015"
|
|
|
|
props.close
|
|
|
|
|
|
|
|
system "#{bin}/dependency-check", "-P", "temp-props.properties", \
|
2015-09-20 19:53:01 +00:00
|
|
|
"-f", "XML", "--project", "dc", "-s", libexec, "-d", testpath, "-o", testpath
|
2015-07-06 14:39:26 +00:00
|
|
|
assert(File.exist?(testpath/"dependency-check-report.xml"))
|
|
|
|
end
|
|
|
|
end
|