aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/checkstyle.rb
blob: f9b1426ca1bd1fcd4e0f4ddbfeac1957f9c82810 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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'
  sha1 '757f89f0bb6148718904577d230a9b4f8221b03c'

  def install
    libexec.install 'checkstyle-5.5-all.jar', 'sun_checks.xml'
    bin.write_jar_script libexec/'checkstyle-5.5-all.jar', 'checkstyle'
  end

  def test
    # Note this test "fails" because the audit has issues
    # TODO - pipe through cat to ingore error code
    mktemp do
      # create test file
      (Pathname.pwd/"Test.java").write <<-EOS.undent
        public class Test{ }
      EOS
      system "#{bin}/checkstyle", "-c", "#{libexec}/sun_checks.xml", "-r", "Test.java"
    end
  end
end