2014-03-25 03:54:25 +00:00
|
|
|
require "formula"
|
|
|
|
|
|
|
|
class Pmd < Formula
|
|
|
|
homepage "http://pmd.sourceforge.net/"
|
2014-05-18 18:00:29 +00:00
|
|
|
url "https://downloads.sourceforge.net/project/pmd/pmd/5.1.1/pmd-src-5.1.1.zip"
|
|
|
|
sha1 "5c2149361f69bcfe48b88dbeaa8022be7c5bcfa4"
|
2014-03-25 03:54:25 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
rm Dir["bin/*.{bat,cmd,dll,exe}"]
|
2014-03-29 14:28:14 +00:00
|
|
|
|
|
|
|
doc.install "LICENSE", "NOTICE", "ReadMe.txt", "licences", Dir["docs/*"]
|
|
|
|
libexec.install "bin", "etc", "lib"
|
|
|
|
|
2014-03-25 03:54:25 +00:00
|
|
|
bin.install_symlink "#{libexec}/bin/run.sh" => "pmd"
|
|
|
|
|
|
|
|
# the run script references paths which don't account for the
|
|
|
|
# file structure of this brew.
|
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
|