2012-04-30 09:37:34 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Checkstyle < Formula
|
|
|
|
homepage 'http://checkstyle.sourceforge.net/'
|
2014-02-27 14:19:55 +00:00
|
|
|
url 'https://downloads.sourceforge.net/project/checkstyle/checkstyle/5.7/checkstyle-5.7-bin.tar.gz'
|
2014-02-15 17:24:01 +00:00
|
|
|
sha1 '232d317391b58d118a0102e8ff289fbaebd0064a'
|
2012-04-30 09:37:34 +00:00
|
|
|
|
|
|
|
def install
|
2013-08-12 23:47:38 +00:00
|
|
|
libexec.install "checkstyle-#{version}-all.jar", "sun_checks.xml"
|
|
|
|
bin.write_jar_script libexec/"checkstyle-#{version}-all.jar", "checkstyle"
|
2012-04-30 09:37:34 +00:00
|
|
|
end
|
2014-02-15 19:15:34 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
path = testpath/"foo.java"
|
|
|
|
path.write "public class Foo{ }\n"
|
|
|
|
|
|
|
|
output = `#{bin}/checkstyle -c #{libexec}/sun_checks.xml -r #{path}`
|
|
|
|
errors = output.split("\n").select { |line| line.start_with?(path) }
|
|
|
|
assert errors.include?("#{path}:1:17: '{' is not preceded with whitespace.")
|
|
|
|
assert_equal errors.size, $?.exitstatus
|
|
|
|
end
|
2012-04-30 09:37:34 +00:00
|
|
|
end
|