scalastyle 1.0.0 (#17414)

Also don't install the default_config resource; only use it for the
test.
The scalastyle script code is as recommended at
http://www.scalastyle.org/command-line.html
This commit is contained in:
Eric Nielsen 2017-11-11 22:14:27 -05:00 committed by ilovezfs
parent cf537fbfd8
commit 170e3ea8bc

View file

@ -1,32 +1,20 @@
class Scalastyle < Formula
desc "Run scalastyle from the command-line"
homepage "http://www.scalastyle.org/command-line.html"
url "https://oss.sonatype.org/content/repositories/releases/org/scalastyle/scalastyle_2.11/0.8.0/scalastyle_2.11-0.8.0-batch.jar"
sha256 "0f902a6d8c3f7bedb87860fc236bbd65deb801ea2a4d703b8f3a6475e9aea531"
url "https://oss.sonatype.org/content/repositories/releases/org/scalastyle/scalastyle_2.12/1.0.0/scalastyle_2.12-1.0.0-batch.jar"
sha256 "e9dafd97be0d00f28c1e8bfcab951d0e5172b262a1d41da31d1fd65d615aedcb"
bottle :unneeded
resource "default_config" do
url "https://raw.githubusercontent.com/scalastyle/scalastyle/v0.8.0/lib/scalastyle_config.xml"
version "0.8.0"
sha256 "feb61c4a09373717f94d277487e8118be524bb4c3265eb6d2fdee7a1fa362e50"
url "https://raw.githubusercontent.com/scalastyle/scalastyle/v1.0.0/lib/scalastyle_config.xml"
version "1.0.0"
sha256 "6ce156449609a375d973cc8384a17524e4538114f1747efc2295cf4ca473d04e"
end
def install
libexec.install "scalastyle_2.11-#{version}-batch.jar"
etc.install resource("default_config")
(bin/"scalastyle").write <<~EOS
#!/bin/sh
java -jar "#{libexec}/scalastyle_2.11-#{version}-batch.jar" --config "#{etc}/scalastyle_config.xml" "$@"
EOS
end
def caveats
<<~EOS
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
libexec.install "scalastyle_2.12-#{version}-batch.jar"
bin.write_jar_script("#{libexec}/scalastyle_2.12-#{version}-batch.jar", "scalastyle")
end
test do
@ -37,6 +25,7 @@ class Scalastyle < Formula
}
}
EOS
system bin/"scalastyle", testpath/"test.scala"
testpath.install resource("default_config")
system bin/"scalastyle", "--config", "scalastyle_config.xml", testpath/"test.scala"
end
end