2012-04-30 09:37:34 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Checkstyle < Formula
|
|
|
|
homepage 'http://checkstyle.sourceforge.net/'
|
|
|
|
url 'http://sourceforge.net/projects/checkstyle/files/checkstyle/5.5/checkstyle-5.5-bin.tar.gz'
|
2012-09-03 18:33:56 +00:00
|
|
|
sha1 '757f89f0bb6148718904577d230a9b4f8221b03c'
|
2012-04-30 09:37:34 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
# wrapper script
|
|
|
|
(bin/'checkstyle').write <<-EOS.undent
|
|
|
|
#! /usr/bin/env bash -e
|
|
|
|
java -jar "#{libexec}/checkstyle-5.5-all.jar" "$@"
|
|
|
|
EOS
|
|
|
|
|
|
|
|
libexec.install 'checkstyle-5.5-all.jar', 'sun_checks.xml'
|
|
|
|
end
|
|
|
|
|
|
|
|
def test
|
|
|
|
mktemp do
|
2012-05-02 02:43:45 +00:00
|
|
|
# create test file
|
2012-04-30 09:37:34 +00:00
|
|
|
(Pathname.pwd/"Test.java").write <<-EOS.undent
|
2012-05-02 02:43:45 +00:00
|
|
|
public class Test{ }
|
2012-04-30 09:37:34 +00:00
|
|
|
EOS
|
2012-05-15 21:36:45 +00:00
|
|
|
system "#{bin}/checkstyle", "-c", "#{libexec}/sun_checks.xml", "-r", "Test.java"
|
2012-04-30 09:37:34 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|