homebrew-core/Formula/scalariform.rb
Rui Chen 722bbbf252
scalariform 0.2.9
Closes #40598.

Signed-off-by: Chongyu Zhu <i@lembacon.com>
2019-06-02 09:01:59 -07:00

42 lines
1.1 KiB
Ruby

class Scalariform < Formula
desc "Scala source code formatter"
homepage "https://github.com/scala-ide/scalariform"
url "https://github.com/scala-ide/scalariform/releases/download/0.2.9/scalariform.jar"
sha256 "9698642ccbb135d6686152a608164c114c37345c7500c4c6ed665a8a429f055e"
head do
url "https://github.com/scala-ide/scalariform.git"
depends_on "sbt" => :build
end
bottle :unneeded
def install
if build.head?
system "sbt", "project cli", "assembly"
libexec.install Dir["cli/target/scala-*/cli-assembly-*.jar"]
bin.write_jar_script Dir[libexec/"cli-assembly-*.jar"][0], "scalariform"
else
libexec.install "scalariform.jar"
bin.write_jar_script libexec/"scalariform.jar", "scalariform"
end
end
test do
before_data = <<~EOS
def foo() {
println("Hello World")
}
EOS
after_data = <<~EOS
def foo() {
println("Hello World")
}
EOS
(testpath/"foo.scala").write before_data
system bin/"scalariform", "-indentSpaces=3", testpath/"foo.scala"
assert_equal after_data, (testpath/"foo.scala").read
end
end