29 lines
773 B
Ruby
29 lines
773 B
Ruby
class Ktlint < Formula
|
|
desc "Anti-bikeshedding Kotlin linter with built-in formatter"
|
|
homepage "https://ktlint.github.io/"
|
|
url "https://github.com/pinterest/ktlint/releases/download/0.40.0/ktlint"
|
|
sha256 "4739662e9ac9a9894a1eb47844cbb5610971f15af332eac94d108d4f55ebc19e"
|
|
license "MIT"
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on "openjdk"
|
|
|
|
def install
|
|
libexec.install "ktlint"
|
|
(libexec/"ktlint").chmod 0755
|
|
(bin/"ktlint").write_env_script libexec/"ktlint", JAVA_HOME: Formula["openjdk"].opt_prefix
|
|
end
|
|
|
|
test do
|
|
(testpath/"In.kt").write <<~EOS
|
|
fun main( )
|
|
EOS
|
|
(testpath/"Out.kt").write <<~EOS
|
|
fun main()
|
|
EOS
|
|
system bin/"ktlint", "-F", "In.kt"
|
|
assert_equal shell_output("cat In.kt"), shell_output("cat Out.kt")
|
|
end
|
|
end
|