aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/scalastyle.rb
blob: caea6262abd7052a4a9939296f5add51c59d07e5 (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
25
26
27
28
29
30
31
32
33
class Scalastyle < Formula
  homepage "http://www.scalastyle.org/command-line.html"
  url "https://oss.sonatype.org/content/repositories/releases/org/scalastyle/scalastyle_2.10/0.6.0/scalastyle_2.10-0.6.0-batch.jar"
  sha1 "01c744fa7eef25f7183beea5d603ce9658861fcf"

  resource "default_config" do
    url "https://raw.githubusercontent.com/scalastyle/scalastyle/v0.6.0/lib/scalastyle_config.xml"
    version "0.6.0"
    sha1 "c22165ccda7ef285665041ad07a4b31a639a85c3"
  end

  def install
    libexec.install "scalastyle_2.10-#{version}-batch.jar"

    etc.install resource("default_config")

    (bin/"scalastyle").write <<-EOS.undent
      #!/bin/sh
      java -jar "#{libexec}/scalastyle_2.10-#{version}-batch.jar" --config "#{etc}/scalastyle_config.xml" "$@"
    EOS
  end

  def caveats
    <<-EOS.undent
      A default configuration file is used from "#{etc}/scalastyle_config.xml"
      To override, pass a "--config your_config.xml" argument on the command line.
    EOS
  end

  test do
    system bin/"scalastyle", "--verbose"
  end
end