34 lines
1.0 KiB
Ruby
34 lines
1.0 KiB
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.46.1/ktlint"
|
|
sha256 "45c5e1104490b2f2a342d3b7ddd94898ea76e267c999100be40791ff724276ad"
|
|
license "MIT"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "58f527c18789bdf631363e77b4180245497356eec1b399a8948c0161b4902742"
|
|
end
|
|
|
|
depends_on "openjdk@11"
|
|
|
|
def install
|
|
libexec.install "ktlint"
|
|
(libexec/"ktlint").chmod 0755
|
|
(bin/"ktlint").write_env_script libexec/"ktlint",
|
|
Language::Java.java_home_env("11").merge(
|
|
PATH: "#{Formula["openjdk@11"].opt_bin}:${PATH}",
|
|
)
|
|
end
|
|
|
|
test do
|
|
(testpath/"Main.kt").write <<~EOS
|
|
fun main( )
|
|
EOS
|
|
(testpath/"Out.kt").write <<~EOS
|
|
fun main()
|
|
EOS
|
|
system bin/"ktlint", "-F", "Main.kt"
|
|
assert_equal shell_output("cat Main.kt"), shell_output("cat Out.kt")
|
|
end
|
|
end
|