2014-03-25 03:54:25 +00:00
|
|
|
class Pmd < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Source code analyzer for Java, JavaScript, and more"
|
2014-03-25 03:54:25 +00:00
|
|
|
homepage "http://pmd.sourceforge.net/"
|
2015-08-10 21:47:42 +00:00
|
|
|
url "https://github.com/pmd/pmd/releases/download/pmd_releases/5.3.3/pmd-src-5.3.3.zip"
|
|
|
|
sha256 "38004ea3274d2f71701f438606a4c4095b7a86110e8d7f2a8940170c9bd5ddbb"
|
2015-06-04 15:35:43 +00:00
|
|
|
|
|
|
|
depends_on "maven" => :build
|
2014-03-25 03:54:25 +00:00
|
|
|
|
|
|
|
def install
|
2015-06-04 15:35:43 +00:00
|
|
|
system "mvn", "clean", "package"
|
2014-03-29 14:28:14 +00:00
|
|
|
|
2015-06-04 15:35:43 +00:00
|
|
|
doc.install "LICENSE", "NOTICE", "README.md"
|
2014-03-29 14:28:14 +00:00
|
|
|
|
2015-06-04 15:35:43 +00:00
|
|
|
# The mvn package target produces a .zip with all the jars needed for PMD
|
2015-08-03 12:55:31 +00:00
|
|
|
safe_system "tar", "-xf", buildpath/"pmd-dist/target/pmd-bin-#{version}.zip"
|
2015-06-04 15:35:43 +00:00
|
|
|
libexec.install "pmd-bin-#{version}/bin", "pmd-bin-#{version}/lib"
|
2014-03-25 03:54:25 +00:00
|
|
|
|
2015-06-04 15:35:43 +00:00
|
|
|
bin.install_symlink "#{libexec}/bin/run.sh" => "pmd"
|
2014-03-29 15:06:52 +00:00
|
|
|
inreplace "#{libexec}/bin/run.sh", "${script_dir}/../lib", "#{libexec}/lib"
|
2014-03-25 03:54:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
2014-03-29 14:28:14 +00:00
|
|
|
Run with `pmd` (instead of `run.sh` as described in the documentation).
|
2014-03-25 03:54:25 +00:00
|
|
|
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
|