aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/scalastyle.rb
blob: d6e77e407d0b0c30e5fcf14692d000e7c712dc96 (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
34
35
36
require "formula"

class Scalastyle < Formula
  homepage "http://www.scalastyle.org/command-line.html"
  url "https://oss.sonatype.org/content/repositories/releases/org/scalastyle/scalastyle-batch_2.10/0.5.0/scalastyle-batch_2.10-0.5.0-distribution.zip"
  version "0.5.0"
  sha1 "bf009e0c4d48e5effce5113f5feb3da626ca1248"

  resource "default_config" do
    url "https://raw.githubusercontent.com/scalastyle/scalastyle/e41e5df2cf4b616d06d1f5b8c383ec084fc32012/lib/scalastyle_config.xml"
    sha1 "993c4d665ae75930c262fcd8a13eef0e9604920f"
  end

  def install
    (libexec/"lib").install Dir["lib/*.jar"]
    libexec.install "scalastyle-batch_2.10.jar"

    etc.install resource("default_config")

    (bin/"scalastyle").write <<-EOS.undent
      #!/bin/sh
      java -jar "#{libexec}/scalastyle-batch_2.10.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