homebrew-core/Formula/pmd.rb
Juan Pablo Civile 98b60f917d pmd 5.3.3
Closes Homebrew/homebrew#42764.

Signed-off-by: Alex Dunn <dunn.alex@gmail.com>
2015-08-10 19:46:13 -07:00

42 lines
1.3 KiB
Ruby

class Pmd < Formula
desc "Source code analyzer for Java, JavaScript, and more"
homepage "http://pmd.sourceforge.net/"
url "https://github.com/pmd/pmd/releases/download/pmd_releases/5.3.3/pmd-src-5.3.3.zip"
sha256 "38004ea3274d2f71701f438606a4c4095b7a86110e8d7f2a8940170c9bd5ddbb"
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