a5748ddccf
Closes Homebrew/homebrew#40383. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
44 lines
1.3 KiB
Ruby
44 lines
1.3 KiB
Ruby
require "formula"
|
|
|
|
class Pmd < Formula
|
|
desc "Source code analyzer for Java, JavaScript, and more"
|
|
homepage "http://pmd.sourceforge.net/"
|
|
url "https://downloads.sourceforge.net/project/pmd/pmd/5.3.2/pmd-src-5.3.2.zip"
|
|
sha1 "036cdb7583de3ea0d24e7486bf7b9f9f14bfb1ec"
|
|
|
|
depends_on "maven" => :build
|
|
|
|
def install
|
|
system "mvn", "clean", "package"
|
|
|
|
doc.install "LICENSE", "NOTICE", "README.md"
|
|
|
|
# The mvn package target produces a .zip with all the jars needed for PMD
|
|
safe_system 'tar', '-xf', buildpath/"pmd-dist/target/pmd-bin-#{version}.zip"
|
|
libexec.install "pmd-bin-#{version}/bin", "pmd-bin-#{version}/lib"
|
|
|
|
bin.install_symlink "#{libexec}/bin/run.sh" => "pmd"
|
|
inreplace "#{libexec}/bin/run.sh", "${script_dir}/../lib", "#{libexec}/lib"
|
|
end
|
|
|
|
def caveats; <<-EOS.undent
|
|
Run with `pmd` (instead of `run.sh` as described in the documentation).
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"java/testClass.java").write <<-EOS.undent
|
|
public class BrewTestClass {
|
|
// dummy constant
|
|
public String SOME_CONST = "foo";
|
|
|
|
public boolean doTest () {
|
|
return true;
|
|
}
|
|
}
|
|
EOS
|
|
|
|
system "#{bin}/pmd", "pmd", "-d", "#{testpath}/java", "-R",
|
|
"rulesets/java/basic.xml", "-f", "textcolor", "-l", "java"
|
|
end
|
|
end
|